]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - tiesr-gforge/tiesr-gforge.git/commitdiff
[#1059] Commit initial trunk line of development.
authorlnetsch <lnetsch@localhost>
Wed, 10 Mar 2010 17:33:11 +0000 (17:33 +0000)
committerlnetsch <lnetsch@localhost>
Wed, 10 Mar 2010 17:33:11 +0000 (17:33 +0000)
531 files changed:
.gitattributes
Data/OffDT_GenDict_PhbVR_LE_MQ/English/A.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/B.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/C.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/D.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/dict.bin [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/phone.lis [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/E.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/F.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/G.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/H.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/I.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/J.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/K.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/L.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/M.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/ROM2cls.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qs.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qstbl.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_tree.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_treetbl.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/cls_centr.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.cb [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.off [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxconfig.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxenc.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxerrcb.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxgconst.cb [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxsil.hmm [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.cb [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.off [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxvar.cb [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxweight.cb [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/monophone.list [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/scale.bin [new file with mode: 0755]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/N.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/O.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/P.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Q.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/R.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/S.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/T.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/U.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/V.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/W.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/X.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Y.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/Z.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/_.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/cAttType.txt [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/cAttValue.txt [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/dash.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/dot.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/onewphone.list [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/English/up.olmdtpm [new file with mode: 0644]
Data/OffDT_GenDict_PhbVR_LE_MQ/ReadMe.txt [new file with mode: 0644]
Data/ReadMe.txt [new file with mode: 0644]
Data/TestTIesrDTWords.txt [new file with mode: 0644]
Documentation/ReadMeFirst.txt [new file with mode: 0644]
Documentation/ReleaseNotes.txt [new file with mode: 0644]
Documentation/SoftwareLicenseAgreement.txt [new file with mode: 0644]
Documentation/SoftwareManifest.pdf [new file with mode: 0644]
Documentation/TIesr_Data_Training.txt [new file with mode: 0644]
Documentation/TIesr_Display_Tools.txt [new file with mode: 0755]
Documentation/TIesr_Grammar.txt [new file with mode: 0755]
Documentation/TIesr_Overview.txt [new file with mode: 0644]
Makefile [new file with mode: 0644]
TIesrDT/ReadMe.txt [new file with mode: 0644]
TIesrDT/TIesrDTso/.dep.inc [new file with mode: 0755]
TIesrDT/TIesrDTso/Makefile [new file with mode: 0755]
TIesrDT/TIesrDTso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrDT/TIesrDTso/nbproject/configurations.xml [new file with mode: 0755]
TIesrDT/TIesrDTso/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrDT/TIesrDTso/nbproject/private/private.properties [new file with mode: 0755]
TIesrDT/TIesrDTso/nbproject/private/private.xml [new file with mode: 0755]
TIesrDT/TIesrDTso/nbproject/project.properties [new file with mode: 0755]
TIesrDT/TIesrDTso/nbproject/project.xml [new file with mode: 0755]
TIesrDT/TestTIesrDT/.dep.inc [new file with mode: 0755]
TIesrDT/TestTIesrDT/Makefile [new file with mode: 0755]
TIesrDT/TestTIesrDT/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrDT/TestTIesrDT/nbproject/configurations.xml [new file with mode: 0755]
TIesrDT/TestTIesrDT/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrDT/TestTIesrDT/nbproject/private/private.properties [new file with mode: 0755]
TIesrDT/TestTIesrDT/nbproject/private/private.xml [new file with mode: 0755]
TIesrDT/TestTIesrDT/nbproject/project.properties [new file with mode: 0755]
TIesrDT/TestTIesrDT/nbproject/project.xml [new file with mode: 0755]
TIesrDT/resource/TIesrDTso.map [new file with mode: 0644]
TIesrDT/src/TIesrDT.c [new file with mode: 0755]
TIesrDT/src/TIesrDT.h [new file with mode: 0755]
TIesrDT/src/TIesrDT_User.h [new file with mode: 0644]
TIesrDT/src/TestTIesrDT.c [new file with mode: 0644]
TIesrDict/ReadMe.txt [new file with mode: 0644]
TIesrDict/TIesrDictso/.dep.inc [new file with mode: 0755]
TIesrDict/TIesrDictso/Makefile [new file with mode: 0755]
TIesrDict/TIesrDictso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrDict/TIesrDictso/nbproject/configurations.xml [new file with mode: 0755]
TIesrDict/TIesrDictso/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrDict/TIesrDictso/nbproject/private/private.properties [new file with mode: 0755]
TIesrDict/TIesrDictso/nbproject/private/private.xml [new file with mode: 0755]
TIesrDict/TIesrDictso/nbproject/project.properties [new file with mode: 0755]
TIesrDict/TIesrDictso/nbproject/project.xml [new file with mode: 0755]
TIesrDict/TestTIesrDict/.dep.inc [new file with mode: 0755]
TIesrDict/TestTIesrDict/Makefile [new file with mode: 0755]
TIesrDict/TestTIesrDict/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrDict/TestTIesrDict/nbproject/configurations.xml [new file with mode: 0755]
TIesrDict/TestTIesrDict/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrDict/TestTIesrDict/nbproject/private/private.properties [new file with mode: 0755]
TIesrDict/TestTIesrDict/nbproject/private/private.xml [new file with mode: 0755]
TIesrDict/TestTIesrDict/nbproject/project.properties [new file with mode: 0755]
TIesrDict/TestTIesrDict/nbproject/project.xml [new file with mode: 0755]
TIesrDict/resource/TIesrDictso.map [new file with mode: 0644]
TIesrDict/resource/TIesrDictso.ver [new file with mode: 0644]
TIesrDict/src/TIesrDict.cpp [new file with mode: 0755]
TIesrDict/src/TIesrDict.h [new file with mode: 0644]
TIesrDict/src/TIesrDictLocal.h [new file with mode: 0644]
TIesrDict/src/TestTIesrDict.cpp [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/.dep.inc [new file with mode: 0755]
TIesrEngine/TIesrEngineCoreso/Makefile [new file with mode: 0755]
TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineCoreso/nbproject/configurations.xml [new file with mode: 0755]
TIesrEngine/TIesrEngineCoreso/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrEngine/TIesrEngineCoreso/nbproject/private/private.properties [new file with mode: 0755]
TIesrEngine/TIesrEngineCoreso/nbproject/private/private.xml [new file with mode: 0755]
TIesrEngine/TIesrEngineCoreso/nbproject/project.properties [new file with mode: 0755]
TIesrEngine/TIesrEngineCoreso/nbproject/project.xml [new file with mode: 0755]
TIesrEngine/TIesrEngineSIso/.dep.inc [new file with mode: 0755]
TIesrEngine/TIesrEngineSIso/Makefile [new file with mode: 0755]
TIesrEngine/TIesrEngineSIso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrEngine/TIesrEngineSIso/nbproject/configurations.xml [new file with mode: 0755]
TIesrEngine/TIesrEngineSIso/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrEngine/TIesrEngineSIso/nbproject/private/private.properties [new file with mode: 0755]
TIesrEngine/TIesrEngineSIso/nbproject/private/private.xml [new file with mode: 0755]
TIesrEngine/TIesrEngineSIso/nbproject/project.properties [new file with mode: 0755]
TIesrEngine/TIesrEngineSIso/nbproject/project.xml [new file with mode: 0755]
TIesrEngine/resource/TIesrEngineCore.map [new file with mode: 0644]
TIesrEngine/resource/TIesrEngineCore.ver [new file with mode: 0644]
TIesrEngine/resource/TIesrEngineSI.map [new file with mode: 0644]
TIesrEngine/resource/TIesrEngineSI.ver [new file with mode: 0644]
TIesrEngine/src/confidence.h [new file with mode: 0755]
TIesrEngine/src/confidence_user.h [new file with mode: 0755]
TIesrEngine/src/dist.cpp [new file with mode: 0755]
TIesrEngine/src/dist_user.h [new file with mode: 0644]
TIesrEngine/src/engine_sireco_init.cpp [new file with mode: 0755]
TIesrEngine/src/filename.h [new file with mode: 0644]
TIesrEngine/src/gmhmm.h [new file with mode: 0644]
TIesrEngine/src/gmhmm_si_api.h [new file with mode: 0644]
TIesrEngine/src/gmhmm_type.h [new file with mode: 0755]
TIesrEngine/src/gmhmm_type_common.cpp [new file with mode: 0755]
TIesrEngine/src/gmhmm_type_common_user.h [new file with mode: 0755]
TIesrEngine/src/hlr_status.h [new file with mode: 0644]
TIesrEngine/src/jac-estm.cpp [new file with mode: 0755]
TIesrEngine/src/jac-estm.h [new file with mode: 0644]
TIesrEngine/src/jac-estm_user.h [new file with mode: 0644]
TIesrEngine/src/jac_one.cpp [new file with mode: 0755]
TIesrEngine/src/jac_one.h [new file with mode: 0755]
TIesrEngine/src/jac_one_user.h [new file with mode: 0644]
TIesrEngine/src/liveproc.cpp [new file with mode: 0755]
TIesrEngine/src/load.cpp [new file with mode: 0755]
TIesrEngine/src/load_user.h [new file with mode: 0644]
TIesrEngine/src/mfcc_f.cpp [new file with mode: 0755]
TIesrEngine/src/mfcc_f.h [new file with mode: 0644]
TIesrEngine/src/mfcc_f_def_struct_user.h [new file with mode: 0644]
TIesrEngine/src/mfcc_f_user.h [new file with mode: 0644]
TIesrEngine/src/noise_sub.cpp [new file with mode: 0755]
TIesrEngine/src/noise_sub.h [new file with mode: 0755]
TIesrEngine/src/noise_sub_user.h [new file with mode: 0755]
TIesrEngine/src/obsprob.cpp [new file with mode: 0755]
TIesrEngine/src/obsprob_user.h [new file with mode: 0644]
TIesrEngine/src/pack.cpp [new file with mode: 0755]
TIesrEngine/src/pack_user.h [new file with mode: 0644]
TIesrEngine/src/pmc_f.cpp [new file with mode: 0755]
TIesrEngine/src/pmc_f.h [new file with mode: 0644]
TIesrEngine/src/pmc_f_user.h [new file with mode: 0644]
TIesrEngine/src/rapidsearch.cpp [new file with mode: 0755]
TIesrEngine/src/rapidsearch.h [new file with mode: 0755]
TIesrEngine/src/rapidsearch_user.h [new file with mode: 0755]
TIesrEngine/src/sbc.cpp [new file with mode: 0755]
TIesrEngine/src/sbc.h [new file with mode: 0755]
TIesrEngine/src/sbc_struct_user.h [new file with mode: 0755]
TIesrEngine/src/sbc_user.h [new file with mode: 0755]
TIesrEngine/src/search.cpp [new file with mode: 0755]
TIesrEngine/src/search_user.h [new file with mode: 0644]
TIesrEngine/src/siinit.cpp [new file with mode: 0755]
TIesrEngine/src/siinit.h [new file with mode: 0644]
TIesrEngine/src/siproc.cpp [new file with mode: 0755]
TIesrEngine/src/status.h [new file with mode: 0644]
TIesrEngine/src/tiesr_config.h [new file with mode: 0644]
TIesrEngine/src/tiesr_engine_api_sireco.h [new file with mode: 0644]
TIesrEngine/src/tiesrcommonmacros.h [new file with mode: 0644]
TIesrEngine/src/uttdet.cpp [new file with mode: 0755]
TIesrEngine/src/uttdet.h [new file with mode: 0644]
TIesrEngine/src/uttdet_user.h [new file with mode: 0755]
TIesrEngine/src/volume.cpp [new file with mode: 0755]
TIesrEngine/src/volume_user.h [new file with mode: 0644]
TIesrEngine/src/winlen.h [new file with mode: 0644]
TIesrFA/ReadMe.txt [new file with mode: 0644]
TIesrFA/TIesrFAWinso/.dep.inc [new file with mode: 0755]
TIesrFA/TIesrFAWinso/Makefile [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/Makefile-impl.mk [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/Makefile-variables.mk [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/configurations.xml [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/private/private.properties [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/private/private.xml [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/project.properties [new file with mode: 0755]
TIesrFA/TIesrFAWinso/nbproject/project.xml [new file with mode: 0755]
TIesrFA/TIesrFA_ALSAso/.dep.inc [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/Makefile [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/configurations.xml [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/private/configurations.xml [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/private/private.properties [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/private/private.xml [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/project.properties [new file with mode: 0644]
TIesrFA/TIesrFA_ALSAso/nbproject/project.xml [new file with mode: 0644]
TIesrFA/TestTIesrFA/.dep.inc [new file with mode: 0755]
TIesrFA/TestTIesrFA/Makefile [new file with mode: 0755]
TIesrFA/TestTIesrFA/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrFA/TestTIesrFA/nbproject/configurations.xml [new file with mode: 0755]
TIesrFA/TestTIesrFA/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrFA/TestTIesrFA/nbproject/private/private.properties [new file with mode: 0755]
TIesrFA/TestTIesrFA/nbproject/private/private.xml [new file with mode: 0755]
TIesrFA/TestTIesrFA/nbproject/project.properties [new file with mode: 0755]
TIesrFA/TestTIesrFA/nbproject/project.xml [new file with mode: 0755]
TIesrFA/resource/TIesrFAso.map [new file with mode: 0644]
TIesrFA/resource/TIesrFAso.ver [new file with mode: 0644]
TIesrFA/src/TIesrFA_ALSA.c [new file with mode: 0644]
TIesrFA/src/TIesrFA_ALSA.h [new file with mode: 0644]
TIesrFA/src/TIesrFA_User.h [new file with mode: 0644]
TIesrFA/src/TIesrFA_WM5.cpp [new file with mode: 0755]
TIesrFA/src/TIesrFA_WM5.h [new file with mode: 0755]
TIesrFA/src/TestTIesrFA.cpp [new file with mode: 0755]
TIesrFlex/ReadMe.txt [new file with mode: 0644]
TIesrFlex/TIesrFlexso/.dep.inc [new file with mode: 0755]
TIesrFlex/TIesrFlexso/Makefile [new file with mode: 0755]
TIesrFlex/TIesrFlexso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrFlex/TIesrFlexso/nbproject/configurations.xml [new file with mode: 0755]
TIesrFlex/TIesrFlexso/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrFlex/TIesrFlexso/nbproject/private/private.properties [new file with mode: 0755]
TIesrFlex/TIesrFlexso/nbproject/private/private.xml [new file with mode: 0755]
TIesrFlex/TIesrFlexso/nbproject/project.properties [new file with mode: 0755]
TIesrFlex/TIesrFlexso/nbproject/project.xml [new file with mode: 0755]
TIesrFlex/TestTIesrFlex/.dep.inc [new file with mode: 0755]
TIesrFlex/TestTIesrFlex/Makefile [new file with mode: 0755]
TIesrFlex/TestTIesrFlex/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrFlex/TestTIesrFlex/nbproject/configurations.xml [new file with mode: 0755]
TIesrFlex/TestTIesrFlex/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrFlex/TestTIesrFlex/nbproject/private/private.properties [new file with mode: 0755]
TIesrFlex/TestTIesrFlex/nbproject/private/private.xml [new file with mode: 0755]
TIesrFlex/TestTIesrFlex/nbproject/project.properties [new file with mode: 0755]
TIesrFlex/TestTIesrFlex/nbproject/project.xml [new file with mode: 0755]
TIesrFlex/resource/TIesrFlexso.map [new file with mode: 0644]
TIesrFlex/resource/TIesrFlexso.ver [new file with mode: 0644]
TIesrFlex/src/TIesrFlex.cpp [new file with mode: 0755]
TIesrFlex/src/TIesrFlex.h [new file with mode: 0644]
TIesrFlex/src/TIesrFlexLocal.h [new file with mode: 0644]
TIesrFlex/src/TestTIesrFlex.cpp [new file with mode: 0755]
TIesrSI/ReadMe.txt [new file with mode: 0644]
TIesrSI/TIesrSIso/.dep.inc [new file with mode: 0755]
TIesrSI/TIesrSIso/Makefile [new file with mode: 0755]
TIesrSI/TIesrSIso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrSI/TIesrSIso/nbproject/configurations.xml [new file with mode: 0755]
TIesrSI/TIesrSIso/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrSI/TIesrSIso/nbproject/private/private.properties [new file with mode: 0755]
TIesrSI/TIesrSIso/nbproject/private/private.xml [new file with mode: 0755]
TIesrSI/TIesrSIso/nbproject/project.properties [new file with mode: 0755]
TIesrSI/TIesrSIso/nbproject/project.xml [new file with mode: 0755]
TIesrSI/TestTIesrSI/.dep.inc [new file with mode: 0755]
TIesrSI/TestTIesrSI/Makefile [new file with mode: 0755]
TIesrSI/TestTIesrSI/nbproject/Makefile-ArmLinuxDebugGnueabi.mk [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Package-ArmLinuxDebugGnueabi.bash [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Package-ArmLinuxReleaseGnueabi.bash [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesrSI/TestTIesrSI/nbproject/configurations.xml [new file with mode: 0755]
TIesrSI/TestTIesrSI/nbproject/private/configurations.xml [new file with mode: 0755]
TIesrSI/TestTIesrSI/nbproject/private/private.properties [new file with mode: 0755]
TIesrSI/TestTIesrSI/nbproject/private/private.xml [new file with mode: 0755]
TIesrSI/TestTIesrSI/nbproject/project.properties [new file with mode: 0755]
TIesrSI/TestTIesrSI/nbproject/project.xml [new file with mode: 0755]
TIesrSI/resource/TIesrSIso.ver [new file with mode: 0644]
TIesrSI/src/TIesrSI.c [new file with mode: 0755]
TIesrSI/src/TIesrSI.h [new file with mode: 0755]
TIesrSI/src/TIesrSI_User.h [new file with mode: 0644]
TIesrSI/src/TestTIesrSI.cpp [new file with mode: 0755]
TIesrSI/src/TestTIesrSI.h [new file with mode: 0755]
TIesr_Tools/Example/Data/AUDIO.tar.gz [new file with mode: 0644]
TIesr_Tools/Example/Data/Fphones.mlf [new file with mode: 0644]
TIesr_Tools/Example/Data/HMMPROTO/global.mmf [new file with mode: 0644]
TIesr_Tools/Example/Data/HMMPROTO/phones.mmf [new file with mode: 0644]
TIesr_Tools/Example/Data/Mphones.mlf [new file with mode: 0644]
TIesr_Tools/Example/Data/Segmented_phones.mlf [new file with mode: 0644]
TIesr_Tools/Example/Data/Words.mlf [new file with mode: 0644]
TIesr_Tools/Example/NaturalOrder.cnf [new file with mode: 0644]
TIesr_Tools/Example/ReadMe.txt [new file with mode: 0644]
TIesr_Tools/Example/Test.grm [new file with mode: 0644]
TIesr_Tools/Example/UserDelta.cnf [new file with mode: 0644]
TIesr_Tools/Example/allwords.dic [new file with mode: 0644]
TIesr_Tools/Example/ltp.map [new file with mode: 0644]
TIesr_Tools/Example/make_cluster_triphones_fm.hed [new file with mode: 0644]
TIesr_Tools/Example/make_fm.hed [new file with mode: 0644]
TIesr_Tools/Example/make_triphones_fm.hed [new file with mode: 0644]
TIesr_Tools/Example/phones.led [new file with mode: 0644]
TIesr_Tools/Example/phones_f.led [new file with mode: 0644]
TIesr_Tools/Example/phones_m.led [new file with mode: 0644]
TIesr_Tools/Example/triphones.led [new file with mode: 0644]
TIesr_Tools/Example/words.dic [new file with mode: 0644]
TIesr_Tools/GaussianCluster/.dep.inc [new file with mode: 0755]
TIesr_Tools/GaussianCluster/Makefile [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/configurations.xml [new file with mode: 0755]
TIesr_Tools/GaussianCluster/nbproject/private/configurations.xml [new file with mode: 0755]
TIesr_Tools/GaussianCluster/nbproject/private/private.properties [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/private/private.xml [new file with mode: 0755]
TIesr_Tools/GaussianCluster/nbproject/project.properties [new file with mode: 0644]
TIesr_Tools/GaussianCluster/nbproject/project.xml [new file with mode: 0755]
TIesr_Tools/GaussianCluster/src/ClusterUtil.c [new file with mode: 0755]
TIesr_Tools/GaussianCluster/src/ClusterUtil.h [new file with mode: 0755]
TIesr_Tools/GaussianCluster/src/GaussianCluster.c [new file with mode: 0755]
TIesr_Tools/HTKdata.pm [new file with mode: 0755]
TIesr_Tools/HTKtmf.pm [new file with mode: 0755]
TIesr_Tools/HTKtrees.pm [new file with mode: 0755]
TIesr_Tools/Makefile [new file with mode: 0644]
TIesr_Tools/TIesrModel.pm [new file with mode: 0644]
TIesr_Tools/TIesrNet.pm [new file with mode: 0644]
TIesr_Tools/cluster_models.pl [new file with mode: 0755]
TIesr_Tools/dictproc/.dep.inc [new file with mode: 0755]
TIesr_Tools/dictproc/Makefile [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Makefile-LinuxDebugGnu.mk [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Makefile-LinuxReleaseGnu.mk [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Makefile-WindowsDebugMinGW.mk [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Makefile-WindowsReleaseMinGW.mk [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Makefile-impl.mk [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Makefile-variables.mk [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Package-LinuxDebugGnu.bash [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Package-LinuxReleaseGnu.bash [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Package-WindowsDebugMinGW.bash [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/Package-WindowsReleaseMinGW.bash [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/configurations.xml [new file with mode: 0755]
TIesr_Tools/dictproc/nbproject/private/configurations.xml [new file with mode: 0755]
TIesr_Tools/dictproc/nbproject/private/private.properties [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/private/private.xml [new file with mode: 0755]
TIesr_Tools/dictproc/nbproject/project.properties [new file with mode: 0644]
TIesr_Tools/dictproc/nbproject/project.xml [new file with mode: 0755]
TIesr_Tools/dictproc/src/compress_entry.c [new file with mode: 0755]
TIesr_Tools/dictproc/src/dictproc.c [new file with mode: 0755]
TIesr_Tools/dictproc/src/dictproc.h [new file with mode: 0644]
TIesr_Tools/dictproc/src/dmakeup.h [new file with mode: 0644]
TIesr_Tools/dictproc/src/english.c [new file with mode: 0644]
TIesr_Tools/dictproc/src/map.c [new file with mode: 0644]
TIesr_Tools/dictproc/src/parse.c [new file with mode: 0644]
TIesr_Tools/dictproc/src/phoneme.c [new file with mode: 0644]
TIesr_Tools/dictproc/src/phones.c [new file with mode: 0644]
TIesr_Tools/dictproc/src/saynum.c [new file with mode: 0644]
TIesr_Tools/dictproc/src/spellword.c [new file with mode: 0644]
TIesr_Tools/htk_dict_to_mlf.pl [new file with mode: 0755]
TIesr_Tools/htk_letter_mmf.pl [new file with mode: 0755]
TIesr_Tools/htk_mmf_to_tiesr.pl [new file with mode: 0755]
TIesr_Tools/htk_model_compare.pl [new file with mode: 0755]
TIesr_Tools/htk_trees_to_tiesr.pl [new file with mode: 0755]
TIesr_Tools/htk_ttp_map.pl [new file with mode: 0755]
TIesr_Tools/htk_ttp_parse.pl [new file with mode: 0755]
TIesr_Tools/odtcompress.pl [new file with mode: 0755]
TIesr_Tools/sample_to_htk.pl [new file with mode: 0755]
TIesr_Tools/tiesr_jac_convert.pl [new file with mode: 0755]
TIesr_Tools/tiesr_model_convert.pl [new file with mode: 0755]
TIesr_Tools/tiesr_net_convert.pl [new file with mode: 0755]
TIesr_Tools/train_trees.pl [new file with mode: 0755]
TIesr_Tools/ttp_dict_tree_data.pl [new file with mode: 0755]

index 8e948c534a1fd79cf59d786adc75fec0a4d091d7..e954d52f3683b523c41bfe1f36a208aa11c98252 100644 (file)
@@ -1 +1,402 @@
 * text=auto !eol
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/A.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/B.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/C.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/D.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/dict.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/phone.lis -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/E.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/F.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/G.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/H.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/I.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/J.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/K.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/L.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/M.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/ROM2cls.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qs.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qstbl.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_tree.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_treetbl.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/cls_centr.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.cb -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.off -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxconfig.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxenc.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxerrcb.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxgconst.cb -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxsil.hmm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.cb -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.off -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxvar.cb -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxweight.cb -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/monophone.list -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/scale.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/N.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/O.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/P.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Q.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/R.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/S.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/T.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/U.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/V.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/W.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/X.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Y.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Z.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/_.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/dash.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/dot.olmdtpm -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/onewphone.list -text
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/up.olmdtpm -text
+Documentation/SoftwareManifest.pdf -text
+TIesrDT/TIesrDTso/.dep.inc -text
+TIesrDT/TIesrDTso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrDT/TIesrDTso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrDT/TIesrDTso/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrDT/TIesrDTso/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrDT/TIesrDTso/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrDT/TIesrDTso/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrDT/TIesrDTso/nbproject/Makefile-impl.mk -text
+TIesrDT/TIesrDTso/nbproject/Makefile-variables.mk -text
+TIesrDT/TIesrDTso/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrDT/TIesrDTso/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrDT/TIesrDTso/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrDT/TIesrDTso/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrDT/TIesrDTso/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrDT/TIesrDTso/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrDT/TIesrDTso/nbproject/configurations.xml -text
+TIesrDT/TIesrDTso/nbproject/private/configurations.xml -text
+TIesrDT/TIesrDTso/nbproject/private/private.properties -text
+TIesrDT/TIesrDTso/nbproject/private/private.xml -text
+TIesrDT/TIesrDTso/nbproject/project.properties -text
+TIesrDT/TIesrDTso/nbproject/project.xml -text
+TIesrDT/TestTIesrDT/.dep.inc -text
+TIesrDT/TestTIesrDT/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrDT/TestTIesrDT/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrDT/TestTIesrDT/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrDT/TestTIesrDT/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrDT/TestTIesrDT/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrDT/TestTIesrDT/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrDT/TestTIesrDT/nbproject/Makefile-impl.mk -text
+TIesrDT/TestTIesrDT/nbproject/Makefile-variables.mk -text
+TIesrDT/TestTIesrDT/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrDT/TestTIesrDT/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrDT/TestTIesrDT/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrDT/TestTIesrDT/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrDT/TestTIesrDT/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrDT/TestTIesrDT/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrDT/TestTIesrDT/nbproject/configurations.xml -text
+TIesrDT/TestTIesrDT/nbproject/private/configurations.xml -text
+TIesrDT/TestTIesrDT/nbproject/private/private.properties -text
+TIesrDT/TestTIesrDT/nbproject/private/private.xml -text
+TIesrDT/TestTIesrDT/nbproject/project.properties -text
+TIesrDT/TestTIesrDT/nbproject/project.xml -text
+TIesrDT/resource/TIesrDTso.map -text
+TIesrDict/TIesrDictso/.dep.inc -text
+TIesrDict/TIesrDictso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrDict/TIesrDictso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrDict/TIesrDictso/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrDict/TIesrDictso/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrDict/TIesrDictso/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrDict/TIesrDictso/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrDict/TIesrDictso/nbproject/Makefile-impl.mk -text
+TIesrDict/TIesrDictso/nbproject/Makefile-variables.mk -text
+TIesrDict/TIesrDictso/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrDict/TIesrDictso/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrDict/TIesrDictso/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrDict/TIesrDictso/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrDict/TIesrDictso/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrDict/TIesrDictso/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrDict/TIesrDictso/nbproject/configurations.xml -text
+TIesrDict/TIesrDictso/nbproject/private/configurations.xml -text
+TIesrDict/TIesrDictso/nbproject/private/private.properties -text
+TIesrDict/TIesrDictso/nbproject/private/private.xml -text
+TIesrDict/TIesrDictso/nbproject/project.properties -text
+TIesrDict/TIesrDictso/nbproject/project.xml -text
+TIesrDict/TestTIesrDict/.dep.inc -text
+TIesrDict/TestTIesrDict/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrDict/TestTIesrDict/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrDict/TestTIesrDict/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrDict/TestTIesrDict/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrDict/TestTIesrDict/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrDict/TestTIesrDict/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrDict/TestTIesrDict/nbproject/Makefile-impl.mk -text
+TIesrDict/TestTIesrDict/nbproject/Makefile-variables.mk -text
+TIesrDict/TestTIesrDict/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrDict/TestTIesrDict/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrDict/TestTIesrDict/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrDict/TestTIesrDict/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrDict/TestTIesrDict/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrDict/TestTIesrDict/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrDict/TestTIesrDict/nbproject/configurations.xml -text
+TIesrDict/TestTIesrDict/nbproject/private/configurations.xml -text
+TIesrDict/TestTIesrDict/nbproject/private/private.properties -text
+TIesrDict/TestTIesrDict/nbproject/private/private.xml -text
+TIesrDict/TestTIesrDict/nbproject/project.properties -text
+TIesrDict/TestTIesrDict/nbproject/project.xml -text
+TIesrDict/resource/TIesrDictso.map -text
+TIesrDict/resource/TIesrDictso.ver -text
+TIesrEngine/TIesrEngineCoreso/.dep.inc -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-impl.mk -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-variables.mk -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrEngine/TIesrEngineCoreso/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrEngine/TIesrEngineCoreso/nbproject/configurations.xml -text
+TIesrEngine/TIesrEngineCoreso/nbproject/private/configurations.xml -text
+TIesrEngine/TIesrEngineCoreso/nbproject/private/private.properties -text
+TIesrEngine/TIesrEngineCoreso/nbproject/private/private.xml -text
+TIesrEngine/TIesrEngineCoreso/nbproject/project.properties -text
+TIesrEngine/TIesrEngineCoreso/nbproject/project.xml -text
+TIesrEngine/TIesrEngineSIso/.dep.inc -text
+TIesrEngine/TIesrEngineSIso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrEngine/TIesrEngineSIso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrEngine/TIesrEngineSIso/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrEngine/TIesrEngineSIso/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrEngine/TIesrEngineSIso/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrEngine/TIesrEngineSIso/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrEngine/TIesrEngineSIso/nbproject/Makefile-impl.mk -text
+TIesrEngine/TIesrEngineSIso/nbproject/Makefile-variables.mk -text
+TIesrEngine/TIesrEngineSIso/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrEngine/TIesrEngineSIso/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrEngine/TIesrEngineSIso/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrEngine/TIesrEngineSIso/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrEngine/TIesrEngineSIso/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrEngine/TIesrEngineSIso/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrEngine/TIesrEngineSIso/nbproject/configurations.xml -text
+TIesrEngine/TIesrEngineSIso/nbproject/private/configurations.xml -text
+TIesrEngine/TIesrEngineSIso/nbproject/private/private.properties -text
+TIesrEngine/TIesrEngineSIso/nbproject/private/private.xml -text
+TIesrEngine/TIesrEngineSIso/nbproject/project.properties -text
+TIesrEngine/TIesrEngineSIso/nbproject/project.xml -text
+TIesrEngine/resource/TIesrEngineCore.map -text
+TIesrEngine/resource/TIesrEngineCore.ver -text
+TIesrEngine/resource/TIesrEngineSI.map -text
+TIesrEngine/resource/TIesrEngineSI.ver -text
+TIesrFA/TIesrFAWinso/.dep.inc -text
+TIesrFA/TIesrFAWinso/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrFA/TIesrFAWinso/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrFA/TIesrFAWinso/nbproject/Makefile-impl.mk -text
+TIesrFA/TIesrFAWinso/nbproject/Makefile-variables.mk -text
+TIesrFA/TIesrFAWinso/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrFA/TIesrFAWinso/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrFA/TIesrFAWinso/nbproject/configurations.xml -text
+TIesrFA/TIesrFAWinso/nbproject/private/configurations.xml -text
+TIesrFA/TIesrFAWinso/nbproject/private/private.properties -text
+TIesrFA/TIesrFAWinso/nbproject/private/private.xml -text
+TIesrFA/TIesrFAWinso/nbproject/project.properties -text
+TIesrFA/TIesrFAWinso/nbproject/project.xml -text
+TIesrFA/TIesrFA_ALSAso/.dep.inc -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-impl.mk -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-variables.mk -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrFA/TIesrFA_ALSAso/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrFA/TIesrFA_ALSAso/nbproject/configurations.xml -text
+TIesrFA/TIesrFA_ALSAso/nbproject/private/configurations.xml -text
+TIesrFA/TIesrFA_ALSAso/nbproject/private/private.properties -text
+TIesrFA/TIesrFA_ALSAso/nbproject/private/private.xml -text
+TIesrFA/TIesrFA_ALSAso/nbproject/project.properties -text
+TIesrFA/TIesrFA_ALSAso/nbproject/project.xml -text
+TIesrFA/TestTIesrFA/.dep.inc -text
+TIesrFA/TestTIesrFA/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrFA/TestTIesrFA/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrFA/TestTIesrFA/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrFA/TestTIesrFA/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrFA/TestTIesrFA/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrFA/TestTIesrFA/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrFA/TestTIesrFA/nbproject/Makefile-impl.mk -text
+TIesrFA/TestTIesrFA/nbproject/Makefile-variables.mk -text
+TIesrFA/TestTIesrFA/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrFA/TestTIesrFA/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrFA/TestTIesrFA/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrFA/TestTIesrFA/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrFA/TestTIesrFA/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrFA/TestTIesrFA/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrFA/TestTIesrFA/nbproject/configurations.xml -text
+TIesrFA/TestTIesrFA/nbproject/private/configurations.xml -text
+TIesrFA/TestTIesrFA/nbproject/private/private.properties -text
+TIesrFA/TestTIesrFA/nbproject/private/private.xml -text
+TIesrFA/TestTIesrFA/nbproject/project.properties -text
+TIesrFA/TestTIesrFA/nbproject/project.xml -text
+TIesrFA/resource/TIesrFAso.map -text
+TIesrFA/resource/TIesrFAso.ver -text
+TIesrFlex/TIesrFlexso/.dep.inc -text
+TIesrFlex/TIesrFlexso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrFlex/TIesrFlexso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrFlex/TIesrFlexso/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrFlex/TIesrFlexso/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrFlex/TIesrFlexso/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrFlex/TIesrFlexso/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrFlex/TIesrFlexso/nbproject/Makefile-impl.mk -text
+TIesrFlex/TIesrFlexso/nbproject/Makefile-variables.mk -text
+TIesrFlex/TIesrFlexso/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrFlex/TIesrFlexso/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrFlex/TIesrFlexso/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrFlex/TIesrFlexso/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrFlex/TIesrFlexso/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrFlex/TIesrFlexso/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrFlex/TIesrFlexso/nbproject/configurations.xml -text
+TIesrFlex/TIesrFlexso/nbproject/private/configurations.xml -text
+TIesrFlex/TIesrFlexso/nbproject/private/private.properties -text
+TIesrFlex/TIesrFlexso/nbproject/private/private.xml -text
+TIesrFlex/TIesrFlexso/nbproject/project.properties -text
+TIesrFlex/TIesrFlexso/nbproject/project.xml -text
+TIesrFlex/TestTIesrFlex/.dep.inc -text
+TIesrFlex/TestTIesrFlex/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrFlex/TestTIesrFlex/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrFlex/TestTIesrFlex/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrFlex/TestTIesrFlex/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrFlex/TestTIesrFlex/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrFlex/TestTIesrFlex/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrFlex/TestTIesrFlex/nbproject/Makefile-impl.mk -text
+TIesrFlex/TestTIesrFlex/nbproject/Makefile-variables.mk -text
+TIesrFlex/TestTIesrFlex/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrFlex/TestTIesrFlex/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrFlex/TestTIesrFlex/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrFlex/TestTIesrFlex/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrFlex/TestTIesrFlex/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrFlex/TestTIesrFlex/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrFlex/TestTIesrFlex/nbproject/configurations.xml -text
+TIesrFlex/TestTIesrFlex/nbproject/private/configurations.xml -text
+TIesrFlex/TestTIesrFlex/nbproject/private/private.properties -text
+TIesrFlex/TestTIesrFlex/nbproject/private/private.xml -text
+TIesrFlex/TestTIesrFlex/nbproject/project.properties -text
+TIesrFlex/TestTIesrFlex/nbproject/project.xml -text
+TIesrFlex/resource/TIesrFlexso.map -text
+TIesrFlex/resource/TIesrFlexso.ver -text
+TIesrSI/TIesrSIso/.dep.inc -text
+TIesrSI/TIesrSIso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrSI/TIesrSIso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrSI/TIesrSIso/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrSI/TIesrSIso/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrSI/TIesrSIso/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrSI/TIesrSIso/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrSI/TIesrSIso/nbproject/Makefile-impl.mk -text
+TIesrSI/TIesrSIso/nbproject/Makefile-variables.mk -text
+TIesrSI/TIesrSIso/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrSI/TIesrSIso/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrSI/TIesrSIso/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrSI/TIesrSIso/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrSI/TIesrSIso/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrSI/TIesrSIso/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrSI/TIesrSIso/nbproject/configurations.xml -text
+TIesrSI/TIesrSIso/nbproject/private/configurations.xml -text
+TIesrSI/TIesrSIso/nbproject/private/private.properties -text
+TIesrSI/TIesrSIso/nbproject/private/private.xml -text
+TIesrSI/TIesrSIso/nbproject/project.properties -text
+TIesrSI/TIesrSIso/nbproject/project.xml -text
+TIesrSI/TestTIesrSI/.dep.inc -text
+TIesrSI/TestTIesrSI/nbproject/Makefile-ArmLinuxDebugGnueabi.mk -text
+TIesrSI/TestTIesrSI/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk -text
+TIesrSI/TestTIesrSI/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesrSI/TestTIesrSI/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesrSI/TestTIesrSI/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesrSI/TestTIesrSI/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesrSI/TestTIesrSI/nbproject/Makefile-impl.mk -text
+TIesrSI/TestTIesrSI/nbproject/Makefile-variables.mk -text
+TIesrSI/TestTIesrSI/nbproject/Package-ArmLinuxDebugGnueabi.bash -text
+TIesrSI/TestTIesrSI/nbproject/Package-ArmLinuxReleaseGnueabi.bash -text
+TIesrSI/TestTIesrSI/nbproject/Package-LinuxDebugGnu.bash -text
+TIesrSI/TestTIesrSI/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesrSI/TestTIesrSI/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesrSI/TestTIesrSI/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesrSI/TestTIesrSI/nbproject/configurations.xml -text
+TIesrSI/TestTIesrSI/nbproject/private/configurations.xml -text
+TIesrSI/TestTIesrSI/nbproject/private/private.properties -text
+TIesrSI/TestTIesrSI/nbproject/private/private.xml -text
+TIesrSI/TestTIesrSI/nbproject/project.properties -text
+TIesrSI/TestTIesrSI/nbproject/project.xml -text
+TIesrSI/resource/TIesrSIso.ver -text
+TIesr_Tools/Example/Data/AUDIO.tar.gz -text
+TIesr_Tools/Example/Data/Fphones.mlf -text
+TIesr_Tools/Example/Data/HMMPROTO/global.mmf -text
+TIesr_Tools/Example/Data/HMMPROTO/phones.mmf -text
+TIesr_Tools/Example/Data/Mphones.mlf -text
+TIesr_Tools/Example/Data/Segmented_phones.mlf -text
+TIesr_Tools/Example/Data/Words.mlf -text
+TIesr_Tools/Example/NaturalOrder.cnf -text
+TIesr_Tools/Example/Test.grm -text
+TIesr_Tools/Example/UserDelta.cnf -text
+TIesr_Tools/Example/allwords.dic -text
+TIesr_Tools/Example/ltp.map -text
+TIesr_Tools/Example/make_cluster_triphones_fm.hed -text
+TIesr_Tools/Example/make_fm.hed -text
+TIesr_Tools/Example/make_triphones_fm.hed -text
+TIesr_Tools/Example/phones.led -text
+TIesr_Tools/Example/phones_f.led -text
+TIesr_Tools/Example/phones_m.led -text
+TIesr_Tools/Example/triphones.led -text
+TIesr_Tools/Example/words.dic -text
+TIesr_Tools/GaussianCluster/.dep.inc -text
+TIesr_Tools/GaussianCluster/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesr_Tools/GaussianCluster/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesr_Tools/GaussianCluster/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesr_Tools/GaussianCluster/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesr_Tools/GaussianCluster/nbproject/Makefile-impl.mk -text
+TIesr_Tools/GaussianCluster/nbproject/Makefile-variables.mk -text
+TIesr_Tools/GaussianCluster/nbproject/Package-LinuxDebugGnu.bash -text
+TIesr_Tools/GaussianCluster/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesr_Tools/GaussianCluster/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesr_Tools/GaussianCluster/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesr_Tools/GaussianCluster/nbproject/configurations.xml -text
+TIesr_Tools/GaussianCluster/nbproject/private/configurations.xml -text
+TIesr_Tools/GaussianCluster/nbproject/private/private.properties -text
+TIesr_Tools/GaussianCluster/nbproject/private/private.xml -text
+TIesr_Tools/GaussianCluster/nbproject/project.properties -text
+TIesr_Tools/GaussianCluster/nbproject/project.xml -text
+TIesr_Tools/HTKdata.pm -text
+TIesr_Tools/HTKtmf.pm -text
+TIesr_Tools/HTKtrees.pm -text
+TIesr_Tools/TIesrModel.pm -text
+TIesr_Tools/TIesrNet.pm -text
+TIesr_Tools/cluster_models.pl -text
+TIesr_Tools/dictproc/.dep.inc -text
+TIesr_Tools/dictproc/nbproject/Makefile-LinuxDebugGnu.mk -text
+TIesr_Tools/dictproc/nbproject/Makefile-LinuxReleaseGnu.mk -text
+TIesr_Tools/dictproc/nbproject/Makefile-WindowsDebugMinGW.mk -text
+TIesr_Tools/dictproc/nbproject/Makefile-WindowsReleaseMinGW.mk -text
+TIesr_Tools/dictproc/nbproject/Makefile-impl.mk -text
+TIesr_Tools/dictproc/nbproject/Makefile-variables.mk -text
+TIesr_Tools/dictproc/nbproject/Package-LinuxDebugGnu.bash -text
+TIesr_Tools/dictproc/nbproject/Package-LinuxReleaseGnu.bash -text
+TIesr_Tools/dictproc/nbproject/Package-WindowsDebugMinGW.bash -text
+TIesr_Tools/dictproc/nbproject/Package-WindowsReleaseMinGW.bash -text
+TIesr_Tools/dictproc/nbproject/configurations.xml -text
+TIesr_Tools/dictproc/nbproject/private/configurations.xml -text
+TIesr_Tools/dictproc/nbproject/private/private.properties -text
+TIesr_Tools/dictproc/nbproject/private/private.xml -text
+TIesr_Tools/dictproc/nbproject/project.properties -text
+TIesr_Tools/dictproc/nbproject/project.xml -text
+TIesr_Tools/htk_dict_to_mlf.pl -text
+TIesr_Tools/htk_letter_mmf.pl -text
+TIesr_Tools/htk_mmf_to_tiesr.pl -text
+TIesr_Tools/htk_model_compare.pl -text
+TIesr_Tools/htk_trees_to_tiesr.pl -text
+TIesr_Tools/htk_ttp_map.pl -text
+TIesr_Tools/htk_ttp_parse.pl -text
+TIesr_Tools/odtcompress.pl -text
+TIesr_Tools/sample_to_htk.pl -text
+TIesr_Tools/tiesr_jac_convert.pl -text
+TIesr_Tools/tiesr_model_convert.pl -text
+TIesr_Tools/tiesr_net_convert.pl -text
+TIesr_Tools/train_trees.pl -text
+TIesr_Tools/ttp_dict_tree_data.pl -text
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/A.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/A.olmdtpm
new file mode 100644 (file)
index 0000000..7207e41
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/A.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/B.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/B.olmdtpm
new file mode 100644 (file)
index 0000000..2c52e6e
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/B.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/C.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/C.olmdtpm
new file mode 100644 (file)
index 0000000..bed1a7a
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/C.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/D.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/D.olmdtpm
new file mode 100644 (file)
index 0000000..fd5a9a8
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/D.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/dict.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/dict.bin
new file mode 100644 (file)
index 0000000..4c64cec
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/dict.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/phone.lis b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict/phone.lis
new file mode 100644 (file)
index 0000000..95ccdac
--- /dev/null
@@ -0,0 +1,48 @@
+aa
+ae
+ah
+ao
+aw
+ax
+ay
+b
+bcl
+ch
+d
+dcl
+dh
+eh
+el
+en
+er
+ey
+f
+g
+gcl
+hh
+ih
+iy
+jh
+k
+kcl
+l
+m
+n
+ng
+ow
+oy
+p
+pcl
+r
+s
+sh
+t
+tcl
+th
+uh
+uw
+v
+w
+y
+z
+zh
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/E.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/E.olmdtpm
new file mode 100644 (file)
index 0000000..b9cc750
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/E.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/F.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/F.olmdtpm
new file mode 100644 (file)
index 0000000..fc87524
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/F.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/G.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/G.olmdtpm
new file mode 100644 (file)
index 0000000..41ab251
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/G.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/H.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/H.olmdtpm
new file mode 100644 (file)
index 0000000..b287883
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/H.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/I.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/I.olmdtpm
new file mode 100644 (file)
index 0000000..6d541cd
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/I.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/J.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/J.olmdtpm
new file mode 100644 (file)
index 0000000..730fc9f
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/J.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/K.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/K.olmdtpm
new file mode 100644 (file)
index 0000000..efacf66
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/K.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/L.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/L.olmdtpm
new file mode 100644 (file)
index 0000000..f8497aa
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/L.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/M.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/M.olmdtpm
new file mode 100644 (file)
index 0000000..d6d31fb
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/M.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/ROM2cls.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/ROM2cls.bin
new file mode 100755 (executable)
index 0000000..49dda1d
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/ROM2cls.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qs.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qs.bin
new file mode 100755 (executable)
index 0000000..8b385c7
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qs.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qstbl.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qstbl.bin
new file mode 100755 (executable)
index 0000000..23683ce
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_qstbl.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_tree.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_tree.bin
new file mode 100755 (executable)
index 0000000..60c60dc
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_tree.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_treetbl.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_treetbl.bin
new file mode 100755 (executable)
index 0000000..031863c
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/_treetbl.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/cls_centr.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/cls_centr.bin
new file mode 100755 (executable)
index 0000000..dc2722e
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/cls_centr.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.cb b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.cb
new file mode 100755 (executable)
index 0000000..cd59891
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.cb differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.off b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.off
new file mode 100755 (executable)
index 0000000..9555e14
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxclust.off differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxconfig.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxconfig.bin
new file mode 100755 (executable)
index 0000000..f43d233
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxconfig.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxenc.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxenc.bin
new file mode 100755 (executable)
index 0000000..9295df4
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxenc.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxerrcb.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxerrcb.bin
new file mode 100755 (executable)
index 0000000..c3f1dee
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxerrcb.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxgconst.cb b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxgconst.cb
new file mode 100755 (executable)
index 0000000..233ec2a
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxgconst.cb differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxsil.hmm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxsil.hmm
new file mode 100755 (executable)
index 0000000..77b00dd
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxsil.hmm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.cb b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.cb
new file mode 100755 (executable)
index 0000000..dddd144
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.cb differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.off b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.off
new file mode 100755 (executable)
index 0000000..d3e6dfe
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxtran.off differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxvar.cb b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxvar.cb
new file mode 100755 (executable)
index 0000000..c61b543
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxvar.cb differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxweight.cb b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxweight.cb
new file mode 100755 (executable)
index 0000000..ad6b778
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/fxweight.cb differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/monophone.list b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/monophone.list
new file mode 100755 (executable)
index 0000000..95ccdac
--- /dev/null
@@ -0,0 +1,48 @@
+aa
+ae
+ah
+ao
+aw
+ax
+ay
+b
+bcl
+ch
+d
+dcl
+dh
+eh
+el
+en
+er
+ey
+f
+g
+gcl
+hh
+ih
+iy
+jh
+k
+kcl
+l
+m
+n
+ng
+ow
+oy
+p
+pcl
+r
+s
+sh
+t
+tcl
+th
+uh
+uw
+v
+w
+y
+z
+zh
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/scale.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/scale.bin
new file mode 100755 (executable)
index 0000000..c402460
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models/scale.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/N.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/N.olmdtpm
new file mode 100644 (file)
index 0000000..85c458d
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/N.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/O.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/O.olmdtpm
new file mode 100644 (file)
index 0000000..7b9f75d
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/O.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/P.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/P.olmdtpm
new file mode 100644 (file)
index 0000000..a49036c
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/P.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Q.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Q.olmdtpm
new file mode 100644 (file)
index 0000000..8a3135a
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Q.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/R.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/R.olmdtpm
new file mode 100644 (file)
index 0000000..1bd17d7
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/R.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/S.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/S.olmdtpm
new file mode 100644 (file)
index 0000000..4fcdb0e
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/S.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/T.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/T.olmdtpm
new file mode 100644 (file)
index 0000000..9215a0c
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/T.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/U.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/U.olmdtpm
new file mode 100644 (file)
index 0000000..06efecd
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/U.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/V.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/V.olmdtpm
new file mode 100644 (file)
index 0000000..c7a683c
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/V.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/W.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/W.olmdtpm
new file mode 100644 (file)
index 0000000..6cc1f9e
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/W.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/X.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/X.olmdtpm
new file mode 100644 (file)
index 0000000..44733e0
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/X.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Y.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Y.olmdtpm
new file mode 100644 (file)
index 0000000..6a2619c
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Y.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Z.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Z.olmdtpm
new file mode 100644 (file)
index 0000000..5a74bf2
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/Z.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/_.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/_.olmdtpm
new file mode 100644 (file)
index 0000000..0ebbaf3
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/_.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/cAttType.txt b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/cAttType.txt
new file mode 100644 (file)
index 0000000..556f358
--- /dev/null
@@ -0,0 +1,12 @@
+L4
+L3
+L2
+L1
+R1
+R2
+R3
+R4
+C4
+C3
+C2
+C1
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/cAttValue.txt b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/cAttValue.txt
new file mode 100644 (file)
index 0000000..ed37dc0
--- /dev/null
@@ -0,0 +1,34 @@
+A
+B
+C
+D
+E
+F
+G
+H
+I
+J
+K
+L
+M
+N
+O
+P
+Q
+R
+S
+T
+U
+V
+W
+X
+Y
+Z
+VOICED
+UNVOICED
+SHORT_PAUSE
+NO_ATTRIBUTE
+-
+_
+'
+.
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/dash.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/dash.olmdtpm
new file mode 100644 (file)
index 0000000..3911e5b
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/dash.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/dot.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/dot.olmdtpm
new file mode 100644 (file)
index 0000000..9d5607d
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/dot.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin
new file mode 100644 (file)
index 0000000..b53fc09
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/onewphone.list b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/onewphone.list
new file mode 100644 (file)
index 0000000..d9f6082
--- /dev/null
@@ -0,0 +1,81 @@
+ey VOICED
+aa VOICED
+_  SHORT_PAUSE
+k  UNVOICED
+ih VOICED
+n  VOICED
+l  VOICED
+s  UNVOICED
+eh VOICED
+th UNVOICED
+m  VOICED
+z  VOICED
+ae VOICED
+ao VOICED
+r  VOICED
+ax VOICED
+b  VOICED
+ay VOICED
+ow VOICED
+iy VOICED
+d  VOICED
+ng VOICED
+t  UNVOICED
+sh UNVOICED
+w_aa  VOICED
+hh  UNVOICED
+aw  VOICED
+uw  VOICED
+v  VOICED
+ah VOICED
+er VOICED
+f  UNVOICED
+k_s VOICED
+g  VOICED
+jh VOICED
+uh VOICED
+ax_l VOICED
+w VOICED
+t_s VOICED
+zh VOICED
+p  UNVOICED
+ax_m VOICED
+y_uw VOICED
+ch  VOICED
+b_ih VOICED
+en VOICED
+y_ax VOICED
+y  VOICED
+oy  VOICED
+w_ey  VOICED
+k_ax  VOICED
+dh  VOICED
+y_uh  VOICED
+y_eh  VOICED
+g_z  VOICED
+ey_eh  VOICED
+k_sh  VOICED
+w_ah  VOICED
+y_ow  VOICED
+w_ao  VOICED
+y_aa  VOICED
+ih_m  VOICED
+v_iy  VOICED
+eh_k_s  VOICED
+ah_l  VOICED
+k_z  VOICED
+eh_n  VOICED
+y_ah  VOICED
+p_iy  VOICED
+g_zh  VOICED
+m_ax  VOICED
+m_ae  VOICED
+el    VOICED
+g_s   VOICED
+k_ey  VOICED
+y_ih  VOICED
+k_eh  VOICED
+y_ao  VOICED
+ax_f  VOICED
+ah_m  VOICED
+w_ax  VOICED
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/English/up.olmdtpm b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/up.olmdtpm
new file mode 100644 (file)
index 0000000..66f9cfb
Binary files /dev/null and b/Data/OffDT_GenDict_PhbVR_LE_MQ/English/up.olmdtpm differ
diff --git a/Data/OffDT_GenDict_PhbVR_LE_MQ/ReadMe.txt b/Data/OffDT_GenDict_PhbVR_LE_MQ/ReadMe.txt
new file mode 100644 (file)
index 0000000..8265d07
--- /dev/null
@@ -0,0 +1,41 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+-----------------
+
+This directory and its sub-directory tree contain data used by the TIesrFlex,
+TIesrDict, and TIesrDT APIs.  The data is for general American English. A user
+utilizes the TIesrFlex API to create a set of binary grammar network and model
+acoustic data files for an input grammar.  The sub-directories are described
+below. All information is in a standard little-endian format so that it can be
+used with Linux, Windows, or any other operating system using little-endian
+format.
+
+The English sub-directory holds files that contain binary pronunciation decision
+trees for each letter and several punctuation marks, plus some additional
+supporting files.  The TIesrDT API uses the decision trees to determine a word
+pronunciation from the spelling of the word. The decision trees contain data
+based on training over a large number of word pronunciations. The decision trees
+provide a phonetic pronunciation for each letter of the word based on the
+surrounding context of the letter. The binary decision tree file format was
+designed to reduce file size while containing offset information for fast node
+location so that the generation of word pronunciations can be accomplished with
+minimal processing.
+
+The English/Dict sub-directory contains a binary phonetic pronunciation
+dictionary in the file dict.bin containing over 96000 entries. The entries
+include common English words and names, and includes multiple pronunciations for
+some words. The size of the binary dictionary file is minimized by encoding only
+the variance between the decision tree pronunciation of the word and the actual
+accepted pronunciation. The sub-directory also contains a listing file,
+phone.lis, that lists the phones used in the dictionary.
+
+The English/Models sub-directory contains binary acoustic model information that
+is used to construct the acoustic phonetic models needed to recognize the words
+specified in a grammar. TIesrFlex uses this data to create a set of
+gender-dependent triphone acoustic Hidden Markov Models (HMMs) which are
+concatenated to define the the acoustic models forming words. Compression
+techniques have been used to reduce the size of the binary files.  The HMM model
+information is in compressed byte format with vq clustered transition and mean
+vector data.
+
diff --git a/Data/ReadMe.txt b/Data/ReadMe.txt
new file mode 100644 (file)
index 0000000..4964b7e
--- /dev/null
@@ -0,0 +1,20 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+------------------
+This directory contains data associated with the TIesr Speech Recognizer and
+with test programs released as part of the open source. This directory also acts
+as a repository for files used by or generated by the TIesr test programs. 
+
+There are three sub-directories as described below.
+
+The OffDT_GenDictPhbVR_LE_MQ directory contains the American English word pronunciation data, a general American dictionary, and phonetic acoustic model data. This data is used by the TIesrFlex API when creating a grammar network and acoustic model data set for a particular user-defined grammar. See the detailed ReadMe documentation in the directory for further information specific to this data, and the TIesr Documentation directory for further information regarding TIesr data.
+
+The AudioDir directory is used by the testtiesrfa program. The testtiesrfa program utilizes the TIesrFA API to record a duration of audio data and write it to a file in the AudioDir directory. The data is in raw 16-bit single-channel format, normally sampled at 8kHz sampling rate. A user of TIesr should execute the testtiesrfa program to record audio data, and examine the data to ensure the proper operation of the TIesrFA API and the quality of the recorded audio signal. It is very important to obtain a good quality audio signal in order for TIesr to operate successfully. There should not be noticeable distortion or clipping in the audio signal.
+
+The GramDir is used by the testtiesrflex program.  The testtiesrflex program utilizes the TIesrFlex API to generate a set of binary grammar network and model files based on an input user-supplied grammar. The program outputs the binary data to the GramDir directory for subsequent use by the TIesrSI API when performing speech recognition based on the input grammar. For further information on creating an input grammar, consult the TIesr Documentation directory.
+
+Various files are also located in this directory. The TestTIesrDTWords.txt file contains words, one per line, that the testtiesrdt program uses. The program outputs the phonetic  pronunciation of each word as determined by the TIesrDT API, which is based on spelling alone. It is likely that there will be pronunciation errors, since determining pronunciation from word spelling alone is not reliable. Consult documentation for the TIesrDT API for further information.
+
+Several output files generated while running test programs may be output in this directory. The TIesr Speech Recognizer keeps track of the state of the recognizer and environment in the "JAC" file. The testtiesrsi program writes the JAC file to this directory for use in testing. Consult documentation for the TIesrSI API for further information.
+
diff --git a/Data/TestTIesrDTWords.txt b/Data/TestTIesrDTWords.txt
new file mode 100644 (file)
index 0000000..6b43c79
--- /dev/null
@@ -0,0 +1,4 @@
+yes
+no
+maybe
diff --git a/Documentation/ReadMeFirst.txt b/Documentation/ReadMeFirst.txt
new file mode 100644 (file)
index 0000000..410ae03
--- /dev/null
@@ -0,0 +1,299 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+
+Using This TIesr Distribution
+-----------------------------
+This TIesr distribution contains all of the APIs that make up the TIesr Speech
+Recognizer. In addition, the distribution contains test programs that may be
+used to test the APIs to ensure they are working correctly. Any speech
+recognizer requires data for grammar and acoustic modeling, and this
+distribution contains data for implementing general American English speech
+recognition. A few tools are also supplied for diagnostics, or in case one just
+wishes to explore operation of the recognizer in greater detail.  All of these
+components are briefly described below.
+
+
+TIesr APIs
+----------
+
+The TIesr speech recognizer consists of seven APIs in six directories. Normally
+a user only needs to interact with the two top-level APIs, TIesrFlex and
+TIesrSI. An API is located within a directory with a name indicating the API or
+APIs contained. Within the API directory is a src directory containing all
+source code. API directories also contain a resource directory which holds
+versioning files for Linux builds. If an API includes a test program, then
+documentation for that program is found within the API directory.
+
+TIesr APIs are written in C and C++. The APIs have been built using the open
+source NetBeans IDE (www.netbeans.org). Each API directory includes a NetBeans
+project directory containing the NetBeans project to build the API.
+Configurations exist in each project for building on a Windows platform with
+cygwin (www.cygwin.com), and on a Linux platform. Also, configurations exist for
+cross-compiling and building for an embedded ARM-based platform using the
+Codesourcery G++ lite gnu toolchain (http://www.codesourcery.com/sgpp/lite/arm).
+
+
+Preparation
+-----------
+
+If you wish to use the NetBeans IDE to perform the build, and do development of
+the source, it must be downloaded to your development platform.  This can be
+done from the NetBeans web site, www.netbeans.org.
+
+If you wish to build and develop on a Windows platform using the NetBeans IDE,
+then install cygwin on the Windows platform from the web site www.cygwin.com.
+(cygwin should be installed at C:\cygwin). The cygwin download should include
+the gnu development tools (gcc-core and gcc-g++, gdb) and support for Mingw32
+(gcc-mingw-core and gcc-mingw-g++).
+
+If you wish to cross-compile and build for the ARM-based platform, then you can
+download the Codesourcery G++ Lite toolchain from
+http://www.codesourcery.com/sgpp/lite/arm. You may load this toolchain anywhere,
+but the TIesr distribution assumes that within the TIesr distribution's
+Tools/ARM directory there is a link called "bin" to a directory containing the
+Codesourcery gnu toolchain, and within the Tools/ARM directory there is a link
+"include" to a directory containing any additional header files needed, and a
+link "lib" to a directory containing any additional libraries needed for linking
+APIs not included with the Codesourcery gnu toolchain (for example, the ALSA
+sound library).
+
+Once the tools are in place, NetBeans should be configured to use the tool sets
+by selecting Tools->Options, selecting C/C++ and then the Build Tools tab.
+Ensure that the locations of the tools are set for the Tool Collection to be
+used for the project configurations of interest.
+
+The NetBeans makefile for the TIesrFA_ALSAso API for configurations that build
+for the ARM platform look for ALSA API header files in the Tools/ARM/include
+directory and ALSA libraries in the Tools/ARM/lib directory. You must create the
+"include" and "lib" directories and place the necessary files in these
+directories or create the "include" and "lib" directories as links to the
+directories where the headers and libraries reside.
+
+During compilation or building in NetBeans, if you encounter a screen that says
+the project was created for a different OS, this can normally be corrected by
+right clicking on the project name in the Projects tab, selecting Properties,
+and then clicking OK. This should regenerate the build files for the platform
+you are using.
+
+
+Quick Overview of TIesr Distribution Directories
+------------------------------------------------
+
+This section provides a quick overview of each of the directories in the TIesr
+distribution.
+
+Data
+----
+The Data directory contains data that the TIesr recognizer needs for building
+grammars and acoustic models, and directories and files created by the TIesr
+test programs. For further information, consult the ReadMe file in the Data
+directory.
+
+Dist
+----
+The Dist directory contains the TIesr API shared objects or DLL's when they are
+built. It also contains the test programs when built. This would be a good place
+to add build outputs for additional configurations for other platforms or
+devices.
+
+Documentation
+-------------
+This directory contains the top-level documentation and licensing information.
+
+TIesrDict
+---------
+This directory contains the TIesrDict API. This API is responsible for looking
+up the pronunciation(s) of a word in a dictionary. It is used by the TIesrFlex
+API, and uses the TIesrDT API. It contains two NetBeans project directories;
+TIesrDictso for building the API, and TestTIesrDict for building a test program
+that exercises TIesrDict.
+
+TIesrDT
+-------
+This directory contains the TIesrDT API. This API is responsible for creating an
+initial hypothesis of the pronunciation of a word from the word spelling alone.
+It is used by the TIesrDict API. It contains two NetBeans project directories;
+TIesrDTso for building the API, and TestTIesrDT for building a test program that
+exercises TIesrDT.
+
+TIesrEngine
+-----------
+This directory contains the code that implements the actual speech recognizer
+processing. There are two NetBeans project directories; TIesrEngineCoreso for
+building the core speech recognition utilities, and TIesrEngineSIso for building
+the speech recognizer adaptation and interface utilities.  TIesrEngineSIso uses
+the TIesrEngineCoreso API, and TIesrEngineSIso is used by the top-level TIesrSI
+API.
+
+TIesrFA
+-------
+This directory contains the TIesrFA API. This API implements audio data
+collection and buffering for the TIesr speech recognizer. You may have to
+specifically implement this interface for a platform or OS, since it depends on
+the particular audio interfaces. This API is multi-threaded, starting collection
+in a separate high priority thread. Two implementation projects are supplied;
+TIesrFAWinso is an implmementation for Window platforms that uses the Windows
+Waveform Audio API, and TIesrFA_ALSAso is for Linux platforms using the ALSA
+audio API. The directory also contains a TestTIesrFA project to build a test
+program that exercises TIesrFA by collecting audio data.  Make sure the audio
+data you collect is good quality before trying speech recognition.
+
+TIesrFlex
+---------
+This directory contains the TIesrFlex API, which is the top-level API that a
+user utilizes to prepare a grammar and acoustic model set for the TIesr
+recognizer. The directory contains two NetBeans projects; TIesrFlexso for
+building the TIesrFlex API, and TestTIesrFlex for building a test program to
+exercise the TIesrFlex API by building a simple speech recognizer grammar and
+model set that recognizes the words "yes", "no", or "maybe".
+
+TIesrSI
+-------
+This directory contains the top-level API that a user utilizes to perform speech
+recognition and obtain recognition results. The directory contains two projects;
+TIesrSIso to build the TIesrSI API, and TestTIesrSI to build a test program that
+tests TIesr by recognizing the words "yes", "no", or "maybe".
+
+TIesr_Tools
+-----------
+This directory contains tools that can be used off-line to build data sets for
+various languages and dictionaries, and for analyzing some of the data files
+used by the TIesr recognizer. Many of the tools are perl scripts, and some are C
+or C++ programs. The programs are not built as part of building and testing
+TIesr as described below. The user must build these separately. See
+documentation in the TIesr_Data_Training.txt file for further information.
+
+Tools
+-----
+The user can place tools, or links to tools, for cross-compiling and building
+the TIesr APIs for other platforms in this directory. An example is placing
+links in the Tools/ARM directory to the Codesourcery GNU build toolchain for
+ARM-based embedded platforms. This directory can also contain include
+directories and libraries, or links to include directories and libraries, that
+are needed in order to build TIesr for other platforms  For example, building
+the TIesrFA API may require the ALSA include and library directories for the
+platform of interest 
+
+Building and Testing TIesr
+--------------------------
+Tools are provided to build the individual TIesr APIs. As the result of building
+the APIs the libraries and executables are placed under the the directory named
+"Dist".
+
+Building the TIesr recognizer is best done by building the individual APIs and
+testing them with the supplied test programs to ensure the APIs are operating
+correctly. The release includes NetBeans IDE projects for each API and test
+program. The NetBeans project files can be used to build and run the individual
+APIs and test programs within the NetBeans IDE. For information regarding the
+NetBeans IDE and obtaining it visit:
+
+http://netbeans.org
+
+During compilation or building in NetBeans, if you encounter a screen that says
+the project was created for a different OS, this can normally be corrected by
+right clicking on the project name in the Projects tab, selecting Properties,
+and then clicking OK. This should regenerate the build files for the platform
+you are using.
+
+Alternatively, in the absence of NetBeans, the APIs and programs can be built by
+using the make files supplied with the released NetBeans projects. In order to
+automate this process, the top level of the release directory contains a single
+Makefile. This Makefile can be used to clean or build any subset of the APIs and
+test programs for any supported configuration. In order for this Makefile to
+work, the Gnu compilation tools gcc, g++, and as (or for Cygwin on Windows
+gcc.exe, g++.exe, as.exe) must be available and specified on the PATH such that
+the tools can be executed from the command line using just the filename of the
+tool. The format of the make command for the Makefile is:
+
+make <CONFIGURATION> [PROJECTS='project ...'  STEP=<clean|build>]
+
+The supported configurations are:
+WindowsDebugMinGW
+WindowsReleaseMinGW
+LinuxDebugGnu
+LinuxReleaseGnu
+ArmLinuxDebugGnueabi
+ArmLinuxReleaseGnueabi
+
+If the variable PROJECTS is not given on the command line, then all projects for
+the configuration will be built. Otherwise, only the projects specified by the
+PROJECTS variable will be built. Valid project names are:
+
+TIesrDTso
+TestTIesrDT
+TIesrDictso
+TestTIesrDict
+TIesrFlexso
+TestTIesrFlex
+TIesrFAWinso (only for Windows)
+TIesrFA_ALSAso (only for Linux with ALSA support)
+
+TestTIesrFA
+TIesrEngineCoreso
+TIesrEngineSIso
+TIesrSIso
+TestTIesrSI
+
+For example, to build the TIesrDTso and TestTIesrDT projects for a Linux debug
+build use:
+
+make LinuxDebugGnu  PROJECTS='TIesrDTso TestTIesrDT'
+
+The user may specify what action to take, build or clean, using the STEP
+variable. The configuration "help" will display the latest information simi
+lar to the above about the make file:
+ make help
+
+
+The remainder of this section describes the order for building and testing
+the APIs. This should be read regardless of whether the Makefile or NetBeans is
+used for building the APIs and test programs.
+
+Three APIs make up the grammar network and model generation capability; TIesrDT,
+TIesrDict, and TIesrFlex. First build the TIesrDT API, and then the TestTIesrDT
+program. Run the TestTIesrDT program as described in the ReadMe.txt file in the
+TIesrDT directory, and ensure the output is correct.
+
+Build the TIesrDict API, and then the TestTIesrDict program. Run the
+TestTIesrDict program as described in the ReadMe.txt file in the TIesrDict
+directory, and ensure the output is correct.
+
+Build the TIesrFlex API, and then the TestTIesrFlex program. Run the
+TestTIesrFlex program as described in the ReadMe.txt file in the TIesrFlex
+directory, and ensure the output is correct.
+
+When these three APIs have been built and tested, then the grammar network and
+model generation portion of TIesr are ready to be used.
+
+Next, build the TIesrFA API for the OS you wish, either Windows, or Linux with
+ALSA. If your platform does not match one of these, you will have to implement
+your own version of the TIesrFA interface. The TIesrFA interface is fully
+specified by the header file TIesrFA/src/TIesrFA_User.h. To write your own
+implementation, you may wish to examine the either the Windows or Linux/ALSA
+versions supplied and use those as a template for your implementation.
+Once the TIesrFA API is built, then build the TestTIesrFA program. Run the
+program as as described in the ReadMe.txt file in the TIesrFA directory. This
+should capture audio data in a file. The data should be single channel 2-byte
+signed integer PCM samples at 8kHz sampling rate. It is very important that the
+audio data be examined carefully. Many of the problems encountered with TIesr
+(or any speech recognizer) are traced to poor audio input. The speech collected
+should have a peak absolute value >2000, and of course the signal should never
+limit ( values of +32767 or-32768 ). You should play the captured signal using
+good quality speakers, and listen for any distortion in the output that might
+indicate a faulty audio channel or microphone.
+
+After building the TIesrFA API, build the two recognizer TIesrEngine APIs,
+TIesrEngineCore and TIesrEngineSI. These two APIs do not have a test program
+written for them.
+
+Build the TIesrSI API, and then the TestTIesrSI program. The TestTIesrSI program
+exercises the TIesr speech recognizer, and uses the TIesrEngineCore,
+TIesrEngineSI, and TIesrFA APIs. The TestTIesrSI program performs speech
+recognition of one of the words "yes", "no" or "maybe". The TestTIesrSI program
+may be run in a live mode where you supply audio from a microphone, or it may
+use a file as input. See the ReadMe.txt file in the TIesrSI directory for more
+information. When this program runs successfully, you have built and tested the
+TIesr speech recognizer. You can use the TestTIesrSI source code as an example
+of how to use the TIesr APIs in an application.
diff --git a/Documentation/ReleaseNotes.txt b/Documentation/ReleaseNotes.txt
new file mode 100644 (file)
index 0000000..16f148f
--- /dev/null
@@ -0,0 +1,79 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+
+Introduction
+------------
+
+These notes cover release Beta-1.2
+
+This release contains builds that have been tested on Windows, and under Linux
+for the x86-64, the ARM running on the Beagle Board (www.beagleboard.org).
+Slightly older versions of the code have run successfully on the Logic TI Zoom
+OMAP MDP, and the Mistral TI OMAP3503 EVM, and so the present release should
+also work on those platforms. Since the TIesr code is written in C/C++, one
+should also be able to easily build it for other platforms.
+
+Changes in This Release
+-----------------------
+
+This release provides an initial version of all of the off-line tools required
+to build the data files for TIesr for a custom vocabulary or a complete
+language. Documentation can be found in the
+Documentation/TIesr_Data_Training.txt file. The release also contains an example
+of how to build the data files in TIesr_Tools/Example. A detailed file at
+TIesr_Tools/Example/ReadMe.txt gives a tutorial on using the tools to create a
+data file set.  Please note that in order to create the data files for another
+language a large dictionary and database of speech in the language must be
+available for training of the data files. These databases will not be provided
+as part of the release.
+
+Some bugs in the APIs and tools have been corrected.  The TIesrDict API and
+TIesrFlex API interfaces have been modified to include an extra parameter
+needed to turn off automatic insertion of closure models for stop consonants.
+
+In order to accommodate the TIesr tools better, the directory structure was
+altered slightly to move the tools provided originally in the TIesrSI/tools
+directory to the TIesr_Tools directory. This new directory is now the central
+location for release of TIesr off-line tools, and also contains documentation
+on how to use them and a tutorial in the Example directory.
+
+The TIesr_Tools.txt file that documents the tools that display the
+contents of the acoustic model and network files output by the TIesrFlex API
+has been renamed to TIesr_Display_Tools.txt in order to avoid confusion with
+the TIesr_Tools directory.
+
+Tasks Remaining
+---------------
+
+In this release there are still tasks remaining to be accomplished, and these
+will be addressed in subsequent releases. The following is a list of tasks
+remaining. This list is not complete or organized by priority.
+
+- This release provides the tools necessary to build data file sets so that one
+can use TIesr to recognize speech in another language, or with alternative
+English data. The provided tools enable: (1) the construction of a pronunciation
+dictionary that provides substantial coverage of the language to be recognized;
+(2) training a set of pronunciation decision trees from the dictionary; (3)
+constructing a compressed dictionary; (4) training a set of phonetic acoustic
+models and extracting the information; (5) constructing a tree that represents
+acoustic similarities of phones in a language; (6) constructing of data files
+for clustering the acoustic feature Gaussian probability density functions used
+in acoustic models. Some tools that compress the resulting data file sets into a
+much smaller footprint have not been ported to the release yet. A subsequent
+release will contain these tools.
+
+- The TIesr algorithm that returns a confidence measure is designed for larger
+vocabulary tasks, where grammars contain many words. The confidence measure
+becomes less accurate for small vocabularies. This will be addressed in a
+subsequent release.
+
+- TIesr provides many advanced setting capabilites to tune recognizer footprint
+and performance. These are not documented in this release. A subsequent release
+will document the advanced settings, and provide a technical description of the
+recognizer algorithms. It will describe formats of the binary files used by
+TIesr.
+
+- The TIesr software has been a developing code base written by several
+engineers. Much clean-up of the code and addition of comments is needed,
+especially in the lower level signal processing APIs.
\ No newline at end of file
diff --git a/Documentation/SoftwareLicenseAgreement.txt b/Documentation/SoftwareLicenseAgreement.txt
new file mode 100644 (file)
index 0000000..0ba223f
--- /dev/null
@@ -0,0 +1,459 @@
+            
+            Source and Object Code Software License Agreement
+       (for Texas Instruments Embedded Speech Recognition Software)
+
+
+IMPORTANT - PLEASE READ THE FOLLOWING LICENSE AGREEMENT CAREFULLY.  THIS IS A
+LEGALLY BINDING AGREEMENT.  AFTER YOU READ THIS LICENSE AGREEMENT, YOU WILL BE
+ASKED WHETHER YOU ACCEPT AND AGREE TO THE TERMS OF THIS LICENSE AGREEMENT.  DO
+NOT CLICK "I HAVE READ AND AGREE" UNLESS: (1) YOU ARE AUTHORIZED TO ACCEPT AND
+AGREE TO THE TERMS OF THIS LICENSE AGREEMENT ON BEHALF OF YOURSELF AND, IF
+APPLICABLE, YOUR COMPANY; AND (2) YOU INTEND TO ENTER INTO AND TO BE BOUND BY
+THE TERMS OF THIS LEGALLY BINDING AGREEMENT ON BEHALF OF YOURSELF AND, IF
+APPLICABLE, YOUR COMPANY.
+
+Important - Read carefully: This source and object code software license
+agreement ("Agreement") is a legal agreement between you (either an individual
+or entity) and Texas Instruments Incorporated ("TI").  The "Licensed Materials"
+subject to this Agreement include the software programs (in whole or in part)
+that accompany this Agreement and which you access "on-line" and/or electronic
+documentation (in whole or in part) associated and provided with these programs,
+as well as any updates or upgrades to such software programs and documentation,
+if any, provided to you at TI's sole discretion.  By installing, copying or
+otherwise using the Licensed Materials you agree to abide by the provisions set
+forth herein.  This Agreement is displayed for you to read prior to using the
+Licensed Materials.  If you choose not to accept or agree with these provisions,
+do not download or install the Licensed Materials.  
+
+Note Regarding Possible Access to Open Source Software:  The Licensed Materials
+may be bundled with Open Source Software.  "Open Source Software" means any
+software licensed under terms requiring that (A) other software ("Proprietary
+Software") incorporated, combined or distributed with such software or developed
+using such software: (i) be disclosed or distributed in source code form; or
+(ii) otherwise be licensed on terms inconsistent with the terms of this
+Agreement, including but not limited to permitting distribution of the
+Proprietary Software on or with devices other than TI Devices, or (B) require
+the owner of Proprietary Software to license any of its patents to users of the
+Open Source Software and/or Proprietary Software incorporated, combined or
+distributed with such Open Source Software or developed using such Open Source
+Software. For purposes of this Agreement, "TI Devices"  means processing devices
+manufactured by or for TI.  
+
+By accepting this Agreement, you may gain access to Open Source Software, in
+which case such Open Source Software will be listed in the applicable software
+manifest (in whole or in part, the "Open Source Materials").  Your use of the
+Open Source Materials is subject to the separate licensing terms applicable to
+such Open Source Materials as specified in the applicable software manifest. 
+For clarification, this Agreement does not limit your rights under, or grant you
+rights that supersede, the license terms of any applicable Open Source Materials
+license agreement.  If any of the Open Source Materials have been provided to
+you in object code only, TI will provide to you or show you where can access the
+source code versions of such Open Source Materials if you contact TI at Texas
+Instruments Incorporated, 12500 TI Boulevard, Mail Station 8638, Dallas, Texas
+75243, Attention: Contracts Manager.  You may terminate this Agreement in the
+event you choose not to accept or agree with the terms in any applicable Open
+Source Materials license agreement, provided that such termination occurs within
+five (5) days of acceptance of this Agreement and you abide by all applicable
+license terms in this Agreement until such termination. 
+
+1. License Grant and Use Restrictions.   
+
+   a. Licensed Materials License Grant.   
+
+      i. Limited Source Code Internal Evaluation and Testing License.  Subject
+         to the terms of this Agreement, TI hereby grants to you a limited,
+         non-transferable, non-exclusive, non-assignable, non-sublicensable,
+         fully paid-up and royalty-free license to make copies, prepare
+         derivative works, display internally and use internally the Licensed
+         Materials provided to you in source code, (A) on any processor or
+         platform, for evaluation and testing purposes only, and (B) for
+         developing object and executable versions of such Licensed Materials,
+         or any derivative thereof, that execute solely and exclusively on TI
+         Devices, for end use in Licensee Products, and maintaining and
+         supporting such Licensed Materials, or any derivative thereof, and
+         Licensee Products.  For purposes of this Agreement, "Licensee Product"
+         means a product that consists of both hardware, including one or more
+         TI Devices, and software components, including only executable versions
+         of the Licensed Materials that execute solely and exclusively on such
+         TI Devices.  For clarification and the avoidance of doubt, this source
+         code internal use license permits you to use and operate the source
+         code on any processor and board platform for internal evaluation and
+         testing purposes, but does not give you the right to use the source
+         code to develop and/or distribute a product other than a Licensee
+         Product.  
+       
+      ii. Limited Object Code Internal Evaluation and Testing License.  Subject
+          to the terms of this Agreement, TI hereby grants to you a limited,
+          non-transferable, non-exclusive, non-assignable, non-sublicensable,
+          fully paid-up and royalty free license to make copies, display
+          internally, distribute internally and use internally the object code
+          format of the Licensed Materials, (A) on any processor or platform,
+          for evaluation and testing purposes only, and (B) for designing and
+          developing Licensee Products, and maintaining and supporting such
+          Licensee Products.  For clarification and the avoidance of doubt, this
+          internal use object code license permits you to use and operate the
+          object code on any processor and board platform for internal
+          evaluation and testing purposes, but does not give you the right to
+          use the object code to develop and/or distribute a product other than
+          a Licensee Product.
+                
+      iii. Limited Production and Distribution License.  Subject to the terms of
+           this Agreement, TI hereby grants to you a non-transferable,
+           non-exclusive, non-assignable, non-sublicensable, fully paid-up and
+           royalty free license under all TI intellectual property embodied in
+           the Licensed Materials to make, use, sell, offer to sell, import,
+           export and otherwise distribute the Licensed Materials, or any
+           derivatives thereof, as part of a Licensee Product, provided that
+           such Licensee Products include only embedded executable copies of
+           such Licensed Materials, or any derivatives thereof, that execute
+           solely and exclusively on TI Devices in such Licensee Products.
+
+   b. Contractors and Suppliers.  The licenses granted to you hereunder shall
+      include your on-site and off-site suppliers and independent contractors,
+      while such suppliers and independent contractors are performing work for
+      or providing services to you, provided that such suppliers and independent
+      contractors have executed work-for-hire agreements with you containing
+      applicable terms and conditions consistent with the terms and conditions
+      set forth in this Agreement and provided further that you shall be liable
+      to TI for any breach by your suppliers or independent contractors of this
+      Agreement to the same extent as you would be if you had breached the
+      Agreement yourself. 
+
+   c. Limited License to TI and Covenant not to Sue.  Continuing for the term
+      of this Agreement, you hereby grant to TI and TI's licensees of the
+      Licensed Materials, under any of your patents embodied in the Licensed
+      Materials, a non-transferable, non-exclusive, non-assignable, worldwide,
+      fully paid-up, royalty-free license to make, use, sell, offer to sell,
+      import, export and otherwise distribute such Licensed Materials.  You
+      covenant not to sue or otherwise assert Derived Patents against TI and
+      TI's affiliates and their licensees of the Licensed Materials.  In the
+      event you assign a Derived Patent, you shall require as a condition of any
+      such assignment that the assignee agree to be bound by the provisions in
+      this Section 1(c) with respect to such Derived Patent.  Any attempted
+      assignment or transfer in violation of this Section 1(c) shall be null and
+      void. For purposes of this Agreement, "Derived Patents" means any of your
+      patents issuing from a patent application that discloses and claims an
+      invention conceived of by you after delivery of the Licensed Materials,
+      and derived by you from your access to the Licensed Materials.
+
+   d. No Other License.  Notwithstanding anything to the contrary, nothing in
+      this Agreement shall be construed as a license to any intellectual
+      property rights of TI other than those rights embodied in the Licensed
+      Materials provided to you by TI.  EXCEPT AS PROVIDED HEREIN, NO OTHER
+      LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY OTHER TI
+      INTELLECTUAL PROPERTY RIGHTS IS GRANTED HEREIN.
+
+   e. Restrictions.  You shall maintain the source code versions of the
+      Licensed Materials, or any derivatives thereof, under password control
+      protection and shall not disclose such source code versions of the
+      Licensed Materials, or any derivatives thereof, to any person other than
+      your employees and contractors whose job performance requires access. 
+      Except as expressly permitted in Section 1a(i) and 1a(ii) above, you shall
+      not use the Licensed Materials, or any derivatives thereof, with a
+      processing device manufactured by or for an entity other than TI, and you
+      agree that any such unauthorized use of the Licensed Materials, or any
+      derivatives thereof, is a material breach of this Agreement.  Except as
+      expressly provided in this Agreement, you shall not copy, publish,
+      disclose, display, provide, transfer or make available the Licensed
+      Materials, or any derivatives thereof, to any third party and you shall
+      not sublicense, transfer, or assign the Licensed Materials, or any
+      derivatives thereof, or your rights under this Agreement to any third
+      party. You shall not mortgage, pledge or encumber the Licensed Materials,
+      or any derivatives thereof, in any way.  You may use the Licensed
+      Materials, or any derivatives thereof, with Open Source Software or with
+      software developed using Open Source Software tools provided you do not
+      incorporate, combine or distribute the Licensed Materials, or any
+      derivatives thereof, in a manner that subjects the Licensed Materials, or
+      any derivatives thereof, to any license obligations or any other
+      intellectual property related terms of any license governing such Open
+      Source Software.  
+.  
+   f. Termination.  This Agreement is effective until terminated.  You
+      may terminate this Agreement at any time by written notice to TI.  Without
+      prejudice to any other rights, if you fail to comply with the terms of
+      this Agreement, TI may terminate your right to use the Licensed Materials,
+      or any derivatives thereof, upon written notice to you.  Upon termination
+      of this Agreement, you will destroy any and all copies of the Licensed
+      Materials, or any derivatives thereof, in your possession, custody or
+      control and provide to TI a written statement signed by your authorized
+      representative certifying such destruction. Except for Sections 1(a) and
+      1(b) and the limited license to TI in Section 1(c), all provisions of this
+      Agreement shall survive termination of this Agreement. 
+
+2. Licensed Materials Ownership.  The Licensed Materials are licensed, not sold
+   to you, and can only be used in accordance with the terms of this Agreement. 
+   Subject to the licenses granted to you pursuant to this Agreement, TI and its
+   licensors own and shall continue to own all right, title, and interest in and
+   to the Licensed Materials, including all copies thereof.  Moreover, you
+   acknowledge and agree that when your independently developed software or
+   hardware components are combined, in whole or in part, with the Licensed
+   Materials, your right to use the combined work that includes the Licensed
+   Materials remains subject to the terms and conditions of this Agreement.
+
+3. Contribution of Improvements and Derivatives to TI and TI Customers.  You
+   agree that, in partial consideration for the licenses provided granted to you
+   in this Agreement, that all fixes, modifications and improvements to the
+   Licensed Materials conceived of or made by TI that are based, either in whole
+   or in part, on your feedback, suggestions or recommendations are the
+   exclusive property of TI and all right, title and interest in and to such
+   fixes, modifications or improvements to the Licensed Materials will vest
+   solely in TI. Furthermore, you agree, as partial consideration for the
+   licenses granted to you in this Agreement, to consider in good faith
+   contributing back to TI and TI's customer community, in both source and
+   object code form, certain improvements to or derivatives of the Licensed
+   Materials created by you, and you hereby assign to TI all right, title and
+   interest in and to all such improvements and derivatives made by you and
+   contributed back to TI pursuant to this Section 3.  
+
+4. Intellectual Property Rights.  
+
+   a. The Licensed Materials contain copyrighted material, trade secrets and
+      other proprietary information of TI and its licensors and are protected by
+      copyright laws, international copyright treaties, and trade secret laws,
+      as well as other intellectual property laws.  To protect TI's and its
+      licensors' rights in the Licensed Materials, you agree, except as
+      specifically permitted by statute by a provision that cannot be waived by
+      contract, not to "unlock", decompile, reverse engineer, disassemble or
+      otherwise translate to a human-perceivable form any portions of the
+      Licensed Materials provided to you in object code format only, nor permit
+      any person or entity to do so.  You shall not remove, alter, cover, or
+      obscure any confidentiality, trade secret, trade mark, patent, copyright
+      or other proprietary notice or other identifying marks or designs from any
+      component of the Licensed Materials and you shall reproduce and include in
+      all copies of the Licensed Materials, or any derivatives thereof, the
+      copyright notice(s) and proprietary legend(s) of TI and its licensors as
+      they appear in the Licensed Materials.  TI reserves all rights not
+      specifically granted under this Agreement.
+
+   b. Certain Licensed Materials may be based on industry recognized standards
+      or software programs published by industry recognized standards bodies and
+      certain third parties may claim to own patents, copyrights, and other
+      intellectual property rights that cover implementation of those standards.
+      You acknowledge and agree that this Agreement does not convey a license
+      to any such third party patents, copyrights, and other intellectual
+      property rights and that you are solely responsible for any patent,
+      copyright, or other intellectual property right claim that relates to your
+      use or distribution of the Licensed Materials, or any derivatives thereof,
+      or your use or distribution of your products that include or incorporate
+      the Licensed Materials, or any derivatives thereof.  Moreover, you
+      acknowledge that you are responsible for any fees or royalties that may be
+      payable to any third party based on such third party's interests in the
+      Licensed Materials or any intellectual property rights that cover
+      implementation of any industry recognized standard, any software program
+      published by any industry recognized standards bodies or any other
+      proprietary technology.
+       
+5. Audit Right.  At TI's request, and within thirty (30) days after receiving
+   written notice, you shall permit an independent auditor selected by TI to
+   have access, no more than once each calendar year (unless the immediately
+   preceding audit revealed a discrepancy) and during your regular business
+   hours, to all of your equipment, records, and documents as may contain
+   information bearing upon the use of the Licensed Materials, or any
+   derivatives thereof.  You shall keep full, complete, clear and accurate
+   records with respect to product sales and distributions for a period
+   beginning with the then-current calendar year and going back three (3) years.
+
+6. Confidential Information.  You acknowledge and agree that the Licensed
+   Materials contain trade secrets and other confidential information of TI and
+   its licensors.  You agree to use the Licensed Materials, or any derivatives
+   thereof, solely within the scope of the licenses set forth herein, to
+   maintain the Licensed Materials, or any derivatives thereof, in strict 
+   confidence, to use at least the same procedures and degree of care that you
+   use to prevent disclosure of your own confidential information of like
+   importance but in no instance less than reasonable care, and to prevent
+   disclosure of the Licensed Materials, or any derivatives thereof, to any
+   third party, except as may be necessary and required in connection with your
+   rights and obligations hereunder.  You agree to obtain executed
+   confidentiality agreements with your employees and contractors having access
+   to the Licensed Materials, or any derivatives thereof, and to diligently take
+   steps to enforce such agreements in this respect.  TI agrees that industry
+   standard employment agreements used in the normal course of your business
+   shall satisfy the requirements of this section. You agree that TI has the
+   right to disclose your contact information to TI's licensors.
+
+7. Warranties and Limitations.  THE LICENSED MATERIALS ARE PROVIDED "AS IS". 
+   FURTHERMORE, YOU ACKNOWLEDGE AND AGREE THAT THE LICENSED MATERIALS HAVE NOT
+   BEEN TESTED OR CERTIFIED BY ANY GOVERNMENT AGENCY OR INDUSTRY REGULATORY
+   ORGANIZATION OR ANY OTHER THIRD PARTY ORGANIZATION.  YOU AGREE THAT PRIOR TO
+   USING, INCORPORATING OR DISTRIBUTING THE LICENSED MATERIALS, OR ANY
+   DERIVATIVES THEREOF, IN OR WITH ANY COMMERCIAL PRODUCT THAT YOU WILL
+   THOROUGHLY TEST THE PRODUCT AND THE FUNCTIONALITY OF THE LICENSED MATERIALS,
+   OR ANY DERIVATIVES THEREOF, IN OR WITH THAT PRODUCT AND BE SOLELY RESPONSIBLE
+   FOR ANY PROBLEMS OR FAILURES.
+
+   TI AND ITS LICENSORS MAKE NO WARRANTY OR REPRESENTATION, EITHER EXPRESS,
+   IMPLIED OR STATUTORY, REGARDING THE LICENSED MATERIALS, INCLUDING BUT NOT
+   LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
+   PARTICULAR PURPOSE OR NON-INFRINGEMENT OF ANY THIRD PARTY PATENTS,
+   COPYRIGHTS, TRADE SECRETS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  YOU AGREE
+   TO USE YOUR INDEPENDENT JUDGMENT IN DEVELOPING YOUR PRODUCTS.  NOTHING
+   CONTAINED IN THIS AGREEMENT WILL BE CONSTRUED AS A WARRANTY OR REPRESENTATION
+   BY TI TO MAINTAIN PRODUCTION OF ANY TI SEMICONDUCTOR DEVICE OR OTHER HARDWARE
+   OR SOFTWARE WITH WHICH THE LICENSED MATERIALS, OR ANY DERIVATIVES THEREOF,
+   MAY BE USED.  
+
+   IN NO EVENT SHALL TI OR ITS LICENSORS BE LIABLE FOR ANY SPECIAL, INDIRECT,
+   INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED, ON ANY THEORY
+   OF LIABILITY, IN CONNECTION WITH OR ARISING OUT OF THIS AGREEMENT OR THE USE
+   OF THE LICENSED MATERIALS, OR ANY DERIVATIVES THEREOF, REGARDLESS OF WHETHER
+   TI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  EXCLUDED DAMAGES
+   INCLUDE, BUT ARE NOT LIMITED TO, COST OF REMOVAL OR REINSTALLATION, OUTSIDE
+   COMPUTER TIME, LABOR COSTS, LOSS OF DATA, LOSS OF GOODWILL, LOSS OF PROFITS,
+   LOSS OF SAVINGS, OR LOSS OF USE OR INTERRUPTION OF BUSINESS.  IN NO EVENT
+   WILL TI'S OR ITS LICENSORS' AGGREGATE LIABILITY UNDER THIS AGREEMENT OR
+   ARISING OUT OF YOUR USE OF THE LICENSED MATERIALS, OR ANY DERIVATIVES
+   THEREOF, EXCEED THE GREATER OF FIVE HUNDRED U.S. DOLLARS (US$500) OR THE FEES
+   PAID TO TI BY YOU FOR THE LICENSED MATERIALS UNDER THIS AGREEMENT.
+
+   Because some jurisdictions do not allow the exclusion or limitation of
+   incidental or consequential damages or limitation on how long an implied
+   warranty lasts, the above limitations or exclusions may not apply to you.
+
+8. Indemnification Disclaimer.  YOU ACKNOWLEDGE AND AGREE THAT TI SHALL NOT
+   BE LIABLE FOR AND SHALL NOT DEFEND OR INDEMNIFY YOU AGAINST ANY THIRD PARTY
+   INFRINGEMENT CLAIM THAT RELATES TO OR IS BASED ON YOUR MANUFACTURE, USE, OR
+   DISTRIBUTION OF THE LICENSED MATERIALS, OR ANY DERIVATIVES THEREOF, OR YOUR
+   MANUFACTURE, USE, OFFER FOR SALE, SALE, IMPORTATION OR DISTRIBUTION OF YOUR
+   PRODUCTS THAT INCLUDE OR INCORPORATE THE LICENSED MATERIALS, OR ANY
+   DERIVATIVES THEREOF.
+
+9. No Technical Support.  TI and its licensors are under no obligation to
+   install, maintain or support the Licensed Materials, or any derivatives
+   thereof. 
+
+10. Notices.  All notices to TI hereunder shall be delivered to Texas
+    Instruments Incorporated, 12500 TI Boulevard, Mail Station 8638, Dallas,
+    Texas 75243, Attention: Contracts Manager, with a copy to Texas Instruments
+    Incorporated, 7839 Churchill Way, Mail Station 3999, Dallas, Texas 75251,
+    Attention: Law Department - ASP.  All notices shall be deemed served when
+    received by TI. 
+
+11. Export Control.  You hereby acknowledge that the Licensed Materials are
+    subject to export control under the U.S. Commerce Department's Export
+    Administration Regulations ("EAR").  You further hereby acknowledge and
+    agree that unless prior authorization is obtained from the U.S. Commerce
+    Department, neither you nor your customers will export, re-export, or
+    release, directly or indirectly, any technology, software, or software
+    source code (as defined in Part 772 of the EAR), received from TI, or
+    export, directly or indirectly, any direct product of such technology,
+    software, or software source code (as defined in Part 734 of the EAR), to
+    any destination or country to which the export, re-export, or release of the
+    technology, software, or software source code, or direct product is
+    prohibited by the EAR. You agree that none of the Licensed Materials may be
+    downloaded or otherwise exported or reexported (i) into (or to a national or
+    resident of) Cuba, Iran, North Korea, Sudan and Syria or any other country
+    the U.S. has embargoed goods; or (ii) to anyone on the U.S. Treasury
+    Department's List of Specially Designated Nationals or the U.S. Commerce
+    Department's Denied Persons List or Entity List. You represent and warrant
+    that you are not located in, under the control of, or a national or resident
+    of any such country or on any such list and you will not use or transfer the
+    Licensed Materials, or any derivatives thereof, for use in any sensitive
+    nuclear, chemical or biological weapons, or missile technology end-uses
+    unless authorized by the U.S. Government by regulation or specific license
+    or for a military end-use in, or by any military entity of Albania, Armenia,
+    Azerbaijan, Belarus, Cambodia, China, Georgia, Iraq, Kazakhstan, Kyrgyzstan,
+    Laos, Libya, Macau, Moldova, Mongolia, Russia, Tajikistan, Turkmenistan,
+    Ukraine, Uzbekistan, and Vietnam. Any software export classification made by
+    TI shall be for TI's internal use only and shall not be construed as a
+    representation or warranty regarding the proper export classification for
+    such software or whether an export license or other documentation is
+    required for the exportation of such software. 
+
+12. Governing Law and Severability; Waiver.  This Agreement will be governed by
+    and interpreted in accordance with the laws of the State of Texas, without
+    reference to conflict of laws principles.  If for any reason a court of
+    competent jurisdiction finds any provision of the Agreement to be
+    unenforceable, that provision will be enforced to the maximum extent
+    possible to effectuate the intent of the parties, and the remainder of the
+    Agreement shall continue in full force and effect.  This Agreement shall not
+    be governed by the United Nations Convention on Contracts for the
+    International Sale of Goods, or by the Uniform Computer Information
+    Transactions Act (UCITA). The parties agree that non-exclusive jurisdiction
+    for any dispute arising out of or relating to this Agreement lies within the
+    courts located in the State of Texas. Notwithstanding the foregoing, any
+    judgment may be enforced in any United States or foreign court, and either
+    party may seek injunctive relief in any United States or foreign court. 
+    Failure by TI to enforce any provision of this Agreement shall not be deemed
+    a waiver of future enforcement of that or any other provision in this
+    Agreement or any other agreement that may be in place between the parties.
+
+13. PRC Provisions.  If you are located in the People's Republic of China
+    ("PRC") or if the Licensed Materials, or any derivatives thereof, will be
+    sent to the PRC, the following provisions shall apply and shall supersede
+    any other provisions in this Agreement concerning the same subject matter:  
+
+    a. Registration Requirements.  You shall be solely responsible for
+       performing all acts and obtaining all approvals that may be required in
+       connection with this Agreement by the government of the PRC, including
+       but not limited to registering pursuant to, and otherwise complying with,
+       the PRC Measures on the Administration of Software Products, Management
+       Regulations on Technology Import-Export, and Technology Import and Export
+       Contract Registration Management Rules.  Upon receipt of such approvals
+       from the government authorities, you shall forward evidence of all such
+       approvals to TI for its records.  In the event that you fail to obtain
+       any such approval or registration, you shall be solely responsible for
+       any and all losses, damages or costs resulting therefrom, and shall
+       indemnify TI for all such losses, damages or costs.
+
+    b. Governing Language.  This Agreement is written and executed in the
+       English language.  If a translation of this Agreement is required for any
+       purpose, including but not limited to registration of the Agreement
+       pursuant to any governmental laws, regulations or rules, you shall be
+       solely responsible for creating such translation.  Any translation of
+       this Agreement into a language other than English is intended solely in
+       order to comply with such laws or for reference purposes, and the English
+       language version shall be authoritative and controlling.
+
+    c. Export Control.
+
+       i. Diversions of Technology.  You hereby agree that unless prior
+          authorization is obtained from the U.S. Department of Commerce,
+          neither you nor your subsidiaries or affiliates shall knowingly
+          export, re-export, or release, directly or indirectly, any technology,
+          software, or software source code (as defined in Part 772 of the
+          Export Administration Regulations of the U.S. Department of Commerce
+          ("EAR")), received from TI or any of its affiliated companies, or
+          export, directly or indirectly, any direct product of such technology,
+          software, or software source code (as defined in Part 734 of the EAR),
+          to any destination or country to which the export, re-export, or
+          release of the technology, software, software source code, or direct
+          product is prohibited by the EAR.
+
+       ii. Assurance of Compliance.  You understand and acknowledge that
+           products, technology (regardless of the form in which it is
+           provided), software or software source code, received from TI or any
+           of its affiliates under this Agreement may be under export control of
+           the United States or other countries. You shall comply with the
+           United States and other applicable non-U.S. laws and regulations
+           governing the export, re-export and release of any products,
+           technology, software, or software source code received under this
+           Agreement from TI or its affiliates.  You shall not undertake any
+           action that is prohibited by the EAR. Without limiting the generality
+           of the foregoing, you specifically agree that you shall not transfer
+           or release products, technology, software, or software source code of
+           TI or its affiliates to, or for use by, military end users or for use
+           in military, missile, nuclear, biological, or chemical weapons end
+           uses.
+       
+       iii. Licenses.  Each party shall secure at its own expense, such
+            licenses and export and import documents as are necessary for each
+            respective party to fulfill its obligations under this Agreement. 
+            If such licenses or government approvals cannot be obtained, TI may
+            terminate this Agreement, or shall otherwise be excused from the
+            performance of any obligations it may have under this Agreement for
+            which the licenses or government approvals are required.
+
+14. Entire Agreement.  This is the entire Agreement between you and TI and this
+    Agreement supersedes any prior agreement between the parties related to the
+    subject matter of this Agreement.  Notwithstanding the foregoing, any signed
+    and effective software license agreement relating to the subject matter
+    hereof and stating expressly that such agreement shall control regardless of
+    any subsequent click-wrap, shrink-wrap or web-wrap, shall supersede the
+    terms of this Agreement.  No amendment or modification of this Agreement
+    will be effective unless in writing and signed by a duly authorized
+    representative of TI.  You hereby warrant and represent that, as necessary,
+    you have obtained all authorizations and other applicable consents required
+    empowering you to enter into this Agreement.
+
+
+
diff --git a/Documentation/SoftwareManifest.pdf b/Documentation/SoftwareManifest.pdf
new file mode 100644 (file)
index 0000000..df57c6a
Binary files /dev/null and b/Documentation/SoftwareManifest.pdf differ
diff --git a/Documentation/TIesr_Data_Training.txt b/Documentation/TIesr_Data_Training.txt
new file mode 100644 (file)
index 0000000..88b0333
--- /dev/null
@@ -0,0 +1,798 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+
+Introduction
+============
+
+The TIesr recognizer relies upon a set of data files in order to be able to
+perform speech recognition. These data files contain the information about the
+language, words, word pronunciations, and acoustic signals associated with
+words. By changing the data files the user may customize TIesr to perform
+recognition of a different language, or recognition of a set of custom
+words or phrases. The a default set of data files for general English is
+included with the TIesr release and is found under the directory:
+
+Data/OffDT_GenDict_PhbVR_LE_MQ/English
+
+Examination of this directory will show that there are several sub-directories
+and many data files.
+
+Creation of the data files takes some effort and requires familiarity with some
+of the underlying concepts of speech processing. One who wishes to create a new
+set of data files must understand the concepts of phonetic pronuncation of
+words, of Hidden Markov Models (HMMs), and certain other basic concepts of data
+clustering.
+
+This document provides descriptions of the processing steps needed to form a new
+set of data files for a user's particular requirements. A suite of tools is
+provided to help with the data file creation tasks.
+
+The TIesr_Tools/Example directory contains a tutorial example of using the TIesr
+tools to create a set of data files. The documentation in this file and the
+ReadMe.txt file in the TIesr_Tools/Example directory provide instructinos on the
+use of the off-line tools.
+
+Necessary External Tools
+------------------------
+Data preparation for TIesr uses several openly available tools, usually
+available in source format. However, some of the tools do not allow
+redistribution of the source code, and so prior to preparing a set of data files
+you must obtain these tools. A list of the tools is given below.
+
+The Hidden Markov Modeling Toolkit (HTK) is used extensively for data
+preparation tasks. It comes with a detailed manual, and one should read it to
+understand the operation of the HTK tools. HTK may be obtained from: 
+
+http://htk.eng.cam.ac.uk/
+
+The decision tree training tool c4.5 is used to create letter to phone
+pronuncation decision trees, and can be obtained from:
+
+http://www.rulequest.com/Personal/
+
+Many of the provided tools are perl scripts. Some of the scripts utilize
+contributions from the CPAN. The following modules must be available for the
+scripts to operate properly:
+
+Math::FFT
+Algorithms::Cluster
+
+These tools should be downloaded, built, and placed appropriately in a directory
+that is part of the correct path so that the tools can be executed from the
+user's command line, or accessed as needed.
+
+TIesr Tools
+-----------
+A suite of TIesr tools is provided to create the data files These tools are
+located in the TIesr_Tools directory, and its sub-directories. Some of the tools
+are perl scripts, and some of the tools are written in C/C++. Some perl script
+tools use additional perl modules that are included in the directory. It is up
+to the user to build the C/C++ tools and to ensure that the scripts and
+executable files are available for use in the user's environment. 
+
+As with the TIesr APIs and test programs, the tools written in C/C++ are
+provided as NetBeans IDE projects for ease of modification and building. For
+user's that do not have the IDE, a Makefile is provided  in the TIesr_Tools
+directory which can be used to build the tools. Instructions on use of the
+Makefile are provided by entering:
+
+make help
+
+See the ReadMeFirst.txt documentation file for additional information.
+
+
+Data Preparation
+================
+Data files for TIesr are created and prepared by a process of training from
+input pronunciation and acoustic data files. There are two main pieces of
+input data that are required. 
+
+The first is a text file dictionary that explains the pronunciation of words in
+terms of the phonetic sounds that make up words. The user must define the set of
+acoustic phonetic sounds that make up the words in the vocabulary of interest.
+Usually most languages have about fifty phonetic sounds. The subject of exactly
+what phonetic sounds exist in a language is beyond the scope of this document.
+The dictionary must consist of word entries with one word entry per line. Each
+line consists of the word, followed by a listing of phone names that define the
+pronunciation of a name. The lines should be sorted in alphabetical word order.
+Double quotes may be used to surround words, which is necessary if the words
+contain punctuation. The dictionary should be formatted as an acceptable HTK
+dictionary. HTK tools provide assistance in creating and managing the dictionary
+file, and so the HTK tools should be consulted. An example of a few word entries
+in a dictionary are shown below.
+
+"ACTRESSES"          ae k t r ax s ax z
+"ACTS"               ae k t s
+"ACTUAL"             ae k ch uw ax l
+
+In the above example, the word "ACTRESSES" is pronounced using the sequence of
+phonetic sounds given by "ae" "k" "t" "r" "ax" "s" "ax" and "z", and similarly
+for the other words.
+
+In order to successfully provide general coverage of a language, the number of
+words in the pronunciation dictionary should be large enough to cover the
+variation of pronunciations within the language. (As an example, the
+number of words used to create the default general English data files was
+about 90000). A much smaller pronunciation dictionary may be used if the TIesr
+recognizer will be used for a limited vocabulary.
+
+The second input data requirement is a database of speech data. The speech data
+is used to train statistical acoustic Hidden Markov Models (HMMs). This data
+should be representative of the talkers that will be encountered by the
+recognizer.  For example the data should include both male and female talkers,
+and perhaps children, and should include the various accents expected. The
+speech data should be provided as short files containing recordings of words,
+phrases, or short paragraphs. A transcription of the words spoken in each of the
+files should be a part of the data. If possible, the male and female speech
+data should be separated, since separate processing of male and female data
+provides better recognition performance. The speech data samples should be
+single-channel 16-bit signed binary numbers sampled at 8kHz sampling rate. The
+size of the speech database will depend on the amount of language coverage
+desired. If the TIesr recognizer will be used for a limited vocabulary, then
+enough speech data should be available to provide many repetitions of the
+vocabulary words by both male and female talkers.
+
+
+Building Pronunciation Decision Tree Data Files
+===============================================
+The TIesrFlex API must determine an estimated word pronunciation from the
+spelling of the word. This is accomplished by using the TIesrDT API to obtain
+the estimated pronunciation of a word by consulting a set of Decision Tree
+Pronunciation Model (DTPM) data files. An example of these files is found in the
+directory Data/OffDT_GenDict_PhbVR_LE_MQ/English. The DTPM files are named
+*.olmdtpm where * represents a letter. For example, the DTPM file for the letter
+A is found in the file A.olmdtpm. The DTPM files are in a compressed binary
+format. Additional support files are cAttType.txt, cAttValue.txt, and
+onewphone.list. The DTPM file for each letter contains a a decision tree that
+determines the phonetic sound corresponding to the letter in a word given the
+context of the surrounding letters of the word. 
+
+1. The first step in creating the DTPM files is to build a letter-to-phone
+dictionary where each letter of a word is mapped to a phone, phone sequence, or
+a _sil symbol indicating the letter is silent in the word. This is done using
+the htk_ttp_map.pl perl script, which uses HTK training tools to create a
+maximum likelihood estimate of the best mapping between letters and phones or
+phone sequences (pseudophones). The inputs to the script include the original
+pronunciation dictionary described above and an initial letter-to-phone model
+file specified by the user that defines how a letter may be mapped to phones or
+phone sequences. The format of this file is one letter per line. The line starts
+with the letter followed by ':' and then sequences of phones followed by
+probabilities and separated by commas.  The special phone '_sil' indicates the
+probability that the letter is silent (has no phone output). For example the
+line:
+X: g s .2, z .3, k s .2, _sil .3
+states that the letter 'X' in a word may generate the phone string 'g s' with a
+probability 0.2, the phone 'z' with probability 0.3, the string 'k s' with
+probability 0.2, or no phone at all with probability 0.3.  These probabilities
+must add to 1.0. Do not be too concerned with the accuracy of the initial
+probabiliites. During training, htk_ttp_map.pl will determine maximum-likelihood
+estimates of the probabilities. The construction of the model file will depend
+on the nature of the language and the definition of the phones and phone
+sequences that may be mapped to a letter of a word. Once these two files are
+constructed, the htk_ttp_map.pl script may be run. To get detailed information
+on the htk_ttp_map.pl script you can run 'htk_ttp_map.pl -Help'. Note that the
+htk_ttp_map.pl tool uses the helper perl scripts htk_dict_to_mlf.pl,
+htk_letter_mmf.pl, and htk_ttp_parse.pl. All of these scripts have the option
+-Help which will provide further information about their function. An example of
+running the htk_ttp_map.pl script to build the letter-to-phone dictionary would
+be:
+
+htk_ttp_map.pl -C NaturalOrder.cnf \
+  -d mydictionary.dict \
+  -l letter_to_phone.file \
+  -w work_path -n 4 -t 3 \
+  -o mydictionary.ltp
+
+In this script, the file NaturalOrder.cnf is specified in order to assure that
+input and output are in the byte order of the machine running the HTK tools.
+This text file consists of:
+
+NATURALREADORDER = T
+NATURALWRITEORDER = T
+
+For the words in the original dictionary as shown above, an example of the
+output letter-to-phone mapped dictionary would be:
+
+"ACTRESSES"          ae k t r ax s _ ax z
+"ACTS"               ae k t s
+
+The "_" indicates that the second "S" in the word "ACTRESSES" is silent. The
+other word has one-to-one letter to phone mappings and does not require a
+null phone, "_" or any pseudophone.  An example of a letter-to-phone dictionary
+entry that requires a pseudophone is:
+
+"ANYONE"             eh n iy w_ah n _
+
+Here the letter "Y" corresponds to the phone "iy", which requires that the
+letter "O" map to the pseudophone "w_ah".
+
+During training of the letter-to-phone mapping dictionary, htk_ttp_map.pl may
+not be able to create a one-to-one letter to phone mapping for some words. These
+words are displayed in the output letter-to-phone mapping dictionary with a "*"
+character at the location where mapping failed. There are several reasons for
+this. One possibility is that the letter-to-phone model file does not contain a
+necessary letter to phone or phone sequence mapping entry. Another possibility
+is that for a particular word there may be more letters that are silent than
+specified in the -n option to htk_ttp_map.pl. Correction by adding new entries
+in the letter-to-phone model file or extending the number of silent letters are
+decisions that you must make based on knowledge of the language. Satisfactory
+creation of the letter-to-phone dictionary may require several passes of
+experimentation. After you are satisfied with the results, all entries in the
+dictionary containing the '*' character should be removed.
+
+2. The second step is to create DTPM files for training the letter decision
+trees. The ttp_dict_tree_data.pl script creates the data files. The input for
+training the decision tree for a letter is the set of cases found for values of
+attributes of the letter in the letter-to-phone mapping dictionary. The
+attributes of a letter can be made up of any of the following:
+
+- Letters found to the left of the letter in the words of the dictionary
+- Letters found to the right of the letter in the words of the dictionary
+- User-defined phonetic labels corresponding to phones mapping to letters to the
+left of the letter in the words of the dictionary
+- User-defined phonetic labels corresponding to phones mapping to letters to the
+right of the letter in the words of the dictionary.
+
+The data case corresponding to a word is the value of each attribute
+corresponding to the word, along with the phone that should be output given the
+data case.
+
+An example will explain this best. Consider making up the attributes from the
+following:
+
+- The four letters to the left of the letter
+- The four letters to the right of the letter
+- Voicing phonetic labels for the four phones mapping to the letters to the left
+of the letter
+- No voicing labels for phones mapping to letters to the right of the letter.
+
+Then consider the letter 'R' in the word 'ACTRESSES' as specified above. For
+this letter, the corresponding values of attributes, and the phone to output
+are given below.
+
+The values of the attributes for the four letters to the left are;
+L4 = fourth letter to the left of 'R' = no attribute value
+L3 = third letter to the left  of 'R' = 'A'
+L2 = second letter to the left of 'R' = 'C'
+L1 = first letter to the left of 'R' = 'T'
+
+The values of the attributes for the four letters to the right are:
+R1 = first letter to the right of 'R' = 'E'
+R2 = second letter to the right of 'R' = 'S'
+R3 = third letter to the right of 'R' = 'S'
+R4 = fourth letter to the right of 'R' = 'E'
+
+The user-defined voicing labels for the four phones mapped to the four letters
+to the left of the letter are:
+
+P1L4 = phone label of fourth phone (none) to left of 'R' = no attribute value
+P1L3 = phone label of third phone (ae) to left of 'R' = 'VOICED'
+P1L2 = phone label of second phone (k) to left of 'R' = 'UNVOICED'
+P1L1 = phone label of first phone (t) to left of 'R' = 'UNVOICED'
+
+The phone to output is the phone 'r'.  Thus the case corresponding to the letter
+'R' in the word 'ACTRESSES' can be written as:
+
+no,A,C,T,E,S,S,E,no,VOICED,UNVOICED,UNVOICED,r.
+
+The ttp_dict_tree_data.pl script will output two files for each letter. The
+*.names file will contain a list of all phones that map to the letter and all
+possible values that each attribute can take. The *.data file will contain all
+of the cases as defined above for the letter, with one case per line. The
+ttp_dict_tree_data.pl script is general purpose; the user is allowed to specify
+any number of left or right letter attributes, and any number of left or right
+phone label attributes. However, the TIesrDT API software is set up only to use
+the attributes as specified above, that is L4-L1, R1-R4, and P1L4-P1L1. Any
+change will require changing constants within the TIesrDT.h header file.
+Further, the number of attributes is limited to 15. 
+
+The ttp_dict_tree_data.pl script -Help option can be used to get detailed
+information about the script. A typical example of running the script to create
+data for training letter decision trees for TIesrDT is:
+
+ttp_dict_tree_data.pl -d mydictionary.ltp -L 4 -R 4 \
+  -p pseudophonelabels.lst -pL 4 -pR 0 -o . -w workdir
+
+In this command line, the pseudophonelabels.lst file consists of lines
+containing a phone name and a phone label corresponding to the phone. For
+example, if the user decides to label phones as VOICED/UNVOICED/SHORT_PAUSE,
+then example lines from the pseudophonelabels.lst file might be:
+
+_      SHORT_PAUSE
+aa     VOICED
+.
+.
+.
+ch     UNVOICED
+.
+.
+.
+
+3. The third step is actual training of the pronunciation decision trees for
+each letter. This is done using the c4.5 decision tree training program. The
+train_trees.pl script runs this training for each letter. An example of running
+this script to create pronunciation decision trees for each letter is:
+
+train_trees.pl -D . -CF 25
+
+The output of this script is a set of files for each letter. The *.unpruned and
+*.tree files are binary output files from the c4.5 program, and the *.CF*log
+files are text log files. Subsequent processing does not use the *.unpruned and
+*.tree files, but rather uses the tree information found in the *.CF*log files.
+
+The train_trees.pl script has a -Help option which will provide more detailed
+information about the script.
+
+4. The last step in creating pronunciation decision trees compresses the tree
+data found in the *.CF*log files into a binary form compatible with the TIesrDT
+API, This is implemented by the odtcompress.pl script. The result is a set of
+*.olmdtpm files, one for each letter. An example of running this script to
+create the compressed decision trees for each letter is:
+
+odtcompress.pl -D . -o . -CF 25
+
+The odtcompress.pl script also has a -Help option for detailed information about
+the script. There is an additional -B option which will output compressed data
+compatible with big-endian processors.
+
+
+The final set of files that the TIesrDT API needs should be created in the
+output directory. The files needed by the API are:
+
+*.olmdtpm
+cAttType.txt
+cAttValue.txt
+onewphone.list
+
+All other files created during the building process can be discarded.
+
+TIesr assumes that the data files are located in a particular directory
+hierarchy. The decision tree data files should be placed in a directory that
+has the language name as the last directory level. For example, note that the
+supplied decision tree data is located in the directory:
+
+Data/OffDT_GenDict_PhbVR_LE_MQ/English
+
+Once the decision tree data has been created, it can be tested using the
+testtiesrdt program provided with the release.
+
+Building the Compressed Binary Dictionary Files
+===============================================
+Once the TIesrFlex API obtains the estimated word pronunciation using TIesrDT,
+the second step is to look the word up in a binary pronunciation dictionary
+using the TIesrDict API. If the word exists in the binary pronunciation
+dictionary, then that pronunciation is more accurate than the one supplied by
+TIesrDT, and is the preferred pronunciation. The reason that TIesrFlex first
+finds the estimated word pronunication using TIesrDT is that this allows the
+binary pronunciation dictionary to be compressed significantly. If the TIesrDT
+pronunciation is correct, then no entry for the word needs to be in the
+pronunciation dictionary, and if the TIesrDT pronunciation is not correct, only
+the difference between the correct and TIesrDT pronunciation needs to be encoded
+in the binary pronunciation dictionary. In addition to the dictionary file, the
+TIesrDict API requires a text file that lists the phones in the dictionary.
+An example of the binary pronunciation dictionary files for the default
+general English data is found in:
+
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Dict
+
+which shows the two files phone.lis and dict.bin. Please note that TIesr
+expects the phone list file and the binary pronunciation dictionary file
+names to be phone.lis and dict.bin respectively, and these two files should be
+in a subdirectory of the directory where the decision trees are located. By
+convention the directory name 'Dict' is used.
+
+The TIesr release provides a C program, dictproc, under the TIesr_Tools
+directory to assist in creating the binary pronunciation dictionary files. The
+program makes use of TIesrDT in order to compress a pronunciation dictionary.
+Usually the binary pronuncation dictionary will be created using the input
+pronunciation dictionary initially prepared, which ensures that all words in the
+input dictionary are in the binary pronunciation dictionary or that TIesrDT
+predicts the pronunciation correctly. However, you are not required to use the
+input pronunciation dictionary to create the binary pronunciation dictionary
+file. You may use any pronunciation dictionary you choose. This allows one to
+add any desired words to create a set of custom binary pronunciation dictionary
+files. An example where this might be helpful would be in the recognition of a
+specific set of proper names.
+
+The dictproc program is run as follows:
+
+dictproc  inputdictionary phonelist outputdictionary endian map decisiontreedir
+
+Inputdictionary is the path to the input pronunciation dictionary that you would
+like to compress. The phonelist is the path to the phone.lis file that consists
+of the list of phones in the input dictionary. As mentioned previously, this is
+by convention placed in the Dict directory. Of course, the set of phones in the
+list must be compatible with the set of phones used in creating the
+pronunciation decision trees for TIesrDT. Usually they are the same. Note that
+phonelist is a list of the set of phones, not phones and pseudophones defined
+during preparation of the pronunciation decision trees. The output dictionary is
+the location that will hold the binary dictionary file dict.bin, and by
+convention the path should be Dict/dict.bin. The endian argument should be set
+to the string "little_endian" or "big_endian" depending on the target platform
+architecture. The map argument is usually set to 0 (zero). As a special case, if
+map is set to 1, then dictproc will automatically precede the voiced closure
+phones (b,d,g) with closure phones (bcl,dcl,gcl) and the unvoiced closure phones
+(k,p,t) with (kcl,pcl,tcl). Note that in this case the phone.lis file must also
+list the closure phones (bcl,dcl,gcl,kcl,pcl,tcl). The reason for using this
+mapping is that in some cases modeling closure phones improved speech
+recognition performance slightly. The decisiontreedir argument is the path to
+the pronunciation decision tree data that was created as described above. An
+example of running the dictproc program where all decision trees are located
+in the relative directory MyLanguage, and the phone list is located in the
+relative file MyLanguage/Dict/phone.lis and using stop closure phones is as
+follows:
+
+dictproc mydictionary.dict MyLanguage/Dict/phone.lis \
+  MyLanguage/Dict/dict.bin little_endian 1 MyLanguage
+
+
+Once the binary dictionary and phone list have been created, they can be tested
+along with the decision trees by using the testtiesrdict program supplied with
+the release.
+
+
+Building the Acoustic Model Data Files
+======================================
+The TIesrFlex API uses acoustic model data files to construct the acoustic HMM
+model set needed to recognize the words in the grammar network. An example of
+the acoustic model data files is found in the directory
+Data/OffDT_GenDict_PhbVR_LE_MQ/English/Models. The data files in this directory
+represent the information necessary to construct the HMMs needed by the grammar
+network. The data files are highly compressed to minimize the size of acoustic
+data files. The files do not store all possible HMMs for a given language and
+application, since the number of triphones found in a language can be quite
+large. Instead, the files contain acoustic information and a set of acoustic
+decision trees that TIesrFlex uses to dynamically construct the set of HMMs and
+the grammar network required for speech recognition.
+
+The binary acoustic data files are created by compressing HMM information
+obtained by using the HTK training tools. This requires using HTK to train a set
+of HMM models using the input speech database, and a corresponding pronunciation
+dictionary. The use of HTK to train a set of HMMs is beyond the scope of this
+document, but the HTK distribution comes with a very detailed HTK Book document
+that describes all aspects of the HTK tools. The user not familiar with HTK must
+read the HTK Book in order to understand the following discussion on preparing
+the acoustic model data files for TIesr.
+
+Preparing Data for HMM training
+-------------------------------
+As mentioned in the section on Data Preparation, training acoustic HMMs requires
+a speech database. Most speech databases consist of many files containing speech
+utterances, with associated transcription files for each utterance defining the
+words spoken. 
+
+The TIesr tools provide the sample_to_htk.pl perl script tool for converting raw
+sampled speech data in files into HTK-compatible files containing TIesr
+parameter vectors of the type used for recognition. The TIesr parameter vectors
+are a variant of the commonly-used cepstral parameters. The sample_to_htk.pl
+perl script provides options to define the number of cepstral parameters in a
+cepstral vector, the number of underlying filterbank parameters, the processing
+window size, and number of samples to shift between successive vectors (which
+defines the parameter frame rate). A script option, -be, specifies that the
+input sample data is in big-endian format; otherwise little-endian format is
+assumed. An option can specify the sample rate of the data. The sample data must
+be 16-bit linear samples. The default parameters nominally used in TIesr are an
+8kHz sample rate, 256 sample window size, 160 sample shift (20msec frame rate),
+20 underlying filterbank parameters, and 10 cepstra. These parameters are the
+assumed defaults by the sample_to_htk.pl script. So, for example, to convert a
+file utt.raw containing raw sampled data in little-endian format using the
+default parameters to an HTK compatible cepstral parameters file, one would
+simply run:
+
+sample_to_htk.pl -o output_directory utt.raw
+
+This will produce the output parameters file at output_directory/utt.htk. To
+examine the parameters in the file you can use the HTK HList tool. The
+HTK-compatible parameter files have a parameter kind of "USER", indicating that
+the TIesr-defined cepstral format is used.
+
+If the dictionary, described in Building Pronunciation Decision Tree Data Files,
+does not contain all of the words found in the speech utterances, then that
+dictionary must be updated, or a different dictionary prepared containing all of
+the words found in the speech data. The dictionary must be compatible with the
+HTK tools, as described in the HTK documentation.
+
+Training HMMs with HTK
+----------------------
+Once the speech data and dictionary have been prepared, HTK tools can be used to
+train the HMMs. It is not possible to provide a simple script or procedure that
+trains a set of HMM models using HTK, since there are so many decisions and
+alternative procedures possible to train HMMs. For example, one must define the
+phones that will be used to describe the language. Different users may wish to
+define more or less detailed sets of phones for the language. The topology  of
+the HMMs must be defined. One user may wish to use the same HMM topology for all
+phones, while another may wish to create separate HMM topologies with different
+numbers of states for each phone. One may also wish to tie state probability
+densities or individual components of the density in a unique way. Such
+decisions are up to the individual. TIesr has been designed such that it can
+accept most variations of continuous-density HMMs created by  HTK. In order to
+compress the model information, during training of HMMs the user must also
+prepare a set of acoustic decision trees following the procedures supplied with
+HTK.
+
+The following paragraphs describe requirements, and in some cases the
+conventions often used, for creating HMM model sets using HTK that will be
+compatible with TIesr. This is followed by paragraphs describing the tools that
+are used to compress the HTK model information to create the set of binary
+acoustic model data files for TIesr.
+
+The HMM models trained should include both static and delta cepstral parameters.
+This can be done by defining an HTK configuration file to produce the delta
+cepstral parameters during training. If desired, the user can also specify in
+the configuration file to use zero mean static cepstral parameters (cepstral
+normalization). Typically a configuration file will include the following:
+
+TARGETKIND = USER_D_Z
+DELTAWINDOW = 2
+
+HTK tools may output either binary or ascii files during training, however the
+TIesr tools require the ascii versions of the files. By convention, all HMMs and
+labels are kept in a small number of MMF or MLF style files as defined by HTK.
+By convention, the names of phones are single or multiple lower-case alphabetic
+characters.
+
+TIesr supports the concept of multiple similar HMM "sets", sometimes also
+referred to as "genders". These sets of HMMs operate in parallel during speech
+recognition. A typical use of HMM "sets" is creating HMM models for different
+"genders", for example one set of HMMs that represents male speakers and one
+that represents female speakers, since this has been shown to improve speech
+recognition performance. However, it is possible to use only a single HMM set,
+or more than two HMM sets( for example, a set of HMMs for male, for female, and
+for children, or sets for various accents). There must be the same number of
+HMMs within each set and they must have the same topology and function. For
+example, if there is a phone for the sound "uh" in one set, then the same phone
+must exist in all other sets, and the "uh" HMM in each set must have the same
+topology. HTK tools provide capabilities to produce these types of HMM model
+sets.
+
+TIesr supports either monophone or triphone models. The two types of models can
+not be mixed while recognizing a spoken utterance. However, it is possible to
+recognize one phrase with monophone HMMs and a subsequent phrase with triphone
+HMMs by using the TIesrFlex API with monophone data files or triphone data files
+to prepare an HMM model set and grammar network for TIesr.
+
+TIesr supports a wide variety of tying of state probability distributions, and
+Gaussian mean vectors and variance vectors that can be implemented with HTK.
+
+A special silence model, named "sil" must be included in the HMMs. This is a
+default model that may be placed between words in an utterance. There must be
+only one set-independent "sil" model, regardless of the number of HMM sets
+trained.
+
+The resulting ascii HTK MMF files that contain the HMMs must meet certain
+criteria as described below.
+
+All HMMs must be represented with macro names.  They may all be set-independent
+or all set-dependent, but not a mix. Set HMM names are marked by set tags
+appended to monophone names which must make a monophone name unique for a set,
+preferably ':*' where * indicates a set tag. Triphone names must be of the form
+*-<monophone>[<settag>]+* where * indicates leading and trailing monophone
+context, such as p-aa:m+l. Typically there are two sets denoted with '*:m' and
+'*:f', where * indicates the monophone name, and ':m' denotes a male HMM and
+':f' denotes a female HMM. However, there may be more than two sets, such as
+children, etc, or there may only be a single set with no set tag, such as
+p-aa+l.  Word ending context in triphones must use the special "sp" phone. For
+example, the word "no" would use the two phones sp-n+ow  and n-ow+sp.
+
+All HMMs use transition matrices defined in macros which define transitions
+for each phone. The transition matrix macros may all be set-independent or
+set-dependent, but not a mix of both. Set-dependent triphones may use either
+set-dependent or set-independent transition macros, but set-independent
+triphones may only use set-independent transition macros. The macro name must be
+of the form *<phone>[<settag>], for example, T_aa or T_aa:m. (This is not a
+requirement for the silence model.) The transition matrix used by a triphone
+must be tied to the center monophone of the triphone. For example, the triphone
+*-aa:m+* uses the transition matrix macro *aa if using set-independent
+transitions, or *aa:m if using set-dependent transitions.
+
+All HMM state acoustic distributions are defined by HTK ~s state macros, which
+for triphones are the result of HTK decision tree clustering. Otherwise, it is
+not possible for TIesrFlex to synthesize the triphone HMMs using decision trees
+alone. (The binary data that TIesrFlex uses does not explicitly include the HMM
+information for triphones from the MMF file since that would take too much
+space.  Instead, TIesrFlex synthesizes each needed triphone from decision
+trees.)
+
+Set-dependent decision tree clustered triphone state macro names must have the
+set tag included in the macro names, for example aa:m_s2_1 or aa:f_s2_1.
+
+The HTK acoustic decision tree data for TIesr must meet certain restrictions.
+If the decision trees will be set-dependent then the questions that form the
+trees must be specified as set-dependent. That is, the question names must
+end in the set tag name. For example, if a set-independent question name is
+LVowel, then the set-dependent names will be LVowel<settag>, such as LVowel:m
+and LVowel:f. In addition, the phonetic contexts associated with a
+set-dependent question must be written as set-dependent. Left context would be
+written as xxx-*<settag>*, and right context would be written as *<settag>+xxx,
+where xxx is the context. For example a left context of phone "aa" for a
+female set would be written as aa-*:f*, and a right phone context would be
+written as *:f+aa.
+
+TIesr tools for creating model data files can read multiple HTK MMF files, but
+the MMF files must be consistent, such as having the same feature size, etc.
+
+TIesr acoustic data compression tools can output cepstral vector and variance
+data in 16-bit words, or in bytes for reduced storage. Normally there is very
+little difference in performance between using 16-bit word or byte data.
+
+Converting HTK Data to TIesr-Compatible Acoustic Data Files
+-----------------------------------------------------------
+Once HTK training is complete, the following files should be available.
+
+- One or more HTK MMF files in ascii format containing the trained HMM models.
+
+- An HTK tree file defining the acoustic questions and decision trees to be able
+to construct triphones. This file will only be created if developing triphone
+HMM models.
+
+To create the TIesr-compatible compressed HMM data files, use the tool
+htk_mmf_to_tiesr.pl. This perl script has several options. The -Help option will
+display detailed information about the script. Use the -H option multiple times
+to specify one or more HTK MMF files containing the HMM data. Use the -d option
+to specify the output directory to hold the data files. If the trained HMM
+models consist of several sets, then use the -g option to specify the tags
+associated with each set as a string separated by commas, for example, use -g
+":m,:f" if you created male and female model sets. If you want to compress the
+HMM mean and variance data as bytes instead of 2-byte words, use the -bmean
+option to convert Gaussian mean vectors to bytes, and -bvar to convert variance
+vectors to bytes (however, see the section Creating the Gaussian Cluster Files
+below for further information on using -bmean and -bvar). If output should be in
+little-endian format, specify the -le option. If the MMF model sets contain
+monophones, then no acoustic decision tree data files are necessary to determine
+triphone models, and the -notrees option should be specified. These are usually
+the options that need to be considered. 
+
+The htk_mmf_to_tiesr.pl tool contains other more advanced options for more
+control over data file creation. The -l and -r options can be used along with
+command line arguments to specify a selected subset of HMM model names in the
+MMF files to be used when creating data files (for example, using only certain
+HMM sets). The -sb option should be specified if mean normalization was not used
+during training with HTK. If you wish the output data files to use fewer
+features than the trained feature vectors contain, the size can be specified
+with the -f option.
+
+The htk_mmf_to_tiesr.pl tool outputs several text files that can be helpful to
+confirm that model data files have been created correctly. The fxclust.list file
+contains a listing of all of the names of the clustered model states. The
+fxtran.list contains a listing of all HMM transition matrix names. These two
+files are not necessary for operation of TIesr, and can be deleted if desired
+after both htk_mmf_to_tiesr.pl and htk_trees_to_tiesr.pl have been run.
+htk_mmf_to_tiesr.pl also creates a monophone.list file that should not be
+deleted, and is also helpful for use with other diagnostic tools.
+
+To create the TIesr-compatible compressed data files containing the HTK question
+and decision tree information, use the htk_trees_to_tiesr.pl tool. This tool is
+only used when creating data files for triphone HMMs. This perl script has
+several options, but most of these are usually determined by the options used
+for htk_mmf_to_tiesr.pl. The -T option specifies the HTK tree file. If the trees
+are unique for each set, use the -g option as described above for
+htk_mmf_to_tiesr.pl. Specify the -le option if output should be in little-endian
+format. The -C option specifies the directory holding the data files that have
+been created with htk_mmf_to_tiesr.pl, and the -d option specifies the output
+directory for the compressed tree data files, which should normally be the same
+directory as specified in the -C option.
+
+The htk_trees_to_tiesr.pl tool outputs several text files that can be helpful to
+confirm that triphone acoustic decision tree data files have been created
+correctly. The _qs.list file lists all questions used by the trees. The
+_tree.list file contains a listing of all of the trees created for each
+individual monophone state. The _treetbl.list file contains a list of all
+monophones for which trees have been created. These three files are not
+necessary for operation of TIesr, and can be deleted if desired.
+
+
+Creating the Hierarchical Linear Regression Phone Cluster Tree File
+===================================================================
+During recognition TIesr takes steps to adapt acoustic models to the
+environment. Based on the amount of acoustic data that has been seen,
+TIesr will adapt models with similar acoustics using the shared adaptation
+parameters. As more acoustic data is seen, TIesr will use an acoustic
+hierarchical linear regression (HLR) tree to determine which models share
+similar acoustics. This section describes how to construct the HLR tree and the
+TIesr tools provided to construct a tree.
+
+The HLR tree file defines a binary tree clustering of monophone models according
+to the similarity of acoustics between models. The HLR tree file is a binary
+file. While it is possible to create a custom HLR tree file by hand with some
+effort, TIesr provides two tools to construct an HLR tree file.
+
+The first tool, htk_model_compare.pl, provides a measure of the similarity
+between monophone HMM models. Use of htk_model_compare.pl assumes that during
+the process of acoustic HMM model training using HTK set-independent monophone
+HMM models were created and trained, including the "sil" silence model. This is
+typically the case. The htk_model_compare.pl tool measures similarity of
+monophone HMM models by extracting the Gaussian mean vectors of the states of
+one model and using them as data to perform recognition using the other
+monophone HMM models.
+
+The htk_model_compare.pl tool requires a list of monophone models to be
+compared. This list should be the same as the phone list created when the binary
+dictionary was created (see Building the Compressed Binary Dictionary Files
+above) with one exception; at the beginning of the list must be the "sil" model.
+The order of phones in the phone list is important, and should agree with the
+dictionary phone list. The other requirement for the htk_model_compare.pl tool
+is one or more HTK MMF files containing the "sil" model and all of the
+set-independent monophone models. The tool creates an ascii output file listing
+relative likelihoods between models. A detailed description of the tool can be
+obtained by running it with the -Help option. Experience has shown that using
+only static feature components works well, and so the -s option is recommended.
+
+Once the relative scores have been obtained in the file output by
+htk_model_compare.pl, the cluster_models.pl tool can be used to prepare the HLR
+tree binary file. The cluster_models.pl tool performs binary tree clustering of
+the models based on the similarity measures output by htk_model_compare.pl.
+Detailed information about the tool can be obtained by running it with the -Help
+option. The -o option specifies the output file. Normally the file name should
+be "hlrtree.bin" and it should be located in the same directory as the
+pronunciation decision trees. Use the -le option to output data in little-endian
+binary format.
+
+
+Creating the Gaussian Cluster Files
+===================================
+In order to speed up recognition and improve performance, TIesr can
+classify incoming audio feature vectors, and simplify processing based on
+the cluster to which a feature vector belongs. Two files define the clusters
+used to classify feature vectors. The ROM2cls.bin file contains the cluster
+index of each Gaussian mean vector in the HMM model sets. The cls_centr.bin
+file contains the cluster centroid feature vector for each cluster. 
+
+In order to create these two files, all of the acoustic model data files must
+have been created, as specified in the above section on Building the Acoustic
+Model Data Files. Specifically, the htk_mmf_to_tiesr.pl tool (and
+htk_trees_to_tiesr.pl tool if triphone HMMs are trained) must have been run to
+create the binary acoustic data files. The htk_mmf_to_tiesr.pl tool must not
+have used the -bmean or -bvar options, since the creation of the ROM2cls.bin and
+cls_centr.bin files require that mean and variance data is not in byte format.
+If byte mean and variance data is desired to save memory space, then the
+htk_mmf_to_tiesr.pl can be re-run using the -bmean and/or -bvar options (and
+htk_trees_to_tiesr.pl re-run also if triphone acoustic models are being used)
+after creating the Gaussian cluster files. 
+
+The gaussiancluster tool is provided to create the two Gaussian cluster files.
+This is a C tool located under the TIesr_Tools/GaussianCluster directory, which
+contains the NetBeans project that can be used for building. If you do not wish
+to use the NetBeans IDE to build the project, the Makefile located in
+TIesr_Tools can be used to build the project. For further information on
+building using the Makefile, under the TIesr_Tools directory run 'make help'.
+
+The gaussiancluster tool will use the previously created acoustic data to form
+clusters of Gaussian mean vectors associated with the trained models. The
+output data includes the ROM2cls.bin and cls_centr.bin files, as well as
+additional files in text form for examining the result of clustering. The
+ROM2cls.list file will contain the cluster index for each model Gaussian mean
+vector. The cls_centr.list file will contain the centroid vector of each
+cluster. The cls_centr_fromROM.txt file will contain the index of the closest
+Gaussian model mean vector to each cluster centroid, and the Centroid_Var.list
+file will contain the pooled cluster variance of the clusters. It is important
+to note that only the two files ROM2cls.bin and cls_centr.bin are necessary;
+the others can be deleted.
+
+The gaussiancluster tool is run as follows:
+
+gaussiancluster modeldir meanfile varfile infofile numclusters littleendian
+
+Modeldir is the directory where all of the data files from htk_mmf_to_tiesr.pl
+and htk_trees_to_tiesr.pl have been output.  Meanfile is the name of a file that
+will hold the text Gaussian mean data during processing. The varfile will hold
+the text global variance data during processing. Both of these files can be
+examined after clustering if you are interested in the mean and global variance
+data. TIesr does not require these files, so they can be deleted after
+processing. Infofile is the name of a file to hold auxilliary information. This
+file name is currently not used. Numclusters is the number of clusters to form
+from the model Gaussian mean vectors. This is often set to 128, but one can
+experiment to determine the tradeoff between performance and memory
+requirements. Littleendian is set to 1 if you want output to be in little-endian
+format, or 0 for big-endian format.
+
+IMPORTANT NOTE: The gaussiancluster tool requires that the model data in the
+modeldir be of the same endianness as the machine that is running the
+gaussiancluster tool. If you are preparing data on a machine for a target
+machine of opposite endianness, then use the htk_mmf_to_tiesr.pl and
+htk_trees_to_tiesr.pl tools to create data for both the target endianness and
+your machine's endianness.
+
+
diff --git a/Documentation/TIesr_Display_Tools.txt b/Documentation/TIesr_Display_Tools.txt
new file mode 100755 (executable)
index 0000000..aaf962b
--- /dev/null
@@ -0,0 +1,304 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+
+TIesr Tools
+-----------
+The TIesr Speech Recognizer software includes a suite of tools that can
+be used for preparing data for TIesr or examining data created by TIesr.
+
+
+TIesrFlex Output Display Tools
+------------------------------
+A TIesr user utilizes the TIesrFlex API to create a binary grammar and model
+file set based on an input grammar. TIesrFlex outputs the binary grammar and
+model files in a particular directory. In order to view the contents of the
+binary files, TIesr provides tools to interpret the binary context and display
+them in human-readable form. The tools also provide the capability to convert
+the data between little-endian and big-endian formats, although this is not
+typically needed.
+
+tiesr_net_convert.pl
+--------------------
+A grammar/model file set generated by TIesrFlex contains the file net.bin.  This
+binary file represents the grammar network that is generated by TIesrFlex based
+on the input grammar provided by the user. In order to examine the network
+details contained in net.bin, TIesr provides a perl script,
+tiesr_net_convert.pl,  and a perl module TIesrNet.pm. The perl script and module
+parse the net.bin file and print out the network structure.  The output first
+provides a summary of the network, and which symbols in the network are the
+starting and ending symbols.  This is followed by a listing for each symbol of
+its index and the gender-independent phone associated with the symbol and index,
+the number of transitions from the symbol, the word index and word represented
+by the symbol if the symbol is a word-ending symbol, and finally the symbol
+indices the symbol transitions to. Below is an example of the output for a
+simple "yes", "no", or "maybe grammar, which includes silence models before and
+after each word. This example reflects that HMMs are for two different sets, for
+example male and female HMM models.
+
+Number of HMMs in network: 22
+Number of symbols in network: 12
+Number of words in network: 4
+Number of HMM sets: 2
+Number of HMMs per set: 11
+
+
+Start Symbols: 4
+    5     7    10    11
+
+
+End Symbols: 4
+    0     1     6     8
+
+
+Symbol Information
+
+Symbol: 0  HMM index: 0(_SIL)  Number transitions: 1  Word: 0(_SIL)
+    0
+
+Symbol: 1  HMM index: 10(iy)  Number transitions: 1  Word: 3(maybe)
+    0
+
+Symbol: 2  HMM index: 9(b)  Number transitions: 1
+    1
+
+Symbol: 3  HMM index: 8(bcl)  Number transitions: 1
+    2
+
+Symbol: 4  HMM index: 7(ey)  Number transitions: 1
+    3
+
+Symbol: 5  HMM index: 6(m)  Number transitions: 1
+    4
+
+Symbol: 6  HMM index: 5(ow)  Number transitions: 1  Word: 2(no)
+    0
+
+Symbol: 7  HMM index: 4(n)  Number transitions: 1
+    6
+
+Symbol: 8  HMM index: 3(s)  Number transitions: 1  Word: 1(yes)
+    0
+
+Symbol: 9  HMM index: 2(eh)  Number transitions: 1
+    8
+
+Symbol: 10  HMM index: 1(y)  Number transitions: 1
+    9
+
+Symbol: 11  HMM index: 0(_SIL)  Number transitions: 4  Word: 0(_SIL)
+    5     7    10    11
+
+
+
+tiesr_model_convert.pl
+----------------------
+The other binary files in the set of files specify the acoustic HMM model data.
+HMM models in TIesr represent the acoustic likelihood in a state as a
+multi-mixture Gaussian probability density.  A density may be shared with other
+states. In addition, the components of a probability density, consisting of the
+mixture weight vector, the mean vectors and the variance vectors may also be
+shared with other probability densities. In TIesr, the last state of an HMM is
+non-emitting.  Entry transitions can be made to any emitting state, but not the
+non-emitting state. The HMM must be exited from the non-emitting state. 
+Transitions may be made from any emitting state to any other emitting state or
+the non-emitting state, although transitions are typically limited to looping to
+the current state, and transitioning to later states for speech recognition. 
+There is no provision in the transition matrices for any transition from the
+non-emitting state to any state within the HMM.
+
+In order to examine the HMM details, TIesr provides a perl script,
+tiesr_model_convert.pl and a perl module, TIesrModel.pm.  The perl script and
+module parse the data in the files in order to display the HMM details. The user
+may request any combination of the following sets of data:
+
+- HMM transition matrix index and state probability density indices
+- probability density weight, mean, and variance indices
+- transition matrix information by index
+- Gaussian mean vector data by index
+- Gaussian variance vector data by index
+- Gaussian constant data by variance index
+- Gaussian cluster indices corresponding to each mean vector
+- Gaussian cluster centroid vectors by cluster index
+
+An example of each form of data is shown and described below for the example
+yes/no grammar. The beginning output provides a summary of the data for the
+given model directory.
+
+Model data for .
+
+Number of words in grammar: 4
+Number of HMMs: 22
+Number of PDFs: 91
+Number of Transition matrices: 11
+Number of mean vectors: 294
+Number of clusters: 128
+Number of variance vectors: 167
+Feature dimension (static+delta): 20
+
+The HMM information index information is shown below. In the information for
+each HMM, the HMM index, transition matrix index, and state pdf indices for each
+emitting state are displayed. The number of pdf indices specify the number of
+emitting states in each HMM, which can vary between HMMs. Note that there is a
+space for the phonetic HMM name, which is not supplied by TIesrFlex output at
+this time. This will be added in a future release.
+
+HMM information:
+  Num              Name   Trans   PDFs
+    0  (               )      0      0      1      2
+    1  (               )      1      3      4      5      6
+    2  (               )      2      7      8      9     10     11
+    3  (               )      3     12     13     14     15     16     17
+    4  (               )      4     18     19     20
+    5  (               )      5     21     22     23     24     25     26
+    6  (               )      6     27     28     29
+    7  (               )      7     30     31     32     33     34     35
+    8  (               )      8     36     37     38
+    9  (               )      9     39     40     41
+   10  (               )     10     42     43     44     45     46
+   11  (               )      0      0      1      2
+   12  (               )      1     47     48     49     50
+   13  (               )      2     51     52     53     54     55
+   14  (               )      3     56     57     58     59     60     61
+   15  (               )      4     62     63     64
+   16  (               )      5     65     66     67     68     69     70
+   17  (               )      6     71     72     73
+   18  (               )      7     74     75     76     77     78     79
+   19  (               )      8     80     81     82
+   20  (               )      9     83     84     85
+   21  (               )     10     86     87     88     89     90
+
+
+
+A portion of the probability density weight, mean and variance index data is
+shown below.  For each pdf index, the number of Gaussians making up the pdf is
+specified, followed by  the scaled log likelihood weight of each Gaussian
+component of the pdf, and the mean and variance index of the Gaussian component.
+
+PDF information:
+  Num  Gaussians     Wgt   Mean    Var  
+    0          5    -303      0      0
+                    -156      1      1
+                    -107      2      2
+                     -70      3      3
+                     -61      4      4
+    1          5    -202      5      5
+                    -149      6      6
+                    -109      7      7
+                     -73      8      8
+                     -65      9      9
+    2          5    -315     10     10
+                    -159     11     11
+                    -108     12     12
+                     -69     13     13
+                     -60     14     14
+                  .
+                  .
+                  .
+
+A portion of the transition matrix information is shown below.  For each
+transition matrix, the index, number of states, and scaled log entry
+probabilities are first given. A log probability of -32768 indicates that a
+transition is not allowed.
+
+TRANS information:
+  Num  States   Entry
+    0       4     -26     -69  -32768
+  Trn from state  0:     -13    -112    -248  -32768
+  Trn from state  1:  -32768      -6    -234    -167
+  Trn from state  2:  -32768  -32768     -17     -92
+
+    1       5     -27     -66  -32768  -32768
+  Trn from state  0:     -34    -553     -55  -32768  -32768
+  Trn from state  1:  -32768     -49    -123     -59  -32768
+  Trn from state  2:  -32768  -32768     -54     -51    -131
+  Trn from state  3:  -32768  -32768  -32768     -75     -23
+                    .
+                    .
+                    .
+
+A portion of the mean vector information is shown below. The vector values
+represent scaled static and dynamic cepstral parameters. Each dimension of the
+vector is individually scaled in order to provide acceptable resolution for the
+parameter.
+
+Mean vectors:
+   Num
+    0:   12800   -3584    -704    1344   -2432   -1280    1792    -704 ...
+    1:   12288   -3328    -448    2560   -1792    -704    3200    -320 ...
+    2:   12544   -3328    -448    2240   -2176    -704    2688    -320 ...
+    3:   12800   -3584    -896    1920   -2816   -1024    2304    -704 ...
+                       .
+                       .
+                       .
+
+A portion of the variance vector information is shown below. The vector values
+represent scaled static and dynamic cepstral parameter variances. Each dimension
+of the vector is individually scaled in order to provide acceptable resolution
+for the variance values.
+
+Variance vectors:
+   Num
+    0:    1216     672    1280     672     768    1072     296     328 ...
+    1:    2368    1456    2144    1008     960    1264     304     368 ...
+    2:    2560    1520    2048     976     992    1264     320     360 ...
+    3:    2368    1088    1568     752     912    1248     324     360 ...
+                       .
+                       .
+                       .
+
+A portion of the Gaussian normalization constant information is shown below.
+There will be one scaled constant value for each Gaussian variance vector.
+
+Gconst values:
+   2654   2159   1987   1993   1973   1764   1673   1632   1673   1637
+   3347   2489   2216   2287   2250   2653   2890   2573   2764   2891
+   2633   2838   2985   2620   2737   2617   2396   2744   2301   2619
+                       .
+                       .
+                       .
+
+
+A portion of the Gaussian cluster indices information is shown below. There
+will be one index for each Gaussian mean vector.
+
+Cluster indices:
+    Num
+     0:    30    30    30    30    30    30    30    30    30    30
+    10:   119    30    30    30    30    42   107     7   115   100
+    20:    41   114    41    51    99    51    51    33    46    25
+                       .
+                       .
+                       .
+
+
+A portion of the Gaussian cluster centroid information is shown below. There
+will be one centroid vector for each cluster.
+
+Cluster centroid vectors:
+   Num
+    0:   12830   -2904    -312    2305   -1937   -1037    1895    -385 ...
+    1:   16711   -1085      46    2609   -4240   -2201   -1940   -2108 ...
+    2:   13783   -4180    -373    2214   -2667    -701    1813   -1110 ...
+    3:   18394   -1850   -2204    1449   -5050   -1745    1701   -2226 ...
+                       .
+                       .
+                       .
+
+
+tiesr_jac_convert.pl
+--------------------
+The TIesr Speech Recognizer maintains a single file that keeps track of the
+TIesr state adaptation parameters. This "JAC file" is updated after each
+recognition attempt that obtains a recognition output result.  The file contains
+parameters that are used during dynamic adaptation of HMM model parameters to
+the current environment, and parameters that are used to adaptively adjust
+background and confidence parameters.  The algorithms that use these parameters
+are complex, and the adaptation is dynamic, so the user generally need not
+examine the contents of the JAC file. For diagnostic purposes, and to convert
+the file between little-endian and big-endian  formats, TIesr supplies the
+tiesr_jac_convert.pl perl script.  Using this script, the advanced user may
+examine the contents of the JAC file.  
+
+<Further information regarding the JAC will be provided in a TIesr Advanced
+Features document which will be provided in a further release.>
\ No newline at end of file
diff --git a/Documentation/TIesr_Grammar.txt b/Documentation/TIesr_Grammar.txt
new file mode 100755 (executable)
index 0000000..53e5f5e
--- /dev/null
@@ -0,0 +1,176 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+
+TIesrFlex Grammar String Overview
+---------------------------------
+
+This document provides an overview of grammar string construction for the
+TIesrFlex API.  The grammar string is provided to the ParseGrammar method of
+TIesrFlex.  The grammar string defines the words and phrases that the TIesr
+recognizer can recognize.
+
+
+ParseGrammar Method
+-------------------
+The ParseGrammar method of the TIesrFlex API parses the grammar string prior to
+building the binary grammar network and model file set.  The grammar string is
+specified as a simple C character string argument.  Other ParseGrammar arguments
+implement other options. Since the dictionary of word pronunciations used by
+TIesrFlex may contain many different pronunciations of the same word, a
+ParseGrammar argument can specify the maximum number of pronunciations in the
+grammar network allowed for a word.  Some words in the grammar string may not be
+in the dictionary.  In this case ParseGrammar will use a putative pronunciation
+generated by the TIesrDT API.  However, if the word is in the dictionary, this
+will most likely be the pronunciation desired.  ParseGrammar does provide an
+argument that forces use of the putative pronunciation in addition to dictionary
+pronunciations.  Finally, ParseGrammar will normally insert a model for silence
+between each word of a phrase automatically.  An argument to ParseGrammar can
+enable or disable the automatic insertion.  If it is disabled, then it is up to
+the writer of the grammar string to manually account for any silence modeling
+between words.  This will be discussed in detail later.
+
+
+The Grammar String
+------------------
+The ParseGrammar grammar string argument specifies a null terminated C string
+that represents the grammar that should be used to construct the binary grammar
+network and acoustic model file set for use in subsequent recognition.  The
+grammar must be specified in a single string.  The grammar string may consist of
+single or multiple lines using newline as a line separator. Spaces, tabs and
+newlines may be inserted in the string, but are ignored except as word
+separators.  
+The beginning of the grammar must consist of \93start(<NT>).\94, which defines the
+beginning of the grammar.  In this part of the string, NT represents the
+user-chosen starting non-terminal symbol name of the grammar.  All non-terminal
+and terminal symbol names consist of alphabetic characters, dash(-), underscore(
+_ ), or a single quote(\91). In general, non-terminal nodes should use some
+convention, such as starting with an underscore, which makes them different from
+terminal symbols which are words. 
+Subsequent to the start of the grammar, the rest of the grammar consists of one
+or more grammar rules. The first grammar rule must define the starting
+non-terminal symbol. Each rule consists of a declaration of a non-terminal
+symbol name on the left side, separated from its definition on the right side by
+the characters \93 ---> \94 (note that there is at least one space prior to and
+after the "--->" symbols).  The right side contains the expansion of the
+non-terminal symbol on the left side as a set of words and other non-terminal
+symbol names. Words should normally consist of alphabetic characters, but may
+include the other characters mentioned above. There are a few special exceptions
+that will be discussed later. The expansion can use parentheses \93( )\94 for
+grouping, square brackets \93[ ]\94 to indicate optional items, and the vertical bar
+\93|\94 to indicate an OR operation.  The right side must end with a period
+character (\93.\94).  Words or non-terminal symbol names appearing next to each
+other are assumed as combined with an AND operation, which takes precedence over
+the OR operation.
+
+
+Example grammars
+
+Several examples of grammars follow.
+
+This is a simple grammar recognizing either the word \93programs\94 or "contacts\94.
+
+     \93start(_S). _S ---> programs | contacts.\94
+
+This grammar would recognize \93hello world\94 or \93goodbye world\94.
+     
+     \93start(_S). _S ---> (hello | goodbye) world.\94
+
+A more complex grammar would recognize seven or ten digits.  This is shown below
+as multiple lines, but all text could be placed on one line, not using newline
+characters.
+
+     \93start(_Phonenumber).
+     _Phonenumber ---> _Digit7 [_Digit3].
+     _Digit7 ---> _digit _digit _digit _digit _digit _digit _digit.
+     _Digit3 ---> _digit _digit _digit.
+     _digit ---> zero | oh | one | two | three | four | five | six | seven |
+                 eight | nine.\94
+
+
+Important limitations 
+---------------------
+There are a few important restrictions on grammar construction.  These must be
+followed carefully.  Most importantly, non-terminal symbols must not appear on
+the left and right side of rules such as to cause a loop in the grammar.  A loop
+grammar will eventually end up having the effect of defining a non-terminal
+symbol in terms of itself. If the grammar is written in this way, then
+ParseGrammar will return a failure to parse the grammar.  An example of a loop
+grammar is shown below.  This grammar will not parse. Notice that if in the
+_Loop rule the _NextRule non-terminal is substituted with the expansion of its
+definition, then _Loop is defined in terms of itself.
+
+     \93start(_Loop).
+     _Loop ---> this is a _NextRule.
+     _NextRule ---> _Loop grammar.\94
+Each non-terminal symbol name must appear only once on the left hand side of all
+rules.  If it appears more than once on the left side, then it causes a
+re-definition of the rule. This will not cause ParseGrammar to fail, but will
+result in a grammar that was not intended. 
+
+Obviously, terminal symbol words and non-terminal symbols should not be the
+same.  This is the reason that a convention of starting non-terminal symbols
+with an underscore may be helpful.
+
+Rule lines may be of any arbitrary length.  
+
+
+Special Words
+-------------
+
+TIesrFlex defines two types of special silence pseudo-words.  
+
+
+The _SIL word
+-------------
+One pseudo-word is the _SIL word.  This word represents an arbitrary amount of
+silence.  When the ParseGrammar method argument specifies automatic insertion of
+silence between words, then this pseudo-word is inserted as an optional word at
+the beginning of the utterance, end of the utterance, and between each word. 
+For example, given this grammar:
+
+     \93start( _Name). _Name ---> John Doe.\94
+
+Then the effect of automatic silence insertion will be to implement a grammar
+that really looks like:
+
+     \93start( _Name). _Name ---> [ _SIL ] John [ _SIL ] Doe [ _SIL ].\94
+
+Typically this is what the grammar designer desires, since this models optional
+pause prior to and after words.
+
+
+_SIL_* words
+------------
+The other set of pseudo-words is given by _SIL_*, where * is any string of ascii
+characters.  The purpose of these pseudo-words is to easily index what could be
+complex recognition results.  Upon successful completion of recognition, the
+TIesr recognizer returns the words it recognizes.  However, in many cases, one
+is not interested in the sequence of words recognized, but rather which phrase
+was actually spoken.  When a _SIL_* pseudo-word is placed in the grammar, it
+acts just like insertion of _SIL from the acoustic perspective, but TIesr
+returns the pseudo-word that was in the path that was recognized.  For example,
+the following grammar may need to be recognized, and action taken based on which
+phrase was spoken.  Since the grammar is somewhat complex and defined
+dynamically during running of the application, it can be involved to determine
+which phrase was spoken by just examining which words were recognized. However,
+it is relatively easy to detect the ending pseudo-word.
+
+  \93start(_Select).
+  _Select ---> [ [please] go to] ( _Selection1 _SIL_A | _Selection2 _SIL_B.)
+  _Selection1 ---> an arbitrary run time phrase.       
+  _Selection2 ---> a different arbitrary run time phrase.
+
+The intent is to normally use these pseudo-word models at the end of each
+phrase.  In this way it is easier to locate the pseudo-word and determine the
+spoken phrase.
+
+
+Helpful Hint
+
+It is best to keep the grammar as simple as possible.  Excessive use of optional
+phrases,  OR clauses, and grouping within a single rule can be confusing to read
+and can easily lead to mistakes in specifying a grammar. In the event that
+recognized phrases seem to be inconsistent with the grammar, a tool is available
+to examine the detailed output grammar network structure that TIesrFlex creates.
diff --git a/Documentation/TIesr_Overview.txt b/Documentation/TIesr_Overview.txt
new file mode 100644 (file)
index 0000000..9cb87e2
--- /dev/null
@@ -0,0 +1,342 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+
+Overview of the TIESR Speech Recognizer
+---------------------------------------
+This document provides an overview of the TI Embedded Speech Recognizer (TIESR)
+for Speaker-Independent recognition.  The overview covers a description of the
+recognizer, information concerning use of the recognizer, and a description of
+the foundational APIs that implement the recognizer.  It discusses procedures
+necessary to port the recognizer to a specific platform, as well as supporting
+tasks such as testing and integration.
+
+The TIESR speech recognizer is targeted toward embedded platforms where
+computation and memory storage efficiency are important. TIESR is written in C
+and C++ using only fixed-point operations. It is grammar-based, which means that
+an application must specify a grammar defining the allowable words and phrases
+that can be recognized (TIESR is not a large vocabulary recognizer that uses a
+language model). TIESR is what would be considered a "medium sized" recognizer,
+being able to recognize up to several hundred words. An application can change
+the grammar prior to recognizing any spoken utterance.  The recognizer allows an
+application to determine what valid grammar phrase was spoken, as well as
+providing a measure of confidence that the phrase was recognized correctly.  If
+the confidence of correct recognition is low, it may also provide a list of
+other likely valid grammar phrases. TIESR is written to be simple to use for an
+application designer who quickly wants to implement speech recognition. It also
+provides more advanced controls so that one can implement more detailed
+configuration and operation of the recognizer. TIESR simplifies the interface
+for the application designer by providing default settings of controls that work
+for most situations.  However, TIESR also provides the capability for advanced
+tuning of the recognizer configuration.  If desired, the application designer
+can use the advanced settings to implement some configuration of the recognizer
+engine itself, such as tuning performance based on some user selection.  The
+application designer may also wish to determine the proper ranges of parameter
+settings in order to optimize performance.  Tuning of the parameters requires
+knowledge of the TIESR recognizer algorithms which is beyond the scope of this
+document.
+
+TIESR contains two main APIs for interface with the application designer. The
+TIesrFlex API provides the designer with the tools to create a recognition
+grammar and acoustic model set for use with TIESR.  The output of the TIesrFlex
+API is a directory containing a set of binary files defining a grammar and the
+associated acoustic models.  The designer may create grammar/model sets at any
+time, and can maintain them for reuse or delete them after speech recognition
+has taken place.
+
+The other main API is the TIesrSI API.  This API performs the actual speech
+recognition. It implements an easy-to-use interface with the ability to create,
+open, start, stop, close, query, and delete a recognizer instance.  The TIesrSI
+API is multi-threaded, starting recognition in a separate thread so that an
+application is free to perform other processing while recognition is being
+performed.  TIesr interacts with an application through two callback functions
+that inform the application when the recognizer is ready to receive speech
+input, and when the recognizer has completed recognition of a spoken phrase.
+
+Detailed documentation of use of the APIs can be found in the directory
+associated with each API, and in the API header files which have detailed
+comments.
+
+TIesr comes with a default general American English dictionary and acoustic
+model data.
+
+
+Overview - Some Recognizer Details
+----------------------------------
+TIESR is a statistical speech recognizer, meaning that it tries to find the
+grammar phrase that most closely matches the spoken utterance. TIESR uses
+state-of-the-art Hidden Markov Model (HMM) technology to model the acoustic
+signals found in speech. In order to be able to recognize any word, TIESR HMMs
+model phonetic sounds, and these phonetic models are concatenated to form the
+models for words. The HMMs are usually context-dependent "triphones", meaning
+that each HMM models a phonetic sound in the context of preceding and following
+phonetic sounds. Usually TIESR has separate HMM models for females and males.
+The HMMs for the phones are not restricted to have the same number of states.
+The acoustic model for each state is a multi-mixture Gaussian probability
+density function which may be shared with other states.
+
+TIesr uses a variant of mel-frequency cepstral coefficients as the acoustic
+model features. It also implements delta cepstral coefficients, but does not use
+delta-delta coefficients in order to reduce space and processing. 
+
+In order to be able to recognize any word, TIESR must determine the phonetic
+pronunciation of a word and concatenate the phonetic HMMs to form the model for
+a word. TIESR accomplishes this using decision tree technology to create an
+initial estimate of the pronunciation of a word based on its spelling. It
+validates the pronunciaion by looking it up in a dictionary. If there is no
+entry in the dictionary, TIESR uses the initial estimate. The dictionary may
+also provide multiple pronunciations. TIESR stores the dictionary in a
+compressed binary form. At present, the TIESR APIs do not include the capability
+to modify the dictionary; it is created offline.
+
+The TIESR recognizer includes advanced algorithms to help it operate robustly in
+the presence of stationary background noises (the sound of the noise does not
+change much during the speech). TIESR includes dynamic adaptation to the
+environment, such as adaptation to changes in microphones and background noises.
+It uses other algorithms to reduce computation and memory storage requirements.
+
+All manipulation of recognition grammars and results that require text handling
+is done via C strings.  The API does not implement support for international
+language character sets.  This does not inherently hamper implementation of
+recognition, since there can be a representation in equivalent ASCII strings,
+and conversion can take place at a higher API level.
+
+
+Overview - TIESR Speech Recognizer Data
+---------------------------------------
+The TIESR speech recognizer is a flexible speech recognition engine. It uses
+three types of data to construct a grammar/model set that defines its operation;
+1) pronunciation decision trees used to estimate word pronunciation from word
+spelling, 2) a pronunciation dictionary, 3) acoustic model information needed to
+construct HMMs for the words in a grammar. These three pieces of data are
+created offline by training algorithms. In the first release, TIESR comes with
+the decision trees, dictionary, and acoustic model information for general
+American English. In addition, it comes with a support tool in order to create a
+custom pronunciation dictionary. 
+
+The pronunciation decision trees and acoustic model information must be trained
+from large sets of input data. This information is by nature language-dependent.
+Therefore, specific data is required for an individual language.  The amount of
+data needed to implement support for a given language will vary, depending many
+factors, such as the regularity of word pronunciations within a language.
+Decision tree training and output tools are included as of Beta-1.2. Acoustic
+model training is most easily done using the openly available HTK toolset, and
+tools to convert from HTK output models to TIESR HMM information are available
+as of release Beta-1.2. The tools provide detailed documentation to enable
+complete customization of TIESR.
+
+If TIESR is to be used with only one grammar/model set, such as a command and
+control application, then the above data need not be stored in the device. The
+only requirement is storage of the grammar/model set.
+
+
+Overview - Using TIESR successfully
+-----------------------------------
+Probably one of the most important tasks for ensuring optimal TIESR recognizer
+performance is testing and confirming the quality of the audio signal delivered
+to the recognizer.  TIESR provides the ability to capture in a file the audio
+data used during recongition. Initially audio should be captured and analyzed to
+ensure that voice signals do not saturate or are too low in amplitude.  Checks
+should be made to ensure that there is minimal audio distortion. The old saying
+remains true, "Garbage in, garbage out."
+
+A significant component to using the TIESR speech recognizer capabilities is
+defining the user interaction between TIESR and applications that are voice
+enabled.  This requires defining and developing a uniform user interface between
+TIESR and applications.  This may include developing a consistent set of GUI
+interfaces for TIESR and implementing higher level APIs above the TIESRSI APIs
+that provide voice enabling with a consistent look and feel between
+applications. A poor user interface may tend to appear to the user as though the
+recognizer is not working well.
+
+A speech recognizer will obviously perform best when the input audio is known to
+contain the speech to be recognized. So, TIESR should not be started until the
+application desires to perform speech recognition. TIESR has a built in
+time-out, such that it will automatically stop recognition if no speech is seen
+for a duration of time. A means for the user to start recognition (such as "push
+to start") is highly recommended.
+
+
+
+
+The TIESR API Software Package
+------------------------------
+The TIESR API package consists of seven APIs.  Each API is implemented as a
+shared object (DLL) library written either in C or C++.  In addition to the
+APIs, the released software includes support tools that are written in C, and
+support scripts written in Perl. The following paragraphs provide an overview of
+each of the APIs comprising the TIESR Recognizer, and the support tools provided
+with TIESR. Detailed descriptions of each API or tool may be found under the
+directory containing the API or tool.
+
+
+TIesrSI API
+-----------
+The TIesrSI API, written in C, is the top-level wrapper above the TIesrEngine
+APIs that perform speech recognition.  The main purpose of the TIesrSI API is to
+provide an easy-to-use interface between the TIesrEngine APIs and applications. 
+The TIesrSI API provides a simple interface to create, open, start, stop, close,
+and destroy a TIESR speech recognizer instance. Opening a recognizer instance
+attaches a grammar/model set to the recognizer and defines the audio channel to
+be used. The TIesrSI API provides for multithreading of recognizer processing. 
+Most speech recognition applications occur in an interactive environment. 
+Therefore, once speech recognition starts, other events may require that the
+speech recognition processing be terminated, or other processing may need to
+take place while recognition is ongoing. For example, on a cell phone, a user
+may start recognition of an utterance, and then receive an incoming phone call. 
+Such events require the recognizer to operate in a multithreaded environment.
+The TIESRSI API provides this multithreading capability by starting the
+recognizer in a separate thread.  The recognizer thread interacts with the
+application thread via two callback functions which indicate that the recognizer
+is ready to receive speech input, and that a recognition result is ready. After
+stopping the recognizer, the application can query for recognition results,
+confidence measures, or recognizer status. Closing the recognizer detaches the
+grammar/model set from the recognizer. 
+
+The TIesrSI API also acts as an interface between the TIesrEngine APIs and the
+TIesrFA (Frame Audio) API, thereby isolating the TIesrEngine APIs from the means
+of obtaining audio data. The TIesrSI API manages the process of receiving audio
+data from the TIesrFA API and providing it to the TIesrEngine APIs for
+subsequent speech recognition processing.
+
+
+TIesrFA API
+-----------
+The TIESREngine APIs process frames of audio data samples, where a frame is a
+fixed number of samples.  By default, the TIESR recognizer operates on 160
+sample frames collected at 8000 samples/second.  The format of the samples
+should be 16-bit linear sampling. The TIesrEngine APIs may not be able to
+process a particular frame of data in real-time.  This requires that frames of
+audio data be buffered and presented to the TIesrEngine APIs as they have
+capability to consume them. The TIesrFA (Frame Audio) API, written in C,
+provides the TIesrSI API a uniform and well-defined interface that collects
+frames of audio data in a buffer and manages the buffer.  While the TIesrFA API
+interface is well defined, the implementation of the API depends upon the OS and
+hardware platform capabilities. Usually an OS and/or hardware platform provides
+an API that implements an audio recording capability which will be used to
+implement the TIesrFA API.  The TIESR release provides implementations of the
+TIesrFA API for Linux using the ALSA library API and for Windows using the
+Waveform Audio API. These implementations may be used as a template for creating
+a new implementation for a particular OS or platform. Using one of the
+implementations as a template, only the portions that interact with the OS or
+device audio API must be modified for each OS or platform. The TIesrFA API
+provides the capability to open, start, stop and close an audio channel data
+collection session, and to provide frames of audio data upon request. TIesr FA
+starts data collection in a separate high-priority thread to perform audio
+collection in real-time.
+
+The TIesrFA implementations provided in the TIESR release define a simple method
+whereby audio input for recognition may originate from a file, rather than a
+real-time audio channel.  This can be very useful for testing and analyzing
+recognizer performance, and confirming correct operation.  This capability also
+provides an excellent method to debug recognition-enabled applications.
+
+
+TIESREngine APIs
+----------------
+The two TIesrEngine APIs are the TIesrSIEngine API and the TIesrEngineCore API. 
+These APIs provide the foundation of the speech recognizer capabilities.  These
+APIs are written in fixed-point C code.  These two APIs provide the entire
+detailed signal processing necessary to implement a state-of-the-art statistical
+speech recognizer based on Hidden Markov Modeling (HMM) concepts.  The
+TIesrEngineCore API implements core speech recognition functions such as
+extraction of salient features from the speech signal and search and decoding
+algorithms to match the input speech with the grammar/model set.  The
+TIesrSIEngine API implements additional functions such as robust adaptation to
+environmental variations and audio channel distortions, as well as interfacing
+between the TIesrEngineCore API and the TIesrSI API. 
+
+The TIesrEngine APIs' C code has not been optimized for any particular hardware
+processor. However, code in the APIs includes techniques to reduce computation
+and efficiently implement processing.  Some of the code may be conducive to
+hardware-specific optimization.  For example, the APIs contain front-end speech
+processing code which converts frames of sampled data to vectors of speech
+features using a sequence of filtering, windowing, FFT calculation, and linear
+transformation. Additional functions within the APIs involve signal processing
+mathematical calculations.  These functions may lend themselves to optimization
+by hardware-specific methods. However, other functions within the APIs, such as
+the core search engine functionality, are not as likely to be conducive to
+optimization.
+
+The TIesrEngine APIs must access and generate various types of data in order to
+operate. For example, when the application requires dynamic grammar/model
+generation, TIESR must access the acoustic HMM information and the dictionary,
+then generate a grammar/model set and store them. The TIesrEngine APIs implement
+data access and model storage by standard C file I/O operations.
+
+
+TIesrFlex API
+-------------
+The TIesrFlex API, written in C++, is the top-level API that supports
+dynamically creating grammar/model sets. An application can access the
+functionality at any time to build a grammar/model set for the desired phrases
+to be recognized.  The application need only supply the grammar of phrases to be
+recognized as an ASCII string utilizing a well-defined format that is
+easy-to-use and flexible, along with the location of a directory containing
+acoustic and pronunciation information. TIesrFlex parses the phrases and
+utilizes the TIesrDict API to determine the pronunciation of each word.  The
+TIesrDict API can accommodate unseen words, so that a grammar/model set can be
+created which contains any word, even if that word is not known within the
+dictionary.  The TIesrFlex API creates a grammar/model set as files in a
+directory that the TIesrSI API can subsequently utilize to perform recognition.
+This directory contains all of the data the TIesrSI API needs to perform
+recognition. The directory may be retained for future recognition of the same
+phrases, or can be deleted after the TIesrSI API uses it.
+
+The TIesrFlex API can handle arbitrarily large grammar sizes.  However, in order
+to minimize recognizer footprint and maximize efficiency, the TIesrSI API
+presently has limitations on the size of grammar networks and HMM model sets. 
+Depending on the complexity of the grammar network and phrases to be recognized,
+recognition is typically limited to between 150-200 words within a grammar/model
+set. Of course, grammar/model sets can be dynamically generated by an
+application, providing for dynamically changing grammars at any time.
+
+
+TIesrDict API
+-------------
+The TIesrDict API, written in C++, provides the phonetic pronunciations of words
+so that the TIesrFlex API can create grammar/model sets for speech recognition.
+The TIesrFlex API initializes the  TIesrDict API by specifying the directory
+locations of a dictionary and pronunciation information.  TIesrFlex obtains the
+pronunciation of a word by supplying the TIesrDict API with an ASCII string
+representing a word. The TIesrDict API determines the pronunciation of the word
+in a two step process.  First the TIesrDict API sends the word to the TIesrDT
+API which returns an estimated pronunciation of the word based on word spelling
+alone. The TIesrDict API then checks if the word is in the dictionary. If the
+word is not in the dictionary, then TIesrDict uses the pronunciation provided by
+TIesrDT. If the word is in the dictionary, then the application may choose to
+use either the dictionary pronunciation or both the dictionary pronunciation and
+that returned by TIesrDT. The dictionary may also contain multiple
+pronunciations for a single word. For example, the word "read" may be pronounced
+in two ways. The application may choose to use any number of pronunciations of a
+word.
+
+The use of TIesrDT within the TIesrDict API provides two advantages. First, if a
+word is not in the dictionary, then TIesrDT can provide a pronunciation of the
+word so that the grammar/model set can handle any possible word. This is
+commonly needed for proper nouns such as names or places. The second advantage
+is that TIesrDT minimizes the size of the dictionary. Instead of providing the
+complete pronunciation of a word, the dictionary only contains the differences
+between the TIesrDT pronunciation and the desired pronunciation. For a general
+American dictionary this results in word pronunciation entries that are only
+slightly larger than one byte per word on average.
+
+Presently, the reduced-size pronunciation dictionary is prepared offline using
+the TIesrDT API and a user-supplied pronunciation dictionary text file. The
+TIESR release includes a utility, dictproc, for this purpose. Using dictproc one
+can create a custom dictionary for a particular application.
+
+
+TIesrDT API
+-----------
+As mentioned above, the TIesrDict API uses the TIesrDT API to determine the
+pronunciation of a word based on the spelling of the word alone. The TIesrDT
+API, written in C, utilizes pronunication decision trees which determine the
+pronunciation of each letter in a word based on surrounding letter context.
+TIesrDT traverses the decision trees to generate the estimated pronunciation. 
+
+The decision trees must be prepared offline based on the input from a large
+number of pronunciations of words. This process is somewhat complex, requiring a
+sequence of training steps to develop and minimize the size of the decision
+trees. As of release Beta-1.2 TIESR includes these tools and detailed
+documentation required to develop a set of decision trees.
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..9e1ced2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,170 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+# This Makefile will build all of the TIesr APIs and test programs for a given
+# configuration. It is assumed that the gnu tools, such as gcc and g++ exist and
+# are on the PATH so that they can be accessed by specifying "gcc" and "g++" on the
+# command line (or "gcc.exe" an "g++.exe for Windows).  The proper method of
+# using this Makefile is to build for a given configuration, for example:
+#
+# make LinuxDebugGnu
+#
+# The valid configurations are:
+#
+# LinuxDebugGnu
+# LinuxReleaseGnu
+# ArmLinuxDebugGnueabi
+# ArmLinuxReleaseGnueabi
+# WindowsDebugMinGW
+# WindowsReleaseMinGW
+#
+# The Makefile also supports building any subset of projects for the selected
+# configuration by specifying the list of projects as the PROJECTS variable
+# on the command line.  For example, to build the TIesrDT and TestTIesrDT 
+# projects for the LinuxDebugGnu configuration:
+#
+# make LinuxDebugGnu  PROJECTS='TIesrDTso TestTIesrDT'
+#
+# Supported projects are:
+#
+# TIesrDTso TestTIesrDT TIesrDictso TestTIesrDict TIesrFlexso TestTIesrFlex
+# TestTIesrFA TIesrEngineCoreso TIesrEngineSIso TIesrSIso TestTIesrSI
+# TIesrFAWinso (for Windows only)
+# TIesrFA_ALSAso (for Linux with ALSA support only)
+#
+# Build steps that can be performed are specified by the STEP variable, which 
+# may be set to "clean", "build", or "clobber".  If not set, "build" is the default.
+#
+
+# Supported configurations
+WINCONFS = WindowsDebugMinGW WindowsReleaseMinGW
+LINUXCONFS = LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi
+
+# Configurations are phony targets
+.PHONY : $(WINCONFS) $(LINXCONFS)
+
+# Supported projects that are OS independent
+FLEXPROJECTS = TIesrDTso TestTIesrDT TIesrDictso TestTIesrDict TIesrFlexso TestTIesrFlex
+RECOPROJECTS = TestTIesrFA TIesrEngineCoreso TIesrEngineSIso TIesrSIso TestTIesrSI
+
+# Projects that are OS dependent - the TIesrFA API. This must be built prior to the 
+# RECOPROJECTS being built.
+WINPROJECTS = TIesrFAWinso
+LINUXPROJECTS = TIesrFA_ALSAso
+
+#Projects are phony targets
+.PHONY : $(FLEXPROJECTS) $(RECOPROJECTS) $(WINPROJECTS) $(LINUXPROJECTS)
+
+# Unless PROJECTS is specified on the command line, the target will build all
+# projects for the given configuration
+BUILDWINPROJECTS =   $(WINPROJECTS) $(RECOPROJECTS) $(FLEXPROJECTS)
+BUILDLINUXPROJECTS =   $(LINUXPROJECTS) $(RECOPROJECTS) $(FLEXPROJECTS)
+
+#If PROJECTS is defined on the command line, it replaces projects to build
+ifdef PROJECTS
+BUILDWINPROJECTS = $(PROJECTS)
+BUILDLINUXPROJECTS = $(PROJECTS)
+endif
+
+# Unless STEP is specified, default to build
+STEP=build
+
+# Specify use of windows Cygwin gcc tools if building for Windows
+$(WINCONFS) : WINTOOLS=CC=gcc.exe CCC=g++.exe CXX=g++.exe AS=as.exe CND_PLATFORM=Cygwin-Windows
+$(LINUXCONFS) : WINTOOLS=
+
+# Define a variable holding the configuration to be built
+WindowsDebugMinGW : BUILDCONF=WindowsDebugMinGW
+WindowsReleaseMinGW : BUILDCONF=WindowsReleaseMinGW
+LinuxDebugGnu : BUILDCONF=LinuxDebugGnu
+LinuxReleaseGnu : BUILDCONF= LinuxReleaseGnu
+ArmLinuxDebugGnueabi : BUILDCONF= ArmLinuxDebugGnueabi
+ArmLinuxReleaseGnueabi : BUILDCONF=ArmLinuxReleaseGnueabi
+
+# Rules to build all requested projects for the target configuration
+$(WINCONFS) : $(BUILDWINPROJECTS)
+
+$(LINUXCONFS) : $(BUILDLINUXPROJECTS)
+
+# Rules to build each project
+TIesrDTso : 
+       cd TIesrDT/TIesrDTso && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TestTIesrDT :
+       cd TIesrDT/TestTIesrDT && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TIesrDictso :
+       cd TIesrDict/TIesrDictso && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TestTIesrDict :
+       cd TIesrDict/TestTIesrDict && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TIesrFlexso :
+       cd TIesrFlex/TIesrFlexso && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TestTIesrFlex :
+       cd TIesrFlex/TestTIesrFlex && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TIesrFAWinso :
+       cd TIesrFA/TIesrFAWinso && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TIesrFA_ALSAso :
+       cd TIesrFA/TIesrFA_ALSAso && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TestTIesrFA :
+       cd TIesrFA/TestTIesrFA && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TIesrEngineCoreso :
+       cd TIesrEngine/TIesrEngineCoreso && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TIesrEngineSIso :
+       cd TIesrEngine/TIesrEngineSIso && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TIesrSIso :
+       cd TIesrSI/TIesrSIso && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+       
+TestTIesrSI :
+       cd TIesrSI/TestTIesrSI && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)  
+
+
+.PHONY : help
+help : 
+       @echo 'This Makefile will build all of the TIesr APIs and test programs for a given'
+       @echo 'configuration. It is assumed that the gnu tools, such as gcc and g++ exist and'
+       @echo 'are on the PATH so that they can be accessed by specifying "gcc" and "g++" on the'
+       @echo 'command line (or "gcc.exe" an "g++.exe" for Windows).  The proper method of'
+       @echo 'using this Makefile is to build for a given configuration, for example:'
+       @echo ' '
+       @echo 'make LinuxDebugGnu'
+       @echo ' '
+       @echo 'The valid configurations are:'
+       @echo ' '
+       @echo 'LinuxDebugGnu'
+       @echo 'LinuxReleaseGnu'
+       @echo 'ArmLinuxDebugGnueabi'
+       @echo 'ArmLinuxReleaseGnueabi'
+       @echo 'WindowsDebugMinGW'
+       @echo 'WindowsReleaseMinGW'
+       @echo ' '
+       @echo 'The Makefile also supports building any subset of projects for the selected'
+       @echo 'configuration by specifying the list of projects as the PROJECTS variable'
+       @echo 'on the command line.  For example, to build the TIesrDT and TestTIesrDT'
+       @echo 'projects for the LinuxDebugGnu configuration:'
+       @echo ' '
+       @echo 'make LinuxDebugGnu  PROJECTS="TIesrDTso TestTIesrDT"'
+       @echo ' '
+       @echo 'Supported projects are:'
+       @echo ' '
+       @echo 'TIesrDTso TestTIesrDT TIesrDictso TestTIesrDict TIesrFlexso TestTIesrFlex'
+       @echo 'TestTIesrFA TIesrEngineCoreso TIesrEngineSIso TIesrSIso TestTIesrSI'
+       @echo 'TIesrFAWinso (for Windows only)'
+       @echo 'TIesrFA_ALSAso (for Linux with ALSA support only)'
+       @echo ' '
+       @echo 'Build steps that can be performed are specified by the STEP variable, which'
+       @echo 'may be set to "clean", "build", or "clobber".  If not set, "build" is the default.'
+       @echo 'For example:'
+       @echo ' '
+       @echo 'make LinuxDebugGnu PROJECTS=TIesrDTso STEP=clean'
+       
+
+
diff --git a/TIesrDT/ReadMe.txt b/TIesrDT/ReadMe.txt
new file mode 100644 (file)
index 0000000..8182b12
--- /dev/null
@@ -0,0 +1,43 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+----------------
+
+The TIesrDT API provides a hypothesized pronunciation of a word based on the
+word spelling.
+
+Using the testtiesrdt Program
+-----------------------------
+The testtiesrdt program exercises the TIesrDT API. The command line for the
+program is:
+
+testtiesrdt  tree_path word_file preload_trees
+
+tree_path: Directory where decision trees are located
+word_file: Words for which to generate a pronunciation, one per line
+preload_trees: (0/1) Load and keep all trees in memory for faster operation
+
+An example of running this program from the top-level distribution directory on
+a Linux OS is shown below. This test generates the hypothesized pronunciations
+of three words, "yes", "no", and "maybe".
+
+Dist/LinuxReleaseGnu/bin/testtiesrdt \
+      Data/OffDT_GenDict_PhbVR_LE_MQ/English \
+      Data/TestTIesrDTWords.txt \
+      1
+
+The output should be as follows:
+
+yes:  y z
+no:  n ow
+maybe:  m ey b
+
+Note that the TIesrDT pronunciations are not completely accurate. This is due to
+the uncertainty of pronunciation of the "es" in "yes", since many words
+pronounce "es" as "z". Similarly the "iy" phone is missing from the word
+"maybe", since often a final "e" is not pronounced. These errors are corrected
+by checking the dictionary pronunciation in TIesrDict.
+
+You can determine the pronunciation of other words by supplying a list of words
+other than the TestTIesrDTWords.txt file.
\ No newline at end of file
diff --git a/TIesrDT/TIesrDTso/.dep.inc b/TIesrDT/TIesrDTso/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrDT/TIesrDTso/Makefile b/TIesrDT/TIesrDTso/Makefile
new file mode 100755 (executable)
index 0000000..7e72f63
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+       if [ ${CONF} == LinuxDebugGnu -o \
+       ${CONF} == LinuxDebugGnuCurrent -o \
+       ${CONF} == LinuxReleaseGnu -o \
+       ${CONF} == LinuxReleaseGnuCurrent -o \
+       ${CONF} == ArmLinuxDebugGnueabi -o \
+       ${CONF} == ArmLinuxReleaseGnueabi ]; \
+       then mkdir -p ../../Dist/${CONF}/lib; \
+       cd ../../Dist/${CONF}/lib; \
+       rm -f libTIesrDT.so; \
+       ln -s libTIesrDT.so.1 libTIesrDT.so; \
+       fi
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrDT/TIesrDTso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrDT/TIesrDTso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..2e412e4
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDT.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDT.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrDT.so.1 -Wl,--version-script=../resource/TIesrDTso.map -shared -o ../../Dist/${CND_CONF}/lib/libTIesrDT.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o ../src/TIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDT.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TIesrDTso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrDT/TIesrDTso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..3e332bb
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDT.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDT.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrDT.so.1 -Wl,--version-script=../resource/TIesrDTso.map -shared -o ../../Dist/${CND_CONF}/lib/libTIesrDT.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o ../src/TIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDT.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TIesrDTso/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrDT/TIesrDTso/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..0134d81
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/lib/libTIesrDT.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrDT.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrDT.so.1 -Wl,--version-script=../resource/TIesrDTso.map -shared -o ../../Dist/${CND_CONF}/lib/libTIesrDT.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o ../src/TIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/lib/libTIesrDT.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TIesrDTso/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrDT/TIesrDTso/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..77aa6c2
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/lib/libTIesrDT.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrDT.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrDT.so.1 -Wl,--version-script=../resource/TIesrDTso.map -shared -o ../../Dist/${CND_CONF}/lib/libTIesrDT.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o ../src/TIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/lib/libTIesrDT.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TIesrDTso/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrDT/TIesrDTso/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..d31b5ff
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/libTIesrDT.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrDT.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.c} -v -shared -o ../../Dist/${CND_CONF}/libTIesrDT.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -DTIESRDT_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o ../src/TIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/libTIesrDT.dll
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TIesrDTso/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrDT/TIesrDTso/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..37b1aae
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/libTIesrDT.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrDT.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.c} -v -shared -o ../../Dist/${CND_CONF}/libTIesrDT.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -DTIESRDT_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDT.o ../src/TIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/libTIesrDT.dll
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TIesrDTso/nbproject/Makefile-impl.mk b/TIesrDT/TIesrDTso/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..4f9d678
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TIesrDTso
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrDT/TIesrDTso/nbproject/Makefile-variables.mk b/TIesrDT/TIesrDTso/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..ebd6256
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=libTIesrDT.dll
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/libTIesrDT.dll
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=libTIesrDTso.so.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/libTIesrDTso.so.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=libTIesrDT.dll
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/libTIesrDT.dll
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=libTIesrDTso.so.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/libTIesrDTso.so.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib
+CND_ARTIFACT_NAME_LinuxDebugGnu=libTIesrDT.so.1
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib/libTIesrDT.so.1
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=libTIesrDTso.so.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/libTIesrDTso.so.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib
+CND_ARTIFACT_NAME_LinuxReleaseGnu=libTIesrDT.so.1
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib/libTIesrDT.so.1
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=libTIesrDTso.so.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/libTIesrDTso.so.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=libTIesrDT.so.1
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDT.so.1
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=libTIesrDTso.so.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrDTso.so.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=libTIesrDT.so.1
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDT.so.1
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=libTIesrDTso.so.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrDTso.so.tar
diff --git a/TIesrDT/TIesrDTso/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrDT/TIesrDTso/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..ce5e387
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrDT.so.1
+OUTPUT_BASENAME=libTIesrDT.so.1
+PACKAGE_TOP_DIR=libTIesrDTso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDTso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TIesrDTso/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrDT/TIesrDTso/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..6491dbc
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrDT.so.1
+OUTPUT_BASENAME=libTIesrDT.so.1
+PACKAGE_TOP_DIR=libTIesrDTso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDTso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TIesrDTso/nbproject/Package-LinuxDebugGnu.bash b/TIesrDT/TIesrDTso/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..9dc0aaf
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrDT.so.1
+OUTPUT_BASENAME=libTIesrDT.so.1
+PACKAGE_TOP_DIR=libTIesrDTso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDTso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TIesrDTso/nbproject/Package-LinuxReleaseGnu.bash b/TIesrDT/TIesrDTso/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..567a146
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrDT.so.1
+OUTPUT_BASENAME=libTIesrDT.so.1
+PACKAGE_TOP_DIR=libTIesrDTso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDTso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TIesrDTso/nbproject/Package-WindowsDebugMinGW.bash b/TIesrDT/TIesrDTso/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..7706fb0
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrDT.dll
+OUTPUT_BASENAME=libTIesrDT.dll
+PACKAGE_TOP_DIR=libTIesrDTso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDTso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TIesrDTso/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrDT/TIesrDTso/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..14b208c
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrDT.dll
+OUTPUT_BASENAME=libTIesrDT.dll
+PACKAGE_TOP_DIR=libTIesrDTso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDTso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDTso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TIesrDTso/nbproject/configurations.xml b/TIesrDT/TIesrDTso/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..24d8e59
--- /dev/null
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrDT.h</itemPath>
+      <itemPath>../src/TIesrDT_User.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+      <itemPath>../resource/TIesrDTso.map</itemPath>
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrDT.c</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRDT_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrDT.dll</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRDT_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrDT.dll</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrDT.so.1</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrDT.so.1 -Wl,--version-script=../resource/TIesrDTso.map</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrDT.so.1</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrDT.so.1 -Wl,--version-script=../resource/TIesrDTso.map</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrDT.so.1</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrDT.so.1 -Wl,--version-script=../resource/TIesrDTso.map</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrDT.so.1</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrDT.so.1 -Wl,--version-script=../resource/TIesrDTso.map</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrDT/TIesrDTso/nbproject/private/configurations.xml b/TIesrDT/TIesrDTso/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..a1af2a8
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrDT/TIesrDTso/nbproject/private/private.properties b/TIesrDT/TIesrDTso/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrDT/TIesrDTso/nbproject/private/private.xml b/TIesrDT/TIesrDTso/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrDT/TIesrDTso/nbproject/project.properties b/TIesrDT/TIesrDTso/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrDT/TIesrDTso/nbproject/project.xml b/TIesrDT/TIesrDTso/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..cdfca00
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TIesrDTso</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions>c</c-extensions>
+            <cpp-extensions/>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrDT/TestTIesrDT/.dep.inc b/TIesrDT/TestTIesrDT/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrDT/TestTIesrDT/Makefile b/TIesrDT/TestTIesrDT/Makefile
new file mode 100755 (executable)
index 0000000..524ba36
--- /dev/null
@@ -0,0 +1,111 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrDT/TestTIesrDT/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrDT/TestTIesrDT/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..52d0b84
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrdt
+
+../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrdt: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/bin
+       ${LINK.c} -o ../../Dist/${CND_CONF}/bin/testtiesrdt ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o ../src/TestTIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrdt
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TestTIesrDT/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrDT/TestTIesrDT/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..afc5db0
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrdt
+
+../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrdt: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/bin
+       ${LINK.c} -o ../../Dist/${CND_CONF}/bin/testtiesrdt ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o ../src/TestTIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrdt
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TestTIesrDT/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrDT/TestTIesrDT/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..a305533
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/bin/testtiesrdt
+
+../../Dist/LinuxDebugGnu/bin/testtiesrdt: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/bin
+       ${LINK.c} -o ../../Dist/${CND_CONF}/bin/testtiesrdt ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o ../src/TestTIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/bin/testtiesrdt
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TestTIesrDT/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrDT/TestTIesrDT/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..9cddf71
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/bin/testtiesrdt
+
+../../Dist/LinuxReleaseGnu/bin/testtiesrdt: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/bin
+       ${LINK.c} -o ../../Dist/${CND_CONF}/bin/testtiesrdt ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o ../src/TestTIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/bin/testtiesrdt
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TestTIesrDT/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrDT/TestTIesrDT/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..30c6994
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF} -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/testtiesrdt.exe
+
+../../Dist/WindowsDebugMinGW/testtiesrdt.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.c} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrdt.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o ../src/TestTIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/testtiesrdt.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TestTIesrDT/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrDT/TestTIesrDT/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..d5cf97c
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF} -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/testtiesrdt.exe
+
+../../Dist/WindowsReleaseMinGW/testtiesrdt.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.c} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrdt.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDT.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDT.o ../src/TestTIesrDT.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/testtiesrdt.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDT/TestTIesrDT/nbproject/Makefile-impl.mk b/TIesrDT/TestTIesrDT/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..85cd683
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TestTIesrDT
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrDT/TestTIesrDT/nbproject/Makefile-variables.mk b/TIesrDT/TestTIesrDT/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..8a2da6a
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=testtiesrdt.exe
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/testtiesrdt.exe
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=testtiesrdt.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/testtiesrdt.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=testtiesrdt.exe
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/testtiesrdt.exe
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=testtiesrdt.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/testtiesrdt.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin
+CND_ARTIFACT_NAME_LinuxDebugGnu=testtiesrdt
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin/testtiesrdt
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=testtiesrdt.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/testtiesrdt.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin
+CND_ARTIFACT_NAME_LinuxReleaseGnu=testtiesrdt
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin/testtiesrdt
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=testtiesrdt.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/testtiesrdt.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=testtiesrdt
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrdt
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=testtiesrdt.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrdt.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=testtiesrdt
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrdt
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=testtiesrdt.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrdt.tar
diff --git a/TIesrDT/TestTIesrDT/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrDT/TestTIesrDT/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..bf03964
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrdt
+OUTPUT_BASENAME=testtiesrdt
+PACKAGE_TOP_DIR=testtiesrdt/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdt/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TestTIesrDT/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrDT/TestTIesrDT/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..8a72a4c
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrdt
+OUTPUT_BASENAME=testtiesrdt
+PACKAGE_TOP_DIR=testtiesrdt/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdt/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TestTIesrDT/nbproject/Package-LinuxDebugGnu.bash b/TIesrDT/TestTIesrDT/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..a01502e
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrdt
+OUTPUT_BASENAME=testtiesrdt
+PACKAGE_TOP_DIR=testtiesrdt/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdt/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TestTIesrDT/nbproject/Package-LinuxReleaseGnu.bash b/TIesrDT/TestTIesrDT/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..5be7cb0
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrdt
+OUTPUT_BASENAME=testtiesrdt
+PACKAGE_TOP_DIR=testtiesrdt/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdt/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TestTIesrDT/nbproject/Package-WindowsDebugMinGW.bash b/TIesrDT/TestTIesrDT/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..c14bf85
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrdt.exe
+OUTPUT_BASENAME=testtiesrdt.exe
+PACKAGE_TOP_DIR=testtiesrdt/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdt/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TestTIesrDT/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrDT/TestTIesrDT/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..1e63c29
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrdt.exe
+OUTPUT_BASENAME=testtiesrdt.exe
+PACKAGE_TOP_DIR=testtiesrdt/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdt/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdt.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDT/TestTIesrDT/nbproject/configurations.xml b/TIesrDT/TestTIesrDT/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..dce4e2a
--- /dev/null
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TestTIesrDT.c</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrdt.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrdt.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrdt</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrdt</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrdt</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrdt</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrDT/TestTIesrDT/nbproject/private/configurations.xml b/TIesrDT/TestTIesrDT/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..a40c0b6
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>0</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ/English  ../../Data/TestTIesrDTWords.txt  1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ/English  ../../Data/TestTIesrDTWords.txt  1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ/English  ../../Data/TestTIesrDTWords.txt  1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ/English  ../../Data/TestTIesrDTWords.txt  1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ/English  ../../Data/TestTIesrDTWords.txt  1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ/English  ../../Data/TestTIesrDTWords.txt  1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrDT/TestTIesrDT/nbproject/private/private.properties b/TIesrDT/TestTIesrDT/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrDT/TestTIesrDT/nbproject/private/private.xml b/TIesrDT/TestTIesrDT/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrDT/TestTIesrDT/nbproject/project.properties b/TIesrDT/TestTIesrDT/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrDT/TestTIesrDT/nbproject/project.xml b/TIesrDT/TestTIesrDT/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..9661897
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TestTIesrDT</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions>c</c-extensions>
+            <cpp-extensions/>
+            <header-extensions/>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrDT/resource/TIesrDTso.map b/TIesrDT/resource/TIesrDTso.map
new file mode 100644 (file)
index 0000000..bc1bdfb
--- /dev/null
@@ -0,0 +1,11 @@
+TXN_1.1 {  
+       global:
+                # TIesrDT.o
+                TIesrDT_Create;
+                TIesrDT_CreatePreload;
+                TIesrDT_Pron;
+                TIesrDT_Destroy;
+                
+        local: 
+                * ;
+};
\ No newline at end of file
diff --git a/TIesrDT/src/TIesrDT.c b/TIesrDT/src/TIesrDT.c
new file mode 100755 (executable)
index 0000000..8ec6119
--- /dev/null
@@ -0,0 +1,2777 @@
+/*=======================================================================
+ TIesrDT.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This file contains the source code that implements the TIesrDT
+ decision tree API.
+
+======================================================================*/
+
+
+/* Windows specific include */
+#if defined( WIN32 ) || defined( WINCE )
+#include <windows.h>
+#define strdup _strdup
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "TIesrDT_User.h"
+#include "TIesrDT.h"
+
+
+#if defined( WIN32 ) || defined( WINCE )
+/* Define Windows entry point for TIesrDT API */
+BOOL APIENTRY DllMain( HANDLE hModule,
+                      DWORD  ul_reason_for_call,
+                      LPVOID lpReserved
+                      )
+{
+   switch (ul_reason_for_call)
+   {
+   case DLL_PROCESS_ATTACH:
+   case DLL_THREAD_ATTACH:
+   case DLL_THREAD_DETACH:
+   case DLL_PROCESS_DETACH:
+      break;
+   }
+   return TRUE;
+}
+#endif
+
+
+/*----------------------------------------------------------------
+ TIesrDT_Create
+
+ This function creates a TIesrDT_Struct object and initializes it
+ with a list of attribute values and a list of phones.
+
+ ----------------------------------------------------------------*/
+TIESRDT_API
+TIesrDT_Error_t TIesrDT_Create( TIesrDT_t* aTIesrDTPtr,
+const char* aTreePath )
+{
+   TIesrDT_t TIesrDT;
+   TIesrDT_Error_t dtError;
+   int index;
+   
+   /* Create the structure for this instance */
+   TIesrDT = (TIesrDT_t)malloc( sizeof(TIesrDT_Struct_t) );
+   if( ! TIesrDT )
+   {
+      *aTIesrDTPtr = NULL;
+      return TIesrDTErrorMemory;
+   }
+   
+   
+   /* Initially set decision trees not preloaded */
+   TIesrDT->preLoaded = FALSE;
+   
+   /* initialize the treePointers and charAtt arrays */
+   for( index = 0; index <= MAX_ASCII; index++ )
+   {
+      TIesrDT->treePointers[index] = NULL;
+      TIesrDT->charAtt[index] = UNUSED_ATT;
+   }
+   
+   
+   /* Initialize phone string and tree structure pointers */
+   for( index = 0; index < NUM_PHONES; index++ )
+   {
+      TIesrDT->phone[index] = NULL;
+   }
+   
+   TIesrDT->tree = NULL;
+   
+   TIesrDT->root.AttVal = NULL;
+   
+   
+   /* Obtain the path containing decision tree files */
+   TIesrDT->treePath = strdup( aTreePath );
+   if( ! TIesrDT->treePath )
+   {
+      free( TIesrDT );
+      *aTIesrDTPtr = NULL;
+      return TIesrDTErrorMemory;
+   }
+   
+   
+   /* Load the character attribute value indices into the character
+    attribute array. */
+   dtError = LoadAttributes( TIesrDT );
+   if( dtError != TIesrDTErrorNone )
+   {
+      TIesrDT_Destroy( TIesrDT );
+      *aTIesrDTPtr = NULL;
+      return dtError;
+   }
+   
+   
+   /* Load the phone set and phone class attribute array */
+   dtError = LoadPhones( TIesrDT );
+   if( dtError != TIesrDTErrorNone )
+   {
+      TIesrDT_Destroy( TIesrDT );
+      *aTIesrDTPtr = NULL;
+      return dtError;
+   }
+   
+
+   
+   /* Everything initialized successfully */
+   *aTIesrDTPtr = TIesrDT;
+   return TIesrDTErrorNone;
+}
+
+
+/*----------------------------------------------------------------
+ TIesrDT_CreatePreload
+
+ This function creates a TIesrDT_Struct object and initializes it
+ with a list of attribute values and a list of phones.  It also
+ preloads all of the decision trees.
+ ----------------------------------------------------------------*/
+TIESRDT_API
+TIesrDT_Error_t TIesrDT_CreatePreload( TIesrDT_t* aTIesrDTPtr,
+const char* aTreePath )
+{
+   TIesrDT_t TIesrDT;
+   TIesrDT_Error_t dtError;
+   
+   /* Try to create the TIesrDT instance prior to preload */
+   dtError = TIesrDT_Create( aTIesrDTPtr, aTreePath );
+   if( dtError != TIesrDTErrorNone )
+   {
+      return dtError;
+   }
+   
+   TIesrDT = *aTIesrDTPtr;
+   
+   
+   /* Preload the decision trees */
+   
+   dtError = PreLoadTrees( TIesrDT );
+   if( dtError != TIesrDTErrorNone )
+   {
+      TIesrDT_Destroy( TIesrDT );
+      *aTIesrDTPtr = NULL;
+      return TIesrDTErrorLoad;
+   }
+   
+   /* Trees loaded successfully */
+   TIesrDT->preLoaded = TRUE;
+   
+   return TIesrDTErrorNone;
+}
+
+
+/*----------------------------------------------------------------
+ PreLoadTrees
+
+ This function pre-loads all of the decision trees on the heap,
+ thus making them available for processing of all letters of all
+ words without loading them from files again.
+ ----------------------------------------------------------------*/
+TIesrDT_Error_t PreLoadTrees( TIesrDT_t aTIesrDT )
+{
+   int ascii;
+   FILE* fp = NULL;
+   char fileName[MAX_FILENAME];
+   TIesrDT_Error_t dtError;
+   int treeBytes;
+   unsigned char numBranches;
+   size_t numRead;
+
+   
+   /* Process the trees for each character attribute */
+   for( ascii = 0; ascii <= MAX_ASCII; ascii++ )
+   {
+      /* If the ascii character has an attribute index, this ascii character
+       has a decision tree */
+      if( aTIesrDT->charAtt[ascii] != UNUSED_ATT )
+      {
+         dtError = GetTreeFileName( aTIesrDT, (char)ascii, fileName );
+         if( dtError != TIesrDTErrorNone )
+            goto FailedPreLoad;
+         
+         fp = fopen( fileName, "rb");
+         if( ! fp )
+            goto FailedPreLoad;
+         
+         numRead = fread( &treeBytes, sizeof(int), 1, fp);
+         numRead = fread( &numBranches, sizeof(unsigned char), 1, fp);
+         if( numRead != 1)
+            goto FailedPreLoad;
+
+         /* Tree size must include initial int specifying size of tree structure
+            and must include branch information */
+         treeBytes +=  4 + (numBranches + 1);
+         
+         /* Allocate space for the tree */
+         aTIesrDT->treePointers[ascii] = (unsigned char*)malloc( treeBytes*sizeof(unsigned char));
+         if( aTIesrDT->treePointers[ascii] == NULL )
+            goto FailedPreLoad;
+
+         
+         /* Go to beginning of tree file and read it */
+         fseek( fp, 0, SEEK_SET );
+         numRead = fread( aTIesrDT->treePointers[ascii], sizeof(unsigned char), treeBytes, fp);
+         if( numRead != treeBytes)
+            goto FailedPreLoad;
+
+         fclose(fp);
+      }
+   }
+   
+   return TIesrDTErrorNone;
+   
+   
+   /* A tree could not be loaded, so remove all preloaded trees */
+   FailedPreLoad:
+      if( fp )
+         fclose(fp);
+      
+      for( ascii = 0; ascii <= MAX_ASCII; ascii++ )
+      {
+         if( aTIesrDT->treePointers[ascii] != NULL )
+         {
+            free( aTIesrDT->treePointers[ascii] );
+            aTIesrDT->treePointers[ascii] = NULL;
+         }
+      }
+      return TIesrDTErrorFail;
+}
+
+
+
+/*----------------------------------------------------------------
+ TIesrDT->Pron
+
+ This function returns the pronunciation string corresponding to an
+ input word.  The user of this function provides a string array and
+ its size, into which the function will place the pronunciation.
+
+ ----------------------------------------------------------------*/
+TIESRDT_API
+TIesrDT_Error_t TIesrDT_Pron( TIesrDT_t aTIesrDT,
+const char *aWord,
+char *aPronString, size_t aStringSize )
+{
+   TIesrDT_Error_t dtError;
+   unsigned char noAtt;
+   char* word;
+   char* wordCopy;
+   short chr;
+   short nCharacters;
+   short pos;
+   unsigned char context[DT_CONTEXT_SIZE];
+   short cxtIndex;
+   char* phone;
+   unsigned char phoneIndex;
+   short phoneLen;
+   short pronLen;
+   
+   
+   /* Clear initial pronunciation */
+   aPronString[0] = '\0';
+   
+   
+   /* The "NO_ATTRIBUTE" attribute, which is always the last class attribute. */
+   noAtt = aTIesrDT->classAtt[NUM_PHONE_CLASS - 1];
+   
+   
+   /* Initialize the prior phone class context */
+   for( cxtIndex = DT_CONTEXT_SIZE - DT_LEFT_CLASS;
+   cxtIndex < DT_CONTEXT_SIZE; cxtIndex++ )
+   {
+      context[cxtIndex] = noAtt;
+   }
+   
+   
+   /* Make a local copy of the word, and prepare it. */
+   wordCopy = strdup(aWord);
+   if( wordCopy == NULL )
+   {
+      return TIesrDTErrorMemory;
+   }
+   
+   /* Remove leading blanks from the word, and use only first part of word */
+   word = Deblank( wordCopy );
+   
+   /* Convert word to upper case */
+   ToUpper( word );
+   
+   
+   /* Loop over all characters of the word, getting phones for each character */
+   nCharacters = strlen(word);
+   for( chr = 0; chr < nCharacters; chr++ )
+   {
+      
+      /* Determine the character's context within the word */
+      cxtIndex = 0;
+      
+      /* Left character context */
+      for( pos = chr - DT_LEFT_CHAR; pos < chr; pos++ )
+      {
+         context[cxtIndex++] = ( pos < 0 || pos >= nCharacters ) ?
+         noAtt  :  aTIesrDT->charAtt[ (unsigned char)word[pos] ];
+      }
+      
+      /* Right character context */
+      for( pos = chr + 1; pos <= chr + DT_RIGHT_CHAR;  pos++ )
+      {
+         context[cxtIndex++] = ( pos < 0 || pos >= nCharacters ) ?
+         noAtt  :  aTIesrDT->charAtt[ (unsigned char)word[pos] ];
+      }
+      
+      
+      /* Get the phone index from the decision tree for this character
+       based on this character's context. */
+      dtError = GetDTPhoneIndex( aTIesrDT, word[chr], context, &phoneIndex );
+      if( dtError != TIesrDTErrorNone )
+      {
+         free( wordCopy );
+         return dtError;
+      }
+      
+      /* Determine the phone and its string length */
+      phone = aTIesrDT->phone[phoneIndex];
+      phoneLen = strlen(phone);
+      
+      /* Concatenate phone to the pronunciation string if the phone
+       is not all blanks */
+      if( strspn(phone, " ") != phoneLen )
+      {
+         
+         /* Must check to ensure the string size has not been used up */
+         pronLen = strlen( aPronString );
+         if( aStringSize >= (size_t)(pronLen + phoneLen + 2) )
+         {
+            if( pronLen > 0 ) strcat( aPronString, " " );
+            strcat( aPronString, phone );
+         }
+         else
+         {
+            free( wordCopy );
+            return TIesrDTErrorMemory;
+         }
+      }
+      
+      
+      /* If more characters remain to be processed, update left phone
+       class context */
+      if( DT_LEFT_CLASS > 0 && chr < nCharacters - 1 )
+      {
+         pos = DT_CONTEXT_SIZE - DT_LEFT_CLASS;
+         while( pos < DT_CONTEXT_SIZE - 1 )
+         {
+            context[pos] = context[pos+1];
+            pos++;
+         }
+         context[pos] = aTIesrDT->phoneAtt[phoneIndex];
+      }
+   }
+   
+   /* Finished determining word pronunciation */
+   free( wordCopy );
+   return TIesrDTErrorNone;
+}
+
+
+
+/*----------------------------------------------------------------
+ TIesrDT_Destroy
+
+ This function destroys the contents of the TIesrDT object that
+ was created with TIesrDT_Create.  After this function is called,
+ the pointer to the TIesrDT object is no longer valid.
+
+ ----------------------------------------------------------------*/
+TIESRDT_API
+TIesrDT_Error_t TIesrDT_Destroy( TIesrDT_t aTIesrDT )
+{
+   int index;
+   
+   /* Free phone list strings */
+   for( index = 0; index < NUM_PHONES; index++ )
+   {
+      if( aTIesrDT->phone[index] != NULL )
+      {
+         free( aTIesrDT->phone[index] );
+         aTIesrDT->phone[index] = NULL;
+      }
+   }
+   
+   
+   /* Free preloaded trees, or any remaining individual tree */
+   if( aTIesrDT->preLoaded )
+   {
+      for (index = 0; index <= MAX_ASCII; index++ )
+      {
+         if( aTIesrDT->treePointers[index] != NULL )
+         {
+            free( aTIesrDT->treePointers[index] );
+            aTIesrDT->treePointers[index] = NULL;
+         }
+      }
+   }
+   else
+   {
+      /* Free any existing tree */
+      if( aTIesrDT->tree != NULL )
+      {
+         free( aTIesrDT->tree );
+         aTIesrDT->tree = NULL;
+      }
+   }
+   
+   if (aTIesrDT->root.AttVal)
+   {
+      free(aTIesrDT->root.AttVal);
+      aTIesrDT->root.AttVal = NULL;
+   }
+   
+   /* Free any existing tree path */
+   if( aTIesrDT->treePath != NULL )
+   {
+      free( aTIesrDT->treePath );
+      aTIesrDT->treePath = NULL;
+   }
+   
+   /* destroy the TIesrDT object itself */
+   free( aTIesrDT );
+   
+   return TIesrDTErrorNone;
+}
+
+/*----------------------------------------------------------------
+ LoadAttributes
+
+ This function loads the character attributes value array in the
+ TIesrDT structure, and the class attribute value array.  The
+ character attributes value array, charAtt, is an unsigned byte
+ array, indexed by the ASCII value of the character.  It returns the
+ attribute value corresponding to a character, for example,
+ charAtt['A'].  The charAtt array is sized to hold attribute values
+ for ASCII characters up to and including ASCII value MAX_ASCII.
+ However, the decision tree code is such that it limits the number of
+ attribute values that can be assigned to NUM_ATT_VAL.  Thus some
+ charAtt array entries may not be used.
+
+ The class attribute value array classAtt, specifies that attribute value
+ for each of the class attributes; voiced, unvoiced, etc.
+
+ ----------------------------------------------------------------*/
+static TIesrDT_Error_t LoadAttributes( TIesrDT_t aTIesrDT )
+{
+   FILE* fp;
+   char* attFile;
+   short isClassAtt;
+   unsigned char attString[MAX_STRING];
+   short nClass;
+   
+   /* Open the ascii character attribute file */
+   attFile = (char*)malloc( strlen( aTIesrDT->treePath ) +
+   strlen(FN_ATTVALUE) + 2 );
+   if( ! attFile )
+      return TIesrDTErrorMemory;
+   
+   strcpy( attFile, aTIesrDT->treePath );
+   strcat( attFile, "/" );
+   strcat( attFile, FN_ATTVALUE );
+   
+   fp = fopen( attFile, "r" );
+   if( ! fp )
+   {
+      free( attFile );
+      return TIesrDTErrorFile;
+   }
+   
+   
+   /* Read all attributes and assign values to the attributes. */
+   
+   aTIesrDT->numAtt = 0;
+   while(  fscanf( fp, "%s", attString ) != EOF )
+   {
+      
+      /* Can not have more than allowed number of attributes */
+      if( aTIesrDT->numAtt >= NUM_ATT_VAL )
+      {
+         fclose(fp);
+         free( attFile );
+         return TIesrDTErrorLoad;
+      }
+      
+      
+      /* Check for class attribute, and if so assign its value */
+      isClassAtt = FALSE;
+      for( nClass = 0; nClass < NUM_PHONE_CLASS; nClass++ )
+      {
+         if( ! strcmp( (const char *)attString, PHONECLASSSTRING[nClass] ) )
+         {
+            isClassAtt = TRUE;
+            aTIesrDT->classAtt[nClass] = (unsigned char)aTIesrDT->numAtt++;
+            break;
+         }
+      }
+      
+      /* Present attribute is phone class attribute, go get next attribute. */
+      if( isClassAtt )
+         continue;
+      
+      
+      /* The attribute must be a character attribute.  Assign its value. */
+      if( strlen( (const char *)attString) != 1 || attString[0] > MAX_ASCII )
+      {
+         fclose(fp);
+         free( attFile );
+         return TIesrDTErrorLoad;
+      }
+      
+      aTIesrDT->charAtt[ attString[0] ] = (unsigned char)aTIesrDT->numAtt++;
+   }
+   
+   /* Assigned all attribute values successfully */
+   fclose( fp );
+   free( attFile );
+   return TIesrDTErrorNone;
+}
+
+
+
+/*----------------------------------------------------------------
+ LoadPhones
+
+ This function loads the phones and their respective class attributes
+ from the FN_NEWPHONE file into the TIesrDT structure. The phone
+ string array provides the phone string corresponding to the phone
+ index value used in the decision tree.  The phone class array
+ indicates whether a phone has a particular class value, such as
+ voiced, unvoiced, or short pause.
+
+ The FN_NEWPHONE file has the format one entry per line consisting of
+ a phone string followed by whitespace followed by the phone's class
+ string.  The class string is one of the strings in the
+ phoneClassString array.
+
+ ----------------------------------------------------------------*/
+static TIesrDT_Error_t LoadPhones( TIesrDT_t aTIesrDT )
+{
+   FILE* fp;
+   char* phoneFile;
+   char phoneString[MAX_STRING];
+   char classString[MAX_STRING];
+   int isClass;
+   int nClass;
+   int numRead;
+   char* phone;
+   
+   /* Open the phone list file */
+   phoneFile = (char*)malloc( strlen( aTIesrDT->treePath ) + strlen(FN_NEWPHONE) + 2 );
+   if( ! phoneFile )
+      return TIesrDTErrorMemory;
+   
+   strcpy( phoneFile, aTIesrDT->treePath );
+   strcat( phoneFile, "/" );
+   strcat( phoneFile, FN_NEWPHONE );
+   
+   fp = fopen( phoneFile, "r" );
+   if( ! fp )
+   {
+      free( phoneFile );
+      return TIesrDTErrorFile;
+   }
+   
+   
+   /* Read phones, and their classes which indicate voiced, unvoiced,
+    short pause, or perhaps other classes in the future. */
+   aTIesrDT->numPhones = 0;
+   
+   numRead = fscanf( fp, "%s %s", phoneString, classString );
+   while( numRead != EOF )
+   {
+      /* Must have both phoneString and classString. */
+      if( numRead != 2 )
+      {
+         fclose(fp);
+         free( phoneFile );
+         return TIesrDTErrorLoad;
+      }
+      
+      /* Save the phone string ordered by location in file */
+      aTIesrDT->phone[aTIesrDT->numPhones] = strdup( phoneString );
+      if( aTIesrDT->phone[aTIesrDT->numPhones] == NULL )
+      {
+         fclose(fp);
+         free( phoneFile );
+         return TIesrDTErrorMemory;
+      }
+      
+      /* Change '_' in a pseudo-phone to a space, which will make
+       output faster, if many words are being looked up */
+      for( phone = aTIesrDT->phone[aTIesrDT->numPhones];
+      *phone; phone++ )
+      {
+         if( *phone == '_' )
+            *phone = ' ';
+      }
+      
+      
+      /* Determine the class of the phone, and assign its attribute */
+      isClass = FALSE;
+      for( nClass = 0; nClass < NUM_PHONE_CLASS; nClass++ )
+      {
+         if( ! strcmp( classString, PHONECLASSSTRING[nClass] ) )
+         {
+            isClass = TRUE;
+            aTIesrDT->phoneAtt[aTIesrDT->numPhones] =
+            aTIesrDT->classAtt[nClass];
+            break;
+         }
+      }
+      
+      
+      /* Phone must have a valid class attribute */
+      if( ! isClass )
+      {
+         fclose(fp);
+         free( phoneFile );
+         return TIesrDTErrorLoad;
+      }
+      
+      
+      /* Completed reading the current phone and class. Go to next one. */
+      aTIesrDT->numPhones++;
+      numRead = fscanf( fp, "%s %s", phoneString, classString );
+   }
+   
+   
+   /* Completed loading phones and classes successfully */
+   fclose( fp );
+   free( phoneFile );
+   return TIesrDTErrorNone;
+}
+
+
+/*----------------------------------------------------------------
+ LoadTreeFile
+
+ This function loads the tree file corresponding to the given
+ character from the path in the TIesrDT object, and puts the pointer
+ to the tree in the TIesrDT object.  If the trees have not been preloaded 
+ as indicated by the TIesrDT preLoaded flag not being set, then space will
+ be allocated for the entire tree, and it will be loaded into heap memory.
+ Otherwise, pointers to the proper tree data will be set in the TIesrDT
+ object without loading any tree data from a file.
+
+ Now loads *.olmdtpm
+ ----------------------------------------------------------------*/
+static TIesrDT_Error_t LoadTreeFile( TIesrDT_t aTIesrDT, char aChar )
+{
+   char treeFile[MAX_FILENAME];
+   int treeBytes;
+   size_t numRead;
+   FILE* fp;
+   unsigned char nBranch;
+   unsigned char nValue;
+   short iTmp;
+   int fromFile;
+   unsigned char *treePtr;
+   TIesrDT_Error_t dtError;
+   
+   
+   /* Determine if tree info comes from file or preLoaded info */
+   fromFile = ! aTIesrDT->preLoaded;
+   
+   /* Open a file pointer to the tree to preload or load from file */
+   if( fromFile )
+   {
+      dtError = GetTreeFileName( aTIesrDT, aChar, treeFile );
+      
+      /* Open the tree file if possible */
+      fp = fopen( treeFile, "rb" );
+      if( ! fp )
+      {
+         return TIesrDTErrorFail;
+      }
+   }
+   else
+   {
+      /* Tree comes from preLoaded location */
+      treePtr = aTIesrDT->treePointers[(int)aChar];
+   }
+   
+   
+   /* Size of the tree exclusive of branch info */
+   if( fromFile )
+   {
+      numRead = fread( &treeBytes,  sizeof(int), 1, fp );
+      if( numRead  != 1 )
+      {
+         fclose( fp );
+         return TIesrDTErrorLoad;
+      }
+   }
+   else
+   {
+      treeBytes = *( (int*)treePtr );
+      treePtr += sizeof(int);
+   }
+   
+   
+   
+   /* Number of branches */
+   if( fromFile )
+   {
+      numRead = fread(&nBranch, sizeof(char), 1, fp);
+      if( numRead  != 1 )
+      {
+         fclose( fp );
+         return TIesrDTErrorLoad;
+      }
+   }
+   else
+      nBranch = *treePtr++;
+
+   aTIesrDT->stAttInfo.numAttTypes = (short)nBranch;
+   
+  
+   /* Branch info */
+   for (iTmp = 0; iTmp < nBranch; iTmp++)
+   {
+      if( fromFile )
+      {
+         numRead = fread(&nValue, sizeof(char), 1, fp);
+         if( numRead  != 1 )
+         {
+            fclose( fp );
+            return TIesrDTErrorLoad;
+         }
+      }
+      else
+         nValue = *treePtr++;
+      
+      aTIesrDT->stAttInfo.numAttValPerAttType[iTmp] = (short) nValue;
+   }
+   
+   
+   /* Read tree from file or get pointer to it. */
+   if( fromFile )
+   {
+      aTIesrDT->tree = (unsigned char*)malloc( treeBytes*sizeof(unsigned char) );
+      if( ! aTIesrDT->tree )
+      {
+         fclose( fp );
+         return TIesrDTErrorMemory;
+      }
+      
+      numRead = fread( aTIesrDT->tree, sizeof(unsigned char), treeBytes, fp );
+      fclose(fp);
+      if( numRead != treeBytes )
+      {
+         free( aTIesrDT->tree );
+         aTIesrDT->tree = NULL;
+         return TIesrDTErrorLoad;
+      }
+   }
+   else
+   {
+      aTIesrDT->tree = treePtr;
+   }
+
+   aTIesrDT->treeSize = treeBytes;
+   return TIesrDTErrorNone;
+}
+
+/*-----------------------------------------------------------------
+ GetTreeFileName
+
+ Get the name of the file holding the decision tree for a character
+ attribute.
+ ------------------------------------------------------------------*/
+static TIesrDT_Error_t GetTreeFileName( TIesrDT_t aTIesrDT, char aChar, char* aFileName )
+{
+   int isSpecial;
+   int chrIndex;
+   int pos;
+
+   
+   strcpy( aFileName, aTIesrDT->treePath );
+   strcat( aFileName, "/" );
+   
+   /* Must determine if the character is a special character that has a special
+    file name associated with it. */
+   isSpecial = FALSE;
+   for( chrIndex = 0; chrIndex < NUM_FN_CHAR; chrIndex++ )
+   {
+      if( aChar == FNCHAR[chrIndex] )
+      {
+         isSpecial = TRUE;
+         strcat( aFileName, FNNAME[chrIndex] );
+         break;
+      }
+   }
+   
+   /* If not special, then use character as file name */
+   if( ! isSpecial )
+   {
+      pos = strlen( aFileName );
+      aFileName[pos++] = aChar;
+      aFileName[pos] = '\0';
+   }
+   
+   strcat( aFileName, EXT_LMDTPM );
+   return TIesrDTErrorNone;
+}
+
+
+/*----------------------------------------------------------------
+ AtLeaf
+
+ This function determines if the present offset is at a leaf node
+ set, which is indicated by the top bit of the current byte having a
+ zero.  This can be put in a macro later, but for now it is a
+ function for debugging.
+
+ ----------------------------------------------------------------*/
+static short AtLeaf( const unsigned char* aTree, int aOffset )
+{
+   unsigned char byte;
+   
+   byte = aTree[ aOffset ];
+   
+   return ( ( byte & LEAFBIT ) == 0 );
+}
+
+static eNodeType TypeOfNode( const unsigned char* aTree, int aOffset )
+{
+   unsigned char byte;
+   
+   byte = aTree[ aOffset ];
+   
+   if (( byte & LEAFBIT ) == 0 )
+      return LEAFSET;
+   else
+   {
+      if (byte & NODE_QUESTION)
+         return BRANCHSET;
+      else
+         return QUESTION;
+   }
+}
+
+
+/*----------------------------------------------------------------
+ GetBranchInfo
+
+ This function retrieves the information encoded in the bit fields
+ of the two-byte branch node pointed to by the offset into the tree.
+
+ ----------------------------------------------------------------*/
+// for loading *.rlmdtpm
+#ifdef DEV_OFFSET
+static TIesrDT_Error_t GetBranchInfo( const unsigned char* aTree,
+int aOffset,
+unsigned short* aBranchOffset,
+unsigned char* aBranchLeafContext,
+unsigned int * pSize )
+{
+   unsigned short branch;
+   
+   if( ( aTree[aOffset] | LEAFBIT ) == 0 )
+      return TIesrDTErrorFail;
+   
+   branch = aTree[aOffset] << 8;
+   branch |= (unsigned short) aTree[aOffset+1];
+   
+   *aBranchOffset = ( branch & BRANCHOFFSET )  ;
+   *aBranchLeafContext = (( branch & BRANCHLEAFCONTEXT_RLM ) >> BLEAFCXTSHIFT_SHIFT);
+   
+   if (pSize) (*pSize) += sizeof(short); // increase number of bytes
+   return TIesrDTErrorNone;
+}
+
+/* GetQuestion
+
+ return the question of a leaf set
+ @param aTree pointer to the tree of the decision tree
+ @param aOffset offset in the tree of the decision tree
+ @param aLeafContext pointer to the returned leaf context (question)
+ @param aptrISize pointer the offset after reading the information
+ */
+static TIesrDT_Error_t GetQuestion( const unsigned char* aTree,
+int aOffset,
+unsigned char* aLeafContext,
+unsigned int * aptrISize )
+{
+   unsigned char branch;
+   
+   if( ( aTree[aOffset] | LEAFBIT ) == 0 )
+      return TIesrDTErrorFail;
+   
+   branch = (aTree[aOffset] &  QUESTION_IN_QUESTION_NODE);
+   *aLeafContext = branch;
+   
+   if (aptrISize) (*aptrISize) += sizeof(unsigned char); // increase number of bytes
+   return TIesrDTErrorNone;
+}
+
+#else
+static TIesrDT_Error_t GetBranchInfo( const unsigned char* aTree,
+int aOffset,
+unsigned char* aBranchPhone,
+unsigned char* aBranchAttribute,
+unsigned char* aBranchLeafContext,
+unsigned int * pSize )
+{
+   unsigned short branch;
+   
+   
+   if( ( aTree[aOffset] | LEAFBIT ) == 0 )
+      return TIesrDTErrorFail;
+   
+   branch = aTree[aOffset] << 8;
+   branch |= (unsigned short) aTree[aOffset+1];
+   
+   *aBranchPhone = ( branch & BRANCHPHONE )  ;
+   *aBranchAttribute = (( branch & BRANCHATTRIBUTE_RLM ) >> BATTSHIRT);
+   *aBranchLeafContext = (( branch & BRANCHLEAFCONTEXT_RLM ) >> BLEAFCXTSHIFT_RLM);
+   
+   if (pSize) (*pSize) += sizeof(short); // increase number of bytes
+   return TIesrDTErrorNone;
+}
+
+/*----------------------------------------------------------------
+ FindNextTopNode
+
+ This function searches through the tree, starting at the global
+ offset location, for the next leaf node set or branch node
+ corresponding to the top branch node context.
+
+ ---------------------------------------------------------------*/
+static TIesrDT_Error_t FindNextTopNode( TIesrDT_t aTIesrDT )
+{
+   TIesrDT_Error_t dtError;
+   unsigned char* tree;
+   int offset;
+   
+   unsigned char topContext;
+   
+   unsigned char branchContext;
+   unsigned char branchAttribute;
+   unsigned char branchLeafContext;
+   
+   
+   /* Start from global offset location */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   topContext = aTIesrDT->topBranchContext;
+   
+   /* Search through tree. */
+   while( offset < aTIesrDT->treeSize )
+   {
+      /* If at a leaf node set, then this set is outside of a branch */
+      if( AtLeaf( tree, offset ) )
+      {
+         aTIesrDT->treeOffset = offset;
+         return TIesrDTErrorNone;
+      }
+      
+      
+      /* At a branch node. */
+      else
+      {
+         /* Check if branch is a top context branch */
+         dtError = GetBranchInfo( tree, offset,
+         &branchContext,
+         &branchAttribute,
+         &branchLeafContext , NULL );
+         
+         if( branchContext == topContext )
+         {
+            aTIesrDT->treeOffset = offset;
+            return TIesrDTErrorNone;
+         }
+         
+         else
+         {
+            /* Go past branch node, and check for end of file, which
+             should not happen since all branches should have either
+             other branch nodes or leaf nodes under them. */
+            offset+=2;
+            if( offset >= aTIesrDT->treeSize )
+               return TIesrDTErrorFail;
+            
+            
+            /* skip past the leaf node set corresponding to this branch,
+             if it exists. */
+            if( AtLeaf( tree, offset ) )
+            {
+               SkipPastLeafSet( tree, &offset , NULL);
+            }
+            
+         }
+      }
+   }
+   
+   
+   /* Could not find a next top node. This should never happen. */
+   return TIesrDTErrorFail;
+}
+
+
+/*----------------------------------------------------------------
+ SearchTopLeafSet
+
+ The current offset into the tree is at a leaf node set that should
+ be compared with the top node context to determine if any of the
+ leaf nodes contain a match to the context.  If a node matches the
+ context, then output the node's phone index.  Otherwise, there is
+ not a match, and the search must continue.
+
+ If the top branch context has not yet been defined, then a search
+ will be made for the context of the top branch prior to doing a
+ search for a context match.  If no top context exists, then it is
+ assumed that the tree is degenerate, that is it contains only one
+ leaf node which defines the phone index to output.
+
+ ----------------------------------------------------------------*/
+static TIesrDT_Error_t SearchTopLeafSet( TIesrDT_t aTIesrDT,
+const unsigned char* aContext,
+short* aPhoneIndex )
+{
+   TIesrDT_Error_t dtError;
+   
+   
+   dtError = SearchLeafSet( aTIesrDT, aContext,
+   aTIesrDT->topBranchContext,
+   aPhoneIndex , NULL);
+   
+   return dtError;
+}
+
+#endif
+
+/*----------------------------------------------------------------
+ SearchLeafSet
+
+ This function searches a leaf set to determine if any of the leaf
+ nodes of the set contain the attribute value that matches the
+ specified context.
+
+ ----------------------------------------------------------------*/
+#ifdef DEV_OFFSET
+static TIesrDT_Error_t  SearchLeafSet( TIesrDT_t aTIesrDT,
+const unsigned char* aContext,
+short aMatchContext,
+short *aPhoneIndex )
+{
+   unsigned char *tree;
+   int offset;
+   unsigned char matchAttribute = CXT_NONE;
+   short nodeCount;
+   unsigned char phoneIndex;
+   short numNodeWithPhone;
+   short attCount;
+   char nodeAtt, lastAtt;
+   short iLastRead, sizeLeafSet;
+   
+   
+   /* Find the word context attribute defining a match.  If aMatchContext is
+    CXT_NONE, then the first leaf node is the only leaf node and it matches
+    by default. */
+   if( aMatchContext != CXT_NONE )
+   {
+      matchAttribute = aContext[aMatchContext];
+   }
+   
+   /* Search the leaf node set pointed to by the global tree offset
+    * for a match */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   iLastRead = offset;
+   
+   /* Number of leaf nodes in set */
+   sizeLeafSet = (short)tree[offset++];
+   
+   /* Check leaf nodes corresponding to each phone index in the set */
+   nodeCount = 0;
+   while( (offset - iLastRead) < sizeLeafSet )
+   {
+      /* Phone index for a set of attribute values */
+      phoneIndex = tree[offset++];
+      
+      if( aMatchContext == CXT_NONE ||
+      (offset - iLastRead == sizeLeafSet) )
+      {
+         /* Two conditions to return phone:
+          1) Context free phone
+          2) the last phone of the set.
+          In the second case, the letters and phone classes do not need to be saved */
+         *aPhoneIndex = phoneIndex;
+         return TIesrDTErrorNone;
+      }
+      
+      /* Number of leaf nodes with attribute values for this phone */
+      numNodeWithPhone = tree[offset++];
+      
+      attCount = 0;
+      while( attCount < numNodeWithPhone )
+      {
+         /* Attribute value, or if negative, a negative value
+          indicating the end of a sequence of attribute values
+          corresponding to the present phone index. */
+         nodeAtt = (char)tree[offset++];
+         
+         /* Individual attribute value or start of sequence. */
+         if( ! (nodeAtt & 0x80) )
+         {
+            
+            /* Found a match, so done with the tree */
+            if( matchAttribute == nodeAtt )
+            {
+               /* Don't have to do this, since done with the tree.  Its here
+                just to remind that there has been an offset.
+               
+                TIesrDT->treeOffset = offset; */
+               
+               *aPhoneIndex = phoneIndex;
+               return TIesrDTErrorNone;
+            }
+            
+            /* Increment attribute count, and keep track of this
+             attribute value in case the next attribute is negative
+             indicating an attribute sequence. */
+            attCount++;
+            lastAtt = nodeAtt;
+         }
+         
+         /* nodeAtt indicates end of a sequence of attribute values */
+         else
+         {
+            
+            /* Check if the match attribute is contained in the sequence.
+             If so, found a match and done with the tree. */
+            if( matchAttribute > lastAtt && matchAttribute <= (nodeAtt & 0x7f) )
+            {
+               /* Don't have to do this, since done with the tree.  Its here
+                just to remind that there has been an offset.
+               
+                TIesrDT->treeOffset = offset; */
+               
+               *aPhoneIndex = phoneIndex;
+               return TIesrDTErrorNone;
+            }
+            
+            /* Update count of attributes encountered for this phone
+             given by the attribute sequence. */
+            attCount += ( (nodeAtt & 0x7f)  - lastAtt );
+         }
+      }
+      
+      nodeCount += numNodeWithPhone;
+   }
+   
+   
+   /* Did not find a match in any of the leaf nodes */
+   aTIesrDT->treeOffset = offset;
+   *aPhoneIndex = -1;
+   
+   return TIesrDTErrorNone;
+}
+
+#else
+static TIesrDT_Error_t  SearchLeafSet( TIesrDT_t aTIesrDT,
+const unsigned char* aContext,
+short aMatchContext,
+short *aPhoneIndex ,
+short * ptrNumLeaves )
+{
+   unsigned char *tree;
+   int offset;
+   
+   unsigned char matchAttribute;
+   
+   short numLeafNodes;
+   short nodeCount;
+   unsigned char phoneIndex;
+   short numNodeWithPhone;
+   short attCount;
+   char nodeAtt;
+   
+   
+   /* Find the word context attribute defining a match.  If aMatchContext is
+    CXT_NONE, then the first leaf node is the only leaf node and it matches
+    by default. */
+   if( aMatchContext != CXT_NONE )
+   {
+      matchAttribute = aContext[aMatchContext];
+   }
+   
+   /* Search the leaf node set pointed to by the global tree offset
+    * for a match */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   /* Number of leaf nodes in set */
+   numLeafNodes = (short)tree[offset++];
+   
+   /* Check leaf nodes corresponding to each phone index in the set */
+   nodeCount = 0;
+   while( nodeCount < numLeafNodes )
+   {
+      /* Phone index for a set of attribute values */
+      phoneIndex = tree[offset++];
+      
+      /* Number of leaf nodes with attribute values for this phone */
+      numNodeWithPhone = tree[offset++];
+      
+      attCount = 0;
+      while( attCount < numNodeWithPhone )
+      {
+         /* Attribute value, or if negative, a negative value
+          indicating the end of a sequence of attribute values
+          corresponding to the present phone index. */
+         nodeAtt = (char)tree[offset++];
+         
+         /* Individual attribute value or start of sequence. */
+         if( (nodeAtt & 0x80) == 0)
+         {
+            
+            /* Found a match, so done with the tree */
+            if( aMatchContext == CXT_NONE || matchAttribute == nodeAtt )
+            {
+               /* Don't have to do this, since done with the tree.  Its here
+                just to remind that there has been an offset.
+               
+                TIesrDT->treeOffset = offset; */
+               
+               *aPhoneIndex = phoneIndex;
+               return TIesrDTErrorNone;
+            }
+            
+         }
+         
+         /* nodeAtt indicates end of a sequence of attribute values */
+         else
+         {
+            
+            /* Check if the match attribute is contained in the sequence.
+             If so, found a match and done with the tree. */
+            //     if( matchAttribute > lastAtt && matchAttribute <= (0x7f & nodeAtt) )
+            if( matchAttribute == (0x7f & nodeAtt) )
+            {
+               /* Don't have to do this, since done with the tree.  Its here
+                just to remind that there has been an offset.
+               
+                TIesrDT->treeOffset = offset; */
+               
+               *aPhoneIndex = phoneIndex;
+               return TIesrDTErrorNone;
+            }
+            
+         }
+         
+         attCount ++;
+      }
+      
+      nodeCount += numNodeWithPhone;
+   }
+   
+   
+   /* Did not find a match in any of the leaf nodes */
+   aTIesrDT->treeOffset = offset;
+   *aPhoneIndex = -1;
+   
+   if (ptrNumLeaves)
+      *ptrNumLeaves = numLeafNodes;
+   
+   return TIesrDTErrorNone;
+}
+#endif
+
+#ifdef DEV_OFFSET
+/*  SearchBranchSet
+
+ This function decode an integer index of a branch that is
+ embedded into a run-length code in branchset.
+ For example, branches with letter A, B, C will be compressed to
+ A, -C. If the branch with letter B is to be locataed, its index is
+ obtained as B-A = 1, which is the second branch with index 1.
+ @param aTIesrDT pointer to TIesrDT
+ @param aContext char pointer to context
+ @param aMatchContext the requested context
+ @param aBranchIndex pointer to branch index to be returned
+ */
+static TIesrDT_Error_t  SearchBranchSet( TIesrDT_t aTIesrDT,
+const unsigned char* aContext,
+short aMatchContext,
+short *aBranchIndex )
+{
+   unsigned char *tree;
+   int offset;
+   unsigned char matchAttribute;
+   short attCount = 0;
+   char nodeAtt;
+   short lastAtt;
+   short sizeBranchSet;
+   short byteCount;
+   
+   /* Search the leaf node set pointed to by the global tree offset
+    * for a match */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   *aBranchIndex = -1;
+   
+   /* Number of bytes of the branch set */
+   sizeBranchSet = (short)(tree[offset++] & ((~NODE_BRANCHSET) & 0xff));
+   
+   if( aMatchContext != CXT_NONE )
+   {
+      matchAttribute = aContext[aMatchContext];
+   }
+   
+   /* Check leaf nodes corresponding to each phone index in the set */
+   byteCount = 1;
+   while( byteCount < sizeBranchSet )
+   {
+      /* Attribute value, or if negative, a negative value
+       indicating the end of a sequence of attribute values
+       corresponding to the present phone index. */
+      nodeAtt = (char)tree[offset++];
+      byteCount++;
+      
+      /* Individual attribute value or start of sequence. */
+      if( ! (nodeAtt & 0x80) )
+      {
+         
+         /* Found a match, so done with the tree */
+         if( matchAttribute == nodeAtt )
+         {
+            /* Don't have to do this, since done with the tree.  Its here
+             just to remind that there has been an offset.
+            
+             TIesrDT->treeOffset = offset; */
+            
+            *aBranchIndex = attCount;
+            break;
+         }
+         
+         /* Increment attribute count, and keep track of this
+          attribute value in case the next attribute is negative
+          indicating an attribute sequence. */
+         attCount++;
+         lastAtt = nodeAtt;
+      }
+      
+      /* nodeAtt indicates end of a sequence of attribute values */
+      else
+      {
+         
+         /* Check if the match attribute is contained in the sequence.
+          If so, found a match and done with the tree. */
+         if( matchAttribute > lastAtt && matchAttribute <= (nodeAtt & 0x7f) )
+         {
+            /* Don't have to do this, since done with the tree.  Its here
+             just to remind that there has been an offset.
+            
+             TIesrDT->treeOffset = offset; */
+            
+            attCount += (matchAttribute - lastAtt - 1);
+            *aBranchIndex = attCount;
+            
+            break;
+         }
+         
+         /* Update count of attributes encountered for this phone
+          given by the attribute sequence. */
+         attCount += ( (nodeAtt & 0x7f) - lastAtt );
+      }
+   }
+   
+   /* Did not find a match in any of the leaf nodes */
+   aTIesrDT->treeOffset += sizeBranchSet;
+   return TIesrDTErrorNone;
+}
+
+/* SearchBranchSetOffset
+
+ Move the offset to the correct offset of sublevel branches or the same
+ level leafset.
+ 1) if the requested BranchIndex is given, then
+ move the offset to the sublevel branch, also obtain the sublevel question
+ 2) else move the offset to the same level leaf set which contains
+ pronunciation .
+
+ @param aTIesrDT pointer to the decision tree
+ @param aContext context of the letter to be pronunced
+ @param aMatchContext the question of this level
+ @param aBranchIndex the sub-level branch to be located
+ @param aLeafContext question of the sublevel branch
+ */
+static TIesrDT_Error_t  SearchBranchSetOffset( TIesrDT_t aTIesrDT,
+const unsigned char* aContext,
+short aMatchContext,
+short aBranchIndex,
+unsigned char * aLeafContext)
+{
+   unsigned char *tree;
+   int offset;
+   short numBranches;
+   short i;
+   short lastPos;
+   int offsetToTheBranch = 0;
+   short branchSiblingOffset;
+   TIesrDT_Error_t dtError;
+   
+   /* Search the leaf node set pointed to by the global tree offset
+    * for a match */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   /* get the number of branches */
+   numBranches = (short) tree[offset++];
+   lastPos = offset;
+   
+   if (aBranchIndex >= 0)
+   {
+      /* the requested branch index is given */
+      
+      /* accumulate offset */
+      for (i=0;i<aBranchIndex;i++)
+      {
+         /* Determine the branch context and attribute to match. */
+         /* Move past branch to its leaf node set */
+         dtError = GetBranchInfo( tree, offset,
+         (unsigned short *)&branchSiblingOffset,
+         aLeafContext,
+         (unsigned int*)&offset);
+         if (dtError != TIesrDTErrorNone)
+         {
+            return dtError;
+         }
+         
+         offsetToTheBranch += branchSiblingOffset;
+         
+      }
+      
+      dtError = GetBranchInfo( tree, offset,
+      (unsigned short *)&branchSiblingOffset,
+      aLeafContext,
+      (unsigned int *)&offset);
+      if (dtError != TIesrDTErrorNone)
+      {
+         return dtError;
+      }
+   }
+   
+   /* offset to position after the end of the BranchOffset data */
+   offset = lastPos + numBranches*sizeof(short);
+   
+   /* need to check if the following read data belongs to the same level */
+   if (numBranches < aTIesrDT->stAttInfo.numAttValPerAttType[aMatchContext]
+   && aBranchIndex >= 0 )
+   {
+      /* still in the same level */
+      /* the following data should be leaf set */
+      
+      if (!AtLeaf(tree, offset))
+      {
+         return dtError;
+      }
+      
+      /* offset to the sublevel branches */
+      offset += (int) tree[offset];
+      
+   }
+   
+   /* return the offset in the tree of the first child */
+   aTIesrDT->treeOffset = offsetToTheBranch + offset;
+   
+   return TIesrDTErrorNone;
+}
+#endif
+
+/*----------------------------------------------------------------
+ FindTopBranchContext
+
+ This function searches through the decision tree to find the first
+ branch node.  Its context defines the top branch context.  If the
+ decision tree has no branch nodes, then it is assumed that the
+ decision tree consists of a single leaf node that defines the output
+ phone index for all possible contexts.
+
+ ----------------------------------------------------------------*/
+#ifdef DEV_OFFSET
+static TIesrDT_Error_t FindTopBranchContext( TIesrDT_t aTIesrDT )
+{
+   TIesrDT_Error_t dtError;
+   unsigned char* tree;
+   int treeOffset;
+   unsigned short branchOffset;
+   unsigned char branchLeafContext;
+   
+   
+   /* Start at top of the tree */
+   tree = aTIesrDT->tree;
+   treeOffset = 0;
+   aTIesrDT->treeOffset = treeOffset;
+   
+   /* Offset is at the first branch node.  Get its info */
+   dtError = GetBranchInfo( tree, treeOffset,
+   &branchOffset,
+   &branchLeafContext ,
+   (unsigned int *)&aTIesrDT->treeOffset);
+   
+   if (dtError == TIesrDTErrorFail)
+   {
+      aTIesrDT->topBranchContext = CXT_NONE;
+      return TIesrDTErrorNone;
+   }
+   
+   aTIesrDT->topBranchContext = branchLeafContext;
+   
+   return TIesrDTErrorNone;
+}
+#else
+static TIesrDT_Error_t FindTopBranchContext( TIesrDT_t aTIesrDT )
+{
+   TIesrDT_Error_t dtError;
+   unsigned char* tree;
+   int treeOffset;
+   
+   unsigned char branchPhone;
+   unsigned char branchAttribute;
+   unsigned char branchLeafContext;
+   
+   
+   /* Start at top of the tree */
+   tree = aTIesrDT->tree;
+   treeOffset = 0;
+   aTIesrDT->treeOffset = treeOffset;
+   
+   /* Offset is at the first branch node.  Get its info */
+   dtError = GetBranchInfo( tree, treeOffset,
+   &branchPhone,
+   &branchAttribute,
+   &branchLeafContext ,
+   &aTIesrDT->treeOffset);
+   if (dtError == TIesrDTErrorFail)
+   {
+      aTIesrDT->topBranchContext = CXT_NONE;
+      return TIesrDTErrorNone;
+   }
+   
+   aTIesrDT->topBranchContext = branchLeafContext;
+   aTIesrDT->cxtfrPhone = branchPhone;
+   
+   return TIesrDTErrorNone;
+}
+
+
+/* If tree starts with top branch context leaf set, go past them to
+ get to the top branch node. */
+if( AtLeaf(tree, treeOffset) )
+{
+   SkipPastLeafSet( tree, &treeOffset, NULL );
+   
+   /* All nodes in tree are a single leaf set, no branch nodes */
+   if( treeOffset >= aTIesrDT->treeSize )
+   {
+      aTIesrDT->topBranchContext = CXT_NONE;
+      return TIesrDTErrorNone;
+   }
+}
+
+
+/* Offset is at the first branch node.  Get its info */
+dtError = SFB_GetBranchInfo( tree, treeOffset,
+&branchContext, d
+&branchAttribute,
+&branchLeafContext );
+
+
+aTIesrDT->topBranchContext = branchContext;
+return TIesrDTErrorNone;
+}
+
+/*----------------------------------------------------------------
+ SkipPastLeafSet
+
+ The offset pointer argument is pointing to the start of a leaf set
+ of a tree. Move the offset pointer past the leaf set.
+
+ ----------------------------------------------------------------*/
+static TIesrDT_Error_t SFB_SkipPastLeafSet( const unsigned char* aTree,
+int *aOffset)
+{
+   int offset;
+   
+   short numLeafNodes;
+   unsigned char phoneIndex;
+   short nodeCount;
+   short numNodeWithPhone;
+   short attCount;
+   short nodeAtt;
+   short lastAtt;
+   
+   offset = *aOffset;
+   
+   /* Number of leaf nodes in set */
+   numLeafNodes = (short)aTree[offset++];
+   
+   /* Skip past leaf nodes corresponding to each phone index in the set */
+   nodeCount = 0;
+   while( nodeCount < numLeafNodes )
+   {
+      /* Phone index for a set of attribute values */
+      phoneIndex = aTree[offset++];
+      
+      /* Number of leaf nodes with attribute values for this phone */
+      numNodeWithPhone = aTree[offset++];
+      
+      attCount = 0;
+      while( attCount < numNodeWithPhone )
+      {
+         /* Attribute value, or if negative, a negative value
+          indicating the end of a sequence of attribute values
+          corresponding to the present phone index. */
+         nodeAtt = (char)aTree[offset++];
+         
+         /* Individual attribute value or start of sequence. */
+         if( nodeAtt >= 0 )
+         {
+            attCount++;
+            lastAtt = nodeAtt;
+         }
+         
+         /* nodeAtt indicates end of a sequence of attribute values */
+         else
+         {
+            attCount += ( -nodeAtt  - lastAtt );
+         }
+      }
+      
+      nodeCount += numNodeWithPhone;
+   }
+   
+   *aOffset = offset;
+   
+   return TIesrDTErrorNone;
+}
+
+static TIesrDT_Error_t SkipPastLeafSet( const unsigned char* aTree,
+int *aOffset ,
+short *nVisitedLeaves)
+{
+   int offset;
+   
+   short numLeafNodes;
+   unsigned char phoneIndex;
+   short nodeCount;
+   short numNodeWithPhone;
+   short attCount;
+   short nodeAtt;
+   short lastAtt;
+   
+   offset = *aOffset;
+   
+   /* Number of leaf nodes in set */
+   numLeafNodes = (short)aTree[offset++];
+   
+   if (nVisitedLeaves) (*nVisitedLeaves) = numLeafNodes;
+   
+   /* Skip past leaf nodes corresponding to each phone index in the set */
+   nodeCount = 0;
+   while( nodeCount < numLeafNodes )
+   {
+      /* Phone index for a set of attribute values */
+      phoneIndex = aTree[offset++];
+      
+      /* Number of leaf nodes with attribute values for this phone */
+      numNodeWithPhone = aTree[offset++];
+      
+      attCount = 0;
+      offset += numNodeWithPhone;
+      
+      nodeCount += numNodeWithPhone;
+   }
+   
+   *aOffset = offset;
+   
+   return TIesrDTErrorNone;
+}
+
+
+/*----------------------------------------------------------------
+ SearchTopBranch
+
+ This function examines a top branch node to determine if the branch
+ node context and attribute match the word context.  If so, this
+ function continues down the branch to find the branch and leaf node
+ of the branch that correspond to the word context.  The phone index
+ of the matching leaf node is output.
+
+ If this top branch node context and attribute do not match the word
+ context, then the leaf nodes of the branch are skipped, and this
+ function does not return a valid phoneIndex.
+
+ ----------------------------------------------------------------*/
+static TIesrDT_Error_t SFB_SearchTopBranch( TIesrDT_t aTIesrDT,
+const unsigned char* aContext,
+short* aPhoneIndex )
+{
+   TIesrDT_Error_t dtError;
+   
+   short phoneIndex;
+   short noMatch;
+   unsigned char  branchContext;
+   unsigned char  branchAttribute;
+   unsigned char  branchLeafContext;
+   unsigned char  curContext;
+   
+   
+   /* Maintain a copy of the current branch context */
+   dtError = SFB_GetBranchInfo( aTIesrDT->tree, aTIesrDT->treeOffset,
+   &branchContext, &branchAttribute,
+   &branchLeafContext );
+   
+   /* Determine if the top branch matches */
+   dtError = SFB_SearchBranch( aTIesrDT, aContext, &noMatch, &phoneIndex );
+   
+   /* If the top branch itself does not match, then return immediately */
+   if( noMatch )
+   {
+      *aPhoneIndex = -1;
+      return dtError;
+   }
+   
+   /* If the top branch matches, and a leaf node of the top branch
+    leaf node set matches the top branch leaf context,
+    then the phone index has been found */
+   if( phoneIndex >= 0 )
+   {
+      *aPhoneIndex = phoneIndex;
+      return dtError;
+   }
+   
+   /* The top branch context matches, but no leaf node matches the top branch
+    node leaf context. Follow the branch nodes down the tree to find the
+    branch and leaf node that match.  We are guaranteed that one of the
+    branches will contain a leaf node that matches. */
+   
+   /* The current branch context to be searched */
+   curContext = branchLeafContext;
+   
+   while( aTIesrDT->treeOffset < aTIesrDT->treeSize )
+   {
+      /* Find the next branch that has branch context that matches current
+       desired branch context. */
+      dtError = FindNextBranch( aTIesrDT, curContext );
+      if( dtError != TIesrDTErrorNone )
+      {
+         return dtError;
+      }
+      
+      /* Obtain current branch context */
+      dtError = SFB_GetBranchInfo( aTIesrDT->tree, aTIesrDT->treeOffset,
+      &branchContext, &branchAttribute,
+      &branchLeafContext );
+      if( dtError != TIesrDTErrorNone )
+         break;
+      
+      /* Determine if the current branch has a leaf node set that matches
+       the context, and therefore the phone has been found. */
+      dtError = SFB_SearchBranch( aTIesrDT, aContext,
+      &noMatch, &phoneIndex );
+      if( dtError != TIesrDTErrorNone )
+         break;
+      
+      
+      /* The present branch matches branch context and contains a leaf
+       that matches the branch leaf context, so the phone has been
+       found. */
+      if( phoneIndex >= 0 )
+      {
+         *aPhoneIndex = phoneIndex;
+         return TIesrDTErrorNone;
+      }
+      
+      /* If the present branch context did match, but no leaf matched
+       the present branch leaf context, change the branch context
+       for further searching to the present branch leaf context.
+       Otherwise, further searching will use the next branch having
+       the same current branch context. */
+      if( ! noMatch )
+      {
+         curContext = branchLeafContext;
+      }
+   }
+   
+   
+   /* Something is wrong with the tree, and a matching leaf node was
+    not found when it should have been found. */
+   *aPhoneIndex = -1;
+   return TIesrDTErrorFail;
+}
+
+static TIesrDT_Error_t SearchTopBranch( TIesrDT_t aTIesrDT,
+const unsigned char* aContext,
+short* aPhoneIndex )
+{
+   TIesrDT_Error_t dtError;
+   short iChecked = 0;
+   short phoneIndex;
+   short noMatch;
+   unsigned char  branchPhone;
+   unsigned char  branchAttribute;
+   unsigned char  branchLeafContext;
+   unsigned char  curContext;
+   
+   
+   /* Maintain a copy of the current branch context */
+   dtError = GetBranchInfo( aTIesrDT->tree, aTIesrDT->treeOffset,
+   &branchPhone, &branchAttribute,
+   &branchLeafContext , NULL);
+   
+   curContext = aTIesrDT->topBranchContext;
+   /* Determine if the top branch matches */
+   dtError = SearchBranch( aTIesrDT, curContext, aContext, &noMatch, &phoneIndex ,
+   &iChecked);
+   
+   /* If the top branch itself does not match, then return immediately */
+   if( noMatch )
+   {
+      *aPhoneIndex = -1;
+      return dtError;
+   }
+   
+   /* If the top branch matches, and a leaf node of the top branch
+    leaf node set matches the top branch leaf context,
+    then the phone index has been found */
+   if( phoneIndex >= 0 )
+   {
+      *aPhoneIndex = phoneIndex;
+      return dtError;
+   }
+   
+   /* since the iChecked is not numBranch, the remainings are
+    branchs that need to be checked */
+   
+   /* The top branch context matches, but no leaf node matches the top branch
+    node leaf context. Follow the branch nodes down the tree to find the
+    branch and leaf node that match.  We are guaranteed that one of the
+    branches will contain a leaf node that matches. */
+   
+   /* The current branch context to be searched */
+   curContext = branchLeafContext;
+   
+   while( aTIesrDT->treeOffset < aTIesrDT->treeSize &&
+   iChecked < aTIesrDT->stAttInfo.numAttValPerAttType[curContext] )
+   {
+      dtError = GetBranchInfo( aTIesrDT->tree, aTIesrDT->treeOffset,
+      &branchPhone, &branchAttribute,
+      &branchLeafContext , NULL);
+      if (branchAttribute != aContext[curContext])
+      {
+         dtError = SkipThisBranch(aTIesrDT);
+         if( dtError != TIesrDTErrorNone )
+         {
+            return dtError;
+         }
+      }else break;
+      iChecked ++;
+      
+   }
+   
+   /* Determine if the current branch has a leaf node set that matches
+    the context, and therefore the phone has been found. */
+   dtError = SearchThisBranch( aTIesrDT, curContext, aContext,
+   &noMatch, &phoneIndex );
+   if( dtError == TIesrDTErrorNone && phoneIndex >= 0 )
+   {
+      *aPhoneIndex = phoneIndex;
+      return TIesrDTErrorNone;
+   }
+   
+   /* Something is wrong with the tree, and a matching leaf node was
+    not found when it should have been found. */
+   *aPhoneIndex = -1;
+   return TIesrDTErrorFail;
+}
+
+
+/*----------------------------------------------------------------
+ SearchBranch
+
+ This function searches a branch to see if it matches the word
+ context.  There are two conditions that must hold true in order to
+ match the word context.
+
+ First, the branch context and attribute must match the word context
+ attribute.  If this does not match, then this function sets the
+ aNoMatch flag, skips the leaf node set corresponding to the branch
+ node, and returns.
+
+ Second, the leaf node set associated with the branch must contain an
+ attribute that matches the branch node leaf context specified in the
+ branch node.  If a match is found, then the aPhoneIndex will contain
+ a valid phone index.  Otherwise it will contain a negative number.
+
+ ----------------------------------------------------------------*/
+static TIesrDT_Error_t SFB_SearchBranch( TIesrDT_t aTIesrDT,
+const unsigned char* aContext,
+short *aNoMatch, short *aPhoneIndex )
+{
+   TIesrDT_Error_t dtError;
+   unsigned char *tree;
+   int offset;
+   
+   unsigned char branchContext;
+   unsigned char branchAttribute;
+   unsigned char branchLeafContext;
+   
+   unsigned char matchAttribute;
+   short phoneIndex;
+   
+   
+   /* Process the tree branch located at global offset */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   
+   /* Determine the branch context and attribute to match. */
+   /* Move past branch to its leaf node set */
+   dtError = SFB_GetBranchInfo( tree, offset,
+   &branchContext,
+   &branchAttribute,
+   &branchLeafContext );
+   
+   /* Move past branch node.  This should not be the end of the tree. */
+   offset += 2;
+   if( offset >= aTIesrDT->treeSize )
+      return TIesrDTErrorFail;
+   
+   
+   /* Check if the branch context and attribute does not match the
+    word context attribute. If it does not match, skip this
+    branch node and its leaf nodes. */
+   matchAttribute = aContext[ branchContext ];
+   if( matchAttribute != branchAttribute )
+   {
+      /* The branch may not be follwed by a leaf node set */
+      if( AtLeaf( tree, offset ) )
+      {
+         dtError = SkipPastLeafSet( tree, &offset , NULL);
+      }
+      aTIesrDT->treeOffset = offset;
+      *aPhoneIndex = -1;
+      *aNoMatch = TRUE;
+      return dtError;
+   }
+   else
+   {
+      /* The branch context does match */
+      *aNoMatch = FALSE;
+      aTIesrDT->treeOffset = offset;
+   }
+   
+   
+   /* Check if this branch node is followed immediately by another
+    branch node.  In this case, there is no leaf context to match,
+    so there can not be a phone index returned.  This acts as if
+    there were no match of any leaf to the branch node leaf
+    context. */
+   if( ! AtLeaf( tree, offset ) )
+   {
+      *aPhoneIndex = -1;
+      return TIesrDTErrorNone;
+   }
+   
+   
+   /* Search the leaf node set corresponding to this branch node */
+   dtError = SearchLeafSet( aTIesrDT, aContext,
+   branchLeafContext,
+   &phoneIndex , NULL);
+   
+   
+   *aPhoneIndex = phoneIndex;
+   return dtError;
+}
+
+static TIesrDT_Error_t SearchBranch( TIesrDT_t aTIesrDT, unsigned char branchContext,
+const unsigned char* aContext,
+short *aNoMatch, short *aPhoneIndex ,
+short * iNumChecked)
+{
+   TIesrDT_Error_t dtError;
+   unsigned char *tree;
+   int offset;
+   short iNumLeaves = 0;
+   unsigned char branchPhone;
+   unsigned char branchAttribute;
+   unsigned char branchLeafContext;
+   
+   unsigned char matchAttribute;
+   short phoneIndex;
+   
+   /* Process the tree branch located at global offset */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   
+   /* Determine the branch context and attribute to match. */
+   /* Move past branch to its leaf node set */
+   dtError = GetBranchInfo( tree, offset,
+   &branchPhone,
+   &branchAttribute,
+   &branchLeafContext ,
+   &offset);
+   
+   /* Move past branch node.  This should not be the end of the tree. */
+   if( offset >= aTIesrDT->treeSize )
+      return TIesrDTErrorFail;
+   
+   
+   /* Check if the branch context and attribute does not match the
+    word context attribute. If it does not match, skip this
+    branch node and its leaf nodes. */
+   matchAttribute = aContext[ branchContext ];
+   if( matchAttribute != branchAttribute )
+   {
+      /* The branch may not be follwed by a leaf node set */
+      if( AtLeaf( tree, offset ) )
+      {
+         dtError = SkipPastLeafSet( tree, &offset , NULL);
+      }
+      aTIesrDT->treeOffset = offset;
+      *aPhoneIndex = -1;
+      *aNoMatch = TRUE;
+      return dtError;
+   }
+   else
+   {
+      /* The branch context does match */
+      *aNoMatch = FALSE;
+      aTIesrDT->treeOffset = offset;
+   }
+   
+   
+   /* Check if this branch node is followed immediately by another
+    branch node.  In this case, there is no leaf context to match,
+    so there can not be a phone index returned.  This acts as if
+    there were no match of any leaf to the branch node leaf
+    context. */
+   if( ! AtLeaf( tree, offset ) )
+   {
+      *aPhoneIndex = -1;
+      return TIesrDTErrorNone;
+   }
+   
+   
+   /* Search the leaf node set corresponding to this branch node */
+   dtError = SearchLeafSet( aTIesrDT, aContext,
+   branchLeafContext,
+   &phoneIndex , &iNumLeaves);
+   
+   if (iNumChecked) (*iNumChecked) += iNumLeaves;
+   
+   *aPhoneIndex = phoneIndex;
+   return dtError;
+}
+#endif
+
+#ifdef DEV_OFFSET
+/* SearchThisBranch
+
+ This recursive function uses offset information to achieve quick decision
+ tree lookup. Three types of nodes are read.
+ 1) branchset : find index of the branch that answers upper-level question
+ 2) quesetion : the read question is used for the following leaf set
+ 3) leaf set  : pronunciation has to be in the leaf set
+
+ @param aTIesrDT pointer to decision tree
+ @param aBranchContext the context (question) to be answered
+ @param aContext the context information, together with the aBranchContext to
+ obtain the question to be answered
+ @param aNoMatch pointer to the returned information that if pronunciation has
+ been found
+ @param aPhoneIndex pointer to the found phone index
+
+ */
+static TIesrDT_Error_t SearchThisBranch( TIesrDT_t aTIesrDT,
+unsigned char aBranchContext,
+const unsigned char* aContext,
+short *aNoMatch, short *aPhoneIndex )
+{
+   TIesrDT_Error_t dtError = TIesrDTErrorNone;
+   unsigned char *tree;
+   int offset;
+   unsigned char branchLeafContext;
+   short phoneIndex;
+   short branchIndex;
+   
+   /* Process the tree branch located at global offset */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   /* three types of nodes in the decision tree.
+    */
+   switch(TypeOfNode(tree, offset))
+   {
+      case BRANCHSET:
+         /* branch set
+         
+          branches are compressed into the branchset using run-length coding,
+          the same as that done in compressing leaves to leaf set. */
+         dtError = SearchBranchSet(aTIesrDT, aContext,
+         aBranchContext,
+         &branchIndex );
+         if (dtError != TIesrDTErrorNone)
+         {
+            
+            *aPhoneIndex = -1;
+            *aNoMatch = TRUE;
+            return TIesrDTErrorFail;
+         }
+         
+         /* find the location of the requested sub-level branch or move to
+          the leafSet at this Level*/
+         dtError = SearchBranchSetOffset( aTIesrDT,
+         aContext,
+         aBranchContext,
+         branchIndex,
+         &branchLeafContext);
+         
+         if (dtError != TIesrDTErrorNone)
+         {
+            
+            *aPhoneIndex = -1;
+            *aNoMatch = TRUE;
+            return TIesrDTErrorFail;
+         }
+         
+         if (branchIndex >= 0)
+         {
+            /* go the sublevel */
+            dtError = SearchThisBranch( aTIesrDT,
+            branchLeafContext,
+            aContext,
+            aNoMatch, &phoneIndex );
+            if (phoneIndex >= 0 && dtError == TIesrDTErrorNone)
+            {
+               *aPhoneIndex = phoneIndex;
+               *aNoMatch = FALSE;
+               return dtError;
+            }
+         }
+         break;
+      case QUESTION:
+         
+         /* read the question of the leaf set */
+         dtError = GetQuestion( aTIesrDT->tree,
+         aTIesrDT->treeOffset,
+         &aBranchContext,
+         (unsigned int *)&aTIesrDT->treeOffset);
+         if (dtError != TIesrDTErrorNone)
+         {
+            return dtError;
+         }
+         
+         break;
+      default:
+         break;
+   }
+   
+   /* Search the leaf node set */
+   dtError = SearchLeafSet( aTIesrDT, aContext,
+   aBranchContext,
+   &phoneIndex);
+   if (phoneIndex >= 0 && dtError == TIesrDTErrorNone)
+   {
+      *aPhoneIndex = phoneIndex;
+      *aNoMatch = FALSE;
+      return dtError;
+   }
+   
+   if (*aNoMatch == FALSE && *aPhoneIndex >= 0 && dtError == TIesrDTErrorNone)
+      return TIesrDTErrorNone;
+   
+   return dtError;
+}
+#else
+static TIesrDT_Error_t SearchThisBranch( TIesrDT_t aTIesrDT, unsigned char branchContext,
+const unsigned char* aContext,
+short *aNoMatch, short *aPhoneIndex )
+{
+   TIesrDT_Error_t dtError = TIesrDTErrorNone;
+   unsigned char *tree;
+   int offset;
+   short iNumLeaves = 0;
+   unsigned char branchPhone;
+   unsigned char branchAttribute;
+   unsigned char branchLeafContext;
+   
+   unsigned char matchAttribute;
+   short phoneIndex;
+   
+   /* Process the tree branch located at global offset */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   
+   /* Determine the branch context and attribute to match. */
+   /* Move past branch to its leaf node set */
+   dtError = GetBranchInfo( tree, offset,
+   &branchPhone,
+   &branchAttribute,
+   &branchLeafContext ,
+   &offset);
+   
+   /* Move past branch node.  This should not be the end of the tree. */
+   if( offset >= aTIesrDT->treeSize )
+      return TIesrDTErrorFail;
+   
+   
+   /* Check if the branch context and attribute does not match the
+    word context attribute. If it does not match, skip this
+    branch node and its leaf nodes. */
+   matchAttribute = aContext[ branchContext ];
+   if( matchAttribute != branchAttribute )
+   {
+      iNumLeaves = 0;
+      /* The branch may not be follwed by a leaf node set */
+      if( AtLeaf( tree, offset ) )
+         dtError = SkipPastLeafSet( tree, &offset , &iNumLeaves);
+      aTIesrDT->treeOffset = offset;
+      
+      while(iNumLeaves<aTIesrDT->stAttInfo.numAttValPerAttType[branchLeafContext])
+      {
+         SkipThisBranch(aTIesrDT);
+         iNumLeaves++;
+      }
+   }
+   else
+   {
+      /* The branch context does match */
+      *aNoMatch = FALSE;
+      aTIesrDT->treeOffset = offset;
+      
+      if( ! AtLeaf( tree, offset ) )
+      {
+         dtError =
+         SearchThisBranch(aTIesrDT, branchLeafContext, aContext, aNoMatch, aPhoneIndex);
+         
+         if (*aNoMatch == FALSE && *aPhoneIndex >= 0 && dtError == TIesrDTErrorNone)
+            return TIesrDTErrorNone;
+      }
+      else
+      {
+         /* Search the leaf node set corresponding to this branch node */
+         dtError = SearchLeafSet( aTIesrDT, aContext,
+         branchLeafContext,
+         &phoneIndex , &iNumLeaves);
+         if (phoneIndex >= 0 && dtError == TIesrDTErrorNone)
+         {
+            *aPhoneIndex = phoneIndex;
+            *aNoMatch = FALSE;
+            return dtError;
+         }
+         
+         while(iNumLeaves < aTIesrDT->stAttInfo.numAttValPerAttType[branchLeafContext])
+         {
+            dtError =
+            SearchThisBranch(aTIesrDT, branchLeafContext, aContext, aNoMatch, aPhoneIndex);
+            
+            if (*aNoMatch == FALSE && *aPhoneIndex >= 0 && dtError == TIesrDTErrorNone)
+               return TIesrDTErrorNone;
+            iNumLeaves++;
+         }
+      }
+   }
+   return dtError;
+}
+
+static TIesrDT_Error_t SkipThisBranch( TIesrDT_t aTIesrDT)
+{
+   TIesrDT_Error_t dtError;
+   unsigned char *tree;
+   int offset;
+   short iNumLeaves = 0, i;
+   unsigned char branchPhone;
+   unsigned char branchAttribute;
+   unsigned char branchLeafContext;
+   unsigned char matchAttribute;
+   short phoneIndex;
+   
+   /* Process the tree branch located at global offset */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   
+   /* Determine the branch context and attribute to match. */
+   /* Move past branch to its leaf node set */
+   dtError = GetBranchInfo( tree, offset,
+   &branchPhone,
+   &branchAttribute,
+   &branchLeafContext ,
+   &offset);
+   
+   /* Move past branch node.  This should not be the end of the tree. */
+   if( offset >= aTIesrDT->treeSize )
+      return TIesrDTErrorFail;
+   
+   
+   /* The branch may not be follwed by a leaf node set */
+   if( AtLeaf( tree, offset ) )
+   {
+      dtError = SkipPastLeafSet( tree, &offset , &iNumLeaves);
+   }
+   aTIesrDT->treeOffset = offset;
+   
+   i=iNumLeaves;
+   while(i<aTIesrDT->stAttInfo.numAttValPerAttType[branchLeafContext])
+   {
+      SkipThisBranch(aTIesrDT);
+      i++;
+   }
+   return TIesrDTErrorNone;
+}
+#endif
+
+/*----------------------------------------------------------------
+ GetDTPhoneIndex
+
+ This function traverses a decision tree to determine the phone index
+ that should be output for the given character of a word in its context.
+
+ ----------------------------------------------------------------*/
+#ifdef DEV_OFFSET
+// read *.olmdtpm
+static TIesrDT_Error_t  GetDTPhoneIndex( TIesrDT_t aTIesrDT, char aChar,
+const unsigned char* aContext,
+unsigned char* aPhoneIndex )
+{
+   TIesrDT_Error_t dtError;
+   short phoneIndex;
+   short noMatch;
+   
+   /* Load the tree file corresponding to the current character. */
+   LoadTreeFile( aTIesrDT, aChar );
+   
+   
+   /* Start processing at beginning of tree */
+   aTIesrDT->treeOffset = 0;
+   
+   
+   /* Get the top branch context.  This is saved in the TIesrDT object. */
+   dtError = FindTopBranchContext( aTIesrDT );
+   if( dtError != TIesrDTErrorNone )
+      goto SearchFail;
+   
+   /* Search the tree file to find the phone index to output */
+   if ( aTIesrDT->treeOffset < aTIesrDT->treeSize )
+      SearchThisBranch( aTIesrDT, aTIesrDT->topBranchContext,
+      aContext,  &noMatch, &phoneIndex );
+   
+   /* If the top branch itself does not match, then return immediately */
+   if( noMatch || phoneIndex < 0 )
+      goto SearchFail;
+   
+   /* If the top branch matches, and a leaf node of the top branch
+    leaf node set matches the top branch leaf context,
+    then the phone index has been found */
+   *aPhoneIndex = (unsigned char)phoneIndex;
+  
+   if( ! aTIesrDT->preLoaded )
+   {
+      free( aTIesrDT->tree );
+      aTIesrDT->tree = NULL;
+   }
+  
+   return TIesrDTErrorNone;
+   
+   /* For some reason the tree failed to provide a phone index for
+    this character and context. This should never happen unless the
+    tree is corrupted. */
+   
+   SearchFail:
+      if( ! aTIesrDT->preLoaded )
+      {
+         free( aTIesrDT->tree );
+         aTIesrDT->tree = NULL;
+      }
+      
+      *aPhoneIndex = -1;
+      
+      return TIesrDTErrorFail;
+}
+#else
+// read *.clmdtpm
+static TIesrDT_Error_t  SFB_GetDTPhoneIndex( TIesrDT_t aTIesrDT, char aChar,
+const unsigned char* aContext,
+unsigned char* aPhoneIndex )
+{
+   TIesrDT_Error_t dtError;
+   short phoneIndex;
+   
+   /* Load the tree file corresponding to the current character. */
+   LoadTreeFile( aTIesrDT, aChar );
+   
+   
+   /* Start processing at beginning of tree */
+   aTIesrDT->treeOffset = 0;
+   
+   
+   /* Get the top branch context.  This is saved in the TIesrDT object. */
+   dtError = FindTopBranchContext( aTIesrDT );
+   if( dtError != TIesrDTErrorNone )
+      goto SearchFail;
+   
+   
+   /* Search the tree file to find the phone index to output */
+   while( aTIesrDT->treeOffset < aTIesrDT->treeSize )
+   {
+      /* Current offset is at a leaf node set corresponding to the top
+       branch context. The information in these leaf nodes is
+       compressed, and a search must be done through the set to see
+       if any of the leaf node attributes match the top branch
+       context word attribute.  If so, the matching leaf node
+       contains the phone index to output.  */
+      if( AtLeaf( aTIesrDT->tree, aTIesrDT->treeOffset ) )
+      {
+         
+         dtError = SearchTopLeafSet( aTIesrDT, aContext, &phoneIndex );
+         if( dtError != TIesrDTErrorNone )
+            goto SearchFail;
+         
+         /* If no matching phone index for the top branch context was
+          found, continue searching */
+         if( phoneIndex < 0 )
+         {
+            continue;
+         }
+         else
+         {
+            /* Phone index to output has been found in the top branch
+             context leaf node set. */
+            *aPhoneIndex = (unsigned char)phoneIndex;
+            free( aTIesrDT->tree );
+            aTIesrDT->tree = NULL;
+            return TIesrDTErrorNone;
+         }
+      }
+      
+      
+      /* Current offset is at a top context branch node.  Test to see if the
+       branch node attribute and context match the word context.  If
+       so, then search this branch to find the output phone. */
+      else
+      {
+         dtError = SearchTopBranch( aTIesrDT, aContext, &phoneIndex );
+         if( dtError != TIesrDTErrorNone )
+            goto SearchFail;
+         
+         /* This top context branch did not match the word context.
+          Go to the next top context node, which may be a leaf node
+          set or another top context branch node. */
+         if( phoneIndex < 0 )
+         {
+            dtError = FindNextTopNode( aTIesrDT );
+            if( dtError != TIesrDTErrorNone )
+               goto SearchFail;
+            
+            /* Process next top node, which is either leaf or branch. */
+            continue;
+         }
+         else
+         {
+            /* Phone index to output has been found by following this
+             top branch. */
+            *aPhoneIndex = (unsigned char)phoneIndex;
+            free( aTIesrDT->tree );
+            aTIesrDT->tree = NULL;
+            return TIesrDTErrorNone;
+         }
+      }
+   }
+   /* For some reason the tree failed to provide a phone index for
+    this character and context. This should never happen unless the
+    tree is corrupted. */
+   
+   SearchFail:
+      free( aTIesrDT->tree );
+      aTIesrDT->tree = NULL;
+      
+      *aPhoneIndex = -1;
+      
+      return TIesrDTErrorFail;
+}
+
+static TIesrDT_Error_t  GetDTPhoneIndex( TIesrDT_t aTIesrDT, char aChar,
+const unsigned char* aContext,
+unsigned char* aPhoneIndex )
+{
+   TIesrDT_Error_t dtError;
+   short phoneIndex;
+   short i;
+   short bFound= FALSE;
+   unsigned char matchAttribute;
+   short noMatch;
+   short nRemainingNodes = aTIesrDT->root.numBranch, iTmp = 0;
+   
+   /* Load the tree file corresponding to the current character. */
+   LoadTreeFile( aTIesrDT, aChar );
+   
+   
+   /* Start processing at beginning of tree */
+   aTIesrDT->treeOffset = 0;
+   
+   
+   /* Get the top branch context.  This is saved in the TIesrDT object. */
+   dtError = FindTopBranchContext( aTIesrDT );
+   if( dtError != TIesrDTErrorNone )
+      goto SearchFail;
+   
+   if( aTIesrDT->topBranchContext != CXT_NONE &&
+   aTIesrDT->root.numBranch > 1 /* there are questions to be asked at the root*/ )
+   {
+      matchAttribute = aContext[aTIesrDT->topBranchContext];
+   }else
+   {
+      /* no question on the context,
+       so just return the context free phone */
+      *aPhoneIndex = (unsigned char)aTIesrDT->cxtfrPhone;
+      free( aTIesrDT->tree );
+      aTIesrDT->tree = NULL;
+      return TIesrDTErrorNone;
+   }
+   
+   for (i=0;i<(short)aTIesrDT->root.numBranch;i++)
+   {
+      if (aTIesrDT->root.AttVal[i] == matchAttribute)
+      {
+         bFound= TRUE;
+         break;
+      }
+   }
+   
+   if (bFound == FALSE)
+      goto SearchFail;
+   
+   aTIesrDT->treeOffset = aTIesrDT->root.BranchOffset[i];
+   
+   /* Search the tree file to find the phone index to output */
+   while( aTIesrDT->treeOffset < aTIesrDT->treeSize )
+   {
+      /* Current offset is at a leaf node set corresponding to the top
+       branch context. The information in these leaf nodes is
+       compressed, and a search must be done through the set to see
+       if any of the leaf node attributes match the top branch
+       context word attribute.  If so, the matching leaf node
+       contains the phone index to output.  */
+      if( AtLeaf( aTIesrDT->tree, aTIesrDT->treeOffset ) )
+      {
+         
+         dtError =  SearchLeafSet( aTIesrDT, aContext,
+         aTIesrDT->topBranchContext,
+         &phoneIndex, &iTmp);
+         if( dtError != TIesrDTErrorNone )
+            goto SearchFail;
+         
+         nRemainingNodes = aTIesrDT->root.numBranch - iTmp;
+         
+         /* If no matching phone index for the top branch context was
+          found, continue searching */
+         if( phoneIndex < 0 )
+         {
+            continue;
+         }
+         else
+         {
+            /* Phone index to output has been found in the top branch
+             context leaf node set. */
+            *aPhoneIndex = (unsigned char)phoneIndex;
+            free( aTIesrDT->tree );
+            aTIesrDT->tree = NULL;
+            return TIesrDTErrorNone;
+         }
+      }
+      
+      
+      /* Current offset is at a top context branch node.  Test to see if the
+       branch node attribute and context match the word context.  If
+       so, then search this branch to find the output phone. */
+      else
+      {
+         dtError = SearchTopBranch( aTIesrDT, aContext, &phoneIndex );
+         if( dtError != TIesrDTErrorNone )
+            goto SearchFail;
+         
+         /* This top context branch did not match the word context.
+          Go to the next top context node, which may be a leaf node
+          set or another top context branch node. */
+         if( phoneIndex < 0 )
+         {
+            printf("should not come to here\n");
+            dtError = FindNextTopNode( aTIesrDT );
+            if( dtError != TIesrDTErrorNone )
+               goto SearchFail;
+            
+            /* Process next top node, which is either leaf or branch. */
+            continue;
+         }
+         else
+         {
+            /* Phone index to output has been found by following this
+             top branch. */
+            *aPhoneIndex = (unsigned char)phoneIndex;
+            free( aTIesrDT->tree );
+            aTIesrDT->tree = NULL;
+            return TIesrDTErrorNone;
+         }
+      }
+   }
+   //   SearchBranch( aTIesrDT,  aTIesrDT->topBranchContext,
+   //   aContext, &noMatch, &phoneIndex );
+   
+   /* If the top branch itself does not match, then return immediately */
+   if( noMatch || phoneIndex < 0 )
+      goto SearchFail;
+   
+   /* If the top branch matches, and a leaf node of the top branch
+    leaf node set matches the top branch leaf context,
+    then the phone index has been found */
+   *aPhoneIndex = (unsigned char)phoneIndex;
+   free( aTIesrDT->tree );
+   aTIesrDT->tree = NULL;
+   
+   return TIesrDTErrorNone;
+   
+   /* For some reason the tree failed to provide a phone index for
+    this character and context. This should never happen unless the
+    tree is corrupted. */
+   
+   SearchFail:
+      free( aTIesrDT->tree );
+      aTIesrDT->tree = NULL;
+      
+      *aPhoneIndex = -1;
+      
+      return TIesrDTErrorFail;
+}
+
+
+/*----------------------------------------------------------------
+ FindNextBranch
+
+ This function searches through the tree to find the next branch that
+ has the desired branch context.
+
+ ----------------------------------------------------------------*/
+static TIesrDT_Error_t  FindNextBranch( TIesrDT_t aTIesrDT, unsigned char aBranchContext )
+{
+   TIesrDT_Error_t dtError;
+   
+   unsigned char* tree;
+   int offset;
+   
+   unsigned char branchContext;
+   unsigned char branchAttribute;
+   
+   unsigned char branchLeafContext;
+   
+   /* Process the tree branch located at global offset */
+   tree = aTIesrDT->tree;
+   offset = aTIesrDT->treeOffset;
+   
+   
+   while( offset < aTIesrDT->treeSize )
+   {
+      
+      /* Go past a leaf node set */
+      if( AtLeaf( tree, offset ) )
+      {
+         SkipPastLeafSet( tree, &offset , NULL);
+      }
+      
+      
+      /* At a branch node.  Check if the branch node context matches
+       the desired branch node context.  */
+      else
+      {
+         dtError = SFB_GetBranchInfo( tree, offset, &branchContext,
+         &branchAttribute, &branchLeafContext );
+         if( dtError != TIesrDTErrorNone )
+            break;
+         
+         if( branchContext == aBranchContext )
+         {
+            aTIesrDT->treeOffset = offset;
+            return TIesrDTErrorNone;
+         }
+         else
+         {
+            /* Go past the branch node */
+            offset += 2;
+         }
+      }
+   }
+   
+   /* The desired branch not found */
+   return TIesrDTErrorFail;
+}
+
+#endif
+
+/*----------------------------------------------------------------
+ ToUpper
+
+ Make a string uppercase.
+
+ ----------------------------------------------------------------*/
+static void ToUpper(char *string )
+{
+   char *chr = string;
+   while (*chr != '\0')
+   {
+      *chr = toupper(*chr);
+      chr++;
+   }
+}
+
+
+/*----------------------------------------------------------------
+ Deblank
+
+ Find location past leading whitespace of a string, and make the string
+ such that it is only the first non-blank portion of the original
+ string.
+
+ ----------------------------------------------------------------*/
+static char*  Deblank( char *word )
+{
+   char* endword;
+   
+   /* Find first non-space in the word */
+   while( *word != '\0' && isspace( (unsigned char)*word ) )
+   {
+      word++;
+   }
+   
+   
+   endword = word;
+   while( *endword != '\0' && !isspace( (unsigned char)*endword ) )
+   {
+      endword++;
+   }
+   *endword = '\0';
+   
+   return word;
+}
diff --git a/TIesrDT/src/TIesrDT.h b/TIesrDT/src/TIesrDT.h
new file mode 100755 (executable)
index 0000000..42759a5
--- /dev/null
@@ -0,0 +1,601 @@
+/*=======================================================================
+ TIesrDT.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file contains the constants and the TIesrDT structure
+ used to process a word and produce a phonetic pronunciation.
+
+======================================================================*/
+
+#ifndef _TIESRDT_H
+#define _TIESRDT_H
+
+
+/* This version uses offset information to achieve speed-up. 
+   In addition, leaf set is further compressed to save 
+   pronunciation of the sub-set with the largest number of 
+   leaves. The leaves are not saved so that search on the leaves
+   is not conducted. 
+*/
+#define DEV_OFFSET
+
+
+/*--------------------------------
+  Standard file names and extentions for TIesrDT
+  --------------------------------*/
+
+/* File defining ASCII character and phonetic class attribute values. */
+static const char* const FN_ATTVALUE = "cAttValue.txt";
+
+/* File defining attribute context types */
+static const char* const FN_ATTTYPE = "cAttType.txt";
+
+/* File defining phones, pseudo-phones, and their phonetic classes. */
+#ifdef DEV_OFFSET
+static const char* const FN_NEWPHONE =  "onewphone.list";
+#else
+static const char* const FN_NEWPHONE =  "cnewphone.list";
+#endif
+
+/* Compressed decision tree file extension */
+#ifdef DEV_OFFSET
+//static const char* const EXT_LMDTPM =  ".clmdtpm";
+static const char* const EXT_LMDTPM =  ".olmdtpm"; // offset-information DTPM
+#else
+static const char* const EXT_LMDTPM =  ".rlmdtpm"; // revised DTPM
+#endif
+
+/* Decision tree files have the basename of their ASCII character.
+   This can be a problem for some characters that are interpreted by the shell,
+   such as '.' or '\''.  So, these characters must have special names.  The mapping
+   is given here. */
+
+#define NUM_FN_CHAR  3 
+static const char  FNCHAR[] = { '\'', '-', '.' };
+
+static const char* const FNNAME[] = 
+{
+   "up",
+   "dash",
+   "dot"
+};
+
+/*-------------------------------- 
+  Attributes 
+
+  Decision tree attributes are specified as unsigned char indices that
+  represent the presence of either 1) a particular ascii character, or
+  2) a particular phonetic class such as voiced, unvoiced or short
+  pause.  The number of attributes is limited in order to specify them
+  in a limited number of bits in the decision tree files.  Attributes
+  are enumerated in the FN_ATTVALUE file in the order of their
+  respective indices.
+
+ --------------------------------*/
+
+/* Total number of attribute values allowed */
+#define  NUM_ATT_VAL 64
+#define  VAL_BITS  6
+
+/* UNUSED_ATT specifies the index to be assigned for an attribute not used. */
+#define UNUSED_ATT 255
+
+/* Number of phonetic class attributes */
+#define NUM_PHONE_CLASS 4
+
+/* The phonetic class attributes are listed in the FN_ATTVALUE file as
+   follows. The "NO_ATTRIBUTE" class must occur in the FN_ATTVALUE file, 
+   but the others are optional.  If you add more class attributes, the
+   "NO_ATTRIBUTE" class must remain the last one. */
+static const char* const PHONECLASSSTRING[] = 
+{
+   "VOICED",
+   "UNVOICED",
+   "SHORT_PAUSE",
+   "NO_ATTRIBUTE"
+};
+
+/* Index of phonetic classes in the classAtt array */
+enum Phone_Class_t
+{
+   VOICED,
+   UNVOICED, 
+   SHORT_PAUSE,
+   NO_ATTRIBUTE
+};
+
+
+/* ASCII characters allowed in a word are 0 .. MAX_ASCII.  However,
+ note that due to the limited number of attributes, not all ASCII
+ characters can be used, since they will not have an associated
+ character attribute. Usually most words will only use A-Z
+ anyway. */
+#define MAX_ASCII  127
+
+
+/*--------------------------------
+  Attribute Contexts
+
+  The attribute contexts define the context in which an attribute will
+  be tested.  Context types include, for example, one charater to the
+  right, two characters to the left, prior phonetic class context,
+  etc.  
+
+  --------------------------------*/
+
+/* Number of allowable attribute contexts */
+#define NUM_ATT_TYPE 16
+#define TYPE_BITS  4
+
+/* Left character, right character, and phonetic class context lengths
+   in decision trees. Sum must be <= NUM_ATT_TYPE. The contexts, as
+   defined below will eventually be configuration parameters in a
+   configuration file, allowing the code to handle decision trees with
+   various context lengths. */
+#define DT_LEFT_CHAR  4
+#define DT_RIGHT_CHAR  4
+#define DT_LEFT_CLASS  4
+#define  DT_CONTEXT_SIZE  12
+
+/* In the code, the testing for context is done by accessing a context
+   array based on the ordering of left character, right character, and
+   left phone class context as defined above.  I am including an
+   enumeration here that defines the indices for the contexts.
+   However, this is not needed, but included just for
+   documentation. */
+enum Context_t
+{
+   CXT_LEFT4,
+   CXT_LEFT3,
+   CXT_LEFT2,
+   CXT_LEFT1,
+   CXT_RIGHT1,
+   CXT_RIGHT2,
+   CXT_RIGHT3,
+   CXT_RIGHT4,
+   CXT_LEFTCLASS4,
+   CXT_LEFTCLASS3,
+   CXT_LEFTCLASS2,
+   CXT_LEFTCLASS1,
+
+   #ifdef DEV_OFFSET
+   /* there are 12 questions asked so far.
+      since only 4 bits are used for these questions, the 0xf is reserved as the 
+      context-free question */
+   CXT_NONE = 15  
+#else
+   CXT_NONE = 255
+#endif
+
+};
+
+
+/*--------------------------------
+  Phones
+
+  Phones include both phones, and pseudo phones.  Pseudo phones are
+  multiple phones which map to a single ascii character, and are
+  specified by separating multiple phones by '_', for example the
+  character 'X' sometimes is mapped to the pseudo phone
+  "eh_k_s". Phones are enumerated in the FN_NEWPHONE file, which also
+  specifies the phone class for each phone or pseudo phone.  The
+  number of phones allowed is limited in order to represent them in
+  the decision trees in a reduced number of bits.  The decision trees
+  represent phones by indices based on their order in the FN_NEWPHONE
+  file.  The format of the FN_NEWPHONE file is one phone name on a
+  line, followed by whitespace followed by the phones class type as
+  specified by one of the phoneClassString array strings.
+
+  --------------------------------*/
+
+/* Number of phones allowed. */
+#define  NUM_PHONES  128
+#define  PHONE_BITS  7
+
+
+
+/*-------------------------------- 
+  Decision tree bit allocation.
+
+  The decision tree consists of an array of bytes specifing 1) a branch set,
+ 2) a question node or 3) a leaf set. 
+ A leaf node set is a sequence of
+  bytes consisting of:
+
+  - The size of the leaf set, with the ms bit = 0
+  - For each phone index that occurs in the leaf node set:
+    - The phone index
+    - The number of leaf nodes corresponding to this phone
+    - a sequence of indices specifying the attribute values for the leaf nodes
+
+  The sequence of attribute values is encoded such that negative
+  numbers indicate a range of attributes.  For example, if the
+  attributes corresponding to a phone have the indices 1,2, 3 through 8, 9,
+  10, then this will be encoded as the sequence of bytes as:
+  1,2,3,-8,9,10
+  
+  A branch set node consists of a byte suquence encoded in the same as above
+ for leaf set. The bit fields consists:
+  - The size of the branch set, with ms code 0xc0 or 11 in the top two bits
+  - Run-lengh code of the branch attribute values
+  Offset of the branches inside the branch set node is coded as following
+  - The number of branches in byte
+  - For each branch, use a short to save branch leaf attribute type (question) 
+and offset to its sibling branch
+
+ A question node consists one byte. The bit fields consits:
+  - The ms as 0x80, i.e., 10 in the top two bits of the byte
+  - attribute type in 6 bits
+
+  --------------------------------*/
+typedef enum{
+  LEAFSET = 0,
+    QUESTION,
+    BRANCHSET} eNodeType;
+
+static const unsigned char LEAFBIT = 0x80;
+#ifdef DEV_OFFSET
+static const unsigned char NODE_QUESTION = 0x40;
+static const unsigned char NODE_BRANCHSET = 0xc0;
+static const unsigned char NODE_LEAFSET = 0x00; 
+#endif
+
+static const unsigned short BRANCHCONTEXT = 0x7800;
+static const unsigned short BCXTSHIFT = 11;
+static const unsigned short BRANCHATTRIBUTE = 0x007F;
+static const unsigned short BRANCHLEAFCONTEXT = 0x0780;
+static const unsigned short BLEAFCXTSHIFT = 7;
+#ifdef DEV_OFFSET
+static const unsigned short BRANCHOFFSET = 0x0fff; 
+static const unsigned short BRANCHLEAFCONTEXT_RLM = 0xf000;
+static const unsigned short BLEAFCXTSHIFT_SHIFT = 12; 
+static const unsigned char  QUESTION_IN_QUESTION_NODE = 0x3f; 
+#else
+static const unsigned short BRANCHPHONE = 0x001f;
+static const unsigned short BRANCHATTRIBUTE_RLM = 0x7e00; 
+static const unsigned short BATTSHIRT = 9;
+static const unsigned short BRANCHLEAFCONTEXT_RLM = 0x01e0;
+static const unsigned short BLEAFCXTSHIFT_RLM = 5;
+#endif
+
+/*--------------------------------
+  Other constants
+  --------------------------------*/
+
+/* Maximum string size allowed for phones, attributes, class characters */
+#define  MAX_STRING  32
+
+/* Maximum full file name size */
+#define MAX_FILENAME 256
+
+/* TRUE and FALSE */
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+typedef struct RootInfo_s
+{
+  unsigned char numBranch; 
+  char *AttVal; 
+  int BranchOffset[NUM_ATT_VAL]; 
+} RootInfo;
+
+// the information of the number of answers per question 
+typedef struct stInfoAtts_s
+{
+  short numAttTypes; 
+  short numAttValPerAttType[NUM_ATT_VAL]; 
+} stInfoAtts; 
+
+/*--------------------------------
+ The TIesrDT instance structure
+ --------------------------------*/
+typedef struct TIesrDT_Struct
+{
+   /* Path to the decision trees and support files */
+   char* treePath;
+   
+   /* Flag indicating that trees are preloaded, and don't need to
+      be loaded for each letter of each word */
+   int preLoaded;
+   
+   /* Pointers to the tree for each character attribute */
+   unsigned char *treePointers[MAX_ASCII+1];
+   
+   /* Number of attribute values */
+   short numAtt;
+   
+   /* Attributes for each ASCII character, for example charAtt['A']. */
+   unsigned char charAtt[MAX_ASCII+1];
+   
+   /* Phoneme class attribute values.  The attribute values that
+    represent voiced, unvoiced, short pause, etc. */
+   unsigned char classAtt[NUM_PHONE_CLASS];
+   
+   /* Number of phonemes, and string of each */
+   short numPhones;
+   char* phone[NUM_PHONES];
+   
+   /* Class attribute values for each phoneme.  These indicate
+    whether the phone is voiced, unvoiced, short pause, or
+    perhaps maybe some other attributes in the future. */
+   unsigned char phoneAtt[NUM_PHONES];
+   
+   
+   /* Tree structure parameters used during processing */
+   
+   RootInfo root;
+   
+   /*
+   the information on the number of answers per question
+    */
+   stInfoAtts stAttInfo;
+   
+   /* Size of tree in bytes */
+   int treeSize;
+   
+   /* Pointer to the tree */
+   unsigned char* tree;
+   
+   /* Current byte offset into the tree. */
+   int treeOffset;
+   
+   /* Top branch context */
+   unsigned char topBranchContext;
+   unsigned char cxtfrPhone; // context free phone of the letter
+} TIesrDT_Struct_t;
+
+
+/*----------------------------------------------------------------
+  Local API functions 
+  ----------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------
+  LoadAttributes
+
+  This function loads the character attributes value array in the
+  TIesrDT structure, and the class attribute value array.  The
+  character attributes value array, charAtt, is an unsigned byte
+  array, indexed by the ascii value of the character.  It returns the
+  attribute value corresponding to a character, for example,
+  attValue['A'].  The charAtt array is sized to hold attribute values
+  for ascii characters up to and including ascii value MAX_ASCII.
+  However, the decision tree code is such that it limits the number of
+  attribute values that can be assigned to NUM_ATT_VAL.  Thus some
+  charAtt array entries may not be used.
+
+  The class attribute value array classAtt, specifies that attribute value
+  for each of the class attributes; voiced, unvoiced, etc.
+
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t LoadAttributes( TIesrDT_t aTIesrDT );
+
+
+/*----------------------------------------------------------------
+  LoadPhones
+
+  This function loads the phones and their respective class attributes
+  from the FN_NEWPHONE file.  This file has the format one entry per
+  line consisting of a phone string followed by whitespace followed by
+  the phone's class string.  The class string is one of the strings in
+  the phoneClassString array.
+
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t LoadPhones( TIesrDT_t aTIesrDT );
+
+
+/*----------------------------------------------------------------
+ PreLoadTrees
+
+ This function loads all of the decision trees from the location
+ specified when TIesrDT_Create is called.  Space is allocated on the
+ heap for the trees, and the treePointers array is filled with
+ pointers to each loaded tree.
+
+ -----------------------------------------------------------------*/
+static TIesrDT_Error_t PreLoadTrees( TIesrDT_t aTIesrDT );
+
+
+/*-----------------------------------------------------------------
+ GetTreeFileName
+
+ Obtain the tree file name corresponding to a character attribute.
+ The aFileName must point to a character array large enough to
+ hold the file name.
+ -------------------------------------------------------------------*/
+static TIesrDT_Error_t GetTreeFileName( TIesrDT_t aTIesrDT, char aChar, char *aFileName );
+
+
+/*----------------------------------------------------------------
+ GetDTPhoneIndex
+
+ This function traverses a decision tree to determine the phone index
+ that should be output for the given character of a word in its context.
+
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t  GetDTPhoneIndex( TIesrDT_t aTIesrDT, char aChar,
+                                        const unsigned char* aContext, 
+                                        unsigned char* aPhoneIndex );
+
+
+/*----------------------------------------------------------------
+  LoadTreeFile
+
+  This function loads the compressed tree file corresponding to the
+  given character from the path in the TIesrDT object, and puts the
+  pointer to the tree in the TIesrDT object.
+
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t LoadTreeFile( TIesrDT_t aTIesrDT, char aChar );
+
+
+/*----------------------------------------------------------------
+  AtLeaf
+
+  This function determines if the present offset is at a leaf node
+  set, which is indicated by the top bit of the current byte having a
+  zero.  This can be put in a macro later, but for now it is a
+  function for debugging.
+
+  ----------------------------------------------------------------*/
+static short AtLeaf( const unsigned char* aTree, int aOffset );
+
+
+/*----------------------------------------------------------------
+  GetBranchInfo
+
+  This function retrieves the information encoded in the bit fields of
+  the two-byte branch node pointed to by the offset into the tree.
+  This can be put in a macro later, but for now it is a function for
+  debugging.
+
+  ----------------------------------------------------------------*/
+#ifdef DEV_OFFSET
+static TIesrDT_Error_t GetBranchInfo( const unsigned char* aTree,
+                                     int aOffset,
+                                     unsigned short* aBranchOffset,
+                                     unsigned char* aBranchLeafContext,
+                                     unsigned int * pSize );
+#else
+static TIesrDT_Error_t GetBranchInfo( const unsigned char* aTree,
+                                     int aOffset,
+                                     unsigned char* aBranchContext,
+                                     unsigned char* aBranchAttribute,
+                                     unsigned char* aBranchLeafContext ,
+                                     unsigned int *pTreeOffset);
+#endif
+
+/*----------------------------------------------------------------
+  FindTopBranchContext
+
+  This function searches through the decision tree to find the first
+  branch node.  Its context defines the top branch context.  If the
+  decision tree has no branch nodes, then it is assumed that the 
+  decision tree consists of a single leaf node that defines the output
+  phone index for all possible contexts.
+
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t FindTopBranchContext( TIesrDT_t aTIesrDT );
+
+
+/*----------------------------------------------------------------
+  SearchLeafSet
+
+  This function searches a leaf node set to determine if any of the
+  leaf nodes of the set contain the attribute value that matches the
+  specified context.
+
+  ----------------------------------------------------------------*/
+#ifdef DEV_OFFSET
+static TIesrDT_Error_t  SearchLeafSet( TIesrDT_t aTIesrDT, 
+                                      const unsigned char* aContext, 
+                                      short aMatchContext,
+                                      short *aPhoneIndex );
+#else
+static TIesrDT_Error_t  SearchLeafSet( TIesrDT_t aTIesrDT, 
+                                      const unsigned char* aContext, 
+                                      short aMatchContext,
+                                      short *aPhoneIndex ,
+                                      short *ptrNumLeaves);
+
+/*----------------------------------------------------------------
+  SkipPastLeafSet
+
+  The offset pointer argument is pointing to the start of a leaf node
+  set of a tree. Move the offset pointer past the leaf node set.
+
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t SkipPastLeafSet( const unsigned char* aTree, 
+                                       int *aOffset ,
+                                       short * nVisitedLeaves );
+
+
+
+/*----------------------------------------------------------------
+  SearchTopBranch
+
+  This function examines a top branch node to determine if the branch
+  node context and attribute match the word context.  If so, this
+  function continues down the branch to find the branch and leaf node
+  of the branch that correspond to the word context.  The phone index
+  of the matching leaf node is output.
+
+  If this top branch node context and attribute do not match the word
+  context, then the leaf nodes of the branch are skipped, and this
+  function does not return a valid phoneIndex.
+
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t SearchTopBranch( TIesrDT_t aTIesrDT,
+                                       const unsigned char* aContext,
+                                       short* aPhoneIndex );
+
+
+/*----------------------------------------------------------------
+  SearchBranch
+
+  This function searches a branch to see if it matches the word
+  context.  There are two conditions that must hold true in order to
+  match the word context.
+
+  First, the branch context and attribute must match the word context
+  attribute.  If this does not match, then this function sets the
+  aNoMatch flag, skips the leaf node set corresponding to the branch
+  node, and returns.
+
+  Second, the leaf node set associated with the branch must contain an
+  attribute that matches the branch node leaf context specified in the
+  branch node.  If a match is found, then the aPhoneIndex will contain
+  a valid phone index.  Otherwise it will contain a negative number.
+  
+  iNumChecked return the number of branchs and leaves that this function 
+  has checked/visited. 
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t SearchBranch( TIesrDT_t aTIesrDT,
+                                    unsigned char curContext, 
+                                    const unsigned char* aContext, 
+                                    short *aNoMatch, short *aPhoneIndex,
+                                    short *iNumChecked);
+
+
+/*----------------------------------------------------------------
+  FindNextBranch
+
+  This function searches through the tree to find the next branch that
+  has the desired branch context.  This function is used in decending
+  into the tree nodes from an initial matching branch node context.
+
+  ----------------------------------------------------------------*/
+static TIesrDT_Error_t  FindNextBranch( TIesrDT_t aTIesrDT, unsigned char aBranchContext );
+
+#endif
+
+/*----------------------------------------------------------------
+  ToUpper
+
+  Make a string uppercase.
+
+  ----------------------------------------------------------------*/
+static void ToUpper(char *string );
+
+
+/*----------------------------------------------------------------
+  Deblank
+
+  Find location past leading whitespace of a string, and make the string
+  such that it is only the first non-blank portion of the original
+  string.
+  
+ ----------------------------------------------------------------*/
+static char*  Deblank( char *word );
+
+#endif
+
diff --git a/TIesrDT/src/TIesrDT_User.h b/TIesrDT/src/TIesrDT_User.h
new file mode 100644 (file)
index 0000000..45b5b53
--- /dev/null
@@ -0,0 +1,187 @@
+/*=======================================================================
+ TIesrDT_User.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file exposes the implementation of the TIesrDT API,
+ which is a Text-to-Pronunciation (TTP) tool.  This tool accepts as
+ input the spelling of a word, and returns the phonetic
+ pronunciation.
+
+======================================================================*/
+
+
+#ifndef _TIESRDT_USER_H
+#define _TIESRDT_USER_H
+
+
+/* This code enables generating a Windows DLL */
+#if defined( WIN32 ) || defined( WINCE )
+
+/* The following ifdef block is the standard way of creating macros which make exporting 
+from a DLL simpler. All files within this DLL are compiled with the TIESRFA_EXPORTS
+symbol defined on the command line. This symbol should not be defined on any project
+that uses this DLL. This way any other project whose source files include this file see 
+TIESRFA_API functions as being imported from a DLL, whereas this DLL sees symbols
+defined with this macro as being exported. */
+#ifdef TIESRDT_EXPORTS
+#define TIESRDT_API __declspec(dllexport)
+#else
+#define TIESRDT_API __declspec(dllimport)
+#endif
+
+#else
+
+#define TIESRDT_API
+
+#endif 
+
+#include <stddef.h>
+
+
+/*--------------------------------
+  Typedefs and defines 
+  --------------------------------*/
+
+
+/* Error return values for this API */
+typedef enum 
+{
+   TIesrDTErrorNone,
+   TIesrDTErrorFail,
+   TIesrDTErrorMemory,
+   TIesrDTErrorLoad,
+   TIesrDTErrorFile
+} TIesrDT_Error_t;
+
+
+/* The instance structure pointer.  A pointer will be returned 
+   by TIesrDT_Create. */
+typedef struct TIesrDT_Struct* TIesrDT_t;
+
+
+
+/*----------------------------------------------------------------
+  Function interface
+  ----------------------------------------------------------------*/
+
+
+
+/*----------------------------------------------------------------
+  TIesrDT_Create
+
+  This function creates an instance of the TIesrDT machine.  It
+  accepts as input the path to the directory containing the decision
+  trees and the supporting files.  Once properly created, this
+  instance may be used with the function TIesrDT_Pron multiple times
+  to determine pronunciation of words using the decision trees.  This
+  function allocates information on the heap, and so TIesrDT_Destroy
+  must be called when done determining pronunciations in order to
+  release all allocated resources.  Note that the first argument is
+  the location that holds a pointer to the TIesrDT structure.  An
+  example of usage is:
+
+  TIesrDT_t aTIesrDT;
+  TIesrDT_Error_t dtError;
+
+  dtError = TIesrDT_Create( &aTIesrDT, aTreePath);
+
+  ----------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    TIESRDT_API
+    TIesrDT_Error_t TIesrDT_Create( TIesrDT_t* aTIesrDTPtr,
+            const char* aTreePath );
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/*----------------------------------------------------------------
+ TIesrDT_CreatePreload
+
+ This function creates an instance of the TIesrDT machine.  It
+ accepts as input the path to the directory containing the decision
+ trees and the supporting files.  This function will preload all
+ decision trees by creating heap space and loading them into memory.  
+ Thus the decision trees will not have to be reloaded for each letter 
+ of each word during calculation of pronunciations. This requires
+ more memory, but pronunciations are obtained much faster. Once properly
+ created, this instance may be used with the function TIesrDT_Pron multiple
+ times to determine pronunciation of words using the decision trees.  This
+ function allocates information on the heap, and so TIesrDT_Destroy
+ must be called when done determining pronunciations in order to
+ release all allocated resources.  Note that the first argument is
+ the location that holds a pointer to the TIesrDT structure.  An
+ example of usage is:
+
+  TIesrDT_t aTIesrDT;
+  TIesrDT_Error_t dtError;
+
+  dtError = TIesrDT_CreatePreload( &aTIesrDT, aTreePath);
+
+  ----------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+    TIESRDT_API
+    TIesrDT_Error_t TIesrDT_CreatePreload( TIesrDT_t* aTIesrDTPtr,
+            const char* aTreePath );
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/*--------------------------------
+  TIesrDT_Pron
+
+  This is the interface function of the TIesrDT API that determines a
+  word pronunciation.  This function accepts as input a word in the
+  character string aWord, and outputs a string, aPronString, which contains
+  the sequential list of phones that describes the pronunciation of
+  the word, each phone separated by a space.  The user must supply the
+  output character string buffer with length aStringSize.
+
+  --------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+    TIESRDT_API
+    TIesrDT_Error_t TIesrDT_Pron( TIesrDT_t aTIesrDT,
+            const char *aWord,
+            char *aPronString, size_t aStringSize );
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+/*----------------------------------------------------------------
+  TIesrDT_Destroy
+
+  This function destroys an instance of the TIesrDT machine created by
+  TIesrDT_Create. This function releases all allocated resources.
+
+  ----------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+    TIESRDT_API
+    TIesrDT_Error_t TIesrDT_Destroy( TIesrDT_t aTIesrDT );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TIESRDT_USER_H */
diff --git a/TIesrDT/src/TestTIesrDT.c b/TIesrDT/src/TestTIesrDT.c
new file mode 100644 (file)
index 0000000..dbd035a
--- /dev/null
@@ -0,0 +1,95 @@
+/*=======================================================================
+ TestTIesrDT.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This program tests TIesrDT.  The user inputs a file containing words
+ on lines, and the program sends these words to TIesrDT.  The result
+ is each word on a line, followed by the pronunciation of the word
+ returned by TIesrDT.
+  
+ The command line is:
+ Test tree_path filename preload_trees(0/1)
+  
+=====================================================================*/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <TIesrDT_User.h>
+
+#define MAX_STRING  256
+
+/* Now allow path to be input
+static const char* const TREE_PATH = "../Tools/CDtrees";
+*/
+
+
+int main( int argc, char** argv)
+{
+  char* fname;
+  FILE* fp;
+  char word[MAX_STRING];
+  char pron[MAX_STRING];
+
+
+  TIesrDT_t tiesrDT;
+  TIesrDT_Error_t dtError;
+
+  if( argc < 2 )
+  {
+     printf("TestTIesrDT tree_path filename preload_trees(0/1) \n");
+     exit(1);
+  }
+
+  fname = argv[2];
+  fp = fopen( fname, "r" );
+  if( ! fp )
+  {
+     printf( "Can not open %s\n", fname );
+     exit(1);
+  }
+  
+
+  //dtError = TIesrDT_Create( &tiesrDT, TREE_PATH );
+  if( argc > 3 && atoi( argv[3] ) != 0 )
+  {
+     dtError = TIesrDT_CreatePreload( &tiesrDT, argv[1] );
+  }
+  else
+  {
+     dtError = TIesrDT_Create( &tiesrDT, argv[1] );
+  }
+
+  if( dtError != TIesrDTErrorNone )
+  {
+     printf( "Can not create TIesrDT instance: %d\n", dtError  );
+     exit(1);
+  }
+
+  while( fscanf( fp, "%s", word ) != EOF )
+  {
+     printf( "%s:  ", word );
+
+     dtError = TIesrDT_Pron( tiesrDT, word, pron, MAX_STRING );
+     if( dtError != TIesrDTErrorNone )
+     {
+       printf( "Can not get pronunciation: %d\n", dtError );
+       exit(1);
+     }
+
+     printf( "%s\n", pron );
+  }
+
+  dtError = TIesrDT_Destroy( tiesrDT );
+
+  fclose( fp );
+
+  exit(0);
+}
+
diff --git a/TIesrDict/ReadMe.txt b/TIesrDict/ReadMe.txt
new file mode 100644 (file)
index 0000000..383355e
--- /dev/null
@@ -0,0 +1,52 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+----------------
+
+The TIesrDict API generates a phonetic pronunciation of a word using either a
+dictionary entry, or a decision tree algorithm.
+
+Using the testtiesrdict Program
+-----------------------------
+The testtiesrdict program exercises the TIesrDict API. The command line for the
+program is:
+
+testtiesrdt  data_path language dict_dir 0 2 [namelist]
+
+data_path: Directory where TIesrFlex data is located
+language:  Language directory, such as "English"
+dict_dir:  Dictionary directory name, usually "Dict"
+use_dt:    Show TIesrDT pronunciation even if a word is in the dictionary
+max_pron:  Number of pronunciations to show, if multiples are in the dictionary
+[add_cl]:  Add closure phones prior to stop consonants. Enabled by default.
+This option adds stop consonant phones (bcl,dcl,gcl,kcl,pcl,tcl) prior to the
+consonant phones (b,d,g,k,p,t), and is somewhat specific to English. 
+[namelist] Optional file of names.  If not given program is interactive.
+
+An example of running this program from the top-level distribution directory on
+a Linux OS is shown below. This test generates the dictionary pronunciations of
+three words, "yes", "no", and "maybe".
+
+Dist/LinuxReleaseGnu/bin/testtiesrdict \
+      Data/OffDT_GenDict_PhbVR_LE_MQ/ \
+      English \
+      Dict \
+      0 2 1\
+      Data/TestTIesrDTWords.txt
+
+
+The output should be:
+
+yes ---> y eh s.
+no ---> n ow.
+maybe ---> m ey bcl b iy.
+
+As can be seen, the dictionary lookup by TIesrDict corrects errors in
+pronunciation that would be obtained by TIesrDT.
+
+If the optional [namelist] is not specified, the program will first output a
+list of all phones in use for the language and then prompt the user
+to input a word, and will provide information about the pronunciations.  To
+terminate the program, when prompted for a name, input only a period "."
+
diff --git a/TIesrDict/TIesrDictso/.dep.inc b/TIesrDict/TIesrDictso/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrDict/TIesrDictso/Makefile b/TIesrDict/TIesrDictso/Makefile
new file mode 100755 (executable)
index 0000000..0e278b9
--- /dev/null
@@ -0,0 +1,118 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+       if [ ${CONF} == LinuxDebugGnu -o \
+       ${CONF} == LinuxReleaseGnu -o \
+       ${CONF} == ArmLinuxDebugGnueabi -o \
+       ${CONF} == ArmLinuxReleaseGnueabi ]; \
+       then cd ../../Dist/${CONF}/lib; \
+       rm -f libTIesrDict.so; \
+       ln -s libTIesrDict.so.1 libTIesrDict.so; \
+       fi
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrDict/TIesrDictso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrDict/TIesrDictso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..07fc441
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../../TIesrDT/TIesrDTso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDT.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDict.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDict.so.1: ../../TIesrDT/TIesrDTso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDT.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDict.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrDict.so.1 -Wl,--version-script=../resource/TIesrDictso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrDict.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o ../src/TIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDict.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TIesrDictso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrDict/TIesrDictso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..df2bc83
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../../TIesrDT/TIesrDTso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDT.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDict.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDict.so.1: ../../TIesrDT/TIesrDTso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDT.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDict.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrDict.so.1 -Wl,--version-script=../resource/TIesrDictso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrDict.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o ../src/TIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDict.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TIesrDictso/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrDict/TIesrDictso/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..bb28a15
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../../TIesrDT/TIesrDTso/../../Dist/LinuxDebugGnu/lib/libTIesrDT.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/lib/libTIesrDict.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrDict.so.1: ../../TIesrDT/TIesrDTso/../../Dist/LinuxDebugGnu/lib/libTIesrDT.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrDict.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrDict.so.1 -Wl,--version-script=../resource/TIesrDictso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrDict.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o ../src/TIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/lib/libTIesrDict.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TIesrDictso/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrDict/TIesrDictso/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..a5d4898
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../../TIesrDT/TIesrDTso/../../Dist/LinuxReleaseGnu/lib/libTIesrDT.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/lib/libTIesrDict.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrDict.so.1: ../../TIesrDT/TIesrDTso/../../Dist/LinuxReleaseGnu/lib/libTIesrDT.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrDict.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrDict.so.1 -Wl,--version-script=../resource/TIesrDictso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrDict.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o ../src/TIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/lib/libTIesrDict.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TIesrDictso/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrDict/TIesrDictso/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..2fad398
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=../../TIesrDT/TIesrDTso/../../Dist/WindowsDebugMinGW/libTIesrDT.dll
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/libTIesrDict.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrDict.dll: ../../TIesrDT/TIesrDTso/../../Dist/WindowsDebugMinGW/libTIesrDT.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrDict.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -shared -o ../../Dist/${CND_CONF}/libTIesrDict.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRDICT_EXPORTS -DWIN32 -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o ../src/TIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/libTIesrDict.dll
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TIesrDictso/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrDict/TIesrDictso/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..bbd7051
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=../../TIesrDT/TIesrDTso/../../Dist/WindowsReleaseMinGW/libTIesrDT.dll
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/libTIesrDict.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrDict.dll: ../../TIesrDT/TIesrDTso/../../Dist/WindowsReleaseMinGW/libTIesrDT.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrDict.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -shared -o ../../Dist/${CND_CONF}/libTIesrDict.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRDICT_EXPORTS -DWIN32 -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrDict.o ../src/TIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/libTIesrDict.dll
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDT/TIesrDTso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TIesrDictso/nbproject/Makefile-impl.mk b/TIesrDict/TIesrDictso/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..6fd1857
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TIesrDictso
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrDict/TIesrDictso/nbproject/Makefile-variables.mk b/TIesrDict/TIesrDictso/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..6e6abee
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=libTIesrDict.dll
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/libTIesrDict.dll
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=libTIesrDictso.so.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/libTIesrDictso.so.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=libTIesrDict.dll
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/libTIesrDict.dll
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=libTIesrDictso.so.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/libTIesrDictso.so.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib
+CND_ARTIFACT_NAME_LinuxDebugGnu=libTIesrDict.so.1
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib/libTIesrDict.so.1
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=libTIesrDictso.so.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/libTIesrDictso.so.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib
+CND_ARTIFACT_NAME_LinuxReleaseGnu=libTIesrDict.so.1
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib/libTIesrDict.so.1
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=libTIesrDictso.so.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/libTIesrDictso.so.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=libTIesrDict.so.1
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDict.so.1
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=libTIesrDictso.so.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrDictso.so.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=libTIesrDict.so.1
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDict.so.1
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=libTIesrDictso.so.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrDictso.so.tar
diff --git a/TIesrDict/TIesrDictso/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrDict/TIesrDictso/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..b81d232
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrDict.so.1
+OUTPUT_BASENAME=libTIesrDict.so.1
+PACKAGE_TOP_DIR=libTIesrDictso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDictso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TIesrDictso/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrDict/TIesrDictso/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..8feb01c
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrDict.so.1
+OUTPUT_BASENAME=libTIesrDict.so.1
+PACKAGE_TOP_DIR=libTIesrDictso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDictso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TIesrDictso/nbproject/Package-LinuxDebugGnu.bash b/TIesrDict/TIesrDictso/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..d34d311
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrDict.so.1
+OUTPUT_BASENAME=libTIesrDict.so.1
+PACKAGE_TOP_DIR=libTIesrDictso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDictso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TIesrDictso/nbproject/Package-LinuxReleaseGnu.bash b/TIesrDict/TIesrDictso/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..0eda8e7
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrDict.so.1
+OUTPUT_BASENAME=libTIesrDict.so.1
+PACKAGE_TOP_DIR=libTIesrDictso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDictso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TIesrDictso/nbproject/Package-WindowsDebugMinGW.bash b/TIesrDict/TIesrDictso/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..c3ed67a
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrDict.dll
+OUTPUT_BASENAME=libTIesrDict.dll
+PACKAGE_TOP_DIR=libTIesrDictso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDictso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TIesrDictso/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrDict/TIesrDictso/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..12439f0
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrDict.dll
+OUTPUT_BASENAME=libTIesrDict.dll
+PACKAGE_TOP_DIR=libTIesrDictso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrDictso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrDictso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TIesrDictso/nbproject/configurations.xml b/TIesrDict/TIesrDictso/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..14bb70e
--- /dev/null
@@ -0,0 +1,260 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrDict.h</itemPath>
+      <itemPath>../src/TIesrDictLocal.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+      <itemPath>../resource/TIesrDictso.ver</itemPath>
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrDict.cpp</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRDICT_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrDict.dll</output>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDT/TIesrDTso"
+                            CT="2"
+                            CN="WindowsDebugMinGW"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrDT/TIesrDTso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean"
+                            OP="../../Dist/WindowsDebugMinGW/libTIesrDT.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRDICT_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrDict.dll</output>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDT/TIesrDTso"
+                            CT="2"
+                            CN="WindowsReleaseMinGW"
+                            AC="true"
+                            BL="true"
+                            WD="../../TIesrDT/TIesrDTso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean"
+                            OP="../../Dist/WindowsReleaseMinGW/libTIesrDT.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrDict.so.1</output>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDT/TIesrDTso"
+                            CT="2"
+                            CN="LinuxDebugGnu"
+                            AC="true"
+                            BL="true"
+                            WD="../../TIesrDT/TIesrDTso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxDebugGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxDebugGnu clean"
+                            OP="../../Dist/LinuxDebugGnu/lib/libTIesrDT.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrDict.so.1 -Wl,--version-script=../resource/TIesrDictso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrDict.so.1</output>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDT/TIesrDTso"
+                            CT="2"
+                            CN="LinuxReleaseGnu"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrDT/TIesrDTso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean"
+                            OP="../../Dist/LinuxReleaseGnu/lib/libTIesrDT.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrDict.so.1 -Wl,--version-script=../resource/TIesrDictso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrDict.so.1</output>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDT/TIesrDTso"
+                            CT="2"
+                            CN="ArmLinuxDebugGnueabi"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrDT/TIesrDTso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean"
+                            OP="../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDT.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrDict.so.1 -Wl,--version-script=../resource/TIesrDictso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrDict.so.1</output>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDT/TIesrDTso"
+                            CT="2"
+                            CN="ArmLinuxReleaseGnueabi"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrDT/TIesrDTso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean"
+                            OP="../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDT.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrDict.so.1 -Wl,--version-script=../resource/TIesrDictso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrDict/TIesrDictso/nbproject/private/configurations.xml b/TIesrDict/TIesrDictso/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..a1af2a8
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrDict/TIesrDictso/nbproject/private/private.properties b/TIesrDict/TIesrDictso/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrDict/TIesrDictso/nbproject/private/private.xml b/TIesrDict/TIesrDictso/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrDict/TIesrDictso/nbproject/project.properties b/TIesrDict/TIesrDictso/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrDict/TIesrDictso/nbproject/project.xml b/TIesrDict/TIesrDictso/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..5693479
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TIesrDictso</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions/>
+            <cpp-extensions>cpp</cpp-extensions>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects>
+                <make-dep-project>../../TIesrDT/TIesrDTso</make-dep-project>
+            </make-dep-projects>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrDict/TestTIesrDict/.dep.inc b/TIesrDict/TestTIesrDict/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrDict/TestTIesrDict/Makefile b/TIesrDict/TestTIesrDict/Makefile
new file mode 100755 (executable)
index 0000000..524ba36
--- /dev/null
@@ -0,0 +1,111 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrDict/TestTIesrDict/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrDict/TestTIesrDict/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..6605393
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDict
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrdict
+
+../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrdict: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrdict ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o ../src/TestTIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrdict
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TestTIesrDict/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrDict/TestTIesrDict/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..76fee68
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDict
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrdict
+
+../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrdict: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrdict ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o ../src/TestTIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrdict
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TestTIesrDict/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrDict/TestTIesrDict/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..b15e465
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDict
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/bin/testtiesrdict
+
+../../Dist/LinuxDebugGnu/bin/testtiesrdict: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrdict ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o ../src/TestTIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/bin/testtiesrdict
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TestTIesrDict/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrDict/TestTIesrDict/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..0d9525d
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDict
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/bin/testtiesrdict
+
+../../Dist/LinuxReleaseGnu/bin/testtiesrdict: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrdict ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o ../src/TestTIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/bin/testtiesrdict
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TestTIesrDict/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrDict/TestTIesrDict/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..5b72a5f
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/ -lTIesrDict
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/testtiesrdict.exe
+
+../../Dist/WindowsDebugMinGW/testtiesrdict.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrdict.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o ../src/TestTIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/testtiesrdict.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TestTIesrDict/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrDict/TestTIesrDict/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..7a6d98a
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/ -lTIesrDict
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/testtiesrdict.exe
+
+../../Dist/WindowsReleaseMinGW/testtiesrdict.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrdict.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrDict.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -I../src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrDict.o ../src/TestTIesrDict.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/testtiesrdict.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrDict/TestTIesrDict/nbproject/Makefile-impl.mk b/TIesrDict/TestTIesrDict/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..b38309e
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TestTIesrDict
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrDict/TestTIesrDict/nbproject/Makefile-variables.mk b/TIesrDict/TestTIesrDict/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..dba5d58
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=testtiesrdict.exe
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/testtiesrdict.exe
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=testtiesrdict.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/testtiesrdict.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=testtiesrdict.exe
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/testtiesrdict.exe
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=testtiesrdict.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/testtiesrdict.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin
+CND_ARTIFACT_NAME_LinuxDebugGnu=testtiesrdict
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin/testtiesrdict
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=testtiesrdict.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/testtiesrdict.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin
+CND_ARTIFACT_NAME_LinuxReleaseGnu=testtiesrdict
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin/testtiesrdict
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=testtiesrdict.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/testtiesrdict.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=testtiesrdict
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrdict
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=testtiesrdict.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrdict.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=testtiesrdict
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrdict
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=testtiesrdict.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrdict.tar
diff --git a/TIesrDict/TestTIesrDict/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrDict/TestTIesrDict/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..74883ff
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrdict
+OUTPUT_BASENAME=testtiesrdict
+PACKAGE_TOP_DIR=testtiesrdict/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdict/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TestTIesrDict/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrDict/TestTIesrDict/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..103c3aa
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrdict
+OUTPUT_BASENAME=testtiesrdict
+PACKAGE_TOP_DIR=testtiesrdict/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdict/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TestTIesrDict/nbproject/Package-LinuxDebugGnu.bash b/TIesrDict/TestTIesrDict/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..691ebe7
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrdict
+OUTPUT_BASENAME=testtiesrdict
+PACKAGE_TOP_DIR=testtiesrdict/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdict/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TestTIesrDict/nbproject/Package-LinuxReleaseGnu.bash b/TIesrDict/TestTIesrDict/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..9b59e56
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrdict
+OUTPUT_BASENAME=testtiesrdict
+PACKAGE_TOP_DIR=testtiesrdict/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdict/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TestTIesrDict/nbproject/Package-WindowsDebugMinGW.bash b/TIesrDict/TestTIesrDict/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..140b1c9
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrdict.exe
+OUTPUT_BASENAME=testtiesrdict.exe
+PACKAGE_TOP_DIR=testtiesrdict/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdict/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TestTIesrDict/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrDict/TestTIesrDict/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..5339218
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrdict.exe
+OUTPUT_BASENAME=testtiesrdict.exe
+PACKAGE_TOP_DIR=testtiesrdict/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrdict/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrdict.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrDict/TestTIesrDict/nbproject/configurations.xml b/TIesrDict/TestTIesrDict/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..8b87af4
--- /dev/null
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TestTIesrDict.cpp</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrdict.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDict</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrdict.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDict</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrdict</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDict</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrdict</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDict</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrdict</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDict</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrdict</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDict</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrDict/TestTIesrDict/nbproject/private/configurations.xml b/TIesrDict/TestTIesrDict/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..0a6a24f
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ English Dict 0 2 </args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ English Dict 0 2 </args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ English Dict 0 2 </args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ English Dict 0 2 </args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ English Dict 0 2 </args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>../../Data/OffDT_GenDict_PhbVR_LE_MQ English Dict 0 2 </args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrDict/TestTIesrDict/nbproject/private/private.properties b/TIesrDict/TestTIesrDict/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrDict/TestTIesrDict/nbproject/private/private.xml b/TIesrDict/TestTIesrDict/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..8ca126a
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1"/>
diff --git a/TIesrDict/TestTIesrDict/nbproject/project.properties b/TIesrDict/TestTIesrDict/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrDict/TestTIesrDict/nbproject/project.xml b/TIesrDict/TestTIesrDict/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..eee36cf
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TestTIesrDict</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions/>
+            <cpp-extensions>cpp</cpp-extensions>
+            <header-extensions/>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrDict/resource/TIesrDictso.map b/TIesrDict/resource/TIesrDictso.map
new file mode 100644 (file)
index 0000000..482eac7
--- /dev/null
@@ -0,0 +1,15 @@
+TXN_1.1 {  
+   global:
+      # TIesrDict.o
+      __10CTIesrDict; 
+      _._10CTIesrDict;
+      LoadDictionary__10CTIesrDictPCcN21;
+      GetPhoneCount__10CTIesrDict;
+      GetPhoneName__10CTIesrDictUiPc;
+      GetNumberEntries__10CTIesrDictPCcPUi;
+      GetPronEntry__10CTIesrDictPCcUiPcT3;
+      GetNextEntry__10CTIesrDictPcT1;
+      GetPron__10CTIesrDictPCcPcT2;
+   local: 
+      * ;
+};
\ No newline at end of file
diff --git a/TIesrDict/resource/TIesrDictso.ver b/TIesrDict/resource/TIesrDictso.ver
new file mode 100644 (file)
index 0000000..678f2e4
--- /dev/null
@@ -0,0 +1,17 @@
+TXN_1.1 {
+        global:
+                # TIesrDict.o
+                _ZN10CTIesrDictC1Ev;
+                _ZN10CTIesrDictC2Ev;
+                _ZN10CTIesrDictD2Ev;
+                _ZN10CTIesrDictD1Ev;
+                _ZN10CTIesrDict14LoadDictionaryEPKcS1_S1_i;
+                _ZN10CTIesrDict13GetPhoneCountEv;
+                _ZN10CTIesrDict12GetPhoneNameEjPc;
+                _ZN10CTIesrDict16GetNumberEntriesEPKcPj;
+                _ZN10CTIesrDict12GetPronEntryEPKcjPcS2_;
+                _ZN10CTIesrDict12GetNextEntryEPcS0_;
+                _ZN10CTIesrDict7GetPronEPKcPcS2_;
+        local:
+                * ;
+};
diff --git a/TIesrDict/src/TIesrDict.cpp b/TIesrDict/src/TIesrDict.cpp
new file mode 100755 (executable)
index 0000000..198018e
--- /dev/null
@@ -0,0 +1,1507 @@
+/*=======================================================================
+ TIesrDict.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This source file defines the TIesrDict API class, which provides a
+ method to determine phonetic word pronunciation from word
+ spelling. 
+
+ ======================================================================*/
+
+
+/* Windows OS specific headers */
+#if defined ( WIN32 ) || defined ( WINCE )
+// #include <commctrl.h>
+#include <windows.h>
+#endif
+
+
+// C++ includes
+#include <new>
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+
+// API includes
+#include "TIesrDict.h"
+#include "TIesrDictLocal.h"
+
+// Decision tree word to pronunciation
+#ifdef _TIESRDICT_USE_TIESRDT
+
+#include <TIesrDT_User.h>
+
+#else
+
+#include <dtmakeup_user.h>
+
+#endif
+
+
+
+//----------------------------------------------------------------
+// Class public functions
+//----------------------------------------------------------------
+
+
+//----------------------------------------------------------------
+// CTIesrDict
+//
+// Constructor for the class.  Initialization of pointers and variables.
+//--------------------------------
+   CTIesrDict::CTIesrDict( )
+   {
+      // The constructor sets all pointers that will be allocated to heap memory
+      // to NULL.  In this way, the class can track if any failures occurred
+      // and which objects contain valid pointers. The assignment to these
+      // pointers are done in LoadDictionary.
+      
+      // pointer to string of present directory
+      direct = NULL;
+      
+      // pointer to language string
+      lang = NULL;
+      
+      // pointer to dictionary identifier
+      ident = NULL;
+      
+      
+      // If TIesrDT is used, then clear allocation of the TIesrDT object
+#ifdef _TIESRDICT_USE_TIESRDT
+      tiesrDT = NULL;
+#endif
+      
+      
+      // pointer to the allocated binary dictionary
+      dict_beg = NULL;
+      
+      // phone list array is initially empty
+      phone = NULL;
+      n_phone = 0;
+      
+      // state for last word looked up
+      m_word = NULL;
+      m_defaultPron = NULL;
+      m_entryLocation = 0;
+      
+      // No pronunciation
+      // pronstr = NULL;
+      // pron = NULL;
+      
+      return;
+   }
+   
+   
+//----------------------------------------------------------------
+// ~CTIesrDict
+//
+// Destructor of the class
+//--------------------------------
+   CTIesrDict::~CTIesrDict()
+   {
+      delete [] direct;
+      delete [] lang;
+      delete [] ident;
+      
+      delete [] phone;
+      
+      delete [] m_word;
+      delete [] m_defaultPron;
+      
+      //delete pronstr;
+      //delete [] pron;
+      
+      // dict_beg malloced
+      if( dict_beg != NULL )
+         free( dict_beg );
+      
+      
+      // If TIesrDT used, destroy any existing copy of the object
+#ifdef _TIESRDICT_USE_TIESRDT
+      if( tiesrDT != NULL )
+      {
+         TIesrDT_Destroy( tiesrDT );
+      }
+#endif
+      
+   }
+   
+   
+//----------------------------------------------------------------
+// LoadDictionary
+//
+// This function loads the dictionary object with a specific dictionary. In
+// addition, if the code is compiled to use the new TIesrDT decision tree
+// searching code, then this function will also create an instantiation of the
+// TIesrDT object.  It returns ErrNone if the loading was successful,
+// otherwise, it returns a non-zero error status value, which indicates the
+// error type. This function can be called multiple times, Each instance
+// removes the old dictionary information, and installs new dictionary
+// information.  In this way, the user can declare one dictinonary object
+// instance and reuse it for multiple dictionary types by reloading.  Loading
+// requires the location of a directory containing all language information.
+// The aDictDir argument should be the base directory, for example my/dict.
+// The location of the dictionary itself is in directory
+// my/dict/aLanguage/aDictID.  This allows multiple languages, and multiple
+// dictionary types for each language.  Under aDictDir the aLanguage directory
+// should hold the decision trees for generating candidate pronunciations for
+// a given language.  The directory aDictID should hold the binary dictionary
+// file dict.bin and the listing of phones in file phone.lst, where the
+// dictionary and phone list have been created by compressing a dictionary
+// using Yu-Hung's dictionary compression tools.  See
+// /speech/tools2/util/asr/context_dep_phone/dictproc.
+//
+//--------------------------------
+   CTIesrDict::Errors  CTIesrDict::LoadDictionary( const char *aDictDir,
+           const char *aLanguage,
+           const char *aDictID,
+           int addClosure )
+   {
+      char *pathName = NULL;
+      char *fileName = NULL;
+      int dirLen, fileLen;
+      int status;
+      
+      // Remove any prior location information
+      delete [] direct;
+      direct = NULL;
+      delete [] lang;
+      lang = NULL;
+      delete [] ident;
+      ident = NULL;
+
+
+      // Store status of adding stop closures
+      doClosure = addClosure;
+      
+      // If using TIesrDT and a prior TIesrDT object exists, then remove it.
+#ifdef _TIESRDICT_USE_TIESRDT
+      if( tiesrDT != NULL )
+      {
+         TIesrDT_Destroy( tiesrDT );
+         tiesrDT = NULL;
+      }
+#endif
+      
+      
+      // Save the location of information in class, not used right
+      // now, but may be valuable in the future
+      try
+      {
+         direct = new char[ strlen( aDictDir ) + 1 ];
+         lang = new  char[ strlen( aLanguage ) + 1 ];
+         ident = new char[ strlen( aDictID ) + 1];
+      }
+      catch( std::bad_alloc &ex )
+      {
+         return ErrMemory;
+      }
+      
+      strcpy( direct, aDictDir );
+      strcpy( lang, aLanguage );
+      strcpy( ident, aDictID );
+      
+      
+      // directories containing the decision tree and dictionary information
+      dirLen = strlen(direct) + strlen(lang) + strlen(ident) + 4;
+      
+      try
+      { pathName = new char[ dirLen ]; }
+      catch( std::bad_alloc &ex )
+      {
+         return ErrMemory;
+      }
+      strcpy( pathName, direct );
+      strcat( pathName, PATH_SEPARATOR );
+      strcat( pathName, lang );
+      
+      
+      // If using TIesrDT, then create the instance of the object.
+#ifdef _TIESRDICT_USE_TIESRDT
+      TIesrDT_Error_t dtError;
+      dtError = TIesrDT_CreatePreload( &tiesrDT, pathName );
+      if( dtError != TIesrDTErrorNone )
+      {
+         delete [] pathName;
+         return ErrFail;
+      }
+#endif
+      
+      
+      // Complete construction of the pathName of the dictionary
+      strcat( pathName, PATH_SEPARATOR );
+      strcat( pathName, ident );
+      strcat( pathName, PATH_SEPARATOR );
+      
+      // Construct the phone information into phone[][] variable
+      fileLen = strlen(pathName) + strlen(PHONELIST) + 1;
+      try
+      { fileName = new char[ fileLen ]; }
+      catch( std::bad_alloc &ex )
+      {
+         delete [] pathName;
+         return ErrMemory;
+      }
+      strcpy( fileName, pathName );
+      strcat( fileName, PHONELIST );
+      
+      
+      // should be some way to abort if this fails
+      status = read_phone( fileName );
+      delete [] fileName;
+      if( status != ErrNone )
+      {
+         delete [] pathName;
+         return ErrFail;
+      }
+      
+      // find the location of the phonetic dictionary
+      fileLen = strlen( pathName ) + strlen( DICTFILE ) + 2;
+      try
+      { fileName = new char[ fileLen ]; }
+      catch( std::bad_alloc )
+      {
+         delete [] pathName;
+         return ErrMemory;
+      }
+      strcpy( fileName, pathName );
+      strcat( fileName, DICTFILE );
+      
+      // read the dictionary
+      status = read_binary_dictionary( fileName );
+      
+      delete [] fileName;
+      delete [] pathName;
+      
+      if( status != ErrNone )
+         return ErrFail;
+      else
+         return ErrNone;
+   }
+   
+   
+//--------------------------------
+// GetPhoneCount
+//
+// Return the number of phones in the loaded language
+//
+   int CTIesrDict::GetPhoneCount()
+   {
+      return n_phone;
+   }
+   
+   
+//--------------------------------
+// GetPhoneName
+//
+// Copy the name of the phone in the list at position aIndex to a
+// user supplied location aPhoneName.  Note that the use must
+// guarantee space available in aPhoneName, and is responsible for
+// managing that space.
+//
+   CTIesrDict::Errors CTIesrDict::GetPhoneName( unsigned int aIndex,
+           phoneName aPhoneName )
+   {
+      if( n_phone == 0 )
+         return ErrFail;
+      
+      if(  aIndex >= n_phone )
+         return ErrInput;
+      
+      strcpy( aPhoneName, phone[aIndex] );
+      
+      return ErrNone;
+   }
+   
+   
+   /*----------------------------------------------------------------
+  GetDefaultPron
+  Get the default, that is rule-based pronunciation for a word.
+  ----------------------------------------------------------------*/
+   CTIesrDict::Errors CTIesrDict::GetDefaultPron( const char* aWord, char aPron[] )
+   {
+      int idx;
+      unsigned int dirLen;
+      
+      char *pathName = NULL;
+      char  *pron_ascii = NULL;
+      char *pron_ascii_2 = NULL;
+      char  *buf = NULL;
+      
+      int maxString;
+      
+      CTIesrDict::Errors error = ErrNone;
+      
+#ifndef _TIESRDICT_USE_TIESRDT
+      Boolean result;
+
+      
+      
+      // Protect epd_make_case.  It can't handle non-alphabetic chars
+      for( idx=0; idx < (int)strlen(aWord); idx++ )
+      {
+         if( ! ( (aWord[idx] > 64 && aWord[idx] < 91) ||
+                 (aWord[idx] > 96 && aWord[idx] < 123 ) ) )
+         {
+            return ErrInput;
+         }
+      }
+
+#else
+      // Allow alphabetic characters, and the characters ' - .
+      for( idx=0; idx < (int)strlen(aWord); idx++ )
+      {
+         if( ! ( (aWord[idx] > 64 && aWord[idx] < 91) ||
+                 (aWord[idx] > 96 && aWord[idx] < 123 ) ||
+                 (aWord[idx] == 39) || (aWord[idx] == 45) ||
+                 (aWord[idx] == 46) ) )
+         {
+            return ErrInput;
+         }
+      }
+
+#endif
+
+      // directory containing the decision tree information
+      dirLen = strlen(direct) + strlen(lang) +3;
+      try
+      { pathName = new char[ dirLen ]; }
+      catch( std::bad_alloc &ex )
+      {
+         error = ErrMemory;
+         goto FinishPron;
+      }
+      
+      // Make pathName
+      strcpy( pathName, direct );
+      strcat( pathName, PATH_SEPARATOR );
+      strcat( pathName, lang );
+      strcat( pathName, PATH_SEPARATOR );
+      
+      // word pronunciation phone string length must not exceed this estimate
+      maxString = MAXPHONESPERWORD*MAXPHONENAME;
+      
+      try
+      {
+         pron_ascii = new char[maxString];
+         pron_ascii_2 = new char[maxString];
+         
+         // Modifiable buffer holding word to look up
+         buf = new char[ strlen(aWord) + 1];
+      }
+      catch( std::bad_alloc &ex )
+      {
+         error = ErrMemory;
+         goto FinishPron;
+      }
+      
+      
+      // Copy word to buf and convert to uppercase
+      strcpy(buf, aWord);
+      chrtoupper( buf );
+      
+      
+      // get default pronunciation, using TIesrDT or dtmakeup depending
+      // on which API was compiled.
+#ifdef _TIESRDICT_USE_TIESRDT
+      TIesrDT_Error_t dtError;
+      dtError = TIesrDT_Pron( tiesrDT, buf, pron_ascii, maxString );
+      
+      // TIesrDT can return an empty string for default pronunciation
+      if( dtError != TIesrDTErrorNone /*|| strlen( pron_ascii ) == 0 */ )
+      {
+         error = ErrFail;
+         goto FinishPron;
+      }
+      
+#else
+      result = epd_make_case(buf, pron_ascii, maxString, pathName, true );
+      if( result != true || strlen( pron_ascii ) == 0  )
+      {
+         error = ErrFail;
+         goto FinishPron;
+      }
+#endif
+      
+      
+      // Map to include stop closures in word phones if needed
+      if( doClosure )
+      {
+          map_pron(pron_ascii, pron_ascii_2);
+      }
+      else
+      {
+          strcpy(pron_ascii_2, pron_ascii );
+      }
+      
+      // Convert ascii to phone indices
+      pron2bin(pron_ascii_2, aPron);
+      
+      
+      FinishPron:
+      delete [] pathName;
+      delete [] pron_ascii;
+      delete [] pron_ascii_2;
+      delete [] buf;
+      
+      return error;
+   }
+   
+   
+//--------------------------------
+// GetPron
+//
+// Get the pronunciation of the word provided as the input argument.
+// The pron[] array will be filled with the indices of the phones,
+// and the pronstr will be filled with the string of phones.
+//
+   CTIesrDict::Errors CTIesrDict::GetPron( const char *aWord,
+           char aPron[],
+           char *aPronString )
+   {
+      CTIesrDict::Errors error;
+      int   idx;
+      char  *ucWord;
+      
+      
+      // Delete any existing lookup for GetPronEntry and GetNextEntry
+      delete [] m_word;
+      m_word = NULL;
+      
+      delete [] m_defaultPron;
+      m_defaultPron = NULL;
+      
+      m_entryLocation = 0;
+      m_entryNumber = 0;
+      
+      // Get the default pronunciation
+      error = GetDefaultPron( aWord, aPron );
+      if( error != ErrNone )
+      {
+         return ErrFail;
+      }
+      
+      
+      // Modifiable buffer holding word to look up in upper case
+      try
+      { ucWord = new char[ strlen(aWord) + 1]; }
+      catch( std::bad_alloc &ex )
+      {
+         return ErrMemory;
+      }
+      
+      strcpy( ucWord, aWord );
+      chrtoupper(ucWord);
+      
+      
+      /* dictionary lookup */
+      idx = lookup( ucWord );
+      
+      // If word found in dictionary, do use the exception
+      if ( idx != -1 )
+      {
+         /* use exception.*/
+         // Note: decode_entry finds and uses first word entry in dictionary
+         decode_entry(ucWord, idx, aPron);
+      }
+      
+      
+      // Done with word text
+      delete [] ucWord;
+      
+      
+      // output the pronunciation string from dictionary lookup
+      if( aPronString != NULL )
+      {
+         PronToString( aPron, aPronString );
+      }
+      
+      return ErrNone;
+   }
+   
+   
+   
+   /*----------------------------------------------------------------
+  GetNumberEntries
+  Get the number of entries in the dictionary for a word specified by
+  aWord.  Note that this does NOT include the rule-based default
+  pronunciation, only the number of pronunciations in the dictionary.
+  Hence the number returned in aNumberEntries can be zero.
+  ----------------------------------------------------------------*/
+   CTIesrDict::Errors CTIesrDict::GetNumberEntries( const char* aWord, unsigned int *aNumberEntries )
+   {
+      int startLocation;
+      int pronLocation;
+      int noMatch;
+      char dictWord[MAX_STR];
+      char *ucWord;
+      int numEntries;
+      
+      *aNumberEntries = 0;
+      numEntries = 0;
+      
+      // convert the word to upper case.
+      try
+      { ucWord = new char[ strlen(aWord) + 1]; }
+      catch( std::bad_alloc &ex )
+      {
+         return ErrMemory;
+      }
+      
+      strcpy( ucWord, aWord );
+      chrtoupper( ucWord );
+      
+      // Check for existence of the word in the dictionary
+      startLocation = lookup( ucWord );
+      if( startLocation == -1 )
+      {
+         delete [] ucWord;
+         return ErrNone;
+      }
+      
+      // Found an entry in the dictionary
+      numEntries++;
+      pronLocation = startLocation;
+      noMatch = 0;
+      
+      // Search backward in dictionary to find all prior entries that match
+      while( ! noMatch && pronLocation > first )
+      {
+         // Go to prior entry location in dictionary
+         pronLocation = dec_entry( pronLocation );
+         
+         // Prior word at the entry location
+         dictWord[0] = '\0';
+         expand_str( dictWord, pronLocation );
+         
+         // If the dictionary word matches the word we want, then increment count
+         noMatch = compare_str( ucWord, dictWord );
+         if( ! noMatch )
+         {
+            numEntries++;
+         }
+      }
+      
+      // Look forward in the dictionary for subsequent matching entries
+      pronLocation = startLocation;
+      noMatch = 0;
+      
+      while( ! noMatch && pronLocation < last )
+      {
+         // Go to next entry location in dictionary
+         pronLocation = inc_entry( pronLocation );
+         
+         // Prior word at the entry location
+         dictWord[0] = '\0';
+         expand_str( dictWord, pronLocation );
+         
+         // If the dictionary word matches the word we want then increment count
+         noMatch = compare_str( ucWord, dictWord );
+         if( ! noMatch )
+         {
+            numEntries++;
+         }
+      }
+      
+      *aNumberEntries = numEntries;
+      
+      delete [] ucWord;
+      return ErrNone;
+   }
+   
+   
+   
+   /*----------------------------------------------------------------
+  GetPronEntry
+  Get the Nth pronunciation entry of a word specified by aWord.  The
+  value of N is specified by the argument aEntryNumber.  If
+  aEntryNumber is zero, then the default rule-based pronunciation is
+  returned without consulting the dictionary.  Otherwise the Nth
+  pronunciation of the word in the dictionary is returned.  If the Nth
+  pronunciation does not exist, aPron will have zero in the first
+  character, and if aPronString is not NULL, it will be set to "".
+  ----------------------------------------------------------------*/
+   CTIesrDict::Errors CTIesrDict::GetPronEntry( const char *aWord,
+           const unsigned int aEntryNumber,
+           char aPron[], char *aPronString )
+   {
+      Errors error;
+      int phone;
+      
+      
+      // No dictionary lookup yet
+      m_entryLocation = 0;
+      m_entryNumber = 0;
+      
+      // Reallocate space to hold the word and its default pronunciation
+      delete [] m_defaultPron;
+      m_defaultPron = NULL;
+      
+      delete [] m_word;
+      m_word = NULL;
+      
+      try
+      {
+         m_word = new char[ strlen( aWord ) + 1 ];
+         
+         // Create space to hold the phones of the default pronunciation of the word.
+         m_defaultPron = new char[ MAXPHONESPERWORD + 1];
+      }
+      catch( std::bad_alloc &ex )
+      {
+         return ErrMemory;
+      }
+      
+      // Copy of the word in upper case
+      strcpy( m_word, aWord );
+      chrtoupper( m_word );
+      
+      
+      // Get default pronunciation and check for failure
+      error = GetDefaultPron( m_word, m_defaultPron );
+      if( error != ErrNone )
+      {
+         strcpy( m_word, "" );
+         return ErrFail;
+      }
+      
+      
+      // Copy default pronunciation phone indices and pron string to output.
+      // This will be replaced if the desired dictionary entry is found.
+      for( phone=0; phone <= m_defaultPron[0]+1; phone++ )
+      {
+         aPron[phone] = m_defaultPron[phone];
+      }
+      
+      if( aPronString )
+         PronToString( m_defaultPron, aPronString );
+      
+      
+      // User only wants the rule-based pronunciation
+      if( aEntryNumber == 0 )
+         return ErrNone;
+      
+      
+      // User requested a pronunciation from the dictionary.  Get the
+      // location of the requested entry in the dictionary for this word.
+      m_entryLocation = LocatePron( m_word, aEntryNumber );
+      if( m_entryLocation == 0 )
+         return ErrNotInDictionary;
+      
+      
+      // Get the pronunciation of the word according to the dictionary
+      print_pron( m_word, m_entryLocation, m_defaultPron, aPron );
+      if( aPronString )
+         PronToString( aPron, aPronString );
+      
+      m_entryNumber = aEntryNumber;
+      
+      return ErrNone;
+   }
+   
+   
+   /*----------------------------------------------------------------
+  GetNextEntry
+  This function should only be called after a call to GetPronEntry.  It
+  provides a means of obtaining the next pronunciation of the word
+  specified in GetPronEntry.  If the next pronunciation does not exist,
+  aPron will have zero in the first character, and if aPronString is
+  not NULL, it will be set to "", and the fuction will return
+  ErrNotInDictionary.  This function call is provided so that
+  dictionary search does not need to be done for each of multiple
+  pronunciations looked up in the dictionary.
+  ----------------------------------------------------------------*/
+   CTIesrDict::Errors CTIesrDict::GetNextEntry( char aPron[], char *aPronString )
+   {
+      int pronLocation;
+      
+      
+      // Check that a word has been looked up by GetPronEntry
+      if( m_word == NULL || strcmp(m_word, "") == 0 )
+      {
+         aPron[0] = 0;
+         if( aPronString )
+            aPronString = "";
+         return ErrFail;
+      }
+      
+      
+      // Try to find a valid dictionary entry location for the next
+      // word entry.
+      
+      // If no dictionary entry has been looked up yet,
+      // try to find the first dictionary entry.
+      if( m_entryLocation == 0 )
+      {
+         pronLocation = LocatePron( m_word, 1 );
+      }
+      
+      // Otherwise, if not at end of dictionary try to find next entry.
+      else if( m_entryLocation < last )
+      {
+         char dictWord[MAX_STR];
+         dictWord[0] = '\0';
+         
+         pronLocation = inc_entry( m_entryLocation );
+         expand_str( dictWord, pronLocation );
+         
+         // Next word entry does not match word
+         if( strcmp(dictWord, m_word ) != 0 )
+         {
+            pronLocation = 0;
+         }
+      }
+      
+      // At the end of dictionary
+      else
+         pronLocation = 0;
+      
+      
+      // If no valid location, then no more entries of this word exist
+      // in the dictionary
+      if( pronLocation < first || pronLocation > last )
+      {
+         aPron[0] = 0;
+         if( aPronString )
+            aPronString = "";
+         
+         return ErrNotInDictionary;
+      }
+      
+      
+      // A valid word exists in the next dictionary location
+      m_entryLocation = pronLocation;
+      
+      // Get the pronunciation of the word according to the dictionary
+      print_pron( m_word, m_entryLocation, m_defaultPron, aPron );
+      if( aPronString )
+         PronToString( aPron, aPronString );
+      
+      m_entryNumber++;
+      
+      return ErrNone;
+   }
+   
+
+/*----------------------------------------------------------------
+  LocatePron
+  This function locates the one-based Nth pronunciation for a word in
+  the dictionary.  N is specified by the argument aEntryNumber.  This
+  function returns the byte entry location in the dictionary if the
+  Nth pronunciation for the word exists, otherwise it returns 0.
+ ----------------------------------------------------------------*/
+   int CTIesrDict::LocatePron( char* aWord, unsigned int aEntryNumber )
+   {
+      int startLocation;
+      int pronLocation;
+      char dictWord[MAX_STR];
+      unsigned int entryNumber;
+      int noMatch;
+      
+      // User should not request the zeroth entry.
+      if( aEntryNumber == 0 )
+         return 0;
+      
+      
+      // Check for existence of the word in the dictionary
+      startLocation = lookup( aWord );
+      if( startLocation == -1 )
+      {
+         return 0;
+      }
+      
+      
+      // Found an entry for the word in the dictionary.
+      // Search backward in dictionary to find the first entry of this word.
+      noMatch = 0;
+      
+      while( ! noMatch && startLocation > first )
+      {
+         // Go to prior entry location in dictionary
+         pronLocation = dec_entry( startLocation );
+         
+         // Prior word at the entry location
+         dictWord[0] = '\0';
+         expand_str( dictWord, pronLocation );
+         
+         // If the dictionary word matches the word we want, then continue searching backward
+         noMatch = compare_str( aWord, dictWord );
+         if( ! noMatch )
+         {
+            startLocation = pronLocation;
+         }
+      }
+      
+      
+      // If user wants the first entry, it is the present one
+      if( aEntryNumber == 1 )
+      {
+         return startLocation;
+      }
+      
+      
+      // User wants an entry number > 1 for the word.
+      // Try searching forward for the entry number the user wants
+      entryNumber = 1;
+      noMatch = 0;
+      while( ! noMatch && startLocation < last )
+      {
+         // Go to next entry location in dictionary
+         pronLocation = inc_entry( startLocation );
+         
+         // Word at the present entry location
+         dictWord[0] = '\0';
+         expand_str( dictWord, pronLocation );
+         
+         // If the dictionary word matches the word wanted then increment count
+         // and determine if it is the entry number wanted
+         noMatch = compare_str( aWord, dictWord );
+         if( ! noMatch )
+         {
+            entryNumber++;
+            
+            // Return this entry, which is the entry number wanted
+            if( entryNumber == aEntryNumber )
+               return pronLocation;
+            
+            // Continue searching, have not found desired entry number yet
+            startLocation = pronLocation;
+         }
+         else
+         {
+            // No more words match, and the wanted entry has not been found
+            return 0;
+         }
+         
+      }
+      
+      // Did not find the wanted entry number for the wanted word
+      return 0;
+      
+   }
+   
+   
+   
+   /*----------------------------------------------------------------
+  PronToString
+  Converts a phone index-based pronunciation into a string.
+  ----------------------------------------------------------------*/
+   CTIesrDict::Errors CTIesrDict::PronToString( char* aPron, char* aPronString )
+   {
+      int phnIndex;
+      aPronString[0] = '\0';
+      for( phnIndex = 1; phnIndex <= aPron[0]; phnIndex++ )
+      {
+         strcat( aPronString, phone[ aPron[phnIndex] ] );
+         if( phnIndex < aPron[0] )
+            strcat( aPronString, " " );
+      }
+      
+      return ErrNone;
+   }
+   
+   
+   
+//----------------------------------------------------------------
+// Class private functions
+//----------------------------------------------------------------
+   
+   
+//--------------------------------
+// read_phone
+//
+// This function reads the list of phones from the file phone.lis
+// and loads them in the CTIesrDict object.
+//
+   CTIesrDict::Errors CTIesrDict::read_phone( char *fname )
+   {
+      FILE  *fp;
+      phoneName phName;
+      int phnidx;
+      
+      
+      // clear any preexisting phone list
+      if( n_phone > 0 )
+      {
+         delete [] phone;
+         phone = NULL;
+         n_phone = 0;
+      }
+      
+      
+      // open new phone file
+      fp = fopen(fname, "r");
+      if ( fp == NULL )
+      {
+         return ErrFail;
+      }
+      
+      
+      // Determine number of phones, and ensure proper formatting
+      while ( fscanf(fp, "%s", phName) != EOF )
+      {
+         n_phone++;
+      }
+      
+      
+      // Create the phone list
+      try
+      {phone = new phoneName[n_phone+1]; }
+      catch( std::bad_alloc )
+      {
+         fclose(fp);
+         return ErrFail;
+      }
+      
+      fseek( fp, 0, SEEK_SET );
+      clearerr( fp );
+
+      phnidx = 0;
+      while ( fscanf(fp, "%s", phName) != EOF )
+      {
+         strcpy( phone[phnidx], phName );
+         phnidx++;
+      }
+      
+      
+      // n_phone does not count this BOUNDARY phone
+      strcpy( phone[ phnidx ], BOUNDARY );
+      
+      fclose( fp );
+      
+      return ErrNone;
+   }
+   
+   
+//--------------------------------
+   CTIesrDict::Errors CTIesrDict::read_binary_dictionary( char *fname )
+   {
+      FILE  *fp;
+      int   size;
+      
+      // if dictionary exists, free it
+      if( dict_beg != NULL )
+         free( dict_beg );
+      
+      /* read binary dictionary */
+      fp = fopen(fname, "rb");
+      if ( fp == NULL )
+      {
+         return ErrFail;
+      }
+      
+      fread(&size, sizeof(int), 1, fp);
+      dict_beg = (char *) malloc( size );
+      
+      if( !dict_beg )
+         return ErrFail;
+      
+      
+      fread(dict_beg, sizeof(char), size, fp);
+      fclose( fp );
+      
+      
+      // Set offsets for first and last indices
+      first = 1;
+      
+      last = size - 1;
+      while( dict_beg[last] != ALIGN ) last--;
+      last++;
+      
+      return ErrNone;
+   }
+   
+   
+//----------------------------
+// map_phone
+//
+// map one phone into one or more phones
+//
+   void CTIesrDict::map_phone(char *iphone, char *ophone)
+   {
+      int   i;
+      
+      for ( i = 0; i < N_PAIR; i++ )
+      {
+         if ( strcmp( iphone, mapping_pair[i].from ) == 0 )
+         {
+            strcpy( ophone, mapping_pair[i].to );
+            return;
+         }
+      }
+      
+      strcpy( ophone, iphone );
+      
+   }
+   
+   
+//--------------------------
+// map_pron
+//
+// map ASCII pron (phone sequence)
+//
+   void CTIesrDict::map_pron(char *ipron, char *opron)
+   {
+      char  *ptr;
+      char  buf[ MAX_STR ], ophone[ MAX_STR ];
+      
+      *opron = '\0';
+      strcpy( buf, ipron );
+      
+      ptr = strtok( buf, DELIMIT );
+      
+      while ( ptr )
+      {
+         
+         map_phone( ptr, ophone );
+         strcat( opron, ophone );
+         strcat( opron, " " );
+         
+         ptr = strtok( NULL, DELIMIT );
+      }
+      
+   }
+   
+   
+//------------------------
+   /* ---------------------------------------------------------------------------
+string can be terminated by 0 or negative
+---------------------------------------------------------------------- */
+   void CTIesrDict::copy_str(char *str1, char *str2)
+   {
+      while ( *str2 && ( ( *str2 & MASK_3 ) == '\0' ) )
+         *str1++ = *str2++;
+      
+      *str1 = '\0';
+      
+   }
+   
+   
+//--------------------------------
+   /* ---------------------------------------------------------------------------
+return -1 0 1 if str1 < = > str2
+---------------------------------------------------------------------- */
+   int CTIesrDict::compare_str(char *str1, char *str2)
+   {
+      while ( *str1 && *str2 )
+      {
+         
+         if ( *str1 > *str2 )
+            return 1;
+         else if ( *str1 < *str2 )
+            return -1;
+         
+         str1++;
+         str2++;
+      }
+      
+      if ( ( *str1 == 0 ) && ( *str2 != 0 ) )
+         return -1;
+      else if ( ( *str1 != 0 ) && ( *str2 == 0 ) )
+         return 1;
+      else
+         return 0;
+      
+   }
+   
+   
+//---------------------------
+   /* ---------------------------------------------------------------------------
+offset computation
+---------------------------------------------------------------------- */
+   int CTIesrDict::mid_entry(int i1, int i2)
+   {
+      int   i;
+      
+      if ( i1 == i2 ) return i1;
+      
+      i = ( i1 + i2 ) >> 1;
+      
+      while ( dict_beg[ i ] != ALIGN ) i++;
+      i++;
+      return i;
+      
+   }
+   
+   
+//------------------------
+   int CTIesrDict::inc_entry(int i)
+   {
+      if ( i == last )
+      {
+         
+         return i + 1;
+         
+      } else
+      {
+         
+         while ( dict_beg[ i ] != ALIGN ) i++;
+         i++;
+         return i;
+      }
+      
+   }
+   
+   
+//--------------------------
+   int CTIesrDict::dec_entry(int i)
+   {
+      if ( i == first )
+      {
+         
+         return i - 1;
+         
+      } else
+      {
+         
+         i -= 2;
+         
+         while ( dict_beg[ i ] != ALIGN ) i--;
+         i++;
+         return i;
+      }
+      
+   }
+   
+   
+//---------------------------
+   /* ---------------------------------------------------------------------------
+must do buf[0] = '\0' before calling expand_str()
+---------------------------------------------------------------------- */
+   void CTIesrDict::expand_str(char *buf, int idx)
+   {
+      int   len;
+      
+      if ( (signed char) dict_beg[ idx ] >= 0 )
+      {
+         
+         copy_str(buf, &dict_beg[ idx ]);
+         
+      } else
+      {
+         
+         expand_str(buf, dec_entry( idx ) );
+         len = - (signed char) dict_beg[ idx ];
+         buf += len;
+         copy_str(buf, &dict_beg[ idx + 1 ]);
+      }
+      
+   }
+   
+   
+//-----------------------------
+   /* ---------------------------------------------------------------------------
+get the offset for pronunciation for the word offset idx
+---------------------------------------------------------------------- */
+   int CTIesrDict::get_pron_offset(int idx)
+   {
+      idx++;               /* first char may be negative, skip */
+      
+      while ( ( dict_beg[ idx ] & MASK_3 ) == '\0' )
+         idx++;
+      
+      return idx;
+      
+   }
+   
+   
+//-------------------------------
+   /* ---------------------------------------------------------------------------
+convert ascii phone sequence to binary
+pron[0] = length in bytes, total length is pron[0] + 1
+---------------------------------------------------------------------- */
+   void CTIesrDict::pron2bin(char *str, char *pron)
+   {
+      int   i = 1;
+      char  *ptr;
+      
+      ptr = strtok(str, DELIMIT);
+      while ( ptr )
+      {
+         pron[ i++ ] = get_phone_idx( ptr );
+         ptr = strtok( NULL, DELIMIT );
+      }
+      
+      pron[ 0 ] = i - 1;
+      
+   }
+   
+   
+//----------------------
+   /* ---------------------------------------------------------------------------
+convert pron_err sequence to pron,
+pron[0] = length in bytes, total length is pron[0] + 1
+---------------------------------------------------------------------- */
+   void CTIesrDict::err2pron(char *pron_def, int len_def, char *pron_err, char *pron)
+   {
+      int   i;
+      int   len, idx1, idx2, pos, insc;
+      
+      /* go through pron_err and reconstruct pron */
+      
+      insc = 0;
+      idx1 = idx2 = 0;
+      len = pron_err[0];
+      
+      i = 1;
+      
+      while ( i <= len )
+      {
+         
+         if ( ( pron_err[i] & MASK ) == SUB )
+         {            /* SUB */
+            
+            pos = pron_err[i] & 0x3f;   /* position */
+            while ( (idx1 + insc) < pos )
+               pron[ 1 + idx1++ ] = pron_def[ idx2++ ];
+            
+            pron[ 1 + idx1++ ] = pron_err[ i + 1 ];
+            idx2++;
+            
+            i += 2;
+            
+         } else if ( ( pron_err[i] & MASK ) == DEL )
+         {     /* DEL */
+            
+            pos = pron_err[i] & 0x3f;   /* position */
+            while ( (idx1 + insc) < pos )
+               pron[ 1 + idx1++ ] = pron_def[ idx2++ ];
+            
+            pron[ 1 + idx1++ ] = pron_err[ i + 1 ];
+            
+            i += 2;
+            
+         } else
+         {                                          /* INS */
+            
+            pos = pron_err[i] & 0x3f;   /* position */
+            while ( (idx1 + insc) < pos )
+               pron[ 1 + idx1++ ] = pron_def[ idx2++ ];
+            
+            idx2++;
+            
+            insc++;
+            
+            i++;
+         }
+      }
+      
+      /* the rest, including no err */
+      
+      while ( idx2 < len_def )
+         pron[ 1 + idx1++ ] = pron_def[ idx2++ ];
+      
+      pron[0] = idx1;
+      
+   }
+   
+   
+//-----------------------
+   /* ---------------------------------------------------------------------------
+must do buf[0] = '\0' before calling expand_pron()
+very similar to expand_str(), but the format is different.
+  "String" is terminated by '\0'.
+    "Pronunciation" is prefixed by length, followed by length bytes,
+    there is no termination char.
+---------------------------------------------------------------------- */
+   void CTIesrDict::expand_pron(char *buf, int idx)
+   {
+      int   len, base;
+      int   i;
+      int   ipron;
+      
+      ipron = get_pron_offset( idx );
+      
+      if ( ( dict_beg[ ipron ] & MASK_2 ) == 0 )
+      {  /* remove the negative bit */
+         
+         buf[0] = '\0';
+         
+      } else if ( ( dict_beg[ ipron + 1 ] & MASK ) != MATCH )
+      {
+         
+         len = dict_beg[ ipron ] & MASK_2;
+         for (i = 1; i <= len; i++) buf[ i ] = dict_beg[ ipron + i ];
+         buf[0] = len;
+         
+      } else
+      {                                    /* delta encoded */
+         
+         expand_pron(buf, dec_entry( idx ) );
+         len = dict_beg[ ipron + 1 ];              /* len of match with previous */
+         base = len + 1;
+         len = ( dict_beg[ ipron ] & MASK_2 ) - 1; /* len of this pron */
+         for (i = 0; i < len; i++) buf[ base + i ] = dict_beg[ ipron + 2 + i ];
+         buf[0] = base + len - 1;
+      }
+      
+   }
+   
+   
+//------------------------------
+   /* ---------------------------------------------------------------------------
+    get_phone index
+    ---------------------------------------------------------------------- */
+   int CTIesrDict::get_phone_idx(char *name)
+   {
+      unsigned int i;
+      
+      for(i = 0; i < n_phone; i++)
+      {
+         if ( strcmp(name, phone[i]) == 0 )
+            return i;
+      }
+      
+      //fprintf(stderr, "Error: %s not a phone\n", phone);
+      return( -1 );
+   }
+   
+   
+//----------------------------
+   /* ---------------------------------------------------------------------------
+    print pron
+    ---------------------------------------------------------------------- */
+   void CTIesrDict::print_pron(char *word, int idx, char *pron_def, char *pron)
+   {
+      char  pron_err[ MAX_PRON ];
+      
+      pron_err[0] = '\0';                         /* get entry in dict */
+      expand_pron(pron_err, idx);
+      err2pron( &pron_def[1], (int) pron_def[0], pron_err, pron );
+   }
+   
+   
+//------------------------
+   /* ---------------------------------------------------------------------------
+    decode one entry
+    ---------------------------------------------------------------------- */
+   void CTIesrDict::decode_entry(char *word, int idx, char *pron)
+   {
+      char  buf[ MAX_STR ];
+      char  pron_def[ MAX_PRON ];
+      int   idx2, i;
+      
+      for (i = 0; i < pron[0] + 1; i++)
+         pron_def[i] = pron[i];
+      
+      /* go up, may be more than one entry, find the first entry of this word */
+      
+      idx2 = idx;
+      
+      idx2 = dec_entry( idx2 );
+      if ( idx2 >= first )
+      {
+         buf[0] = '\0';
+         expand_str(buf, idx2);
+      }
+      while ( ( idx2 >= first ) && compare_str(word, buf) == 0 )
+      {
+         
+         idx = idx2;
+         
+         idx2 = dec_entry( idx2 );
+         if ( idx2 >= first )
+         {
+            buf[0] = '\0';
+            expand_str(buf, idx2);
+         }
+      }
+      
+      /* go down, starting from first entry of this word */
+      
+      idx2 = idx;
+      
+      buf[0] = '\0';
+      expand_str(buf, idx2);
+      
+      while ( ( idx2 <= last ) && compare_str(word, buf) == 0 )
+      {
+         
+         print_pron( word, idx2, pron_def, pron );
+         
+         return;                /* only the first pron, discard multiple pron */
+         
+         idx2 = inc_entry( idx2 );
+         if ( idx2 <= last )
+         {
+            buf[0] = '\0';
+            expand_str(buf, idx2);
+         }
+      }
+      
+   }
+   
+   
+//------------------------------
+   /* ---------------------------------------------------------------------------
+    convert to uppercase
+    ---------------------------------------------------------------------- */
+   void CTIesrDict::chrtoupper(char *str)
+   {
+      while ( *str )
+      {
+         
+         if ( *str >= 'a' && *str <= 'z' )
+            *str -= 'a' - 'A';
+         
+         str++;
+      }
+      
+   }
+   
+   
+//----------------------
+   /* ---------------------------------------------------------------------------
+    dictionary lookup, binary search, it returns:
+    
+    index: first <= index <= last
+    -1: not found
+    ---------------------------------------------------------------------- */
+   int CTIesrDict::lookup(char *word)
+   {
+      int   idx, icompare, imax, imin;
+      char  buf[ MAX_STR ];
+      
+      imax = last;
+      imin = first;
+      
+      while ( imax >= imin )
+      {
+         
+         idx = mid_entry( imin, imax );
+         
+         buf[0] = '\0';
+         expand_str(buf, idx);
+         
+         icompare = compare_str(word, buf);
+         if ( icompare == 0 )
+         {
+            return idx;
+         } else if ( icompare > 0 )
+         {
+            imin = inc_entry( idx );
+         } else
+         {
+            imax = dec_entry( idx );
+         }
+      }
+      
+      return -1;
+   }
diff --git a/TIesrDict/src/TIesrDict.h b/TIesrDict/src/TIesrDict.h
new file mode 100644 (file)
index 0000000..94a7faa
--- /dev/null
@@ -0,0 +1,274 @@
+/*=======================================================================
+ TIesrDict.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+This header contains the description of the CTIesrDict class API.
+This class provides the user with a method to look up phonetic 
+pronunciation of words from their spelling.  
+
+The method used is to create a candidate phonetic pronunciation
+using  decision tree technology.  Then look up the
+word in the delta-encoded dictionary.  If there is an entry for the
+word, then modify the candidate according to the dictionary,
+otherwise use the candidate pronunciation itself.  
+
+The sequence of usage is to first to instantiate an instance of the
+TIesrDict object.
+
+Next the TIesrDict object is loaded with a dictionary by
+LoadDictionary.  This allows one to utilize a particular dictionary
+for a language.
+
+To get word pronunciations, use GetPron. The result will be an array
+of byte indices in the variable pron that describes the indices of
+the phones corresponding to a word, and in pronstr there will be a
+string of phones that make up the word, separated by whitespace.
+
+A convenience function, GetPhoneCount can be used to determine the
+number of phones used in the dictionary.
+
+A convenience function, GetPhoneName returns a phone spelling for each
+phone used in the dictionary.
+
+======================================================================*/
+
+#ifndef _TIESRDICT_H
+#define _TIESRDICT_H
+
+
+/* Windows method of exporting DLL functions */
+
+#if defined( WIN32 ) || defined ( WINCE )
+
+// The following ifdef block is the standard way of creating macros which make exporting 
+// from a DLL simpler. All files within this DLL are compiled with the TIESRDICT_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see 
+// TIESRDICT_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef TIESRDICT_EXPORTS
+#define TIESRDICT_API __declspec(dllexport)
+#else
+#define TIESRDICT_API __declspec(dllimport)
+#endif
+
+#else
+#define TIESRDICT_API
+#endif
+
+
+//--------------------------------
+// The TIesrDict API may use either the old dtmakeup decision tree API
+// or it may use the newer, faster and smaller TIesrDT API (recommended).
+// The flag defined here determines which one is used.  If commented out,
+// then the older dtmakeup is used.  Eventually dtmakeup will no longer
+// be supported, and so it is deprecated.
+#define _TIESRDICT_USE_TIESRDT
+
+#ifdef _TIESRDICT_USE_TIESRDT
+#include <TIesrDT_User.h>
+#endif
+
+//--------------------------------
+//  CTIesrDict
+//
+//  The TIesrDict API class.
+//
+class TIESRDICT_API CTIesrDict 
+{
+public:
+
+      // Enumeration of errors returned by the class
+      enum Errors
+      {
+        ErrNone,
+        ErrFail,
+        ErrMemory,
+        ErrInput,
+        ErrNotInDictionary
+      };
+
+      // The phoneName is a character array containing a character
+      // string holding the name of a phone.  The last character will
+      // be \0.  Phone names can have a maximum length of
+      // MAXPHONENAME.  This constant and typedef are provide publicly
+      // for the app user.
+      //
+      static const unsigned int MAXPHONENAME = 10;
+      typedef char phoneName[MAXPHONENAME+1];
+
+
+      // No word may have more than this number of phones
+      // in its pronunciation.
+      static const unsigned int MAXPHONESPERWORD = 100;
+
+
+   public:
+
+      // Public interface to CTIesrDict
+
+      // Constructor
+      CTIesrDict();
+
+      // Destructor
+      ~CTIesrDict();
+       
+
+      // Load a dictionary into the TIesrDict object.  Specify the top
+      // level directory, the language, and the dictionary identifier.
+      // The decision trees should be in aDictDir/aLanguage, and the
+      // delta-encoded dictionary and phone list should be in
+      // aDictDir/aLanguage/aDictID. If the dictionary contains added stop phone
+      // closures, then addClosure should be set to 1, otherwise set it to
+      // zero. Adding closures is the assumed default.
+      Errors LoadDictionary( const char *aDictDir, 
+                            const char *aLanguage, 
+                            const char *aDictID,
+                             int addClosure = 1 );
+      
+
+      // Return the number of phones in the loaded dictionary
+      int GetPhoneCount();
+
+
+      // Get the phone indexed by aIndex according to the phone list
+      // in aPhoneName.
+      Errors GetPhoneName( unsigned int aIndex, phoneName aPhoneName );
+       
+
+      // Get the number of entries in the dictionary for a word specified by
+      // aWord.  Note that this does NOT include the rule-based default
+      // pronunciation, only the number of pronunciations in the dictionary.
+      // Hence the number returned in aNumberEntries can be zero.
+      Errors GetNumberEntries( const char* aWord, unsigned int *aNumberEntries );
+
+
+      // Get the pronunciation of the word specified by aWord.  Return the
+      // indices of the phones according to the phonelist in aPron, and return
+      // the pronunciation string in aPronString.  If aPronString is NULL, no
+      // string is output.  aPron[0] is the number of phones in the
+      // pronunciation.  The pronunciation provided by this call is either the
+      // default pronunciation provided by the rule-based system, or the first
+      // pronunciation located in the dictionary.  This function is supplied
+      // for legacy reasons.
+      Errors GetPron( const char *aWord, char aPron[], 
+                     char *aPronString = NULL );
+
+
+      // Get the Nth pronunciation entry of a word specified by aWord.  The
+      // value of N is specified by the argument aEntryNumber.  If
+      // aEntryNumber is zero, then the default rule-based pronunciation is
+      // put into aPron and aPronString, without consulting the dictionary.
+      // Otherwise this function will attempt to find and supply the Nth
+      // pronunciation of the word in the dictionary.  If the Nth
+      // pronunciation does not exist, it will output the rule-based
+      // pronunciation, and will return ErrNotInDictionary.
+      Errors GetPronEntry( const char *aWord, const unsigned int aEntryNumber,
+                          char aPron[], char *aPronString = NULL );
+
+
+      // This function should only be called after a call to GetPronEntry.  If
+      // GetPronEntry has not been called, ErrFail will be returned.  This
+      // function provides a means of efficiently obtaining the next
+      // pronunciation of the word specified in GetPronEntry.  If the next
+      // pronunciation does not exist, aPron will have zero in the first
+      // character, and if aPronString is not NULL, it will be set to "", and
+      // the function will return ErrNotInDictionary.  This function call is
+      // provided so that dictionary search does not need to be done for each
+      // of multiple pronunciations looked up in the dictionary.
+      Errors GetNextEntry( char aPron[], char *aPronString = NULL );
+
+
+   private:
+
+      // class internal functions that manipulate the dictionary
+
+      Errors read_phone( char *aFname );
+      Errors read_binary_dictionary( char *aFname );
+      int compare_str( char *str1, char *str2 );
+      int inc_entry( int i );
+      int mid_entry( int i1, int i2 );
+      void copy_str( char *str1, char *str2 );
+      void chrtoupper(char *str);
+      int lookup( char *word );
+      void decode_entry( char *word, int idx, char *pron);
+      void print_pron( char *word, int idx, char *pron_def, char *pron);
+      int get_phone_idx( char *name );
+      void expand_pron( char *buf, int idx );
+      void err2pron( char *pron_def, int len_def, char *pron_err, char *pron );
+      void pron2bin( char *str, char *pron );
+      int get_pron_offset( int idx );
+      void expand_str( char *buf, int idx );
+      int dec_entry( int i );
+      void map_pron( char *ipron, char *opron );
+      void map_phone( char *iphone, char *ophone );
+
+
+      // Locate the one-based Nth dictionary pronunciation where
+      // N = aEntryNumber.
+      int LocatePron( char* aWord, unsigned int aEntryNumber );
+
+      // Get default rule-based pronunciation
+      Errors GetDefaultPron( const char* aWord, char aPron[] );
+
+      // Convert a pronunciation representation into a string
+      Errors PronToString( char* aPron, char* aPronString );
+
+
+   private:
+
+      // Top level directory containing decision trees, dictionary,
+      // and phone list
+      char * direct;
+   
+      // Variables that define the dictionary type
+      char *lang;
+      char *ident;
+
+      // Variable that indicates dictionary contains stop closures
+      int doClosure;
+
+    // If using TIesrDT, then TIesrDict contains a TIesrDT object
+#ifdef _TIESRDICT_USE_TIESRDT
+    TIesrDT_t tiesrDT;
+#endif
+
+    //The pointer to the beginning of the phonetic dictionary entries
+    char *dict_beg;
+
+    // variables for doing dictionary lookup
+    int last;
+    int first;
+
+    // phone list, and number of phones in the language
+    phoneName *phone;
+    unsigned int n_phone;
+
+    // Worst case length of phone string for present word
+    unsigned int maxString;
+
+
+    // The last word for which a pronunciation was looked up using
+    // GetPronEntry.
+    char* m_word;
+
+    // The number of the entry for the pronunciation last requested by
+    // GetPronEntry or GetNextEntry.
+    unsigned int m_entryNumber;
+
+    // The entry index in the dictionary of the last word looked up using
+    // GetPronEntry or GetNextEntry
+    int m_entryLocation;
+
+    // Default pronunciation for last word looked up using GetPronEntry or
+    // GetNextEntry.
+    char* m_defaultPron;
+
+};
+
+
+
+#endif // _TIESRDICT_H
diff --git a/TIesrDict/src/TIesrDictLocal.h b/TIesrDict/src/TIesrDictLocal.h
new file mode 100644 (file)
index 0000000..702b095
--- /dev/null
@@ -0,0 +1,99 @@
+/*=======================================================================
+ TIesrDictLocal.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+This header contains structures and constants that are local to the
+TIesrDict class, but are not exposed by the class.
+
+======================================================================*/
+
+#ifndef _TIESRDICTLOCAL_H
+#define _TIESRDICTLOCAL_H
+
+
+//--------------------------------
+// Constants
+
+
+#if defined (WIN32) || defined (WINCE)
+#define PATH_SEPARATOR "\\"
+#else
+#define PATH_SEPARATOR "/"
+#endif
+
+
+#define TRUE 1
+#define FALSE 0
+
+
+
+/* Max word string length */
+#define    MAX_STR      256
+
+/* max # of phones in a word */
+#define    MAX_PRON     30       
+
+
+//--------------------------------
+//  mapping_pairs
+//
+//  The mapping_pairs structure type that does context sensitive
+//  mappings, eg, stop consonants.  At this time it is a static member
+//  of the class, but probably should be static in local parameters.
+//
+typedef struct mapping_pairs
+{
+    char *from;
+    char *to;
+} mapping_pairs;
+
+
+// These are the context sensitive stops for our WSJ trained triphones
+// Eventually this should be transferred to data, not in code.
+static const int N_PAIR = 8;
+
+static const mapping_pairs mapping_pair[] = 
+{
+    { "b", "bcl b" },
+    { "d", "dcl d" },
+    { "g", "gcl g" },
+    { "jh", "dcl jh" },
+    { "p", "pcl p" },
+    { "t", "tcl t" },
+    { "k", "kcl k" },
+    { "ch", "tcl ch"}
+};
+
+static const char* BOUNDARY = "sp";
+static const char* DELIMIT =  " \n\t";
+
+
+//--------------------------------
+// Filenames that are fixed within the API
+static const char* PHONELIST = "phone.lis";
+static const char* DICTFILE = "dict.bin";
+
+
+//--------------------------------
+// Encoded dictionary character definitions
+//
+// lower 7 bits is the pron len
+static const char MASK_2 = (char) 0x7f;
+static const char MASK_3 = (char) 0x80;
+static const char ALIGN =  (char) 0xff;
+// MSB 2 bits 
+static const char MASK =   (char) 0xc0;
+static const char MATCH =  (char) 0x00;
+static const char SUB =    (char) 0x40;
+static const char DEL =    (char) 0x80;
+static const char INS =    (char) 0xc0;
+
+//#define LEFT_PART    0
+//#define MATCH_PART   1
+//#define RIGHT_PART   2
+//#define OUT_PART     3
+
+#endif // _TIESRDICTLOCAL_H 
diff --git a/TIesrDict/src/TestTIesrDict.cpp b/TIesrDict/src/TestTIesrDict.cpp
new file mode 100644 (file)
index 0000000..84b9689
--- /dev/null
@@ -0,0 +1,204 @@
+/*=======================================================================
+ TestTIesrDict.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This program tests TIesrDict.  To test TIesrDict, you must have the
+ TIesrDT API available, since TIesrDict uses TIesrDT. The command line is:
+
+ TestTIesrDict dictDir lang dictID bUseRule numProns bUseClosure fileName
+ dictDir is the top level directory that contains the information necessary
+ to look up a pronunciation.  
+
+======================================================================*/
+#include <TIesrDict.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+static const char* DELIMIT = " \n\t";
+
+int main( int argc, char** argv )
+{
+   CTIesrDict dict;
+   CTIesrDict::phoneName phoneName;
+   CTIesrDict::Errors result;
+   char word[100], pron[300], pronstr[3000];
+   char *wordptr;
+   int idx;
+   unsigned int numEntries;
+   unsigned int entry;
+   int isEnd;
+   
+   char* dictDir;
+   char* lang;
+   char* dictID;
+   
+   int bUseRule = 0;
+   int numProns = 0;
+   int bUseFile = 0;
+   int bUseClosure = 1;
+   
+   FILE *fp;
+   
+   if( argc < 4 )
+      return (1);
+   
+   
+   
+   // Location of dictionary to use
+   dictDir = argv[1];
+   lang = argv[2];
+   dictID = argv[3];
+   
+   // Use TIesrDT rule as a pronunciation
+   if( argc > 4 )
+      bUseRule = atoi( argv[4] );
+
+   // Number of pronunciations to output
+   if( argc > 5 )
+      numProns = atoi( argv[5] );
+
+   // Use closures for stop phones
+   if( argc > 6 )
+       bUseClosure = atoi( argv[6] );
+   
+   // A file of items to look up is given, or else prompt user
+   bUseFile = ( argc > 7 );
+   
+   
+   dict.LoadDictionary( dictDir, lang, dictID, bUseClosure );
+   
+   if( !bUseFile )
+   {
+      printf( "Number of phones used: %d\n", dict.GetPhoneCount() );
+      
+      for( idx=0; idx < dict.GetPhoneCount(); idx++ )
+      {
+         dict.GetPhoneName( idx, phoneName );
+         printf( "%s\n", phoneName );
+      }
+   }
+   else
+   {
+      fp = fopen( argv[7], "r" );
+      if( !fp )
+      {
+         printf( "Can not open %s", argv[7] );
+         exit(1);
+      }
+   }
+   
+   // Get first word
+   if( !bUseFile )
+   {
+      printf("\nEnter Name: " );
+      gets( word );
+   }
+   else
+   {
+      isEnd = fscanf( fp, "%s", word );
+   }
+   
+   wordptr = strtok( word, DELIMIT );
+   
+   // Loop as long as a valid word is found
+   while(  wordptr != NULL && strlen(wordptr) > 0 && strcmp(wordptr, ".") != 0
+           && ( !bUseFile || ( bUseFile && isEnd != EOF ) ) )
+   {
+      int numPron = 0;
+      
+      
+      // Find number of entries of the word in the dictionary
+      result = dict.GetNumberEntries( wordptr, &numEntries );
+      if( result == CTIesrDict::ErrNone )
+      {
+         if( !bUseFile )
+         {
+            printf( "%s has %d entries in dictionary\n", wordptr, numEntries );
+         }
+      }
+      else
+      {
+         printf( "Invalid input\n" );
+      }
+      
+      // Get rule pronunciation
+      result = dict.GetPronEntry( wordptr, 0, pron, pronstr );
+      if( result == CTIesrDict::ErrNone )
+      {
+         if( !bUseFile )
+         {
+            printf( "Rule:  %s ---> %s\n", wordptr, pronstr );
+         }
+         else if( ( bUseRule || numEntries == 0 ) && numPron < numProns )
+         {
+            printf( "%s ---> %s.\n", wordptr, pronstr );
+            numPron++;
+         }
+      }
+      else
+         printf( "Invalid input\n" );
+      
+      
+      
+      // Loop over all entries in the dictionary
+      for( entry = 1; entry <= numEntries; entry++ )
+      {
+         result = dict.GetNextEntry( pron, pronstr );
+         if( result == CTIesrDict::ErrNone )
+         {
+            if( !bUseFile )
+            {
+               printf( "Dict(%d) for %s:  %s\n", entry, wordptr, pronstr );
+            }
+            else if( numPron < numProns )
+            {
+               printf( "%s ---> %s.\n", wordptr, pronstr );
+               numPron++;
+               if( numPron >= numProns )
+                  break;
+            }
+         }
+         else
+            printf( "Invalid input\n" );
+      }
+      
+      
+      // Default pronunciation - first dictionary entry, or rule if no entry
+      if( !bUseFile )
+      {
+         result = dict.GetPron( wordptr, pron, pronstr );
+         if( result == CTIesrDict::ErrNone )
+            printf("Used now: %s\n", pronstr );
+         else
+            printf( "Invalid input\n" );
+      }
+      
+      // Get next word
+      if( !bUseFile )
+      {
+         printf("\nEnter Name: " );
+         gets( word );
+      }
+      else
+      {
+         isEnd = fscanf( fp, "%s", word );
+      }
+      
+      wordptr = strtok( word, DELIMIT );
+   }
+   
+   
+   
+   // Close file when done
+   if( bUseFile )
+   {
+      fclose(fp);
+   }
+   
+   return(0);
+}
diff --git a/TIesrEngine/TIesrEngineCoreso/.dep.inc b/TIesrEngine/TIesrEngineCoreso/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrEngine/TIesrEngineCoreso/Makefile b/TIesrEngine/TIesrEngineCoreso/Makefile
new file mode 100755 (executable)
index 0000000..b534ada
--- /dev/null
@@ -0,0 +1,119 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+       if [ ${CONF} == LinuxDebugGnu -o \
+       ${CONF} == LinuxReleaseGnu -o \
+       ${CONF} == ArmLinuxDebugGnueabi -o \
+       ${CONF} == ArmLinuxReleaseGnueabi ]; \
+       then cd ../../Dist/${CONF}/lib; \
+       rm -f libTIesrEngineCore.so; \
+       ln -s libTIesrEngineCore.so.1 libTIesrEngineCore.so; \
+       fi
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..8d08f32
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/load.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/search.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineCore.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineCore.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrEngineCore.so.1 -Wl,--version-script=../resource/TIesrEngineCore.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o: nbproject/Makefile-${CND_CONF}.mk ../src/gmhmm_type_common.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o ../src/gmhmm_type_common.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o: nbproject/Makefile-${CND_CONF}.mk ../src/noise_sub.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o ../src/noise_sub.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o: nbproject/Makefile-${CND_CONF}.mk ../src/rapidsearch.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o ../src/rapidsearch.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/pmc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o ../src/pmc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o: nbproject/Makefile-${CND_CONF}.mk ../src/uttdet.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o ../src/uttdet.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o: nbproject/Makefile-${CND_CONF}.mk ../src/obsprob.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o ../src/obsprob.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/mfcc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o ../src/mfcc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/load.o: nbproject/Makefile-${CND_CONF}.mk ../src/load.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/load.o ../src/load.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pack.o: nbproject/Makefile-${CND_CONF}.mk ../src/pack.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o ../src/pack.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/dist.o: nbproject/Makefile-${CND_CONF}.mk ../src/dist.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o ../src/dist.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o: nbproject/Makefile-${CND_CONF}.mk ../src/sbc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o ../src/sbc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/search.o: nbproject/Makefile-${CND_CONF}.mk ../src/search.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/search.o ../src/search.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/volume.o: nbproject/Makefile-${CND_CONF}.mk ../src/volume.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o ../src/volume.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineCore.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..046d68d
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/load.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/search.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineCore.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineCore.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrEngineCore.so.1 -Wl,--version-script=../resource/TIesrEngineCore.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o: nbproject/Makefile-${CND_CONF}.mk ../src/gmhmm_type_common.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o ../src/gmhmm_type_common.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o: nbproject/Makefile-${CND_CONF}.mk ../src/noise_sub.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o ../src/noise_sub.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o: nbproject/Makefile-${CND_CONF}.mk ../src/rapidsearch.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o ../src/rapidsearch.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/pmc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o ../src/pmc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o: nbproject/Makefile-${CND_CONF}.mk ../src/uttdet.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o ../src/uttdet.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o: nbproject/Makefile-${CND_CONF}.mk ../src/obsprob.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o ../src/obsprob.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/mfcc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o ../src/mfcc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/load.o: nbproject/Makefile-${CND_CONF}.mk ../src/load.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/load.o ../src/load.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pack.o: nbproject/Makefile-${CND_CONF}.mk ../src/pack.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o ../src/pack.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/dist.o: nbproject/Makefile-${CND_CONF}.mk ../src/dist.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o ../src/dist.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o: nbproject/Makefile-${CND_CONF}.mk ../src/sbc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o ../src/sbc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/search.o: nbproject/Makefile-${CND_CONF}.mk ../src/search.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/search.o ../src/search.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/volume.o: nbproject/Makefile-${CND_CONF}.mk ../src/volume.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o ../src/volume.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineCore.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..d97f687
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/load.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/search.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/lib/libTIesrEngineCore.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrEngineCore.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrEngineCore.so.1 -Wl,--version-script=../resource/TIesrEngineCore.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o: nbproject/Makefile-${CND_CONF}.mk ../src/gmhmm_type_common.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o ../src/gmhmm_type_common.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o: nbproject/Makefile-${CND_CONF}.mk ../src/noise_sub.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o ../src/noise_sub.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o: nbproject/Makefile-${CND_CONF}.mk ../src/rapidsearch.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o ../src/rapidsearch.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/pmc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o ../src/pmc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o: nbproject/Makefile-${CND_CONF}.mk ../src/uttdet.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o ../src/uttdet.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o: nbproject/Makefile-${CND_CONF}.mk ../src/obsprob.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o ../src/obsprob.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/mfcc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o ../src/mfcc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/load.o: nbproject/Makefile-${CND_CONF}.mk ../src/load.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/load.o ../src/load.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pack.o: nbproject/Makefile-${CND_CONF}.mk ../src/pack.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o ../src/pack.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/dist.o: nbproject/Makefile-${CND_CONF}.mk ../src/dist.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o ../src/dist.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o: nbproject/Makefile-${CND_CONF}.mk ../src/sbc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o ../src/sbc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/search.o: nbproject/Makefile-${CND_CONF}.mk ../src/search.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/search.o ../src/search.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/volume.o: nbproject/Makefile-${CND_CONF}.mk ../src/volume.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o ../src/volume.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/lib/libTIesrEngineCore.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..d739198
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/load.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/search.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/lib/libTIesrEngineCore.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrEngineCore.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrEngineCore.so.1 -Wl,--version-script=../resource/TIesrEngineCore.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o: nbproject/Makefile-${CND_CONF}.mk ../src/gmhmm_type_common.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o ../src/gmhmm_type_common.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o: nbproject/Makefile-${CND_CONF}.mk ../src/noise_sub.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o ../src/noise_sub.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o: nbproject/Makefile-${CND_CONF}.mk ../src/rapidsearch.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o ../src/rapidsearch.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/pmc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o ../src/pmc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o: nbproject/Makefile-${CND_CONF}.mk ../src/uttdet.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o ../src/uttdet.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o: nbproject/Makefile-${CND_CONF}.mk ../src/obsprob.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o ../src/obsprob.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/mfcc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o ../src/mfcc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/load.o: nbproject/Makefile-${CND_CONF}.mk ../src/load.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/load.o ../src/load.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pack.o: nbproject/Makefile-${CND_CONF}.mk ../src/pack.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o ../src/pack.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/dist.o: nbproject/Makefile-${CND_CONF}.mk ../src/dist.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o ../src/dist.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o: nbproject/Makefile-${CND_CONF}.mk ../src/sbc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o ../src/sbc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/search.o: nbproject/Makefile-${CND_CONF}.mk ../src/search.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/search.o ../src/search.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/volume.o: nbproject/Makefile-${CND_CONF}.mk ../src/volume.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o ../src/volume.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/lib/libTIesrEngineCore.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..a24a777
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/load.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/search.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/libTIesrEngineCore.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrEngineCore.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -v -shared -o ../../Dist/${CND_CONF}/libTIesrEngineCore.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o: nbproject/Makefile-${CND_CONF}.mk ../src/gmhmm_type_common.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o ../src/gmhmm_type_common.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o: nbproject/Makefile-${CND_CONF}.mk ../src/noise_sub.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o ../src/noise_sub.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o: nbproject/Makefile-${CND_CONF}.mk ../src/rapidsearch.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o ../src/rapidsearch.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/pmc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o ../src/pmc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o: nbproject/Makefile-${CND_CONF}.mk ../src/uttdet.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o ../src/uttdet.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o: nbproject/Makefile-${CND_CONF}.mk ../src/obsprob.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o ../src/obsprob.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/mfcc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o ../src/mfcc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/load.o: nbproject/Makefile-${CND_CONF}.mk ../src/load.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/load.o ../src/load.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pack.o: nbproject/Makefile-${CND_CONF}.mk ../src/pack.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o ../src/pack.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/dist.o: nbproject/Makefile-${CND_CONF}.mk ../src/dist.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o ../src/dist.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o: nbproject/Makefile-${CND_CONF}.mk ../src/sbc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o ../src/sbc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/search.o: nbproject/Makefile-${CND_CONF}.mk ../src/search.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/search.o ../src/search.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/volume.o: nbproject/Makefile-${CND_CONF}.mk ../src/volume.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o ../src/volume.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/libTIesrEngineCore.dll
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..f95ba65
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/load.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/search.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/libTIesrEngineCore.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrEngineCore.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -v -shared -o ../../Dist/${CND_CONF}/libTIesrEngineCore.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o: nbproject/Makefile-${CND_CONF}.mk ../src/gmhmm_type_common.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/gmhmm_type_common.o ../src/gmhmm_type_common.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o: nbproject/Makefile-${CND_CONF}.mk ../src/noise_sub.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/noise_sub.o ../src/noise_sub.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o: nbproject/Makefile-${CND_CONF}.mk ../src/rapidsearch.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/rapidsearch.o ../src/rapidsearch.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/pmc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pmc_f.o ../src/pmc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o: nbproject/Makefile-${CND_CONF}.mk ../src/uttdet.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/uttdet.o ../src/uttdet.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o: nbproject/Makefile-${CND_CONF}.mk ../src/obsprob.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/obsprob.o ../src/obsprob.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o: nbproject/Makefile-${CND_CONF}.mk ../src/mfcc_f.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/mfcc_f.o ../src/mfcc_f.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/load.o: nbproject/Makefile-${CND_CONF}.mk ../src/load.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/load.o ../src/load.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/pack.o: nbproject/Makefile-${CND_CONF}.mk ../src/pack.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/pack.o ../src/pack.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/dist.o: nbproject/Makefile-${CND_CONF}.mk ../src/dist.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/dist.o ../src/dist.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o: nbproject/Makefile-${CND_CONF}.mk ../src/sbc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/sbc.o ../src/sbc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/search.o: nbproject/Makefile-${CND_CONF}.mk ../src/search.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/search.o ../src/search.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/volume.o: nbproject/Makefile-${CND_CONF}.mk ../src/volume.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINECOREAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/volume.o ../src/volume.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/libTIesrEngineCore.dll
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-impl.mk b/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..4947a10
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TIesrEngineCoreso
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-variables.mk b/TIesrEngine/TIesrEngineCoreso/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..b058224
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=libTIesrEngineCore.dll
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/libTIesrEngineCore.dll
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=libTIesrEngineCoreso.so.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/libTIesrEngineCoreso.so.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=libTIesrEngineCore.dll
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/libTIesrEngineCore.dll
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=libTIesrEngineCoreso.so.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/libTIesrEngineCoreso.so.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib
+CND_ARTIFACT_NAME_LinuxDebugGnu=libTIesrEngineCore.so.1
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib/libTIesrEngineCore.so.1
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=libTIesrEngineCoreso.so.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/libTIesrEngineCoreso.so.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib
+CND_ARTIFACT_NAME_LinuxReleaseGnu=libTIesrEngineCore.so.1
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib/libTIesrEngineCore.so.1
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=libTIesrEngineCoreso.so.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/libTIesrEngineCoreso.so.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=libTIesrEngineCore.so.1
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineCore.so.1
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=libTIesrEngineCoreso.so.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrEngineCoreso.so.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=libTIesrEngineCore.so.1
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineCore.so.1
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=libTIesrEngineCoreso.so.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrEngineCoreso.so.tar
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrEngine/TIesrEngineCoreso/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..0a4f5d8
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1
+OUTPUT_BASENAME=libTIesrEngineCore.so.1
+PACKAGE_TOP_DIR=libTIesrEngineCoreso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineCoreso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrEngine/TIesrEngineCoreso/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..4603be3
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1
+OUTPUT_BASENAME=libTIesrEngineCore.so.1
+PACKAGE_TOP_DIR=libTIesrEngineCoreso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineCoreso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Package-LinuxDebugGnu.bash b/TIesrEngine/TIesrEngineCoreso/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..6ff2404
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1
+OUTPUT_BASENAME=libTIesrEngineCore.so.1
+PACKAGE_TOP_DIR=libTIesrEngineCoreso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineCoreso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Package-LinuxReleaseGnu.bash b/TIesrEngine/TIesrEngineCoreso/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..68bca14
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1
+OUTPUT_BASENAME=libTIesrEngineCore.so.1
+PACKAGE_TOP_DIR=libTIesrEngineCoreso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineCoreso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Package-WindowsDebugMinGW.bash b/TIesrEngine/TIesrEngineCoreso/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..0cb7550
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrEngineCore.dll
+OUTPUT_BASENAME=libTIesrEngineCore.dll
+PACKAGE_TOP_DIR=libTIesrEngineCoreso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineCoreso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrEngine/TIesrEngineCoreso/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..673dbc3
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrEngineCore.dll
+OUTPUT_BASENAME=libTIesrEngineCore.dll
+PACKAGE_TOP_DIR=libTIesrEngineCoreso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineCoreso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineCoreso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/configurations.xml b/TIesrEngine/TIesrEngineCoreso/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..4bf3b5a
--- /dev/null
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>../src/confidence.h</itemPath>
+      <itemPath>../src/confidence_user.h</itemPath>
+      <itemPath>../src/dist_user.h</itemPath>
+      <itemPath>../src/filename.h</itemPath>
+      <itemPath>../src/gmhmm.h</itemPath>
+      <itemPath>../src/gmhmm_type.h</itemPath>
+      <itemPath>../src/gmhmm_type_common_user.h</itemPath>
+      <itemPath>../src/hlr_status.h</itemPath>
+      <itemPath>../src/load_user.h</itemPath>
+      <itemPath>../src/mfcc_f.h</itemPath>
+      <itemPath>../src/mfcc_f_def_struct_user.h</itemPath>
+      <itemPath>../src/mfcc_f_user.h</itemPath>
+      <itemPath>../src/noise_sub.h</itemPath>
+      <itemPath>../src/noise_sub_user.h</itemPath>
+      <itemPath>../src/obsprob_user.h</itemPath>
+      <itemPath>../src/pack_user.h</itemPath>
+      <itemPath>../src/pmc_f.h</itemPath>
+      <itemPath>../src/pmc_f_user.h</itemPath>
+      <itemPath>../src/rapidsearch.h</itemPath>
+      <itemPath>../src/rapidsearch_user.h</itemPath>
+      <itemPath>../src/sbc.h</itemPath>
+      <itemPath>../src/sbc_struct_user.h</itemPath>
+      <itemPath>../src/sbc_user.h</itemPath>
+      <itemPath>../src/search_user.h</itemPath>
+      <itemPath>../src/status.h</itemPath>
+      <itemPath>../src/tiesr_config.h</itemPath>
+      <itemPath>../src/tiesrcommonmacros.h</itemPath>
+      <itemPath>../src/uttdet.h</itemPath>
+      <itemPath>../src/uttdet_user.h</itemPath>
+      <itemPath>../src/volume_user.h</itemPath>
+      <itemPath>../src/winlen.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+      <itemPath>../resource/TIesrEngineCore.ver</itemPath>
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/dist.cpp</itemPath>
+      <itemPath>../src/gmhmm_type_common.cpp</itemPath>
+      <itemPath>../src/load.cpp</itemPath>
+      <itemPath>../src/mfcc_f.cpp</itemPath>
+      <itemPath>../src/noise_sub.cpp</itemPath>
+      <itemPath>../src/obsprob.cpp</itemPath>
+      <itemPath>../src/pack.cpp</itemPath>
+      <itemPath>../src/pmc_f.cpp</itemPath>
+      <itemPath>../src/rapidsearch.cpp</itemPath>
+      <itemPath>../src/sbc.cpp</itemPath>
+      <itemPath>../src/search.cpp</itemPath>
+      <itemPath>../src/uttdet.cpp</itemPath>
+      <itemPath>../src/volume.cpp</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRENGINECOREAPI_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrEngineCore.dll</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRENGINECOREAPI_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrEngineCore.dll</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrEngineCore.so.1 -Wl,--version-script=../resource/TIesrEngineCore.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrEngineCore.so.1 -Wl,--version-script=../resource/TIesrEngineCore.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrEngineCore.so.1 -Wl,--version-script=../resource/TIesrEngineCore.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrEngineCore.so.1</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrEngineCore.so.1 -Wl,--version-script=../resource/TIesrEngineCore.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/private/configurations.xml b/TIesrEngine/TIesrEngineCoreso/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..a1af2a8
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/private/private.properties b/TIesrEngine/TIesrEngineCoreso/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/private/private.xml b/TIesrEngine/TIesrEngineCoreso/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/project.properties b/TIesrEngine/TIesrEngineCoreso/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrEngine/TIesrEngineCoreso/nbproject/project.xml b/TIesrEngine/TIesrEngineCoreso/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..2b2999b
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TIesrEngineCoreso</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions/>
+            <cpp-extensions>cpp</cpp-extensions>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrEngine/TIesrEngineSIso/.dep.inc b/TIesrEngine/TIesrEngineSIso/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrEngine/TIesrEngineSIso/Makefile b/TIesrEngine/TIesrEngineSIso/Makefile
new file mode 100755 (executable)
index 0000000..85184a7
--- /dev/null
@@ -0,0 +1,119 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+       if [ ${CONF} == LinuxDebugGnu -o \
+       ${CONF} == LinuxReleaseGnu -o \
+       ${CONF} == ArmLinuxDebugGnueabi -o \
+       ${CONF} == ArmLinuxReleaseGnueabi ]; \
+       then cd ../../Dist/${CONF}/lib; \
+       rm -f libTIesrEngineSI.so; \
+       ln -s libTIesrEngineSI.so.1 libTIesrEngineSI.so; \
+       fi
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..d9ed44f
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../TIesrEngineCoreso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineCore.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineSI.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineSI.so.1: ../TIesrEngineCoreso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineCore.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineSI.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrEngineSI.so.1 -Wl,--version-script=../resource/TIesrEngineSI.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/siproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o ../src/siproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o: nbproject/Makefile-${CND_CONF}.mk ../src/engine_sireco_init.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o ../src/engine_sireco_init.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o: nbproject/Makefile-${CND_CONF}.mk ../src/siinit.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o ../src/siinit.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac-estm.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o ../src/jac-estm.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/liveproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o ../src/liveproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac_one.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o ../src/jac_one.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineSI.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..de0e9cf
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../TIesrEngineCoreso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineCore.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineSI.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineSI.so.1: ../TIesrEngineCoreso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineCore.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineSI.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrEngineSI.so.1 -Wl,--version-script=../resource/TIesrEngineSI.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/siproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o ../src/siproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o: nbproject/Makefile-${CND_CONF}.mk ../src/engine_sireco_init.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o ../src/engine_sireco_init.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o: nbproject/Makefile-${CND_CONF}.mk ../src/siinit.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o ../src/siinit.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac-estm.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o ../src/jac-estm.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/liveproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o ../src/liveproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac_one.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o ../src/jac_one.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineSI.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..7a7a8ac
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../TIesrEngineCoreso/../../Dist/LinuxDebugGnu/lib/libTIesrEngineCore.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/lib/libTIesrEngineSI.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrEngineSI.so.1: ../TIesrEngineCoreso/../../Dist/LinuxDebugGnu/lib/libTIesrEngineCore.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrEngineSI.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrEngineSI.so.1 -Wl,--version-script=../resource/TIesrEngineSI.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/siproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o ../src/siproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o: nbproject/Makefile-${CND_CONF}.mk ../src/engine_sireco_init.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o ../src/engine_sireco_init.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o: nbproject/Makefile-${CND_CONF}.mk ../src/siinit.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o ../src/siinit.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac-estm.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o ../src/jac-estm.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/liveproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o ../src/liveproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac_one.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o ../src/jac_one.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/lib/libTIesrEngineSI.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..d91cb5e
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../TIesrEngineCoreso/../../Dist/LinuxReleaseGnu/lib/libTIesrEngineCore.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/lib/libTIesrEngineSI.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrEngineSI.so.1: ../TIesrEngineCoreso/../../Dist/LinuxReleaseGnu/lib/libTIesrEngineCore.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrEngineSI.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrEngineSI.so.1 -Wl,--version-script=../resource/TIesrEngineSI.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/siproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o ../src/siproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o: nbproject/Makefile-${CND_CONF}.mk ../src/engine_sireco_init.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o ../src/engine_sireco_init.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o: nbproject/Makefile-${CND_CONF}.mk ../src/siinit.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o ../src/siinit.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac-estm.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o ../src/jac-estm.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/liveproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o ../src/liveproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac_one.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o ../src/jac_one.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/lib/libTIesrEngineSI.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..2ee7c43
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=../TIesrEngineCoreso/../../Dist/WindowsDebugMinGW/libTIesrEngineCore.dll
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/libTIesrEngineSI.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrEngineSI.dll: ../TIesrEngineCoreso/../../Dist/WindowsDebugMinGW/libTIesrEngineCore.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrEngineSI.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -v -shared -o ../../Dist/${CND_CONF}/libTIesrEngineSI.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/siproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o ../src/siproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o: nbproject/Makefile-${CND_CONF}.mk ../src/engine_sireco_init.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o ../src/engine_sireco_init.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o: nbproject/Makefile-${CND_CONF}.mk ../src/siinit.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o ../src/siinit.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac-estm.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o ../src/jac-estm.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/liveproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o ../src/liveproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac_one.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o ../src/jac_one.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/libTIesrEngineSI.dll
+
+# Subprojects
+.clean-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..5102e63
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=../TIesrEngineCoreso/../../Dist/WindowsReleaseMinGW/libTIesrEngineCore.dll
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/libTIesrEngineSI.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrEngineSI.dll: ../TIesrEngineCoreso/../../Dist/WindowsReleaseMinGW/libTIesrEngineCore.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrEngineSI.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -v -shared -o ../../Dist/${CND_CONF}/libTIesrEngineSI.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/siproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siproc.o ../src/siproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o: nbproject/Makefile-${CND_CONF}.mk ../src/engine_sireco_init.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/engine_sireco_init.o ../src/engine_sireco_init.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o: nbproject/Makefile-${CND_CONF}.mk ../src/siinit.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/siinit.o ../src/siinit.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac-estm.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac-estm.o ../src/jac-estm.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o: nbproject/Makefile-${CND_CONF}.mk ../src/liveproc.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/liveproc.o ../src/liveproc.cpp
+
+${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o: nbproject/Makefile-${CND_CONF}.mk ../src/jac_one.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRENGINESIAPI_EXPORTS -DWIN32 -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/jac_one.o ../src/jac_one.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/libTIesrEngineSI.dll
+
+# Subprojects
+.clean-subprojects:
+       cd ../TIesrEngineCoreso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-impl.mk b/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..2e953d9
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TIesrEngineSIso
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-variables.mk b/TIesrEngine/TIesrEngineSIso/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..f0b34df
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=libTIesrEngineSI.dll
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/libTIesrEngineSI.dll
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=libTIesrEngineSIso.so.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/libTIesrEngineSIso.so.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=libTIesrEngineSI.dll
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/libTIesrEngineSI.dll
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=libTIesrEngineSIso.so.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/libTIesrEngineSIso.so.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib
+CND_ARTIFACT_NAME_LinuxDebugGnu=libTIesrEngineSI.so.1
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib/libTIesrEngineSI.so.1
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=libTIesrEngineSIso.so.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/libTIesrEngineSIso.so.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib
+CND_ARTIFACT_NAME_LinuxReleaseGnu=libTIesrEngineSI.so.1
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib/libTIesrEngineSI.so.1
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=libTIesrEngineSIso.so.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/libTIesrEngineSIso.so.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=libTIesrEngineSI.so.1
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineSI.so.1
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=libTIesrEngineSIso.so.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrEngineSIso.so.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=libTIesrEngineSI.so.1
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineSI.so.1
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=libTIesrEngineSIso.so.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrEngineSIso.so.tar
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrEngine/TIesrEngineSIso/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..a753e32
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1
+OUTPUT_BASENAME=libTIesrEngineSI.so.1
+PACKAGE_TOP_DIR=libTIesrEngineSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrEngine/TIesrEngineSIso/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..70e33ef
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1
+OUTPUT_BASENAME=libTIesrEngineSI.so.1
+PACKAGE_TOP_DIR=libTIesrEngineSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Package-LinuxDebugGnu.bash b/TIesrEngine/TIesrEngineSIso/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..27b38a3
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1
+OUTPUT_BASENAME=libTIesrEngineSI.so.1
+PACKAGE_TOP_DIR=libTIesrEngineSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Package-LinuxReleaseGnu.bash b/TIesrEngine/TIesrEngineSIso/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..afda4d0
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1
+OUTPUT_BASENAME=libTIesrEngineSI.so.1
+PACKAGE_TOP_DIR=libTIesrEngineSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Package-WindowsDebugMinGW.bash b/TIesrEngine/TIesrEngineSIso/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..aab4ace
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrEngineSI.dll
+OUTPUT_BASENAME=libTIesrEngineSI.dll
+PACKAGE_TOP_DIR=libTIesrEngineSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrEngine/TIesrEngineSIso/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..12f95dd
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrEngineSI.dll
+OUTPUT_BASENAME=libTIesrEngineSI.dll
+PACKAGE_TOP_DIR=libTIesrEngineSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrEngineSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrEngineSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/configurations.xml b/TIesrEngine/TIesrEngineSIso/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..7baf87f
--- /dev/null
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>../src/gmhmm.h</itemPath>
+      <itemPath>../src/gmhmm_si_api.h</itemPath>
+      <itemPath>../src/gmhmm_type.h</itemPath>
+      <itemPath>../src/gmhmm_type_common_user.h</itemPath>
+      <itemPath>../src/jac-estm.h</itemPath>
+      <itemPath>../src/jac-estm_user.h</itemPath>
+      <itemPath>../src/jac_one.h</itemPath>
+      <itemPath>../src/jac_one_user.h</itemPath>
+      <itemPath>../src/sbc_user.h</itemPath>
+      <itemPath>../src/siinit.h</itemPath>
+      <itemPath>../src/status.h</itemPath>
+      <itemPath>../src/tiesr_config.h</itemPath>
+      <itemPath>../src/tiesr_engine_api_sireco.h</itemPath>
+      <itemPath>../src/tiesrcommonmacros.h</itemPath>
+      <itemPath>../src/winlen.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/engine_sireco_init.cpp</itemPath>
+      <itemPath>../src/jac-estm.cpp</itemPath>
+      <itemPath>../src/jac_one.cpp</itemPath>
+      <itemPath>../src/liveproc.cpp</itemPath>
+      <itemPath>../src/siinit.cpp</itemPath>
+      <itemPath>../src/siproc.cpp</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRENGINESIAPI_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrEngineSI.dll</output>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../TIesrEngineCoreso"
+                            CT="2"
+                            CN="WindowsDebugMinGW"
+                            AC="false"
+                            BL="true"
+                            WD="../TIesrEngineCoreso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean"
+                            OP="../../Dist/WindowsDebugMinGW/libTIesrEngineCore.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRENGINESIAPI_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrEngineSI.dll</output>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../TIesrEngineCoreso"
+                            CT="2"
+                            CN="WindowsReleaseMinGW"
+                            AC="true"
+                            BL="true"
+                            WD="../TIesrEngineCoreso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean"
+                            OP="../../Dist/WindowsReleaseMinGW/libTIesrEngineCore.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1</output>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../TIesrEngineCoreso"
+                            CT="2"
+                            CN="LinuxDebugGnu"
+                            AC="true"
+                            BL="true"
+                            WD="../TIesrEngineCoreso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxDebugGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxDebugGnu clean"
+                            OP="../../Dist/LinuxDebugGnu/lib/libTIesrEngineCore.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrEngineSI.so.1 -Wl,--version-script=../resource/TIesrEngineSI.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1</output>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../TIesrEngineCoreso"
+                            CT="2"
+                            CN="LinuxReleaseGnu"
+                            AC="false"
+                            BL="true"
+                            WD="../TIesrEngineCoreso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean"
+                            OP="../../Dist/LinuxReleaseGnu/lib/libTIesrEngineCore.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrEngineSI.so.1 -Wl,--version-script=../resource/TIesrEngineSI.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1</output>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../TIesrEngineCoreso"
+                            CT="2"
+                            CN="ArmLinuxDebugGnueabi"
+                            AC="false"
+                            BL="true"
+                            WD="../TIesrEngineCoreso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean"
+                            OP="../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineCore.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrEngineSI.so.1 -Wl,--version-script=../resource/TIesrEngineSI.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrEngineSI.so.1</output>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../TIesrEngineCoreso"
+                            CT="2"
+                            CN="ArmLinuxReleaseGnueabi"
+                            AC="false"
+                            BL="true"
+                            WD="../TIesrEngineCoreso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean"
+                            OP="../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineCore.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrEngineSI.so.1 -Wl,--version-script=../resource/TIesrEngineSI.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/private/configurations.xml b/TIesrEngine/TIesrEngineSIso/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..a1af2a8
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/private/private.properties b/TIesrEngine/TIesrEngineSIso/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/private/private.xml b/TIesrEngine/TIesrEngineSIso/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/project.properties b/TIesrEngine/TIesrEngineSIso/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrEngine/TIesrEngineSIso/nbproject/project.xml b/TIesrEngine/TIesrEngineSIso/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..24499ae
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TIesrEngineSIso</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions/>
+            <cpp-extensions>cpp</cpp-extensions>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects>
+                <make-dep-project>../TIesrEngineCoreso</make-dep-project>
+            </make-dep-projects>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrEngine/resource/TIesrEngineCore.map b/TIesrEngine/resource/TIesrEngineCore.map
new file mode 100644 (file)
index 0000000..a090d46
--- /dev/null
@@ -0,0 +1,151 @@
+TXNprivate_1.1 {  
+       global:
+               EM_alpha_t__FPsT0UsUsP7HmmTypeT0P10gmhmm_type;
+               EM_beta__FPsT0UsP7HmmTypeT0P10gmhmm_type;
+               EM_get_lld__FsPCsT1sP11_SEARCH_MEMP10gmhmm_type;
+               back_trace_beam__FssPUsN42P10gmhmm_type;
+               gauss_obs_score_f__FPsiP10gmhmm_type;
+               search_a_frame__FPssUsP10gmhmm_type;
+               set_search_space__FPsUsUsUsUsP10gmhmm_type;
+               circ_idx__Fs;
+               compute_regression__FssPssPCsPA15_s;
+               cos_transform__FPsT0PCsssPPCs;
+               dim_p2_init__FsP10gmhmm_type;
+               fft__FPsT0;
+               inverse_cos_transform__FPsT0PCsssPPCs;
+               log_polyfit__Fls;
+               pow_polyfit__Fs;
+               mfcc_a_window__FPsN20ssPC15mel_filter_typePPCsT0PCsP8NormTypeT0T0;
+               ss_mfcc_a_window__FPsN20ssPC15mel_filter_typePPCsT0PCsP8NormTypeT0P7NssType;
+               nbr_coding__Fssi;
+               vector_packing__FPCsPUsT0s;
+               vector_unpacking__FPCUsPsPCss;
+               SpeechDetected__FP10gmhmm_type;
+               SpeechEnded__FP10gmhmm_type;
+               compute_uttdet__FPsssT0P10gmhmm_typeP8NormType;
+               init_uttdet__FP10gmhmm_type;
+               set_default_uttdet__FP10gmhmm_type;
+               set_uttdet__FsP10gmhmm_type;
+               update_level__Fssss;
+               init_spect_sub__FPs;
+               noise_subs__FPssT0T0UsT0;
+               mem_alloc__FPsPUsUsUiUsPc;
+               free_models__FP10gmhmm_type;
+               free_scales__FP10gmhmm_type;
+               load_models__FPcP10gmhmm_typecT0T0;
+               load_n_mfcc__FPc;
+               load_scales__FPcP10gmhmm_type;
+               load_mean_vec__FPcP10gmhmm_types;
+               log_spectral_compensation__FPsN30PCsT4sT0s;
+               pmc__FPsN30sssPCsT0PPCsT0s;
+               GetTIesrVolRange__FP10gmhmm_typePUsT1;
+               SetTIesrVolRange__FP10gmhmm_typeUsUs;
+               set_volume_flag__FP10gmhmm_type ;
+               GetAnswerCount__FPC10gmhmm_types;
+               GetAnswerIndex__FPC10gmhmm_types;
+               GetAnswerWord__FUsPC10gmhmm_types;
+               GetNumNbests__FPC10gmhmm_type;
+               SetTIesrNBest__FP10gmhmm_types;
+               GetTIesrNBest__FP10gmhmm_typePs;
+               GetConfidenceScore__FPC10gmhmm_type;
+               GetCycleCount__FPC10gmhmm_type;
+               GetFrameCount__FPC10gmhmm_type;
+               GetTIesrPrune__FPC10gmhmm_typePs;
+               GetTIesrSAD__FPC10gmhmm_typePsN41;
+               GetTIesrTransiWeight__FPC10gmhmm_typePs;
+               GetTotalScore__FPC10gmhmm_type;
+               GetVolumeStatus__FPC10gmhmm_type;
+               GetTIesrGaussSel__FPC10gmhmm_typePUsT1;
+               SetTIesrGaussSel__FP10gmhmm_typeUsUs;
+               OpenSearchEngine__FP10gmhmm_type;
+               SetTIesrPrune__FP10gmhmm_types;
+               SetTIesrSAD__FP10gmhmm_typesssss;
+               SetTIesrTransiWeight__FP10gmhmm_types;
+               GetTIesrJAC__FPC10gmhmm_typePsN61;
+               SetTIesrJAC__FP10gmhmm_typesssssss;
+               GetTIesrSBC__FPC10gmhmm_typePs;
+               SetTIesrSBC__FP10gmhmm_types;
+               SetTIesrORM__FsssssUsssP10gmhmm_type;
+               GetTIesrORM__FPsN40PUsT0T0P10gmhmm_type;
+               SetTIesrSS__FUssP10gmhmm_type;
+               GetTIesrSS__FPUsPsP10gmhmm_type;
+               SetTIesrCM__FssP10gmhmm_type;
+               GetTIesrCM__FPsT0P10gmhmm_type;
+               SetRealTimeGuardTh__FsP10gmhmm_type;
+                GetRealTGuard__FPsP10gmhmm_type;
+                SetRealTGuard__FsP10gmhmm_type;
+                GetRealTimeGuardTh__FPsP10gmhmm_type;
+               hlr_expn__Fss;
+               hlr_expn_q__FssPs;
+               hlr_gauss_obs_score_f__FPCsi7ObsTypePssPC10gmhmm_type;
+               hlr_log_one__FUs;
+               hlr_logsum__Fss;
+               observation_likelihood__FUssP7HmmTypePssP10gmhmm_type;
+               gauss_det_const__FPsUsPCss;
+               sbc_save__FP13FeaHLRAccTypeP4FILE;
+               sbc_rst_seg_stat__FP13FeaHLRAccType;
+               sbc_free__FP13FeaHLRAccType;
+               sbc_rst_SBC_stat__FP13FeaHLRAccType;
+               sbc_rtn_hmm2phone__FP13FeaHLRAccType;
+               sbc_re_enhance__FP13FeaHLRAccTypePsT1UssT1;
+               sbc_acc_cep_bias__FUsUsPsT2PCsUsT2P13FeaHLRAccType;
+               sbc_set_default_params__FP10gmhmm_type;
+               sbc_open__FP13FeaHLRAccType;
+               sbc_load__FP13FeaHLRAccTypeP4FILE;
+               sbc_enhance__FP13FeaHLRAccTypePsUssT1;
+               sbc_init_tree__FP13FeaHLRAccTypePCcT1sUsUss;
+               sbc_enhance_all_trans__FP13FeaHLRAccTypePss;
+               sbc_observation_likelihood__FUssUsP7HmmTypePssP10gmhmm_type;
+               sbc_acc_SBC__FUsUsUsP13FeaHLRAccTypeUs;
+                sbc_update_SBC__FP10gmhmm_type;
+               sbc_load_hmm2phone__FPCcUsP13FeaHLRAccTypes;
+               sbc_phone2terminalidx__FUsP13FeaHLRAccType;
+               sbc_backup__FP13FeaHLRAccType;
+               sbc_restore__FP13FeaHLRAccType;
+               ss_close__FP10gmhmm_type; 
+               ss_open__FP7NssTypeP10gmhmm_type;
+               ss_reset__FP7NssType;
+               ss_set_default__FP7NssType;
+               ss_set_parm__FUssP7NssType;
+               rj_open__FUsUsP10gmhmm_type;
+               rj_clear_obs_scr__FP10gmhmm_typePs;
+               rj_close__FP10gmhmm_type;
+               rj_compensate__FP10gmhmm_type;
+               rj_noise_compensation__FP10gmhmm_type;
+               rj_init__FP10gmhmm_type;
+               rj_gauss_obs_score_f__FPsiP10gmhmm_typePlT0;
+               rj_update_noise__FP10gmhmm_typePss;
+               rj_set_param__FUsUsP10gmhmm_type;
+               rj_set_ORM__FsssssUsssP10gmhmm_type;
+               rj_vad_proc__FP10gmhmm_typePs;
+               rj_save__FP10gmhmm_typeP4FILE;
+               rj_load__FP10gmhmm_typeP4FILE;
+               mlp_open__FP10gmhmm_type;
+               mlp_init__FP10gmhmm_type;
+               mlp_close__FP10gmhmm_type;
+                mlp_threshold__FP10gmhmm_typels;
+               mlp_update__FP10gmhmm_typesl;
+               q15_x__FUsl;
+                div32_32__Fll;
+               cm_init__FP10gmhmm_type;
+               cm_open__FP8ConfTypeP10gmhmm_type;
+               cm_set_param__FssP10gmhmm_type;
+               cm_freeze__FP8ConfType;
+               cm_close__FP10gmhmm_type;
+               cm_save__FP4FILEP10gmhmm_type;
+               cm_load__FP4FILEP10gmhmm_type;
+               cm_antiscr__FP8ConfTypeUs;
+               cm_acc_seg_ratio_to_antimodel__FP10gmhmm_typeUsssl;
+               cm_update_status__FP10gmhmm_type;
+               cm_backup_adp__FP10gmhmm_type;
+               cm_restore_adp__FP10gmhmm_type;
+               cm_score__FP10gmhmm_type;
+
+                # Added to support TIesrTTS               
+                fx_sqrt__Fl;
+                q14_x__Fsl;
+                load_model_file__FPcPUs;
+
+       local:
+               *;
+};
diff --git a/TIesrEngine/resource/TIesrEngineCore.ver b/TIesrEngine/resource/TIesrEngineCore.ver
new file mode 100644 (file)
index 0000000..76e4b8c
--- /dev/null
@@ -0,0 +1,175 @@
+TXNprivate_1.1 {
+        global:
+                # search.o
+                _Z10EM_alpha_tPsS_ttP7HmmTypeS_P10gmhmm_type;
+                _Z7EM_betaPsS_tP7HmmTypeS_P10gmhmm_type;
+                _Z10EM_get_lldsPKsS0_sP11_SEARCH_MEMP10gmhmm_type;
+                _Z15back_trace_beamssPtS_S_S_S_P10gmhmm_type;
+                _Z17gauss_obs_score_fPsiP10gmhmm_type;
+                _Z14search_a_framePsstP10gmhmm_type;
+                _Z16set_search_spacePsttttP10gmhmm_type;
+
+                # mfcc_f.o
+                _Z8circ_idxs;
+                _Z18compute_regressionssPssPKsPA16_s;
+                _Z13cos_transformPsS_PKsssPS1_;
+                _Z11dim_p2_initsP10gmhmm_type;
+                _Z3fftPsS_;
+                _Z21inverse_cos_transformPsS_PKsssPS1_;
+                _Z13mfcc_a_windowPsS_S_ssPK15mel_filter_typePPKsS_S4_P8NormTypeS_S_;
+
+                # dist.o
+                _Z11log_polyfitls;
+                _Z11pow_polyfits;
+                _Z8hlr_expnss;
+                _Z10hlr_expn_qssPs;
+                _Z21hlr_gauss_obs_score_fPKsi7ObsTypePssPK10gmhmm_type;
+                _Z11hlr_log_onet;
+                _Z10hlr_logsumss;
+                _Z15gauss_det_constPstPKss;
+                _Z5q15_xtl;
+                _Z8div32_32ll;
+                _Z5q14_xsl;
+                _Z7fx_sqrtl;
+
+
+                # noise_sub.o
+                _Z16ss_mfcc_a_windowPsS_S_ssPK15mel_filter_typePPKsS_S4_P8NormTypeS_P7NssType;
+                _Z14init_spect_subPs;
+                _Z10noise_subsPssS_S_tS_;
+                _Z7ss_openP7NssTypeP10gmhmm_type;
+                _Z8ss_closeP10gmhmm_type;
+                _Z8ss_resetP7NssType;
+                _Z14ss_set_defaultP7NssType;
+                _Z11ss_set_parmtsP7NssType;
+
+                # pack.o
+                _Z10nbr_codingssi;
+                _Z14vector_packingPKsPtS0_s;
+                _Z16vector_unpackingPKtPsPKss;
+
+                # uttdet.o
+                _Z14SpeechDetectedP10gmhmm_type;
+                _Z11SpeechEndedP10gmhmm_type;
+                _Z14compute_uttdetPsssS_P10gmhmm_typeP8NormType;
+                _Z11init_uttdetP10gmhmm_type;
+                _Z18set_default_uttdetP10gmhmm_type;
+                _Z10set_uttdetsP10gmhmm_type;
+                _Z12update_levelssss;
+
+                # load.o
+                _Z9mem_allocPsPttjtPc;
+                _Z11free_modelsP10gmhmm_type;
+                _Z11free_scalesP10gmhmm_type;
+                _Z11load_modelsPcP10gmhmm_typecS_S_;
+                _Z11load_n_mfccPc;
+                _Z11load_scalesPcP10gmhmm_type;
+                _Z13load_mean_vecPcP10gmhmm_types;
+                _Z15load_model_filePcPt;
+
+                # pmc_f.o
+                _Z25log_spectral_compensationPsS_S_S_PKsS1_sS_s;
+                _Z3pmcPsS_S_S_sssPKsS_PS1_S_s;
+
+                # volume.o
+                _Z16SetTIesrVolRangeP10gmhmm_typett;
+                _Z15set_volume_flagP10gmhmm_type;
+                _Z16GetTIesrVolRangeP10gmhmm_typePtS1_;
+
+                # gmhmm_type_common.o
+                _Z14GetAnswerCountPK10gmhmm_types;
+                _Z13GetAnswerWordtPK10gmhmm_types;
+                _Z14GetAnswerIndexPK10gmhmm_types;
+                _Z12GetNumNbestsPK10gmhmm_type;
+                _Z13GetTIesrNBestP10gmhmm_typePs;
+                _Z13SetTIesrNBestP10gmhmm_types;
+                _Z18GetConfidenceScorePK10gmhmm_type;
+                _Z13GetCycleCountPK10gmhmm_type;
+                _Z13GetFrameCountPK10gmhmm_type;
+                _Z13GetTIesrPrunePK10gmhmm_typePs;
+                _Z13SetTIesrPruneP10gmhmm_types;
+                _Z11GetTIesrSADPK10gmhmm_typePsS2_S2_S2_S2_;
+                _Z11SetTIesrSADP10gmhmm_typesssss;
+                _Z20GetTIesrTransiWeightPK10gmhmm_typePs;
+                _Z20SetTIesrTransiWeightP10gmhmm_types;
+                _Z13GetTotalScorePK10gmhmm_type;
+                _Z15GetVolumeStatusPK10gmhmm_type;
+                _Z16GetTIesrGaussSelPK10gmhmm_typePtS2_;
+                _Z16SetTIesrGaussSelP10gmhmm_typett;
+                _Z16OpenSearchEngineP10gmhmm_type;
+                _Z11GetTIesrJACPK10gmhmm_typePsS2_S2_S2_S2_S2_S2_;
+                _Z11SetTIesrJACP10gmhmm_typesssssss;
+                _Z11GetTIesrSBCPK10gmhmm_typePs;
+                _Z11SetTIesrSBCP10gmhmm_types;
+                _Z11GetTIesrORMPsS_S_S_S_PtS_S_P10gmhmm_type;
+                _Z11SetTIesrORMssssstssP10gmhmm_type;
+                _Z10GetTIesrSSPtPsP10gmhmm_type;
+                _Z10SetTIesrSStsP10gmhmm_type;
+                _Z10GetTIesrCMPsS_P10gmhmm_type;
+                _Z10SetTIesrCMssP10gmhmm_type;
+                _Z18GetRealTimeGuardThPsP10gmhmm_type;
+                _Z18SetRealTimeGuardThsP10gmhmm_type;
+                _Z13GetRealTGuardPsP10gmhmm_type;
+                _Z13SetRealTGuardsP10gmhmm_type;
+
+                # obsprob.o
+                _Z22observation_likelihoodtsP7HmmTypePssP10gmhmm_type;
+
+                # sbc.o
+                _Z8sbc_saveP13FeaHLRAccTypeP8_IO_FILE;
+                _Z16sbc_rst_seg_statP13FeaHLRAccType;
+                _Z8sbc_freeP13FeaHLRAccType;
+                _Z16sbc_rst_SBC_statP13FeaHLRAccType;
+                _Z17sbc_rtn_hmm2phoneP13FeaHLRAccType;
+                _Z14sbc_re_enhanceP13FeaHLRAccTypePsS1_tsS1_;
+                _Z16sbc_acc_cep_biasttPsS_PKstS_P13FeaHLRAccType;
+                _Z22sbc_set_default_paramsP10gmhmm_type;
+                _Z8sbc_openP13FeaHLRAccType;
+                _Z8sbc_loadP13FeaHLRAccTypeP8_IO_FILE;
+                _Z11sbc_enhanceP13FeaHLRAccTypePstsS1_;
+                _Z13sbc_init_treeP13FeaHLRAccTypePKcS2_stts;
+                _Z21sbc_enhance_all_transP13FeaHLRAccTypePss;
+                _Z26sbc_observation_likelihoodtstP7HmmTypePssP10gmhmm_type;
+                _Z11sbc_acc_SBCtttP13FeaHLRAccTypet;
+                _Z14sbc_update_SBCP10gmhmm_type;
+                _Z18sbc_load_hmm2phonePKctP13FeaHLRAccTypes;
+                _Z21sbc_phone2terminalidxtP13FeaHLRAccType;
+                _Z10sbc_backupP13FeaHLRAccType;
+                _Z11sbc_restoreP13FeaHLRAccType;
+
+                # rapidsearch.o
+                _Z7rj_openttP10gmhmm_type;
+                _Z16rj_clear_obs_scrP10gmhmm_typePs;
+                _Z8rj_closeP10gmhmm_type;
+                _Z13rj_compensateP10gmhmm_type;
+                _Z21rj_noise_compensationP10gmhmm_type;
+                _Z7rj_initP10gmhmm_type;
+                _Z20rj_gauss_obs_score_fPsiP10gmhmm_typePlS_;
+                _Z15rj_update_noiseP10gmhmm_typePss;
+                _Z12rj_set_paramttP10gmhmm_type;
+                _Z10rj_set_ORMssssstssP10gmhmm_type;
+                _Z11rj_vad_procP10gmhmm_typePs;
+                _Z7rj_saveP10gmhmm_typeP8_IO_FILE;
+                _Z7rj_loadP10gmhmm_typeP8_IO_FILE;
+                _Z8mlp_openP10gmhmm_type;
+                _Z8mlp_initP10gmhmm_type;
+                _Z13mlp_thresholdP10gmhmm_typels;
+                _Z10mlp_updateP10gmhmm_typesl;
+                _Z9mlp_closeP10gmhmm_type;
+                _Z7cm_openP8ConfTypeP10gmhmm_type;
+                _Z7cm_initP10gmhmm_type;
+                _Z12cm_set_paramssP10gmhmm_type;
+                _Z9cm_freezeP8ConfType;
+                _Z8cm_closeP10gmhmm_type;
+                _Z7cm_loadP8_IO_FILEP10gmhmm_type;
+                _Z7cm_saveP8_IO_FILEP10gmhmm_type;
+                _Z10cm_antiscrP8ConfTypet;
+                _Z29cm_acc_seg_ratio_to_antimodelP10gmhmm_typetssl;
+                _Z16cm_update_statusP10gmhmm_type;
+                _Z13cm_backup_adpP10gmhmm_type;
+                _Z14cm_restore_adpP10gmhmm_type;
+                _Z8cm_scoreP10gmhmm_type;
+
+        local:
+                * ;
+};
diff --git a/TIesrEngine/resource/TIesrEngineSI.map b/TIesrEngine/resource/TIesrEngineSI.map
new file mode 100644 (file)
index 0000000..965dfee
--- /dev/null
@@ -0,0 +1,7 @@
+TXN_1.1 {  
+       global:
+               TIesrEngineClose;
+               TIesrEngineOpen;
+       local:
+               *;
+};
\ No newline at end of file
diff --git a/TIesrEngine/resource/TIesrEngineSI.ver b/TIesrEngine/resource/TIesrEngineSI.ver
new file mode 100644 (file)
index 0000000..965dfee
--- /dev/null
@@ -0,0 +1,7 @@
+TXN_1.1 {  
+       global:
+               TIesrEngineClose;
+               TIesrEngineOpen;
+       local:
+               *;
+};
\ No newline at end of file
diff --git a/TIesrEngine/src/confidence.h b/TIesrEngine/src/confidence.h
new file mode 100755 (executable)
index 0000000..13fa0b4
--- /dev/null
@@ -0,0 +1,120 @@
+/*=======================================================================
+ confidence.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+#ifndef _CONFIDENCE_H
+#define _CONFIDENCE_H
+
+#include "tiesr_config.h"
+
+#define CM_UPDATE_MEAN /* online update of mean of the hypothesis models */
+//#define CM_UPDATE_VAR /* online update of variance of the hypothesis models */
+
+typedef struct{
+  short mean; /* Q11 */
+  short inv ; /* Q9 */
+  short gconst; /* Q6 */
+}CM_hypo; 
+
+#define CM_MAX_FRM 500
+#define CM_MAX_WORD 10
+#define CM_SCRS 5 /* number of computed measures for confidence measure */
+
+#define  CM_NBR_BETA 3
+
+const short CM_NBEST_LOW_CONF = -50;
+/* the confidence score for those utterances have too many N-bests */
+
+#define CM_SIZE 900
+typedef struct{
+  short  base_mem[CM_SIZE];
+  ushort  mem_count ; 
+  
+  ushort *answers; //[CM_MAX_WORD]; /* recognized words */
+  ushort *uStp; //[CM_MAX_WORD]; /* word-ending frame index */
+  ushort nWords; /* number of words */
+
+  short nS; /* number of segments */
+
+  short *cm_scr; /* the confidence measure 
+                   [0] : raw log-likelihood distance of the best path versus the 
+                         accumulated score of the maximum likelihood score along speech frames,
+                   [1] : non-stationary SNR, refer to AT&T paper
+                   [2] : likelihood ratio of the two hypothesis log(P(X|H_0)) - log(P(X|H_1))
+                   [3] : logistic regression score, P(H_0|X) ,
+                   the final confidence score is cm_scr[2]*cm_scr[3], which is the product
+                       of the scores = p(H_0|X)*[ log(P(X|H_0)) - log(P(X|H_1)) ] */
+
+  Boolean bNeedUpdate; /* TRUE if the anti score needs to be updated */
+  short *cm_anti_scr; //[CM_MAX_FRM];
+
+  long cm_fg_scr; 
+  long cm_bk_scr; /* accumulated max score of speech frames */
+
+  short th_nbest; /* the threshold of number of N-bests to declare low 
+                    confidence of an uttearnce */
+
+  short nSpeech; /* number of speech frames */
+  short nNoise;  /* number of noise frames */
+  long speech_power; /* Q6 */
+  long noise_power;  /* Q6 */
+  long noise_power_sqr; /* Q12 */
+  short NSNR; /* non-stationary SNR */
+  CM_hypo H0;
+  CM_hypo H1; 
+
+  short *lgBeta; //[CM_NBR_BETA]; 
+  long *acc_dif2_beta; //[CM_NBR_BETA]; 
+
+  Boolean bCalced; /* calculated confidence score */
+
+#ifdef USE_CONF_DRV_ADP
+  /* for confidence driven unsupervised adaptation */
+  short *sCH; /* channel distortion estimate backup */
+  long * lAccum; 
+  short adp_th; /* the threshold for adaptation */
+#ifdef USE_SVA
+  short * sLogVarRho; 
+  long * lVarFisherIM; 
+#endif
+
+#endif
+
+}ConfType; 
+
+#ifdef USE_CONFIDENCE
+
+/* ----------------------- trained UV model parameters -----------------------
+   CM_UV_ACC and CM_UV_REJ are mean, inv, and gconst of the acceptance/rejection models
+   for the feature of LLR between the best path and the accumulated maximum likelihood 
+   score. LLR is on speech segments. 
+   [mean, inv, gconst] with Q11, Q9, and Q6; 
+*/
+const short CM_UV_ACC[3] = {-4685, 128, 206}; /* trained from OOV, IV in 8-types of Aurora noise,
+                                                TIMIT noise in 10dB, and WAVES noise. */
+//const short CM_UV_ACC[3] = {-4189, 166, 190}; // trained from OOV in WAVES noise 
+const short CM_UV_REJ[3] = {-9793, 5, 412}; /* trained from OOV, IV in 8-types of Aurora noise,
+                                              TIMIT noise in 10dB, and WAVES noise. */
+//const short CM_UV_REJ[3] = {-9120, 86, 231};   // trained from OOV in WAVES noise
+
+/* ---------------------- logistic regression ------------------------------
+   train UV with logistic regression
+   1 / (1 + exp(-W X) 
+   where W = [w0, w1, w2], and X = [1, cm[0], cm[1]]
+*/
+const short CM_LOGIST_PARA[CM_NBR_BETA] = {377, 62, -18};  
+/* trained from OOV, IV in 8-types of Aurora noise, TIMIT noise in 10dB, and WAVES noise. */
+//const short CM_LOGIST_PARA[CM_NBR_BETA] = {296, 64, -97}; // triained from OOV in WAVES noise
+
+#ifdef USE_CONF_DRV_ADP
+const short CM_ADP_THRE = -200; /* the minimum value of confidence score for adaptation */
+//const short CM_ADP_THRE = -1000; /* the minimum value of confidence score for adaptation */
+#endif
+
+#endif
+
+#endif
diff --git a/TIesrEngine/src/confidence_user.h b/TIesrEngine/src/confidence_user.h
new file mode 100755 (executable)
index 0000000..8241c95
--- /dev/null
@@ -0,0 +1,111 @@
+/*=======================================================================
+ confidence_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+#ifndef CONFIDENCE_USER_H
+#define CONFIDENCE_USER_H
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+
+/*--------------------------------------------------------*/
+
+#include "tiesrcommonmacros.h"
+#include "status.h"
+#include "gmhmm_type.h"
+#include "tiesr_config.h"
+#include "search_user.h"
+#include "confidence.h"
+
+const ushort CM_NBR_NBEST_LOW_CONF = 20; 
+/* the number of N-bests that shows that the utterance has low confidence */
+
+/* open space for confidence measure calculation */
+TIESRENGINECOREAPI_API TIesrEngineStatusType cm_open( ConfType * , gmhmm_type * );
+
+/* The parameters for confidence-driven adaptation
+   @param th_adp, the threshold for unsupervised adaptation, default = CM_ADP_THRE, which is
+   -200.
+   @param th_nbest, the threshold of number of N-bests to declare low 
+                    confidence of an uttearnce 
+                    default is 20
+*/
+TIESRENGINECOREAPI_API void cm_set_param( short th_adp,
+                  short th_nbest,
+                  gmhmm_type * gv );
+
+/* initialize confidence measure for one utterance */
+void cm_init(gmhmm_type * gv);
+
+/* load parameters of confidence measure computation */
+TIESRENGINECOREAPI_API void cm_load(FILE*fp, gmhmm_type *gv);
+
+/* save updated parameter for confidence measure computation */
+TIESRENGINECOREAPI_API void cm_save(FILE *fp,
+            gmhmm_type* gv);
+
+/* return confidence score */
+short cm_score(gmhmm_type *gv);
+
+/* accumulate statistics */
+TIESRENGINECOREAPI_API void cm_acc_seg_ratio_to_antimodel(gmhmm_type *gv,
+        ushort hmm_code, 
+        short stt, short stp,
+        long scaling);
+
+/* close confidence measure space */
+TIESRENGINECOREAPI_API void cm_close( gmhmm_type* gv );
+
+/* freeze background scores */
+TIESRENGINECOREAPI_API void cm_freeze(ConfType* pconf);
+
+/* get the address to the anti score at frame $frm_cnt */
+short * cm_antiscr( ConfType* pconf, ushort frm_cnt );
+
+/* compute confidence score and update confidence measure */
+TIESRENGINECOREAPI_API void cm_update_status(gmhmm_type *gv);
+
+
+/* --------------------- used for confidence-driven adaptation ------------------*/
+
+/* backup channel and SBC parameters */
+TIESRENGINECOREAPI_API void cm_backup_adp( gmhmm_type * gv);
+
+/* restore channel and SBC parameters */
+TIESRENGINECOREAPI_API void cm_restore_adp(gmhmm_type * gv);
+
+/* ------------------------------------------------------------------------------*/
+
+#endif
diff --git a/TIesrEngine/src/dist.cpp b/TIesrEngine/src/dist.cpp
new file mode 100755 (executable)
index 0000000..6adf5c1
--- /dev/null
@@ -0,0 +1,657 @@
+/*=======================================================================
+ dist.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Functions to calculate Gaussian likelihood, and associated processing.
+======================================================================*/
+
+/*
+#include "mfcc_f.h"
+#include "gmhmm.h"
+#include "gmhmm_type.h"
+#include "dist.h"
+#include "hlr_dist.h"
+*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+
+#include "tiesr_config.h"
+#include "dist_user.h"
+
+/* prototypes */
+
+
+/*================================================================
+  hlr_gauss_obs_score_f 
+
+  Fixed point gaussian log likelihood calculation.  This version
+  supports Viterbi mixtures, full mixture log likelihood, and mixture
+  component likelihood calculation.
+
+  ----------------------------------------------------------------*/
+
+TIESRENGINECOREAPI_API short /*Q6 */ hlr_gauss_obs_score_f(const short *feature, int pdf_idx,
+                                    ObsType type, short *comp, const short n_dim, const gmhmm_type *gv )
+
+{
+  short i;
+  long  scr;
+  short total_scr;
+  short n_mix;
+  short *p2wgt;
+  short *mixture;
+  short imin, imax;
+#ifndef BIT8MEAN 
+  short j;
+  long  diff;
+  short *mu, *invvar, gconst;
+  const short *feat;
+  short diff_s;
+#endif
+
+/*--------------------------------*/
+
+  total_scr = BAD_SCR;
+
+  mixture = GET_MIX(gv,pdf_idx);
+  n_mix = MIX_SIZE(mixture);
+  p2wgt = mixture + 1;
+
+  if( type == COMPONENT )
+  {
+     imin = *comp;
+     imax = imin + 1;
+  }
+  else
+  {
+     imin = 0;
+     imax = n_mix;
+  }
+
+  for (i = imin; i < imax; i++) {      /* n mixtures */
+#ifndef BIT8MEAN
+    mu     = get_mean(gv->base_mu, mixture, n_dim, i);
+    invvar = get_var(gv->base_var, mixture, n_dim, i);
+    gconst = gv->base_gconst[ mixture[ i * 3 + 3 ] ];
+    feat = feature;
+    /* macro formed to make this reusable */
+    GAUSSIAN_DIST(gv, scr, feat, j, n_dim, diff, diff_s, gconst, mu, invvar);
+#else
+    GAUSSIAN_DIST(gv, scr, n_dim, mixture, i, feature);
+#endif
+    scr += p2wgt[ i * 3 ];         /* mixture weight */
+
+    if( type == FULL )
+    {
+       /* total_scr = log( exp( total_scr ) + exp( scr ) ); */
+       total_scr = ( i == 0 ) ? LONG2SHORT((long)scr) : hlr_logsum( total_scr, LONG2SHORT((long)scr) );
+    }
+    else
+    {
+       if( scr > (long) total_scr )
+       { 
+         total_scr = scr;
+         *comp = i;
+       }
+    }
+  }
+
+  return total_scr;
+}
+
+
+/*================================================================
+  hlr_logsum
+
+  This function accepts two short arguments as input, ln(a) and ln(b),
+  in Q6 format.  It returns ln( a + b ) in Q6 format.  It uses the
+  factorization ln( a + b ) = ln(a) + ln( 1 + exp( ln(b)/ln(a) ) ),
+  where b < a.
+
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API short hlr_logsum( short lna, short lnb )
+{
+   short s_temp;
+   long temp;
+   long diff;
+   short result;
+   unsigned short adb;
+
+   /* lna holds larger value, lnb smaller */
+   if( lna < lnb )
+   {
+      s_temp = lnb;
+      lnb = lna;
+      lna = s_temp;
+   }
+        
+   /* check for lnb small enough to be ignored, difference -7 or less */
+   diff = (long)lnb;
+   diff -= (long)lna;
+   if( diff < -448 )
+      return( lna );
+      
+   /* find exponential of diff in unsigned short Q15 */
+   s_temp = (short)diff;
+   adb = hlr_expn( s_temp, 6 );
+
+   /* find ln( 1 + adb ) in short Q15 */
+   result = hlr_log_one( adb );
+
+   /* round and return result in Q6 */
+   temp = (long)result;
+   temp += lna << 9;
+   temp += 1<<8;
+   temp >>= 9;
+   if( temp > 32767 )
+      temp = 32767;
+
+   return (short)temp;
+}
+
+/*================================================================
+  hlr_expn
+
+  This function returns exp(x) for x in the range of -limit to 0. Note
+  that x is short, and you must supply the Q point, between 0 and
+  15, with x.  The output is unsigned short Q15.
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API unsigned short hlr_expn( short x, short qpt )
+{
+   /* log2(e) in Q14 */
+   short ln2e = 23637;
+
+   /* order 4 polynomial for 2^x,  in Q14 */
+   short coef_pow2[5] = { 158, 909, 3936, 11357, 16384 };
+
+   long temp;
+   long itemp;
+   unsigned long ftemp;
+   unsigned short result;
+   short frac, s_temp;
+   short coef;
+
+   /* base two exponent Q qpt+14 */
+   temp = ln2e*x;
+   
+   /* work with positive numbers */
+   temp = -temp;
+
+   /* 
+      We want to find 2^(-temp) = 2^(-I)*2^(-frac). 
+      Integer portion of base two exponent 
+   */
+   itemp =  temp >> (qpt+14);
+   if( itemp >= 16 )
+      return 0;
+   else
+   {
+      s_temp = (short) itemp;
+      result = ( 32768 >> s_temp );
+   }
+
+   /* fractional portion of base two exponent in Q15 */
+   ftemp = itemp << (qpt+14);
+   ftemp = temp & ~ftemp;
+   if( qpt + 14 <= 15 )
+   {
+      ftemp <<= 15 - qpt - 14;
+   }
+   else
+   {
+      ftemp += ( 1 << ( qpt + 14 - 16 ) );
+      ftemp >>= ( qpt + 14 - 15 );
+   }
+
+   /* find the fraction between -.5 and .5 */
+   frac = (short)ftemp;
+   if( frac >= 16384 )
+   {
+      result >>= 1;
+      frac += -32768;;
+   }      
+   frac = -frac;
+
+   /* calculate the fractional power of two by polynomial */
+   s_temp = coef_pow2[0];
+   for( coef = 1; coef < 5; coef++ )
+   {
+      /* Q14*Q15 */
+      temp = s_temp*frac;
+      temp += (long)( coef_pow2[coef] << 15 );
+
+      /* Q14 */
+      temp += (long)1<<14;
+      s_temp = (short)( temp >>= 15 );
+   }
+
+   /* multiply fractional exponent by integer exponent, Q15 * Q14 */
+   temp = result * (unsigned short)s_temp;
+
+   /* result in unsigned short Q15 */
+   temp += 1<<13;
+   return (unsigned short)( temp >> 14 );
+}
+
+/* exponential operation
+   @param x data in Q_qpt
+   @param qpt Q value of data x
+   @param rNorm norm of returned exponential
+   return exponential in Q_rNorm
+*/
+unsigned short hlr_expn_q( short x, short qpt, short *rNorm)
+{
+  ushort tmpx; 
+  short norm; 
+  long ltmp, lnum = 1073741824 /* 1 in Q30 */;
+
+  *rNorm = 15; 
+
+  if (x == 0){
+    return ONE_Q15; 
+  }else{
+    if (x < 0)
+      return hlr_expn(x, qpt);
+    else{
+      tmpx = hlr_expn(-x, qpt);
+      if (tmpx == 0){
+       tmpx = ONE_Q15; norm = 0;
+      }else{
+       ltmp = lnum / tmpx ; /* Q30 - Q15 = Q15 */
+       norm = 15; 
+       while(ltmp > ONE_Q15){ ltmp >>= 1; norm--; }
+       tmpx = LONG2SHORT(ltmp);
+      }
+      *rNorm = norm; 
+      return tmpx;
+    }
+  }
+}
+
+/*================================================================
+  hlr_log_one( x );
+
+  This function calculates ln( 1 + x ), where x is between 0
+  and 1 and is in unsigned short Q15.
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API short hlr_log_one( unsigned short x )
+{
+   /* order 4 polynomial for ln( 1 + x ) in Q15 */
+   short coef_lnopx[5] = { -1801, 7104, -15220, 32623, 4 };
+   
+   long temp;
+   short s_temp;
+   short data;
+   short coef;
+   
+   /* special case if x is 1.0 Q15, return ln(2) in Q15 */
+   if( x == 32768 )
+      return( 22713 );
+
+   
+   /* polynomial fit for ln( 1 + x ) */
+   data = (short)x;
+   s_temp = coef_lnopx[0];
+   for( coef = 1; coef < 5; coef++ )
+   {
+      /* Q15*Q15 */
+      temp = s_temp * data;
+      temp += (long)( coef_lnopx[coef] << 15 );
+
+      /* to Q15 */
+      temp += 1<<14;
+      s_temp = (short)( temp >> 15 );
+   }
+      
+   return  s_temp;
+}
+
+/*--------------------------------
+  Multiplication of a Q15 and a long; should be in math API.
+  --------------------------------*/
+TIESRENGINECOREAPI_API long q15_x(ushort a, long b)
+{
+  long tmp;
+  short norm, tmp_s;
+
+  if (b==0) return 0;
+  else {
+    tmp = b > 0 ? b : -b;
+    GET_NORM(tmp,norm); 
+    tmp_s = tmp >> 16; 
+    tmp = a * tmp_s;  /* Q 15 * Q -16 = Q -1 */
+    tmp <<= 1;           /* Q 0 */
+    tmp >>= norm;
+    return b > 0 ? tmp : -tmp;
+  }
+}
+
+/* multiplication of a and b. 
+   return long with the same Qnumber of b's.
+   @param a, must be smaller than 1, can have minus value, in Q14
+*/
+TIESRENGINECOREAPI_API long q14_x(short a, long b)
+{
+  long tmp;
+  short norm, tmp_s;
+
+  if (b==0) return 0;
+  else {
+    tmp = b > 0 ? b : -b;
+    GET_NORM(tmp,norm);  /* to the maximum precision */
+    tmp_s = tmp >> 16; 
+    tmp = a * tmp_s;  /* Q14 * (-Q16) = Q -2 */
+    tmp <<= 2;           /* Q 0 */
+    tmp >>= norm;
+    return b > 0 ? tmp : -tmp;
+  }
+}
+
+/*--------------------------------
+  div 32 32 return specified Q; should be in math API.
+  --------------------------------*/
+TIESRENGINECOREAPI_API long div32_32_Q(long num, long den, ushort q_prec)
+{
+  long tmp1, tmp2, tmp3;
+  short norm_n, norm_d, d;
+  
+  if (num == 0) return 0;
+  else {
+    if (num < 0) tmp1 = -num;
+    else tmp1 = num;
+
+    if (den < 0) tmp2 = -den;
+    else tmp2 = den; 
+    GET_NORM(tmp1,norm_n);
+    tmp2 = MAX(1, tmp2);
+    GET_NORM(tmp2, norm_d);
+    tmp2 >>= q_prec; /* Q - q_prec */
+    tmp3 = tmp1 / tmp2;
+    d = norm_d - norm_n;
+    if (d>0) tmp3 <<=d;
+    else tmp3 >>= -d;
+    if (num<0) tmp3 = -tmp3;
+    if (den<0) tmp3 = -tmp3; 
+    return tmp3;
+  }
+}
+
+/*--------------------------------*/
+/*
+** div 32 32 return Q9
+*/
+long div32_32(long num, long den)
+{
+  long tmp1, tmp2, tmp3;
+  short norm_n, norm_d, d;
+  
+  if (num == 0) return 0;
+  else {
+    if (num < 0) tmp1 = -num;
+    else tmp1 = num;
+    if (den < 0) tmp2 = -den; 
+    else tmp2 = den; 
+    tmp2 = MAX(1, tmp2); 
+
+    GET_NORM(tmp1,norm_n);
+    GET_NORM(tmp2, norm_d);
+    tmp2 >>= 9; /* Q -9 */
+    tmp3 = tmp1 / tmp2; 
+    d = norm_d - norm_n;
+    if (d>0) tmp3 <<=d;
+    else tmp3 >>= -d;
+    if (num<0) tmp3 = -tmp3;
+    if (den<0) tmp3 = -tmp3;
+    return tmp3;
+  }
+}
+
+/*--------------------------------
+  Multiplication of a Q15 and a long; should be in math API.
+  --------------------------------*/
+TIESRENGINECOREAPI_API long fx_sqrt(long x)
+{
+  long y0, y1, z;
+
+  if (x <= 0) {
+    y1 = 0;
+  } else {
+    y1 = x >> 1;
+    if (y1 == 0) return x; 
+    else {
+      do {
+       y0 = y1;
+       z = x / y0;
+       y1 = (y0 + z) >> 1;
+      } while (abs(y0 - y1) > 1);
+    }
+  }
+  return y1;
+}
+
+/* ---------------------------------------------------------------------------
+   polynomial fit for log2() from 0.5 to 1.0, in Matlab:
+
+   x=[0.5:0.001:1.0];
+   y=log2(x);
+   z=polyfit(x,y,8);
+   z*347.8996
+   ---------------------------------------------------------------------- */
+
+const short coef_logpoly[ LOGPOLYORD + 1 ] = {
+  -781, 5338, -16182, 28637, -32768, 25419, -13767, 5640, -1536};
+
+/* ---------------------------------------------------------------------------
+   polynomial fit to compute log2()
+   ---------------------------------------------------------------------- */
+short
+log_polyfit(long value, short compensate)
+{
+  //  static short result = 0;
+  short result = 0;
+  short data;
+  short norm;
+  short i;
+  long  tmp;
+
+  if ( value <= 0 ) {
+    PRT_ERR(printf("negative log_polyfit value %ld\n", value)); /* should never happen */
+    // return result;     /* repeat neighboring value */
+    value = 1; /* need a better solution  */
+  }
+
+  /* normalize to most precision */
+
+  for (norm = 0; value < 0x40000000; norm++)
+    value <<= 1;
+
+  /* positive, between 0.5 and 1, Q 15 */
+
+  data = (short) ( value >> 16 );
+
+  /* compute the log2(data) polynomial */
+  
+  result = coef_logpoly[ 0 ];
+
+  for (i = LOGPOLYORD - 1; i >= 0; i--) {
+
+    tmp = result * data;                                      /* Q 15 */
+    tmp <<= 1;                                                /* Q 16 */
+    tmp += ( (long) coef_logpoly[ LOGPOLYORD - i ] << 16 );   /* Q 16 */
+    result = (short)  LONG_RIGHT_SHIFT_N( tmp, 16 );          /* Q 0 */
+  }
+
+  /* result >= -348, -348 * 24103 * 256 / (2^16) = -32765, -1 in Q 15 */
+  tmp = result * MAX_COEF_LOGPOLY;                    /* Q 15 * Q 8 = Q 23 */
+  tmp <<= 8;                                          /* Q 31 */
+
+  /* Compensate previous normalizations:
+     Here we treat 2^30 as 0.5, so we need to compensate 31,
+     31 - norm -compensate */
+  tmp >>= 6;                                          /* Q 25 */
+  tmp -= (long) norm << 25;                           /* log norm */
+  tmp -= (long) compensate << 25;
+
+  tmp += 1040187392;                                  /* 31 in Q 25 */
+
+  result =  LONG_RIGHT_SHIFT_N( tmp , 16 );        /* Q 25 - 16 = Q 9 */
+
+  return result;                                      /* log2(value) in Q 9 */
+}
+
+/* ---------------------------------------------------------------------------
+   polynomial fit to compute pow2()
+   ---------------------------------------------------------------------- */
+
+TIESRENGINECOREAPI_API long pow_polyfit( short value )
+{
+  short result;
+  short data;
+  short norm;
+  short i;
+  long  tmp;
+
+  /* rounding */
+  if ( value < -512 ) return (long) 0;
+  else if ( value <= 0) return (long) 1; 
+  if ( value > 15870 ) return (long) 2147483647; /* overflow clip */
+
+  /* normalization to between 0 and 1, value in Q 9 */
+
+  norm = (value &  0xfe00) >> 9;
+  data =  value & ~0xfe00;
+
+  /* compute the pow2(data) polynomial */
+  
+  result = coef_powpoly[ 0 ];
+
+  for (i = POWPOLYORD - 1; i >= 0; i--) {
+
+    tmp = result * data;                                      /* Q 9 */
+    tmp += ( (long) coef_powpoly[ POWPOLYORD - i ] << 9 );    /* Q 9 */
+    result = (short)  LONG_RIGHT_SHIFT_N( tmp, 9 );                            /* Q 0 */
+  }
+
+  /* 2.0 == 32725 >= result >= 16384 == 1.0 */
+  tmp = result; 
+  if ( norm > 14 ) {
+    tmp = (long) tmp << ( norm - 14 );
+  }
+  else{
+    i = 14-norm-1; 
+    if (i>=0)   /* rounding */
+      tmp += (1 << i); 
+    tmp =  tmp >> ( 14 - norm );
+  }
+
+  return tmp;
+}
+
+/* return 2^x
+   $param l_in in Q9,
+   return Q0 */
+long  pow2x(long l_in)
+{
+  short norm_pow; 
+  long tmp_l = l_in; 
+  long tmp_l2 = l_in; 
+
+  tmp_l -= 15870; /* max value w/o overflowing pow_poly */
+  if (tmp_l < 0) norm_pow = 0;
+  else if (tmp_l == 0) norm_pow =1;
+  else norm_pow = (tmp_l >> 9) + 1; 
+
+  tmp_l2 -= 512 * norm_pow; /* norm_pow is dim-specific */
+
+  tmp_l2 = pow_polyfit((short)tmp_l2);
+
+  if (norm_pow>=0) tmp_l2 <<= norm_pow; 
+  else tmp_l2 >>= (-norm_pow); 
+
+  return tmp_l2; 
+}
+
+/*----------------------------------------------------------------
+  gauss_det_const
+
+  This function calculates the log of the Gaussian constant based on
+  the present inverse variance values.  The leading normalization term
+  in a Gaussian distribution is given by 1/((2*pi)^N/2 * det(COV)^1/2
+  ).  Since in TIESR the covariance is stored as inverse covariance
+  terms in which covariances are scaled by dividing by the square of
+  the mean vector component scales, and TIESR implements the
+  multiplication by the gaussian constant by subtracting the term in
+  the log domain and then multiplying by 1/2, the Gaussian constant
+  term is calculated as: N*log(2*pi) - sum(log(1/Ci) ).  Correction
+  terms are added according to the scaling of the covariance
+  components.
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API short gauss_det_const(short *cov, ushort power_factor,
+                     const short mu_scale_p2[],
+                     const short dim) 
+{
+  long sum  = 0;
+  long sumc = 0;
+  ushort d;
+
+  /* Calculate log2 sum of covariance terms.  Subtraction is due
+     to using inverse covariance. Returns Q9 result. */
+  for (d=0; d<dim; d++) {
+    sum  -= log_polyfit((long)cov[d],9); 
+
+    /* this could be pre-calculated */
+    if (mu_scale_p2) sumc += mu_scale_p2[d]; 
+  }
+
+
+  /* Convert to Ln, Q21 */
+  sum *= LOG2Q12;
+
+
+  /* Add the leading constant term, and account for inv variance
+   scaling */
+  sum += dim * LOG_2_PI + ( (power_factor * LOG2Q12 * sumc) << 9);
+
+  /* Q6  */
+  sum >>= 15;
+
+  return (short)sum;
+}
+
+/* This function conducts uniq operation on a vector. Each element may contain its probability.
+   In such case, same elements are merged with their prabilities are summed. 
+   @param imax_10 pointer to elements to be compared
+   @param prob probability of the elements
+          the updated probability of an element is the sum of probablities of same elements 
+*/
+short uniq(short * imax_10, short *prob , short inum)
+{
+  short i, j, k; 
+
+  for (i=0;i<inum;i++){
+    for (j=i+1;j<inum;){
+      if ( imax_10[i] == imax_10[j] ){
+       if (prob) 
+         prob[i] += prob[j]; 
+       for (k=j;k<inum-1;k++){
+         imax_10[k] = imax_10[k+1];
+         if (prob) 
+           prob[k] = prob[k+1]; 
+       }
+       inum--; 
+      }else j++;
+    }
+  }
+
+  return inum;
+}
+
diff --git a/TIesrEngine/src/dist_user.h b/TIesrEngine/src/dist_user.h
new file mode 100644 (file)
index 0000000..9a7f5ff
--- /dev/null
@@ -0,0 +1,282 @@
+/*=======================================================================
+ dist_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header file exposes interface functions and definitions for
+ processing distance measures.  Some of the definitions of macros
+ are rather lengthy, and perhaps would be better written
+ as functions, but the idea was to write code that took minimum of
+ time.
+
+ The macros are also difficult to use because the macros have different
+ number of parameters depending on setting of BIT8MEAN and BIT8VAR.
+======================================================================*/
+
+#ifndef DIST_USER_H
+#define DIST_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+
+#include "tiesr_config.h"
+#include "tiesrcommonmacros.h"
+#include "gmhmm_type.h"
+#include "search_user.h"
+
+#ifdef BIT8MEAN
+#include "pack_user.h"
+#endif
+
+#define   LOGPOLYORD   8
+#define   MAX_COEF_LOGPOLY  24103         /* 94.15, Q8 */
+
+#define   POWPOLYORD   6
+
+static const short coef_powpoly[ POWPOLYORD + 1 ] = {
+  4, 20, 159, 909, 3936, 11357, 16384};
+
+
+/* log10(2) = 0.30103 in Q 15 */
+/*
+#define   LOG2TOLOG10  9864               
+*/
+
+/* log2(10) = 3.3219 in Q 13 */
+/*
+#define   LOG10TOLOG2  27213              
+*/
+
+/*--------------------------------*/
+/*
+** Macro interface of gaussian distance calculations,
+** implemented as macro, as function will cost more CPU.
+*/
+
+
+
+/*----------------------------------------------------------------
+  GAUSSIAN_DIST
+
+  This macro is defined differently depending on the setting of BIT8MEAN.
+
+
+  If BIT8MEAN is set, then the macro unpacks the interleaved static/dynamic
+  byte mean vector into a non-interleaved vector of shorts.
+
+  It then uses another macro, GAUSSIAN_DIST_MU16, to do the distance calculation.
+  
+  --------------------------------*/
+
+#ifdef BIT8MEAN
+
+#define GAUSSIAN_DIST(gv, scr, nbr_dim, mixture, i, feature) \
+{ \
+    short j;\
+    long  diff;\
+    short *mu8, *invvar, gconst, *feat = (short*)feature;\
+    short diff_s;\
+    ushort n_mfcc = nbr_dim>>1;\
+    short mu16[  MAX_DIM ], *pmu16 = mu16;\
+    mu8 = get_mean(gv->base_mu,mixture, nbr_dim, i);\
+    invvar = get_var(gv->base_var,mixture, nbr_dim, i);\
+    gconst = gv->base_gconst[ mixture[ i * 3 + 3 ] ];\
+    vector_unpacking((const unsigned short *)mu8, mu16, gv->scale_mu, n_mfcc);\
+    GAUSSIAN_DIST_MU16(scr, feat, j, nbr_dim, diff, diff_s, gconst, pmu16, invvar, n_mfcc, gv->scale_var);\
+}
+
+/* ! BIT8MEAN */
+#else
+
+/* Mean is already in short */
+#define GAUSSIAN_DIST(gv, scr, feat, j, nbr_dim, diff, diff_s, gconst, mu, invvar) \
+    GAUSSIAN_DIST_MU16(scr, feat, j, nbr_dim, diff, diff_s, gconst, mu, invvar, gv->n_mfcc, gv->scale_var)
+
+#endif
+
+
+
+/*----------------------------------------------------------------
+  GAUSSIAN_DIST_MU16
+
+  This macro has different implementation depending on whether BIT8VAR is set
+  or not.  If it is not set, then the likelihood calculation can be implemented
+  directly.  If it is set, then the likelihood must unpack the variance in-line
+  during calculation.
+  --------------------------------*/
+
+#ifdef BIT8VAR
+
+/* Both feature and mean vectors are unpacked, but variance is packed */
+#define GAUSSIAN_DIST_MU16(scr, feat, j, nbr_dim, diff, diff_s, gconst, mu, invvar, n_mfcc, scale_var) \
+    scr = 0; \
+    for (j = 0; j < nbr_dim; j++) { \
+      long prod;\
+      WEIGHTED_DIFF(prod, diff, diff_s, n_mfcc, invvar, scale_var, feat, mu, j); \
+      scr -= prod; \
+    } \
+    scr = LONG_RIGHT_SHIFT_N(scr,10);   /* Q 6 */ \
+    scr -= gconst; \
+    scr >>= 1; /* 1/2 */
+
+#define  WEIGHTED_DIFF(prod, diff, diff_s, n_mfcc, invvar, scale_var, feat, mu, jx) \
+      diff = (long) *feat++ - (long) *mu++; /* Q 11 */ \
+      diff = MAX(diff, -32768);    /* clip */ \
+      diff = MIN(diff, 32767); \
+      diff_s = (short) diff; \
+      diff = diff_s * diff_s;      /* Q 22 */ \
+      diff_s = (short)LONG_RIGHT_SHIFT_N(diff, 15);         /* Q 7 */ \
+      { short invv; \
+        if (jx < n_mfcc) invv = invvar[jx] & 0xff00;  /* static */  \
+        else  invv = (invvar[jx - n_mfcc] & 0xff) << 8; /* dynamic */ \
+        invv >>=  scale_var[jx]; \
+        prod = diff_s * invv;    /* Q 7 * Q 9 = Q 16 */ \
+      }
+
+
+/* ! BIT8VAR */
+#else
+
+/* Mean and variance are both in short, so do score likelihood calculation directly.
+   Arguments n_mfcc and scale_var are not used in this case but are retained for 
+   uniformity with the macro definition. */
+#define GAUSSIAN_DIST_MU16(scr, feat, j, nbr_dim, diff, diff_s, gconst, mu, invvar, n_mfcc, scale_var) \
+    scr = 0; \
+    for (j = 0; j < nbr_dim; j++) { \
+      diff = (long) *feat++ - (long) *mu++; /* Q 11 */ \
+      diff = MAX(diff, -32768);    /* clip */ \
+      diff = MIN(diff, 32767); \
+      diff_s = (short) diff; \
+      diff = diff_s * diff_s;      /* Q 22 */ \
+      diff += (1 << 14);           /* round */ \
+      diff_s = diff >> 15;         /* Q 7 */ \
+      scr -= diff_s * *invvar++;    /* Q 7 * Q 9 = Q 16 */ \
+    } \
+    scr += (1 << 9);               /*round */ \
+    scr >>= 10;                    /* Q 6 */ \
+    scr -= gconst; \
+    scr >>= 1; /* 1/2 */ 
+
+#endif
+
+
+
+/*--------------------------------*/
+/* Functional interface */
+
+/* returns Q6 */
+TIESRENGINECOREAPI_API short  hlr_gauss_obs_score_f(const short *feature, int pdf_idx,
+                            ObsType type, short *comp, 
+                            const short n_dim, const gmhmm_type *gv );
+
+TIESRENGINECOREAPI_API short hlr_logsum( short lna, short lnb );
+
+TIESRENGINECOREAPI_API unsigned short hlr_expn( short x, short qpt );
+
+/* exponential operation
+   @param x data in Q_qpt
+   @param qpt Q value of data x
+   @param rNorm norm of returned exponential
+   return exponential in Q_rNorm
+*/
+unsigned short hlr_expn_q( short x, short qpt, short *rNorm);
+
+TIESRENGINECOREAPI_API short hlr_log_one( unsigned short x );
+
+#define GET_NORM(tmp, norm) for ( norm = 0; tmp < 0x40000000; norm++ ) tmp <<= 1;
+
+/*--------------------------------
+  Multiplication of a Q15 and a long
+  --------------------------------*/
+TIESRENGINECOREAPI_API long q15_x(ushort a, long b);
+
+/* -------------------------------
+   return long with the same Qnumber of b's.
+   @param a, must be smaller than 1, can have minus value, in Q14
+  --------------------------------*/
+TIESRENGINECOREAPI_API long q14_x(short a, long b);
+
+/*--------------------------------
+  div 32 32 return specified Q
+  --------------------------------*/
+TIESRENGINECOREAPI_API long div32_32_Q(long num, long den, ushort q_prec);
+
+/*--------------------------------
+div 32 32 return Q9
+---------------------------------*/
+TIESRENGINECOREAPI_API long div32_32(long num, long den);
+
+/* fixed-point square root operation */
+TIESRENGINECOREAPI_API long fx_sqrt(long x);
+
+/* ---------------------------------------------------------------------------
+   polynomial fit to compute log2()
+   ---------------------------------------------------------------------- */
+TIESRENGINECOREAPI_API short log_polyfit(long value, short compensate);
+
+/* ---------------------------------------------------------------------------
+   polynomial fit to compute pow2()
+   ---------------------------------------------------------------------- */
+TIESRENGINECOREAPI_API long pow_polyfit( short value );
+
+/*----------------------------------------------------------------
+  gauss_det_const
+
+  This function calculates the log of the Gaussian constant based on
+  the present inverse variance values.  The leading normalization term
+  in a Gaussian distribution is given by 1/((2*pi)^N/2 * det(COV)^1/2
+  ).  Since in TIESR the covariance is stored as inverse covariance
+  terms in which covariances are scaled by dividing by the square of
+  the mean vector component scales, and TIESR implements the
+  multiplication by the gaussian constant by subtracting the term in
+  the log domain and then multiplying by 1/2, the Gaussian constant
+  term is calculated as: N*log(2*pi) - sum(log(1/Ci) ).  Correction
+  terms are added according to the scaling of the covariance
+  components.
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API short gauss_det_const(short *cov, ushort power_factor,
+                         const short mu_scale_p2[],
+                         const short dim) ;
+
+/* This function conducts uniq operation on a vector. Each element may contain its probability.
+   In such case, same elements are merged with their prabilities are summed. 
+   @param imax_10 pointer to elements to be compared
+   @param prob probability of the elements
+          the updated probability of an element is the sum of probablities of same elements 
+*/
+short uniq(short * imax_10, short *prob , short inum);
+
+#endif
diff --git a/TIesrEngine/src/engine_sireco_init.cpp b/TIesrEngine/src/engine_sireco_init.cpp
new file mode 100755 (executable)
index 0000000..747a7a8
--- /dev/null
@@ -0,0 +1,182 @@
+/*=======================================================================
+ engine_sireco_init.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This function defines the API that is exposed to the user of the
+ TIesr SI recognizer.
+
+======================================================================*/
+
+/*
+#include "mfcc_f.h"
+#include "tiesr_engine_api_sireco.h"
+#include "gmhmm.h"
+#include "jacheader.h"
+#include "gmhmm_si_api.h"
+*/
+
+/* Windows OS specific includes */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "tiesr_config.h"
+
+#include "tiesr_engine_api_sireco.h"
+#include "gmhmm_si_api.h"
+#include "gmhmm_type_common_user.h"
+#include "volume_user.h"
+#include "uttdet_user.h"
+#include "jac-estm_user.h"
+#include "jac_one_user.h"
+
+
+#ifdef USE_CONFIDENCE
+#include "confidence_user.h"
+#endif
+
+
+#if defined (WIN32) || defined (WINCE)
+/*---------------------------------------------------------
+DllMain
+
+Windows DLL entry point if Windows OS.
+----------------------------------------------------------*/
+
+
+BOOL APIENTRY DllMain( HANDLE hModule,
+                      DWORD  ul_reason_for_call,
+                      LPVOID lpReserved
+                      )
+{
+    switch (ul_reason_for_call)
+    {
+    case DLL_PROCESS_ATTACH:
+    case DLL_THREAD_ATTACH:
+    case DLL_THREAD_DETACH:
+    case DLL_PROCESS_DETACH:
+        break;
+    }
+    return TRUE;
+}
+
+#endif
+
+
+/*---------------------------------------------------------
+TIesrEngineOpen
+
+This function initializes pointers to all functions in the
+TIesrEngineSIRECOType structure.
+-----------------------------------------------------------*/
+TIESRENGINESIAPI_API
+void TIesrEngineOpen (TIesrEngineSIRECOType *tiesr)
+{
+  tiesr->OpenASR           = OpenASR; 
+  tiesr->CloseASR          = CloseASR; 
+  tiesr->OpenSearchEngine  = OpenSearchEngine; 
+  tiesr->CallSearchEngine  = CallSearchEngine; 
+  tiesr->CloseSearchEngine = CloseSearchEngine; 
+  tiesr->SpeechDetected    = SpeechDetected; 
+  tiesr->SpeechEnded       = SpeechEnded; 
+
+
+  tiesr->JAC_load   = JAC_load;
+  tiesr->JAC_save  = JAC_save;
+  tiesr->JAC_clear  = JAC_clear;
+  tiesr->JAC_update = JAC_update;
+
+  tiesr->GetFrameCount   = GetFrameCount; 
+  tiesr->GetTotalScore = GetTotalScore;
+
+  tiesr->GetCycleCount   = GetCycleCount; 
+  tiesr->GetAnswerIndex  = GetAnswerIndex; 
+  tiesr->GetAnswerWord   = GetAnswerWord; 
+  tiesr->GetAnswerCount  = GetAnswerCount; 
+  tiesr->GetVolumeStatus = GetVolumeStatus; 
+  tiesr->GetSearchMemorySize = GetSearchMemorySize;  
+  tiesr->GetMaxFrames = GetMaxFrames;
+//#ifdef USE_CONFIDENCE
+  tiesr->GetConfidenceScore = GetConfidenceScore; 
+//#ifdef USE_CONF_DRV_ADP
+  tiesr->SetTIesrConfidenceAdaptation = SetTIesrCM;
+  tiesr->GetTIesrConfidenceAdaptation = GetTIesrCM; 
+//#endif
+//#endif
+
+#ifdef REALTIMEGUARD
+  tiesr->getRealTimeGuardTh=GetRealTimeGuardTh;
+  tiesr->getGetRealTGuard=GetRealTGuard;
+  tiesr->setRealTimeGuardTh=SetRealTimeGuardTh;
+  tiesr->setGetRealTGuard=SetRealTGuard;
+#endif
+
+// Defines should not change the compatibility of 
+// TIesr processing that is optional
+//#ifdef USE_GAUSS_SELECT
+  tiesr->SetTIesrGaussSelection = SetTIesrGaussSel;
+  tiesr->GetTIesrGaussSelection = GetTIesrGaussSel; 
+//#endif
+
+//#if defined(USE_ORM_VAD)||defined(USE_ONLINE_REF)
+  tiesr->SetTIesrOnlineReferenceModel = SetTIesrORM; 
+  tiesr->GetTIesrOnlineReferenceModel = GetTIesrORM; 
+//#endif
+
+//#ifdef USE_SNR_SS
+  tiesr->SetTIesrNoiseSubtraction = SetTIesrSS; 
+  tiesr->GetTIesrNoiseSubtraction = GetTIesrSS; 
+//#endif
+
+  tiesr->SetTIesrPrune        = SetTIesrPrune;
+  tiesr->SetTIesrTransiWeight = SetTIesrTransiWeight;
+  tiesr->SetTIesrSAD          = SetTIesrSAD; 
+  tiesr->SetTIesrJacRate      = SetTIesrJacRate; 
+  tiesr->SetTIesrJAC          = SetTIesrJAC; 
+  tiesr->SetTIesrSBC          = SetTIesrSBC; 
+
+#ifdef USE_AUDIO
+  tiesr->SetTIesrVolRange     = SetTIesrVolRange; 
+#endif
+
+  tiesr->GetTIesrPrune        = GetTIesrPrune;
+  tiesr->GetTIesrTransiWeight = GetTIesrTransiWeight;
+  tiesr->GetTIesrSAD          = GetTIesrSAD; 
+  tiesr->GetTIesrJacRate      = GetTIesrJacRate; 
+  tiesr->GetTIesrJAC          = GetTIesrJAC; 
+  tiesr->GetTIesrSBC          = GetTIesrSBC;
+#ifdef USE_AUDIO
+  tiesr->GetTIesrVolRange     = GetTIesrVolRange; 
+#endif
+
+#ifdef _MONOPHONE_NET
+  tiesr->GetBestWordStartAt = GetBestWordStartAt;
+#endif
+
+  tiesr->GetNumNbests = GetNumNbests;
+  tiesr->SetTIesrNBest = SetTIesrNBest;
+  tiesr->GetTIesrNBest = GetTIesrNBest;
+
+#ifdef USE_NBEST
+  tiesr->GetBestWordStartAt = GetBestWordStartAt;
+#endif
+
+  return;
+}
+
+
+/*--------------------------------------------------------------
+TIesrEngineClose
+
+This function performs any necessary closing operations.  None are
+used at this time.
+----------------------------------------------------------------*/
+TIESRENGINESIAPI_API
+void TIesrEngineClose(TIesrEngineSIRECOType *)
+
+{
+  return;
+}
diff --git a/TIesrEngine/src/filename.h b/TIesrEngine/src/filename.h
new file mode 100644 (file)
index 0000000..d4a0c8a
--- /dev/null
@@ -0,0 +1,32 @@
+/*=======================================================================
+ filename.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+======================================================================*/
+
+#ifndef _FILENAME_H
+#define _FILENAME_H
+
+static const char * const file_names[] =  {
+   "word.lis",
+   "net.bin",
+   "hmm.bin",
+   "mu.bin",
+   "var.bin",
+   "tran.bin",
+   "pdf.bin",
+   "mixture.bin",
+   "gconst.bin",
+   "dim.bin",
+
+   /* scaling factor for mean and/or variance if they are in byte format */
+   "scale.bin", 
+   /* file defining configuration of the model file information */
+   "config.bin",
+   /* file defining mapping from hmm to monophone or other model index */
+   "hmm2phone.bin"
+};
+
+#endif
diff --git a/TIesrEngine/src/gmhmm.h b/TIesrEngine/src/gmhmm.h
new file mode 100644 (file)
index 0000000..1c233ef
--- /dev/null
@@ -0,0 +1,478 @@
+/*=======================================================================
+ gmhmm.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header contains only structures and data used internally in the
+ search engine.  It was modified to make the tiesr code more modular.
+ It rightly should be called search.h, but is retained for historical
+ reasons.
+
+======================================================================*/
+
+#ifndef GMHMM_H
+#define GMHMM_H
+
+#include "tiesr_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+/*
+#include "status.h"
+*/
+
+#include "tiesrcommonmacros.h"
+
+/*
+Now in tiesrcommonmacros.h
+#define ushort unsigned short
+*/
+
+/* ---------------------------------------------------------------------------
+   define
+   ---------------------------------------------------------------------- */
+/* Now in tiesrcommonmacros.h
+#define TRUE  1
+#define FALSE 0
+*/
+
+
+/* real time guard parameters */
+
+#define REALTIME_TH  50  // frames that trigger more pruning as realtime guard, 50 is one second
+#define REALT_GUARD  800
+
+
+/* Now in tiesr_config.h */
+/* 8 bit mean vectors */
+/* #define BIT8MEAN */
+/* 8 bit variance */
+/* #define BIT8VAR */
+/* 8 bit feature vectors */
+/* #define BIT8FEAT */
+
+
+#define   MAX_STR            1024
+#define   MAX_WORD           1024
+#define   MAX_MONOPHONES     75   /* maximum number of monophones */
+
+/* static + dynamic */
+/*
+#define   MAX_DIM            (2 * MAX_DIM_MFCC16) 
+*/
+
+
+#define   BAD_SCR            -32768
+#define   PMCFRM             8         /* must be power of 2 */
+#define   PMCFRM_P2          3
+
+#define PRUNE_COEFF -3  /* default pruning */
+#define WIP 0   /*  default word insertion penalty */
+
+#define NSYM 2 /* hash code nbr */
+
+//#define   MAX_STATE_CELL     20000    /* these 4 const define search space */
+//#define   MAX_SYM_CELL       4000     /* actual space allocated  */ 
+//#define   MAX_BEAM_CELL      10000 
+//#define   MAX_TIME_CELL      2000 
+//#define   MAX_SYM_CELL2     (MAX_SYM_CELL>>1)  
+
+#define NN (unsigned short) 20 /* store last NN time stamps */
+#define   MAX_WORD_UTT      128/* max words in an utterance */
+
+/*
+** number of frames to be stored in memory for JAC adaptation:
+*/
+#define   MAX_FRM_NBR 600   /* 50 frames/second under 8KHz (200 -> 4 seconds of speech */
+
+#define MAX_NBR_SEGS  70 /* per utterance max segments */
+
+/* Search array structure sizing */
+#define BEAM_SZ  3
+#define SYMB_SZ  3 /* 2 times cell 2 */
+#define STATE_SZ 3
+#define TIME_SZ  2
+
+
+/* From search.cpp */
+#define UNDEF_CELL  0xffff
+#define UNDEFINEDTIME (-1)
+
+
+/* ---------------------------------------------------------------------------
+   backtrace structures 
+   ---------------------------------------------------------------------- */
+
+/* state cell */
+typedef struct {
+  short          scr;   /* accumulated score */
+  unsigned short sym;   /* previous sym */
+  unsigned short frm;   /* time of previous sym */
+} StateCell;
+
+/* sym cell */
+typedef struct {
+  unsigned short sym_code;    /* MSB bit 1 means not active */
+  unsigned short start_cell;  /* start state cell index */
+  unsigned short depth;  
+} SymCell;
+
+
+/* backtrace cell */
+typedef struct ele {
+  unsigned short sym;
+  unsigned short idx_flag; /* store 1. back cell index AND 2. empty flag */
+  unsigned short next;     /* index to next cell */
+} BeamType;
+
+
+typedef struct  {           /* points to the first element of beam cells */
+  unsigned short frm;       /* frame index */
+  unsigned short beam_idx;  /* the index of BeamType cell */
+} TimeType;
+
+
+typedef struct {
+  unsigned short high_pos;   /* watermark, peak usage estimate */
+  unsigned short cur_pos;    /* next available cell */
+} PosType;
+
+typedef struct {             /* peak usage statistics */
+  PosType      state;        /* state cell statistics */
+  PosType      sym[NSYM];    /* sym cell statistics   */
+  PosType      beam;         /* beam cell (backtrace) statistics */
+  PosType      time;         /* time cell (backtrace) statistics */
+} EvalStat;
+
+#define MAX_NUM_SYMS 8000
+
+typedef struct {
+  unsigned short max_nbr_syms; /* maximum number of symbols */
+  short nbr_syms; /* number of accessed symbols */
+  short sym2pos[MAX_NUM_SYMS];  // [15]: 1 : previous time ; 0 : current time
+  unsigned short syms[MAX_NUM_SYMS]; 
+} Sym2PosType; 
+
+typedef struct {
+  unsigned short cur_sym[NSYM];    /* active symbol's start cell position 
+                                   for male/female */
+  unsigned short cur_state;  /* active states's start cell position */
+
+} EvalIdx;
+
+/* ---------------------------------------------------------------------------
+   net structure, top level grammar, it consists of HMM's
+   ---------------------------------------------------------------------- */
+
+//typedef struct {
+//  unsigned short hmm_code; /* HMM code, not context-expanded */
+//  unsigned short n_next;   /* the number of symbols in next[]. if bit15 == 1 then the last element in
+//                              "next[]" is the word code  */
+//  unsigned short next[1];  /* the list of following symbols, 
+//                           cannot use short *, more than 1 */
+//} SymType;
+
+
+/* Now in search_user.h*/
+//typedef struct {
+//  unsigned short   n_hmm;     /* total # of hmm (including m and f) */
+//  unsigned short   n_sym;     /* size of symlist[] */
+//  unsigned short   n_word;    /* # of words */
+//
+//  unsigned short   n_set;     /* # of hmm set, e.g. 2 for male + female */
+//  unsigned short   n_hmm_set; /* # of hmm per set, 
+//                                 e.g. = n_hmm / 2 for male / female */
+//
+//  unsigned short   start;            /* start node */
+//  unsigned short   stop;             /* stop node */
+//  unsigned short   symlist[1];       /* list of all nodes, 
+//                                     cannot use short *, more than 1 */
+//} TransType;
+
+/* ---------------------------------------------------------------------------
+   HMM structure
+   ---------------------------------------------------------------------- */
+
+/* Now in search_user.h */
+//typedef struct {
+//
+//  short          tran;    /* offset pointing into the transition matrix pool,
+//                             NOT converted into real addr in initialization
+//                          */
+//  unsigned short pdf_idx[1]; /* each entry is an offset pointing into
+//                             base_pdf[],
+//                             it is the observation distribution for each
+//                             emission state,
+//                             pdf_idx[ n_state - 1 ]
+//                          */
+//} HmmType;
+//
+
+/* gaussian observation likelihood type evaluation */
+/* Now in search_user.h
+typedef enum ObsType 
+{
+   VITERBI,
+   FULL,
+   COMPONENT
+} ObsType;
+*/
+
+/*
+** compensation for robustness
+*/
+/* Now in gmhmm_type.h
+typedef enum CompensationType {
+  NONE,
+  CMN,
+  JAC,
+};
+*/
+
+
+
+/*--------------------------------*/
+/* Macros used for tiesr search engine */
+
+#define HCODE(sym) ((sym) & 1)
+
+#define   STATE_CELL(base,pos,n_state,time_idx, max_state_cell) \
+      (time_idx) ? ((base) + (pos)) : \
+      ((base) + max_state_cell - (pos) - n_state)
+
+/* was: ((base) + MAX_STATE_CELL - 1 - (pos) - n_state) */
+
+#define   SYM_CELL(base,pos,time_idx,max_sym_cell2) \
+      (time_idx) ? ((base) + (pos)) : \
+     ((base) + max_sym_cell2 - 1 - (pos))
+
+#define   PREV_SYM(time_idx,pc)   (time_idx)? pc-- : pc++
+
+#define   NEXT_SYM(time,pc)   ((time) & 1) ? pc++ : pc--
+
+/* 
+Now in tiesrcommonmacros.h
+#define   MAX(a,b)  ((a) > (b) ? (a): (b))
+#define   MIN(a,b)  ((a) < (b) ? (a): (b))
+*/
+
+/*
+** new macros for single grammar multi-hmm-set decoding:
+*/
+
+#define VTL_SYM(sym,sym_d) ((sym)+(sym_d))
+
+#define GET_HMM(base_hmms, hmmcode, hmm_dlt) (HmmType *) ( base_hmms + base_hmms[ hmmcode + hmm_dlt ])
+
+/*
+** extract n_next info:
+*/
+#define GET_N_NEXT(n_next) (n_next & 0x7fff)
+
+
+
+/*
+** introduced for name dilaing: 
+*/
+
+/* Two macros named identically, except for case.  Not only that,
+   nbr_states was a variable within code.  The
+   macro nbr_states is never used in code, only through the macro NBR_STATES,
+   so for now, renamed it.  It should be deleted entirely. 
+*/
+/* number of HMM states (incl. exit) */
+/* #define nbr_states(hmm,b_tran) (*( b_tran + hmm->tran )) */
+
+/* #define NBR_STATES(hmm,base_tran) nbr_states(hmm, base_tran) */
+
+#define NR_STATES(hmm,b_tran) (*( b_tran + hmm->tran ))
+
+/* the number of emitting states + 1 */
+#define NBR_STATES(hmm,base_tran) NR_STATES(hmm, base_tran) 
+
+#define GET_PI(hmm,base_tran)     (base_tran + hmm->tran + 1)   /* initial prob, skip nbr_state */
+
+#define get_a_gvn_trans(hmm,base_tran)    (base_tran + hmm->tran + NBR_STATES(hmm,base_tran))
+
+#define get_ai_gvn_trans(hmm,i,base_tran) (get_a_gvn_trans(hmm,base_tran)+(NBR_STATES(hmm,base_tran)*(i)))
+
+#define GET_AIJ(hmm,i,j, base_tran) (get_ai_gvn_trans(hmm,i,base_tran)[j]) /* access to transition prob: a_ij  */
+
+#define HAS_TRANSITION(tr_prob) ((tr_prob) > BAD_SCR)
+/* The below code is revised since the two macros perform identically and are
+   confusing since the names are the same except for case.
+
+*/
+/*
+#define for_ems_states(i,hmm,b_tran) for (i=0; i< nbr_states(hmm,b_tran) - 1; i++) 
+
+#define FOR_EMS_STATES(i,hmm,base_tran) for_ems_states(i,hmm,base_tran)
+*/
+#define FOR_EM_ST(i,hmm,b_tran) for (i=0; i< NR_STATES(hmm,b_tran) - 1; i++) 
+
+#define FOR_EMS_STATES(i,hmm,base_tran) FOR_EM_ST(i,hmm,base_tran)
+
+
+#define FOR_ALL_STATES(i,hmm) for (i=0; i< NBR_STATES(hmm); i++) 
+
+#define GET_BJ_IDX(hmm,j) (hmm->pdf_idx[j])  /* i.e. the rank in state distribution pool */
+
+#define GET_MIX(gv,pdf_idx) (gv->base_mixture + gv->base_pdf[ pdf_idx ])
+
+#define GET_BJ(gv,hmm,j) GET_MIX(gv,GET_BJ_IDX(hmm,j))
+
+#define MIX_SIZE(state_pdf) (*(state_pdf)) /* number of gaussian in the mixture */
+#define GET_MIXING_COMPONENT(state_pdf)  (state_pdf+1) /* pointor to the mix cell */
+#define COMPONENT_SIZE 3 /* for mixture component: weight, mean, sigma2 */
+
+#define SIZEOFAMIX (1+COMPONENT_SIZE) /* size of a single gaussian mixture */
+
+#define NEXT_MIXING_COMPONENT(state_pdf) (state_pdf+COMPONENT_SIZE)
+/*
+** iteration on each mixing component:
+*/
+
+#define FOR_EACH_MIXING(k,pmix,pdf) \
+ for (k=0, pmix = GET_MIXING_COMPONENT(pdf); k<MIX_SIZE(pdf); k++, pmix = NEXT_MIXING_COMPONENT(pmix))
+/*
+** sequential access of mixture components:
+*/
+#define MIXTURE_WEIGHT(mixing_pdf)  (mixing_pdf[0])
+
+#define INDEX_FOR_MEAN(mixing_pdf)  (mixing_pdf[1])
+
+#define INDEX_FOR_VARC(mixing_pdf)  (mixing_pdf[2])
+
+/*
+** return the begining of the array for mean and sigma2:
+*/
+#define GET_MU(base_mu,pmix,_dim_) (base_mu + (INDEX_FOR_MEAN(pmix) * _dim_))
+
+#define GET_SIGMA2(base_var, pmix,_dim_) (base_var + (INDEX_FOR_VARC(pmix) * _dim_))
+
+#define FOR_EACH_MEAN(i,m,_dim_, base_mu,n_mu) for (m=base_mu, i=0; i<n_mu; i++, m += _dim_)
+
+#define FOR_EACH_SIGMA2(i,m,_dim_, base_mu,n_mu)  FOR_EACH_MEAN(i,m,_dim_, base_mu,n_mu)
+
+#define ADJ_POINTOR(p_old, base_old, base_new) (base_new + (p_old - base_old))
+
+/*
+** given the size of different search arrays, calculate total search space size
+*/
+
+#define SEARCH_SIZE(beam_z, sym_z, state_z, time_z) \
+        (beam_z * BEAM_SZ  +  SYMB_SZ * sym_z + state_z * STATE_SZ + TIME_SZ * time_z)
+
+#define SEARCH_SPACE(evalstat) \
+        SEARCH_SIZE(evalstat.beam.high_pos, MAX(evalstat.sym[0].high_pos,evalstat.sym[1].high_pos), \
+        evalstat.state.high_pos, evalstat.time.high_pos)
+
+
+/* From search.cpp */
+#define CELLEMPTY(idx_flag) ((idx_flag) == 0x7fff)
+
+#define MATCH_TIME(tm, time, stop_frm) for (tm = 0; time_base[tm].frm != stop_frm; tm++); 
+
+#define MATCH_SYMB(bm, bm0, beam0, best_sym) for (bm = beam0 + bm0; bm->sym != best_sym; bm = beam0 + bm->next)
+
+#define NOT_END_IX_CELL(index_beam, max_beam_cell) (index_beam != max_beam_cell)
+
+#define BACKWARD_MARKING(bm,b_index,cont, beam, max_beam_cell) \
+   do { \
+     if (bm->idx_flag & 0x8000 ) break; /* predecessors already been marked */  \
+     b_index = bm->idx_flag; \
+     bm->idx_flag |= 0x8000; /* color it */  \
+     if ((cont = NOT_END_IX_CELL(b_index,max_beam_cell)==TRUE)) bm = beam + b_index; \
+   } \
+   while (cont) ; /* only need to traceback to "seen" */ 
+
+//trail code:
+#define ZBACKWARD_MARKING(bm,b_index,cont, beam, max_beam_cell, depth) \
+   do { \
+        depth++; \
+     b_index = bm->idx_flag; \
+     bm->idx_flag |= 0x8000; /* color it */  \
+     if ((cont = NOT_END_IX_CELL(b_index,max_beam_cell)==TRUE)) bm = beam + b_index; \
+   } \
+   while (cont) ; /* only need to traceback to "seen" */ 
+
+
+#define GET_NEW_CELL(found,i,pos, maxm_pos) \
+  if (found) pos.cur_pos = i+1;  /* return the empty backtrace cell */ \
+  else    /* update watermark, check overflow */ { \
+    if (pos.high_pos == maxm_pos) { \
+     PRT_ERR(fprintf(stderr, "Error: backtrace beam or time cell overflow (%d)\n", maxm_pos)); \
+     return USHRT_MAX; \
+    } \
+    else {\
+      i = pos.high_pos; \
+      pos.cur_pos = ++pos.high_pos; \
+    } \
+  }
+
+#define SET_NEXT_SYM(sym_cell,ps,direction, nbr) {sym_cell = ps; if ( --(nbr) ) ps += direction; else ps = NULL; }
+
+#define SET_SYM_CELL(ps0,ps1,sym_cell,nbr0,nbr1,direction, expr) \
+    if (!ps0) SET_NEXT_SYM(sym_cell,ps1,direction, nbr1) \
+      else if (!ps1) SET_NEXT_SYM(sym_cell,ps0,direction, nbr0) \
+           else if (expr) SET_NEXT_SYM(sym_cell,ps0,direction, nbr0) \
+                else SET_NEXT_SYM(sym_cell,ps1,direction, nbr1)
+
+
+
+/* 
+** given mixture array, dim, and i-th mixing component, return precision vector
+ */
+
+#ifdef BIT8VAR
+#define get_var(base_var, mix_ar, dim_, i_) (base_var + mix_ar[ i_ * 3 + 3 ] * ((dim_)>>1))
+#else
+#define get_var(base_var, mix_ar, dim_, i_) (base_var + mix_ar[ i_ * 3 + 3 ] * ((dim_)))
+#endif
+
+
+#ifdef BIT8MEAN 
+#define get_mean(base_mu, mix_ar, dim_, i_) (base_mu + mix_ar[ i_ * 3 + 2 ] * ((dim_)>>1))
+#else
+#define get_mean(base_mu, mix_ar, dim_, i_) (base_mu + mix_ar[ i_ * 3 + 2 ] * ((dim_)))
+#endif
+
+
+
+#define GET_ALPHA(alpha,t,NBRST) ((t) & 1? (alpha + NBRST): alpha)
+
+#define FOR_E_STATES(i,b_i,nbr_states, beta, T) for (i=0, b_i = beta; i<nbr_states; i++, b_i += T) 
+
+
+
+
+/* ---------------------------------------------------------------------------
+   function prototype
+   ---------------------------------------------------------------------- */
+
+/* Not needed or used here now. */
+/*
+extern short gauss_det_const(short *, ushort, const short []) ;
+
+extern short to_short(float value, int qpoint);
+*/
+
+//extern void const_init();
+
+/*
+extern short circ_idx(short idx);
+extern void compute_regression(short buf_idx, short type, short *reg_mfcc, short n_mfcc, const short *,
+                              short mfcc_buf[ MFCC_BUF_SZ ][ MAX_DIM_MFCC16 ]);
+*/
+
+//extern void pmc(short *sp_mfcc,   short *noise_log_ps, short *pmc_mfcc, short *chn, short jac, short n_mfcc);
+
+//extern short lo_gpolyfit(long value, short compensate);
+
+#endif
diff --git a/TIesrEngine/src/gmhmm_si_api.h b/TIesrEngine/src/gmhmm_si_api.h
new file mode 100644 (file)
index 0000000..b69a249
--- /dev/null
@@ -0,0 +1,185 @@
+/*=======================================================================
+ gmhmm_si_api.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header defines the interface specific to the TIesr SI API
+ structure TIesrEngineSIRECOType.  This defines main SI functions.
+======================================================================*/
+
+
+/*
+** functions to build a frame-based (live-mode) recognizer. 
+*/
+
+// #include "use_si_dll.h" 
+
+#include "tiesr_config.h"
+
+#include "status.h"
+#include "winlen.h"
+#include "gmhmm_type.h"
+
+/* initialization of ASR:
+** The function loads speech HMM and sentence network. Both of them are
+** stored in the directory (folder) specified by the argument.
+*/
+
+
+
+/* GMHMM_SI_API */
+/*TIesrEngineStatusType OpenASR(char [], int, void *);*/
+TIesrEngineStatusType OpenASR(char[] , int total_words, gmhmm_type *memoryPool);
+
+/* close ASR: */
+/* GMHMM_SI_API */
+/*void CloseASR(void *);*/
+void CloseASR(gmhmm_type *);
+/* initialization:
+** Initialize functions and variables (e.g. utterance detection, frame counter) 
+** for recognizing the next utterance.
+** RETURN:  location for audio buffer
+*/
+/* GMHMM_SI_API */ 
+/* Now part of CORE API */
+/*TIesrEngineStatusType 
+OpenSearchEngine(void *); 
+*/
+/* search one frame:
+** Perform search (recognition) function for one frame, given in the argument.
+*/
+/* GMHMM_SI_API */
+/*TIesrEngineStatusType CallSearchEngine(short [], void *);*/
+TIesrEngineStatusType CallSearchEngine(short [], gmhmm_type *, unsigned int);
+
+/* back tracking search space: 
+** Find the best sequence of word index.
+*/
+/* GMHMM_SI_API */
+/*TIesrEngineStatusType CloseSearchEngine(TIesrEngineStatusType, void *);*/
+TIesrEngineStatusType CloseSearchEngine(TIesrEngineStatusType, gmhmm_type *);
+
+/* speech activity detected: 
+*/
+/* GMHMM_SI_API */ 
+/* Now part of CORE API 
+short SpeechDetected(void *);
+*/
+
+/* utterance end detected: 
+** Indicate (using utterance detection information) if the utterance has ended.
+*/
+/* GMHMM_SI_API */ 
+/* Now part of CORE API
+short SpeechEnded(void *);
+*/
+
+/*
+** the following functions access search related quantities
+*/
+
+/* frames fed into search engine, used in search.c */
+/* GMHMM_SI_API */ 
+/* Now part of CORE API 
+short GetFrameCount(void *);  
+*/
+
+/* GMHMM_SI_API */ 
+/* Now part of CORE API
+long GetTotalScore(void *);  
+*/
+
+/*  nbr of times the whole model set has been compensated */
+/* GMHMM_SI_API */ 
+/* Now part of CORE API
+unsigned short  GetCycleCount(void *); 
+*/
+
+/* index of words in the recognized string, in reversed time order */
+/* GMHMM_SI_API */
+/* Now part of CORE API 
+ unsigned short *GetAnswerIndex(void *);
+*/
+
+/* i-th word in the recognized string */
+/* GMHMM_SI_API */
+/* Now part of CORE API 
+const char *GetAnswerWord(unsigned short, void *);
+*/
+
+/* number of words in the recognized string        */
+/* GMHMM_SI_API */
+/* Now part of CORE API 
+unsigned short GetAnswerCount(void const *) ; 
+*/
+
+/* actual search space 
+ */
+/*unsigned short GetSearchMemorySize(void *);*/
+unsigned short GetSearchMemorySize(gmhmm_type *);
+
+
+/* Maximum number of MFCC frames */
+unsigned short GetMaxFrames(gmhmm_type *gv );
+
+
+//void GetSearchInfo(void *);
+
+/* indication of the volume setting */
+/* GMHMM_SI_API */
+/* Now part of CORE API 
+short GetVolumeStatus(void *);
+*/
+
+/* GMHMM_SI_API */ 
+/* Now all of this is part of COREAPI */
+/*void SetTIesrPrune(void *data, short);*/
+/* GMHMM_SI_API */ 
+/*void GetTIesrPrune(void *data, short *);*/
+/* GMHMM_SI_API */
+/* void SetTIesrTransiWeight(void *data, short); */
+/* GMHMM_SI_API */ 
+/*void GetTIesrTransiWeight(void *data, short*);*/
+
+
+/*
+** reset SAD control parameters
+*/
+/*
+Th_SPEECH_DELTA = 10   // larger -> more robust
+Th_MIN_SPEECH_DB = 50  //  min dB level to be considered as speech 
+Th_MIN_BEG_FRM = 5     // larger  -> more robust to  noise pulses 
+Th_MIN_END_FRM = 30    // smaller (.e.g. 30) --> quicker latency  time 
+Th_NOISE_FLR = 0       // larger -> more robust
+*/
+/* GMHMM_SI_API */ 
+/* Now part of CORE API */
+/*void SetTIesrSAD(void *, short, short, short, short, short);*/
+/* GMHMM_SI_API */
+/*void GetTIesrSAD(void *, short*, short*, short*, short*, short*);*/
+
+/*
+** set the number of mean vectors to adapt during each frame 
+** PC: 300, DSP 75, Compal 45 
+*/
+
+/* GMHMM_SI_API */ 
+/* Now in jac_one_user.h */
+/*void SetTIesrJacRate(void *, short);*/
+/*void SetTIesrJacRate(gmhmm_type *, short);*/
+/* GMHMM_SI_API */
+/*void GetTIesrJacRate(void *, short*);*/
+/*void GetTIesrJacRate(gmhmm_type *, short*);*/
+
+/* check audio volume range (typical: [1200, 25000]) */
+
+/* GMHMM_SI_API */
+/* Now part of CORE API */
+/* void SetTIesrVolRange(void *, unsigned short, unsigned short);*/
+/* GMHMM_SI_API */ 
+/*void GetTIesrVolRange(void *, unsigned short*, unsigned short*);*/
+
diff --git a/TIesrEngine/src/gmhmm_type.h b/TIesrEngine/src/gmhmm_type.h
new file mode 100755 (executable)
index 0000000..4616114
--- /dev/null
@@ -0,0 +1,608 @@
+/*=======================================================================
+ gmhmm_type.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header defines the gmhmm_type structure, which is the global
+ structure that defines a TIESR recognizer API instance.
+
+======================================================================*/
+
+#ifndef _GMHMM_TYPE_H
+#define _GMHMM_TYPE_H
+
+/* Configuration of the recognizers */
+#include "tiesr_config.h"
+
+#include "tiesrcommonmacros.h"
+#include "mfcc_f_def_struct_user.h"
+#include "gmhmm.h"
+#include "sbc_struct_user.h"
+
+/*--------------------------------*/
+typedef enum CompensationType {
+   NONE = 0,
+   CMN = 1,
+   JAC = 2,
+   SBC = 4,
+   SVA = 8
+} CompensationType;
+
+/* used in TIesrFlex */
+typedef struct hmmtb
+{            /* hmm's center, left, right monophone index */
+  int   c;
+  int   l;
+  int   r;
+} Hmmtbl;
+
+/*--------------------------------*/
+/* TransType */
+typedef struct {
+      unsigned short   n_hmm;     /* total # of hmm (including m and f) */
+      unsigned short   n_sym;     /* size of symlist[] */
+      unsigned short   n_word;    /* # of words */
+
+      unsigned short   n_set;     /* # of hmm set, e.g. 2 for male + female */
+      unsigned short   n_hmm_set; /* # of hmm per set, 
+                                    e.g. = n_hmm / 2 for male / female */
+
+      unsigned short   start;            /* start node */
+      unsigned short   stop;             /* stop node */
+      unsigned short   symlist[1];       /* list of OFFSETS FOR  all nodes, 
+                                           cannot use short *, more than 1 */
+} TransType;
+
+#ifdef _MONOPHONE_NET
+/* the maximum number of N-best */
+#define RS_OUTNBEST 24
+
+typedef struct{
+  short wcur; /* current word position */
+  short hcur; /* current HMM position */
+  ushort word[RS_OUTNBEST];
+  ushort hmm[RS_OUTNBEST];
+  ushort stt[RS_OUTNBEST];
+  ushort stp[RS_OUTNBEST];
+
+  ushort unbest;
+  ushort u_nbest_word_start_at[RS_OUTNBEST];
+  ushort u_nbest_hmm_start_at[RS_OUTNBEST]; 
+
+  NBestType * pNBestCells; 
+}NBestPath;
+#endif
+
+#ifdef USE_NBEST
+/* the maximum number of N-best */
+#define RS_OUTNBEST 24
+
+typedef struct{
+  short wcur; /* current word position */
+  short hcur; /* current HMM position */
+  ushort word[RS_OUTNBEST];
+  ushort hmm[RS_OUTNBEST];
+  ushort stt[RS_OUTNBEST];
+  ushort stp[RS_OUTNBEST];
+
+  ushort unbest;
+  ushort u_nbest_word_start_at[RS_OUTNBEST];
+  ushort u_nbest_hmm_start_at[RS_OUTNBEST]; 
+
+  NBestType * pNBestCells; 
+}NBestPath;
+#endif
+
+#define MAX_N_BESTS 30
+/* N-best word indices */
+typedef struct{
+  short scr; /* score of the word sequence */
+  short n_ans;/* number of words */
+  ushort answers[20];
+}NB_element; 
+
+typedef struct{
+  short n_bests; /* number of best hypothesis */
+  short best_idx[MAX_N_BESTS]; 
+  NB_element elem[MAX_N_BESTS];
+}NB_words; 
+
+/*--------------------------------*/
+/*
+** global control variables. invisible to API
+*/
+typedef struct gmhmm_type
+{ 
+      ushort avedepth;
+      ushort bestdepth;
+      //
+      // front-end iteration
+      //
+
+      /* index to the first mean vector to be JAC compensated */
+      ushort index_mean;
+
+      /* count of incoming signal frames (w/o utterance detection) */
+      ushort signal_cnt;
+
+      /* being in the speech segment  */
+      ushort speech_detected;
+
+      /* frames received in the front-end, index to the first available
+        location (mutiplied by n_mfcc) */
+      ushort mfcc_cnt;
+      
+      /* nbr of times the whole model set has been compensated */
+      ushort nbr_cpy;
+      
+      /* the last sample of the previous window */
+      short last_sig;
+
+      /* store an analysis window of sample signal */
+      short sample_signal[ WINDOW_LEN ];
+
+      /* max of time signal (per utterance) */
+      short amplitude_max;
+
+      /* min of time signal (per utterance) */
+      short amplitude_min;
+
+
+      /* indication of first call */
+      short pred_first_frame;
+
+      /* frames fed into search engine, used in search.c */
+      short frm_cnt;
+      
+      /*number of beam*/
+      short beam_count;
+      unsigned short ending_sym_count ;
+
+      /* CMN, JAC, HLR may change this value */
+      short comp_type;
+
+
+      //
+      // Volume testing and indication
+      //
+
+      // API low and high volume warning limit parameter settings
+
+      unsigned short  low_vol_limit;
+      unsigned short  high_vol_limit;
+
+      // Volume variables
+
+      /* indication of the volume setting */
+      short vol;
+
+      
+      //
+      // feature space dimension and processing
+      //
+
+      /* feature dimension, e.g. static mfcc */
+      ushort n_mfcc;
+
+      /* actual feature vector size of recognition models (static + dynamic)*/
+      short nbr_dim;
+
+      /* actual number of frequency filters: 20 or 26 */
+      ushort n_filter;
+
+      /* MFCC buffer for regression */
+      short mfcc_buf[ MFCC_BUF_SZ ][ MAX_DIM_MFCC16 ];
+  
+      /* mfcc mean running vector */
+      short mfcc_mean[ MAX_DIM_MFCC16 ];
+
+      const short *cosxfm[  MAX_DIM_MFCC16 ];
+
+      /* mel sacle filter */
+      const mel_filter_type *mel_filter;
+      
+
+      //
+      // SAD
+      //
+      
+
+      // API SAD threshold parameter settings
+
+      /* noise floor for sad */
+      short th_noise_flr;
+
+      /* speech stronger than noise level */
+      short th_speech_delta;
+
+      /* min dB level to be considered as speech */
+      short th_min_speech_db;
+
+      /* larger (e.g. 5)  -> more robust to noise pulses */
+      short th_min_beg_frm;
+
+      /* smaller (.e.g. 30) --> quicker latency  time */
+      short th_min_end_frm;
+
+      // SAD variables
+
+      /* length of speech segment */
+      short uttdet_cnt;
+
+      /* smooth filter for noise floor */
+      short noise_smooth;
+
+      /* smoothed noise estimate */
+      short ps_noisy_smoothed[WINDOW_LEN/2];
+
+      /* noise floor */ 
+      short noise_floor[WINDOW_LEN/2];
+
+      /* smoothed autoc */
+      short sm_autoc;
+
+      /* peak track, speech loudness level */
+      short speech_level;
+
+      /* valley track, noise level */
+      short noise_level;
+
+      /* this frame is speech? */
+      short uttdet_isspeech;
+
+      /* cumulate the product of pram level and duration */
+      long  delta_sum_accum;
+
+      /* utterance detector machine state */
+      short uttdet_state;
+
+      /* begin frame */
+      short uttdet_beg_frm;
+
+      /* end frame */
+      short uttdet_end_frm;
+
+  /* end-of-grammar network has been reached, so SAD can trigger end-of-utterance
+     the idea is that the end-of-grammar nodes are pointing to gv->trans->stop. From the stop node, 
+     the pointing grammar nodes can be located. By looking up the nodes, their numbers are sequential.
+     Hence, by checking if the true symbol is within the smallest and the largest numbers, the end of 
+     grammar can be detected. */
+  Boolean sr_is_end_of_grammar;
+  short sr_MAX_END_SYM;   /* the highest true symbol index */
+  short sr_MIN_END_SYM; /* the lowest true symbol index */
+  
+  Boolean gbg_end_of_speech; /* end of speech trigger set from the on-line garbage model
+                             trigger if speech is detected but the length of 
+                             low-confidence segments is more than a certain number */
+
+      //
+      // JAC/SVA/SBC compensation of channel and noise
+      //
+
+      // API JAC/IJAC/SVA/SBC parameter settings
+
+      /* Number of model vector means compensated per input frame. */
+      /* Depends on size of gtm, machine speed */
+      /* Want to complete all mean in less than 1 second */ 
+      short jac_vec_per_frame; 
+
+      /* Threshold of component log likelihood required to accum in JAC */
+      short jac_component_likelihood;
+
+      /* Maximum size limit of an aligned segment to accum in JAC */
+      short jac_max_segment_size;
+
+      /* Coefficient for channel correction temporal smoothing filter */
+      short jac_smooth_coef;
+
+      /* IJAC channel discounting factor */
+      short jac_discount_factor;
+
+      /* IJAC channel correction deweighting factor */
+      short jac_deweight_factor;
+
+      /* IJAC channel inverse variance prior bayesian weight */
+      short jac_bayesian_weight;
+
+      /* SVA variance forgetting factor, power of two */
+      short sva_var_forget_factor;
+      
+      /* SBC forgetting factor */
+      short sbc_fgt;
+
+
+      // JAC variables for channel estimate and accumulation.
+
+      /* log-spectral channel */
+      short log_H[ N_FILTER26 ];
+
+      /* noise, Q 9 */
+      short log_N[ N_FILTER26 ];
+
+      /* not used in SD: */
+      long accum [ ACC_MEMORY ]; /* JAC accumulator  */
+
+      /* contribution of current accumulator values to the total  */
+      ushort smooth_coef;
+
+      /* SBC structure for dynamic compensation */
+      FeaHLRAccType* sbcState;
+
+
+#ifdef  USE_SVA
+      /* variance scaling */
+      short log_var_rho [ MAX_DIM ];
+      short var_dif1[MAX_DIM]; 
+      /* fisher information matrix */
+      long  var_fisher_IM[  MAX_DIM ];
+
+      /* per-utterance fisher information matrix */
+      long  var_fisher_IM_per_utter[  MAX_DIM ];
+#endif
+
+      /* running noise estimation in MFCC domain */
+      short mfcc_noise[ MAX_DIM_MFCC16 ];
+      long mfcc_noise_init_acc[ MAX_DIM_MFCC16 ];  /*init noise estimation accumulator*/
+
+      //
+      // back traced segmental information
+      //
+      //  ushort hmm_code[MAX_NBR_SEGS];  /* HMM code */
+      //  ushort stt[MAX_NBR_SEGS];       /* start    */
+      //  ushort stp[MAX_NBR_SEGS];       /* stop     */
+
+      /* variable size, so SI, SA, and SD can all use: */
+      ushort *hmm_code;  /* HMM code */
+      ushort *stt;       /* start    */
+      ushort *stp;       /* stop     */
+
+      ushort nbr_seg;    /* number of phonetic segments   */
+      ushort hmm_dlt;    /* delta for hmm code */ 
+      ushort max_frame_nbr; /* max. number of frames of mfcc */
+
+
+      //
+      //  search space:
+      //
+
+      /* symcell and statecell arrays for evaluation */
+      SymCell   *symcell_base;
+      StateCell *statecell_base;
+
+      /* backtrace array for evaluation */
+      BeamType  *beam_base;      
+      ushort cur_beam_count ; /* number of active beam cells for the current time */
+      /* time cells */
+      TimeType  *time_base;
+
+  Boolean bUseNBest; /* if the Nbest output is invoked */
+
+#ifdef USE_NBEST
+  NBestPath * ptr_nbest_tmp; /* pointer to the tempary space for N-best */
+
+  ushort max_nb_beam_cell;
+  BeamType * nb_beam_base;
+  TimeType * nb_time_base;
+
+  Boolean  nb_first_time_call; 
+  ushort nb_next_time; 
+  unsigned short last_nbest_cell;
+
+#endif
+
+#ifdef _MONOPHONE_NET
+  NBestPath * ptr_nbest_tmp; /* pointer to the tempary space for N-best */
+
+  BeamType * nb_beam_base;
+  TimeType * nb_time_base;
+
+  Boolean  nb_first_time_call; 
+  ushort nb_next_time; 
+  unsigned short last_nbest_cell;
+
+#endif
+
+      //
+      // search control
+      //
+
+      /* total scratch memory size for (including gmhmm_type) */
+      unsigned int total_words;
+
+      /* (-10)*(1<<6)    -6144  6 * 16, Q 6 */
+      short prune;
+
+      /* (3)*(1<<6) tidigit 6, wv dig 4, wv cmd 1, Q 6 */
+      short tranwgt;
+
+
+      //
+      // models (grammar + gtm)
+      //
+
+      /* char pointer to the model directory for TIesrEngine */
+      char *chpr_Model_Dir;
+
+      TransType *trans;
+      short     *base_net;
+      unsigned short  *base_hmms;
+      short     *base_mu;
+      /* original non-compensated model mu */
+      short     *base_mu_orig;
+      short     *base_var;
+      /* original non-compensated model sigma2 */
+      short     *base_var_orig;
+      short     *base_tran;
+      unsigned short  *base_pdf;
+      short     *base_mixture;
+      short     *base_gconst;
+      short     *obs_scr;
+      
+      short     *gauss_scr;//[7000];  //this should be the max of total Gaussian number, 6800 is enough. 5000 is enough for a task
+      //short tt;  //temp
+      
+      /* mean and variance scaling, used for unpacking mean vectors */
+      short     *scale_mu;
+      short     *scale_var;
+      /* the size of obs_scr */ 
+      unsigned short     n_pdf;
+      /* the number of mean vectors */
+      unsigned short     n_mu;
+      /* the number of variance vectors */
+      unsigned short     n_var;
+      char      **vocabulary;
+
+
+      //
+      // scales
+      //
+
+      /* scale for the feature vectors, used only for SA */
+      short *scale_feat;
+
+      /* mu scale power of 2, sta+dyn, points to the feature scaling */
+      short muScaleP2[ MAX_DIM ];
+
+
+      //
+      // search space variables: statistics for sym, state, and beam 
+      // cells arrays peak usage 
+      //
+      EvalStat  evalstat;
+
+      /* idx to state cell and sym cell arrays, alternate allocation direction
+      **   between begin and end of arrays depending on odd or even frames 
+      */
+      EvalIdx   eval[2];
+
+    Sym2PosType sym2pos_map; /* mapping from symbol indices to start state cell positions */
+
+      /* best score for current frame evaluation */
+      short          best_cur_scr;
+
+      /* best score from previous frame evaluation */
+      short          best_prev_scr;
+
+      long           cum_best_prev_scr;
+      unsigned short best_sym;
+      
+      unsigned short best_word; //
+      unsigned short best_word_frm; //
+      unsigned short best_word_gender; //
+
+  NB_words nbest; /* space saving N-best word indices */
+
+      bool need_compact;
+      short word_backtrace;  //0 Hmm , 1, word, -1, hmm  and BT
+      
+      /* best symbol end score */
+      long           best_sym_scr;
+
+      /* index to record next frame table table entry */
+      unsigned short next_time;
+
+      /* last beam cell */
+      unsigned short last_beam_cell;
+
+
+      //
+      // search space dimensioning 
+      //
+      ushort max_state_cell;
+      ushort max_beam_cell;
+      ushort max_time_cell;
+
+      /* max_sym_cell/2 */
+      ushort max_sym_cell2;
+
+      /* direct access of time table */
+      short time_table_idx[NN];
+
+
+      //
+      // output:
+      //
+
+      /* word sequence of the recognized string */
+      ushort *answer;
+
+      /* number of words in the recognized string   */
+      ushort nbr_ans;
+
+      //
+      // pointor for feature vector sequence (for the whole utterance):
+      //
+      ushort *mem_feature;
+/*
+** common structure for SD live
+*/
+
+      /* max. total number of frames for each utterance */
+      ushort total_frames[2];
+
+      /* number of utterance loaded to memory */
+      short nbr_loaded_utter;
+
+      /* index of the first available place in mfcc buffer */
+      //  ushort mem_start_index;
+
+      /* index of the first available frame in mfcc buffer */
+      ushort mem_start_frame;
+
+
+  /* ---------------  Cluster-dependent JAC, Gaussian selection, Online Reference Modeling -*/
+  /*  the following functions with their default arguments are used to setup parameters
+      Gaussian selection -> 
+      rj_set_param( ushort perc_core_clusters_q15,
+                  ushort perc_inter_clusters_q15, 
+                  gmhmm_type * gv )
+      Online reference modeling, VAD, and End-of-speech detection -> 
+      rj_set_ORM(GBG_num_ids, 
+            GBG_END_SPEECH_CNT_TH, GBG_END_SPEECH_TH_PERC, GBG_END_SPEECH_START, gv)
+  */
+  short * offline_vq; /* pointer to vector-quantized mean vectors */
+
+  short * pPhoneLevelPrune; /* pointer to the phone-level pruning structure */
+
+  /* --------------  spectral subtraction ----------------*/
+  /* change noise subtraction parameters using the following function defined in noise_sub_user.h
+     void ss_set_parm( ushort sAlpha, short sBeta, NssType* p_ss_crtl);
+     the default value of sAlpha is NSS_ALPHA
+     the default value of sBeta is NSS_BETA
+  */
+  short * pNss; /* pointer to noise subtraction data structure */ 
+
+  short cm_score; /* confidence score of the current recognition result, in Q6 */
+  short * pConf; /* pointer to the confidence measure data structure */
+
+  /* for force alignment */
+  TransType *trans_bk;   /* backup symbol network */
+  short     *base_net_bk;
+  short nbr_ans_bk; 
+  short answer_bk[MAX_NBR_SEGS];
+
+#ifdef USE_AVL_TREE
+  /* for AVL tree */
+  short * pAVLTree; 
+#endif
+  
+  /*for realtime guard*/
+  unsigned int FramesQueued;
+  unsigned int prev_FramesQueued;
+  
+  short guard;/*will be reset when queue reduce, but will increase when queue increase at a high level*/
+  short realtime_th;  // frames that trigger more pruning as realtime guard, 50 is one second.
+  short realt_guard;
+  
+
+} gmhmm_type;
+
+
+
+
+#define display_size(mesg, curt_mem,stt_mem, total_mem_size) \
+  PRT_ERR(printf("Current: %6d, Total: %6d, Limit: %6d (words) [%s]\n", curt_mem, stt_mem, total_mem_size, mesg))
+
+#endif
diff --git a/TIesrEngine/src/gmhmm_type_common.cpp b/TIesrEngine/src/gmhmm_type_common.cpp
new file mode 100755 (executable)
index 0000000..35648ab
--- /dev/null
@@ -0,0 +1,464 @@
+/*=======================================================================
+ gmhmm_type_common.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This code provides common functions that TIesr APIs may
+ use to access the gmhmm_type structure.
+
+======================================================================*/
+
+/* Windows DLL API entry point if Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+
+BOOL APIENTRY DllMain( HANDLE hModule,
+                       DWORD  ul_reason_for_call,
+                       LPVOID lpReserved
+                                       )
+{
+      switch (ul_reason_for_call)
+      {
+      case DLL_PROCESS_ATTACH:
+      case DLL_THREAD_ATTACH:
+      case DLL_THREAD_DETACH:
+      case DLL_PROCESS_DETACH:
+              break;
+      }
+    return TRUE;
+}
+
+#endif
+
+
+#include "tiesr_config.h"
+#include "gmhmm_type_common_user.h"
+#include "uttdet_user.h"
+#include "jac-estm_user.h"
+#ifdef USE_CONFIDENCE
+#include "confidence_user.h"
+#endif
+#include "noise_sub_user.h"
+#if defined(OFFLINE_CLS) || defined(RAPID_JAC)
+#include "rapidsearch_user.h"
+#endif
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short GetFrameCount(const gmhmm_type *gvv)
+{
+  return   (gvv)->frm_cnt;
+}
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API long GetTotalScore(const gmhmm_type *gvv)
+{
+  return   (gvv)->best_sym_scr;
+}
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API ushort  GetCycleCount(const gmhmm_type *gvv)
+{
+  return (gvv)->nbr_cpy;
+}
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API ushort GetAnswerCount(const gmhmm_type *gvv, short nbest_idx)
+{
+  if (nbest_idx == 0)
+    return (gvv)->nbr_ans;
+  else{
+    if (nbest_idx < gvv->nbest.n_bests){
+      return (gvv->nbest.elem[gvv->nbest.best_idx[nbest_idx]].n_ans);
+    }else return 0; 
+  }
+}
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API const unsigned short *GetAnswerIndex(const gmhmm_type *gvv, short nbest_idx)
+{
+  if (nbest_idx == 0)
+    return (gvv)->answer;
+  else{
+    if (nbest_idx < gvv->nbest.n_bests){
+      return (gvv->nbest.elem[gvv->nbest.best_idx[nbest_idx]].answers);
+    }else return NULL; 
+  }
+}
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API const char *GetAnswerWord(unsigned short i, const gmhmm_type *gvv, short nbest_idx)
+{
+  short k; 
+   /*gmhmm_type *gv = (gmhmm_type *)gvv; */
+  if (nbest_idx == 0)
+    return gvv->vocabulary[ gvv->answer[ gvv->nbr_ans - 1 - i ] ];
+  else{
+    if (nbest_idx < gvv->nbest.n_bests){
+      k = gvv->nbest.elem[gvv->nbest.best_idx[nbest_idx]].n_ans;
+      return (gvv->vocabulary[gvv->nbest.elem[gvv->nbest.best_idx[nbest_idx]].answers[k - 1 - i]]);
+    }else return NULL; 
+  }
+}
+
+
+TIESRENGINECOREAPI_API ushort GetNumNbests(const gmhmm_type *gvv)
+{
+  return gvv->nbest.n_bests;
+}
+
+#ifdef USE_NBEST
+ushort GetBestWordStartAt(unsigned short i, const gmhmm_type *gv)
+{
+  return gv->nbr_ans - gv->ptr_nbest_tmp->u_nbest_word_start_at[i]; 
+}
+#endif
+
+#ifdef _MONOPHONE_NET
+
+ushort GetBestWordStartAt(unsigned short i, const gmhmm_type *gvv)
+{
+  gmhmm_type * gv = (gmhmm_type*) gvv->pAux; 
+  return gv->nbr_ans - gv->ptr_nbest_tmp->u_nbest_word_start_at[i]; 
+}
+#endif
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void GetTIesrPrune(const gmhmm_type *gvv, short *value)
+{
+  *value = (gvv->prune) >> 6;  
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void GetTIesrTransiWeight(const gmhmm_type *gvv, short *value)
+{
+  *value = (gvv->tranwgt) >> 6; 
+}
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short GetVolumeStatus(const gmhmm_type *gvv)
+{
+  return (gvv)->vol;
+}
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short GetConfidenceScore(const gmhmm_type *gvv)
+{
+  return (gvv)->cm_score ; 
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void SetTIesrPrune(gmhmm_type *gvv, short value)
+{
+  (gvv)->prune = value * (1<<6);    /* pruning coefficient */
+}
+
+
+/*-------------------------------*/
+TIESRENGINECOREAPI_API void SetTIesrTransiWeight(gmhmm_type *gvv, short value)
+{
+  (gvv)->tranwgt = (value)*(1<<6);
+}
+
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void GetTIesrSAD(const gmhmm_type *gvv, short  *a, short  *b, short  *c,
+                short  *d, short  *e)
+{
+   /*gmhmm_type *gv = (gmhmm_type *) gvv; */
+
+  *a = gvv->th_speech_delta;
+  *b = gvv->th_min_speech_db;
+  *c = gvv->th_min_beg_frm;
+  *d = gvv->th_min_end_frm;
+  *e = gvv->th_noise_flr;
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void SetTIesrSAD(gmhmm_type *gvv, short a, short b, short c, short d, short e)
+{
+   /*gmhmm_type *gv = (gmhmm_type *) gvv; */
+
+  gvv->th_speech_delta = a;
+  gvv->th_min_speech_db = b; 
+  gvv->th_min_beg_frm = c;
+  gvv->th_min_end_frm = d;
+  gvv->th_noise_flr = e ;
+}
+
+/*--------------------------------
+  invoke N-best 
+*/
+TIESRENGINECOREAPI_API void SetTIesrNBest(gmhmm_type *gvv, Boolean bNbest)
+{
+  gvv->bUseNBest = bNbest; 
+}
+
+TIESRENGINECOREAPI_API void GetTIesrNBest(gmhmm_type *gvv, Boolean *bNbest)
+{
+  *bNbest = gvv->bUseNBest ;
+}
+
+/*--------------------------------
+  setup parameters for Gaussian selection 
+  @param perc_core_clusters default 16384 
+  @param perc_inter_clusters dfault 0 
+  all in Q15 format 
+ */
+TIESRENGINECOREAPI_API void SetTIesrGaussSel( gmhmm_type *gvv,
+        ushort perc_cor_clusters,
+        ushort perc_inter_clusters )
+{
+#ifdef USE_GAUSS_SELECT
+  rj_set_param( perc_cor_clusters, perc_inter_clusters, gvv); 
+#endif
+}
+
+/*--------------------------------
+  return parameters of Gaussian selection 
+  setup parameters for Gaussian selection 
+  @param *a = perc_core_clusters default 16384 
+  @param *b = perc_inter_clusters dfault 0 
+  all in Q15 format 
+*/
+TIESRENGINECOREAPI_API void GetTIesrGaussSel(const gmhmm_type *gvv, ushort  *a, ushort  *b )
+{
+#ifdef USE_GAUSS_SELECT
+  long l; 
+  OFFLINE_VQ_HMM_type * vqhmm = (OFFLINE_VQ_HMM_type*) gvv->offline_vq;
+  
+  l = vqhmm->sVQ_CLS_TO_EVAL << 15; 
+  l /= vqhmm->n_cs; 
+  *a = l;
+
+  l = vqhmm->sVQ_NUM_INTER << 15; 
+  *b = (l/vqhmm->n_cs);
+#endif
+}
+
+/* setup parameters for online reference modeling, VAD and EOS detection
+   @param num_frms_gbg: number of begining frames to construct gabage model, default 9 
+   @param noise_level : the noise level threshold to choose an LLR threshold
+   @param th_llr_low_noise: the LLR threshold in low noise level
+   @param th_llr_high_noise: the LLR threshold in high noise level 
+   @param ctn_th : number of frames that continuously below a threshold, default 80
+   @param llr_perc_th : the threshold is computed as $llr_perc_th * max_llr, where max_llr
+   is the score of the best matched cluster, default 3277 in Q15
+   @param start_from : don't do EOS decision making untill $start_from of frames have
+   passed the peak of LLR, default 30
+   @param nbr_frm_after_peak_LLR : the threshold of number of frames that have passed
+   the peak of LLR
+*/
+TIESRENGINECOREAPI_API void SetTIesrORM(short num_frms_gbg, short noise_level,
+                short th_llr_low_noise, short th_llr_high_noise,
+                short cnt_th, ushort llr_perc_th, short start_from, 
+                short nbr_frm_after_peak_LLR, gmhmm_type * gv)
+{
+#if defined(USE_ORM_VAD)||defined(USE_ONLINE_REF)
+  rj_set_ORM( num_frms_gbg, noise_level, th_llr_low_noise, th_llr_high_noise,
+             cnt_th, llr_perc_th, 
+             start_from, nbr_frm_after_peak_LLR, gv); 
+#endif
+}
+
+TIESRENGINECOREAPI_API void GetTIesrORM(short * num_frms_gbg, short* noise_level,
+                short* th_llr_low_noise, short* th_llr_high_noise,
+                short * cnt_th, ushort * llr_perc_th, short * start_from, 
+                short *  nbr_frm_after_peak_LLR, 
+                gmhmm_type * gv)
+{
+#if defined(USE_ORM_VAD)||defined(USE_ONLINE_REF)
+  OFFLINE_VQ_HMM_type * pOffline = (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+
+  *num_frms_gbg = pOffline->inum_frms_gbg;
+#ifdef USE_ORM_VAD
+  *noise_level = pOffline->th_noise_lvl; 
+  *th_llr_low_noise = pOffline->th_llr_in_low_noise; 
+  *th_llr_high_noise = pOffline->th_llr_in_high_noise; 
+
+  *cnt_th = pOffline->ending_cnt_th;
+  *llr_perc_th = pOffline->ending_llr_perc;
+  *start_from = pOffline->ending_cnt_stt ;
+
+  * nbr_frm_after_peak_LLR= pOffline->ending_cnt_after_peak;
+#endif
+#endif
+}
+
+
+/*setup parameters for noise subtraction 
+  x = y - sAlpha * n if y - sAlpha * n > 0, 
+    = n >> sBeta, otherwise
+  @param sAlpha default 29491 in Q15
+  @param sBeta default 3 in Q0
+*/
+TIESRENGINECOREAPI_API void SetTIesrSS( ushort sAlpha, short sBeta, gmhmm_type * gv)
+{
+#ifdef USE_SNR_SS
+  ss_set_parm( sAlpha, sBeta, (NssType*)gv->pNss); 
+#endif
+}
+
+TIESRENGINECOREAPI_API void GetTIesrSS(ushort *sAlpha, short * sBeta, gmhmm_type * gv)
+{
+#ifdef USE_SNR_SS
+  NssType* p_ss_crtl = (NssType*) gv->pNss; 
+  *sAlpha = p_ss_crtl->sAlpha; 
+  *sBeta = p_ss_crtl->sBeta; 
+#endif
+}
+
+/* 
+   1) setup paramters for confidence-driven adaptation 
+   2) set the threshold of nbest to declare low confidence score 
+*/
+TIESRENGINECOREAPI_API void SetTIesrCM( short cm_th, short cm_th_nbest, gmhmm_type * gv)
+{
+#ifdef  USE_CONF_DRV_ADP
+    cm_set_param(cm_th, cm_th_nbest, gv); 
+#endif
+}
+
+TIESRENGINECOREAPI_API void GetTIesrCM( short* cm_th, short * cm_th_nbest, gmhmm_type * gv)
+{
+#ifdef USE_CONFIDENCE
+  ConfType * pconf = (ConfType*)gv->pConf; 
+#ifdef  USE_CONF_DRV_ADP
+  *cm_th = pconf->adp_th;
+#endif
+  *cm_th_nbest = pconf->th_nbest; 
+#endif
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void GetTIesrJAC(const gmhmm_type *gvv,
+                short *vec_per_frame,
+                short *comp_like,
+                short *max_seg_size,
+                short *smooth_coef,
+                short *discount_factor,
+                short *deweight_factor,
+                short *forget_factor )
+{
+  *vec_per_frame = gvv->jac_vec_per_frame;
+  *comp_like = gvv->jac_component_likelihood;
+  *max_seg_size = gvv->jac_max_segment_size;
+  *smooth_coef = gvv->jac_smooth_coef;
+  *discount_factor = gvv->jac_discount_factor;
+  *deweight_factor = gvv->jac_deweight_factor;
+  *forget_factor = gvv->sva_var_forget_factor;
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void SetTIesrJAC( gmhmm_type *gvv,
+                short vec_per_frame,
+                short comp_like,
+                short max_seg_size,
+                short smooth_coef,
+                short discount_factor,
+                short deweight_factor,
+                short forget_factor )
+{
+  gvv->jac_vec_per_frame = vec_per_frame;
+  gvv->jac_component_likelihood = comp_like;
+  gvv->jac_max_segment_size = max_seg_size;
+  gvv->jac_smooth_coef = smooth_coef;
+  gvv->jac_discount_factor = discount_factor;
+  gvv->jac_deweight_factor = deweight_factor;
+  gvv->sva_var_forget_factor = forget_factor;
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void GetTIesrSBC(const gmhmm_type *gvv, short *sbc_fgt )
+{
+  *sbc_fgt = gvv->sbc_fgt;
+}
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void SetTIesrSBC( gmhmm_type *gvv, short sbc_fgt )
+{
+  gvv->sbc_fgt = sbc_fgt;
+}
+
+#ifdef REALTIMEGUARD 
+//  int realtime_th;  
+//  int realt_guard;
+
+  TIESRENGINECOREAPI_API void GetRealTimeGuardTh(short* th, gmhmm_type * gv)
+  { *th = gv->realtime_th  ;
+  }
+  
+  TIESRENGINECOREAPI_API void GetRealTGuard(short* guard,  gmhmm_type * gv)
+  { *guard=gv->realt_guard; 
+  }
+
+  TIESRENGINECOREAPI_API void SetRealTimeGuardTh(short th, gmhmm_type * gv)
+  {  gv->realtime_th= th;
+  }
+
+  TIESRENGINECOREAPI_API void SetRealTGuard(short guard, gmhmm_type * gv)
+  {  gv->realt_guard=guard;
+  }
+
+#endif
+
+
+/*--------------------------------
+  OpenSearchEngine
+
+  This function initializes the gmhmm_type object parameters and variables
+  in preparation for speech recognition. 
+  --------------------------------*/
+/* GMHMM_SI_API */ 
+TIesrEngineStatusType  OpenSearchEngine(gmhmm_type *gvv)
+{
+  gvv->signal_cnt = 0;
+  gvv->index_mean = 0;
+  gvv->mfcc_cnt = 0;  
+
+  init_uttdet(gvv);
+
+  gvv->speech_detected = 0;
+  gvv->frm_cnt = 0;
+  gvv->amplitude_max = gvv->amplitude_min = 0;
+  gvv->nbr_cpy = 0; 
+  gvv->pred_first_frame = TRUE;
+
+#ifdef USE_SNR_SS
+  ss_reset((NssType * )gvv->pNss);
+
+#endif
+
+  /* init N-best */
+  gvv->nbest.n_bests = 0; 
+  
+#if defined(OFFLINE_CLS) || defined(RAPID_JAC)
+  rj_init( gvv); 
+#endif
+
+#if defined(USE_CONFIDENCE)
+  cm_init( gvv );
+#endif
+
+#if defined(MODEL_LEVEL_PRUNE)
+  mlp_init(gvv);
+#endif
+
+  return eTIesrEngineSuccess;
+}
diff --git a/TIesrEngine/src/gmhmm_type_common_user.h b/TIesrEngine/src/gmhmm_type_common_user.h
new file mode 100755 (executable)
index 0000000..dbc54a2
--- /dev/null
@@ -0,0 +1,193 @@
+/*=======================================================================
+ gmhmm_type_common_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file was created to encapsulate the common functions 
+ that interface with the gmhmm_type structure, and yet are not exposed
+ to the TIesr application designer.
+
+======================================================================*/
+
+#ifndef GMHMM_TYPE_COMMON_USER_H
+#define GMHMM_TYPE_COMMON_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+
+/*--------------------------------------------------------------------*/
+
+
+#include "status.h"
+#include "tiesrcommonmacros.h"
+#include "gmhmm_type.h"
+#include "tiesr_config.h"
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short GetFrameCount(const gmhmm_type *gvv);
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API long GetTotalScore(const gmhmm_type *gvv);
+
+#ifdef _MONOPHONE_NET
+
+ushort GetNumNbests(const gmhmm_type *gvv); 
+
+ushort GetBestWordStartAt(unsigned short i, const gmhmm_type *gvv);
+
+#endif
+
+#ifdef REALTIMEGUARD 
+  TIESRENGINECOREAPI_API void GetRealTimeGuardTh(short* th, gmhmm_type * gvv);
+  TIESRENGINECOREAPI_API void GetRealTGuard(short* time,  gmhmm_type * gvv);
+  TIESRENGINECOREAPI_API void SetRealTimeGuardTh(short th, gmhmm_type * gvv);
+  TIESRENGINECOREAPI_API void SetRealTGuard(short th, gmhmm_type * gvv);
+#endif
+
+#ifdef USE_NBEST
+
+ushort GetBestWordStartAt(unsigned short i, const gmhmm_type *gvv);
+
+#endif
+
+TIESRENGINECOREAPI_API ushort GetNumNbests(const gmhmm_type *gvv);
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API ushort GetAnswerCount(const gmhmm_type *gvv, short nbest_idx);
+
+/* GMHMM_SI_API */
+TIESRENGINECOREAPI_API const unsigned short *GetAnswerIndex(const gmhmm_type *gvv, short nbest_idx);
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API const char *GetAnswerWord(unsigned short i, const gmhmm_type *gvv, short nbest_idx);
+
+/* GMHMM_SI_API */
+TIESRENGINECOREAPI_API short GetConfidenceScore(const gmhmm_type *gvv);
+
+/* GMHMM_SI_API on Gaussian selection */
+TIESRENGINECOREAPI_API void GetTIesrGaussSel(const gmhmm_type *gvv,
+        ushort  *a, ushort  *b );
+TIESRENGINECOREAPI_API void SetTIesrGaussSel( gmhmm_type *gvv,
+        ushort perc_cor_clusters,
+        ushort perc_inter_clusters );
+
+/*--------------------------------
+  invoke N-best 
+*/
+TIESRENGINECOREAPI_API void SetTIesrNBest(gmhmm_type *gvv, Boolean bNbest);
+
+TIESRENGINECOREAPI_API void GetTIesrNBest(gmhmm_type *gvv, Boolean *bNbest);
+
+/* GMHMM_SI_API on On-line Reference Modeling */
+/* setup parameters for online reference modeling, VAD and EOS detection
+   @param num_frms_gbg: number of begining frames to construct gabage model, default 9 
+   @param noise_level : the noise level threshold to choose an LLR threshold
+   @param th_llr_low_noise: the LLR threshold in low noise level
+   @param th_llr_high_noise: the LLR threshold in high noise level 
+   @param ctn_th : number of frames that continuously below a threshold, default 80
+   @param llr_perc_th : the threshold is computed as $llr_perc_th * max_llr, where max_llr
+   is the score of the best matched cluster, default 3277 in Q15
+   @param start_from : don't do EOS decision making untill $start_from of frames have
+   passed the peak of LLR, default 30
+   @param nbr_frm_after_peak_LLR : the threshold of number of frames that have passed
+   the peak of LLR
+*/
+TIESRENGINECOREAPI_API void SetTIesrORM(short num_frms_gbg, short noise_level,
+                short th_llr_low_noise, short th_llr_high_noise,
+                short cnt_th, ushort llr_perc_th, short start_from, 
+                short  nbr_frm_after_peak_LLR, gmhmm_type * gv);
+
+TIESRENGINECOREAPI_API void GetTIesrORM(short * num_frms_gbg, short* noise_level,
+                short* th_llr_low_noise, short* th_llr_high_noise,
+                short * cnt_th, ushort * llr_perc_th, short * start_from, 
+                short *  nbr_frm_after_peak_LLR, gmhmm_type * gv);
+
+/* GMHMM_SI_API on noise subtraction */
+TIESRENGINECOREAPI_API void SetTIesrSS( ushort sAlpha, short sBeta, gmhmm_type * gv);
+TIESRENGINECOREAPI_API void GetTIesrSS(ushort *sAlpha, short * sBeta, gmhmm_type * gv);
+
+/* --------------- GMHMM_SI_API on confidence measure setup ------- */
+/* 
+   1) setup paramters for confidence-driven adaptation 
+   2) set the threshold of nbest to declare low confidence score 
+*/
+TIESRENGINECOREAPI_API void SetTIesrCM( short cm_th, short cm_th_nbest, gmhmm_type * gv) ;
+TIESRENGINECOREAPI_API void GetTIesrCM( short* cm_th, short * cm_th_nbest, gmhmm_type * gv);
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API ushort GetCycleCount(const gmhmm_type *gvv);
+
+TIESRENGINECOREAPI_API void GetTIesrPrune(const gmhmm_type *gvv, short *value);
+
+TIESRENGINECOREAPI_API void GetTIesrTransiWeight(const gmhmm_type *gvv, short *value);
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short GetVolumeStatus(const gmhmm_type *gvv);
+
+TIESRENGINECOREAPI_API void SetTIesrPrune(gmhmm_type *gvv, short value);
+
+TIESRENGINECOREAPI_API void SetTIesrTransiWeight(gmhmm_type *gvv, short value);
+
+TIESRENGINECOREAPI_API void GetTIesrSAD(const gmhmm_type  *gvv, short  *a, short  *b, short  *c,
+                short  *d, short  *e);
+
+TIESRENGINECOREAPI_API void SetTIesrSAD(gmhmm_type *gvv, short a, short b, short c, short d, short e);
+
+TIESRENGINECOREAPI_API void GetTIesrJAC( const gmhmm_type *gvv,
+                 short *vec_per_frame,
+                 short *comp_like,
+                 short *max_seg_size,
+                 short *smooth_coef,
+                 short *discount_factor,
+                 short *deweight_factor,
+                 short *forget_factor );
+
+TIESRENGINECOREAPI_API void SetTIesrJAC( gmhmm_type *gvv,
+                 short vec_per_frame,
+                 short comp_like,
+                 short max_seg_size,
+                 short smooth_coef,
+                 short discount_factor,
+                 short deweight_factor,
+                 short forget_factor );
+
+TIESRENGINECOREAPI_API void GetTIesrSBC(const gmhmm_type *gvv, short *sbc_fgt );
+
+TIESRENGINECOREAPI_API void SetTIesrSBC( gmhmm_type *gvv, short sbc_fgt );
+
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API TIesrEngineStatusType  OpenSearchEngine(gmhmm_type *gvv);
+
+#endif
diff --git a/TIesrEngine/src/hlr_status.h b/TIesrEngine/src/hlr_status.h
new file mode 100644 (file)
index 0000000..01bbc6b
--- /dev/null
@@ -0,0 +1,63 @@
+/*=======================================================================
+ hlr_status.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header file defines the HLR status return values that will
+ be returned by the API.  It also defines the maximum number of
+ adaptation utterances that can be collected.
+
+======================================================================*/
+
+#ifndef _HLR_STATUS_H
+#define _HLR_STATUS_H
+
+
+/*--------------------------------*/
+/* 
+   The maximum number of HLR utterances that an app can collect.
+   This number must not be exceeded 
+*/
+
+#define HLR_MAX_UTTERANCES 5     /* maximum number of utterances that will be stored for adaptation */
+
+
+/*--------------------------------*/
+/*
+** HLR error codes:
+*/
+
+typedef enum {
+       eTIesrEngineHLRSuccess = 100,            
+       eTIesrEngineHLRFail,
+/* load/save problem */
+       eTIesrEngineHLRTxmSave = 200,     /* fail to save transformation to file */
+       eTIesrEngineHLRTxmLoad,           /* fail to load transformation to file */
+       eTIesrEngineHLRLoadNbrTerminal,   /* fail to load the number of terminal symbols */
+       eTIesrEngineHLRLoadTree,          /* fail to load tree */
+       eTIesrEngineHLRPhoneTable,        /* fail to load phone table */
+       eTIesrEngineHLRMuFail,            /* fail to write mu file */
+/* memory limitation */
+       eTIesrEngineHLRMaxNbrUtter = 300, /* max. nbr of utterances limit */
+       eTIesrEngineHLRTxmMemory,         /* out of memory for transformation */
+       eTIesrEngineHLRMemoryAlloc,       /* fail to mem_alloc */
+       eTIesrEngineHLRMemoryBase,        /* base_map size limit reached */
+       eTIesrEngineHLRNbrTmnls,          /* too many ternimals  */
+       eTIesrEngineHLRAlignmentMemory,   /* alignment memory out */
+       eTIesrEngineHLRMaxMeanVectors,    /* max nbr of mean vectors (for estmation) not enough */
+       eTIesrEngineHLRMemoryBlock,       /* search memory not large enough to cover transformation */
+       eTIesrEngineHLRGlobalMemory,      /* specified memory limit not large enough */
+/* others */
+       eTIesrEngineHLRDimensionMismatch = 400, /* dimension (model) mismatch */
+       eTIesrEngineHLRFailed_Xfm,        /* HLR: failed xfm means */
+       eTIesrEngineHLRUtterShort,        /* too short enroll utterance */
+       eTIesrEngineHLRTreeTransformFail ,/* fail in tree_transform */
+       eTIesrEngineHLRMergeTransfFail ,  /* fail in merge transform */
+       eTIesrEngineHLRSuperviseAlignUtt, /* fail in supervison */
+       eTIesrEngineHLRBacktraceAligned,  /* fail in alignment */
+       eTIesrEngineHLRGetStats,          /* fail to get stats */
+} TIesrEngineHLRStatusType;
+
+
+#endif /* _HLR_STATUS_H */
diff --git a/TIesrEngine/src/jac-estm.cpp b/TIesrEngine/src/jac-estm.cpp
new file mode 100755 (executable)
index 0000000..9ccbf54
--- /dev/null
@@ -0,0 +1,1239 @@
+/*=======================================================================
+ jac-estm.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This source implements JAC model compensation.  Includes improved
+ JAC (IJAC) and stochastic bias compensation (SBC).
+
+======================================================================*/
+
+/* Windows OS specific includes */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+
+#include "tiesr_config.h"
+#include "tiesrcommonmacros.h"
+#include "dist_user.h"
+#include "search_user.h"
+#include "mfcc_f_user.h"
+#include "pack_user.h"
+#include "pmc_f_user.h"
+#include "obsprob_user.h"
+#include "jac-estm_user.h"
+#include "jac-estm.h"
+#include "sbc_user.h"
+#include "noise_sub_user.h"
+//#ifdef USE_CONFIDENCE 
+#include "confidence_user.h"
+//#endif
+#ifdef RAPID_JAC
+#include "rapidsearch_user.h"
+#endif
+#include "load_user.h"
+
+//#define DBG_CONF
+
+//extern short test_convergence(short new_like, short last_like, ushort iter);
+
+/*extern unsigned short hlr_expn( short x, short qpt );*/ /* Q15 */
+
+/*
+** cumulate per token statistics 
+** - assume alpha and beta computed
+*/
+
+#ifndef BIT8FEAT
+extern void  copy_feature(short feature[], ushort crt_vec, short n_mfcc);
+#endif
+
+/*
+  IJAC update of channel estimates for noisy speech recognition
+
+  @param jac_hmm pointer to HmmType
+  @param pdfa pointer to log likelihood 
+  @param ap pointer to alpha in EM estimates
+  @param bp pointer to beta in EM estimates
+  @param vec short pointer to MFCC feature
+  @param log_vec short pointer to log-spectral observation vector
+  @param T length of an utterance
+  @param accum long pointer to the first- and second-order differentials of auxiliary function
+  @param log_H short pointer to the estimated channel distortion in log-spectral domain
+  @param log_N short pointer to the estimated noise in log-spectral domain
+  @param n_mfcc MFCC dimension
+  @param temp_freq short pointer to a memory space allocated by the upper function for temparary usage
+  @param gv pointer to gmhmm_type
+  @param p_transform pointer to tranformation applied to this model for this segment of feature
+  @param s_normalization state normalization factor
+ */
+#ifdef USE_IJAC
+static void ijac_update_t(HmmType *jac_hmm, short *pdfa, const short ap[], const short bp[], 
+                         const short vec[], 
+                         const short log_vec[], const ushort T, long accum[], const short log_H[], 
+                         const short log_N[], const short n_mfcc,  short temp_freq[], gmhmm_type *gv,
+                         short * p_transform, short s_normalization)
+{
+  short k, frame = 0, d, j;
+  long indep_k, temp, *accum_d = GET_D_OBJ(accum, gv->n_filter);
+  short pdf_i, *pdf, *pmix, *mu, *org_mu, s3, s2;
+  ushort gamma_jk;
+  short *func_d = temp_freq, Lr;
+  short noisy_log[N_FILTER26];
+  short *pmu, sp_log_ps[ N_FILTER26 ];        /* log power spectrum */  
+  short *pnoisymu;
+#ifdef BIT8MEAN 
+  short org_mu16[ MAX_DIM ];
+  short noisy_mu16[ MAX_DIM ];
+#endif
+  long  long_diff, longtemp; 
+  short diff_s, weight;
+  short invvar[ MAX_DIM ], *p_invvar ;
+  
+  FOR_EMS_STATES(j,jac_hmm, gv->base_tran) {
+    
+    indep_k = (long) ap[j] + bp[frame] - pdfa[frame] - s_normalization;
+    pdf_i = GET_BJ_IDX(jac_hmm,j);
+    pdf = GET_MIX(gv,pdf_i);
+    FOR_EACH_MIXING(k,pmix,pdf) { 
+#ifdef BIT8MEAN 
+      mu = GET_MU(gv->base_mu, pmix, n_mfcc);
+#else
+      mu = GET_MU(gv->base_mu, pmix, gv->nbr_dim);
+#endif
+      org_mu = ADJ_POINTOR(mu, gv->base_mu,gv->base_mu_orig);
+      temp = hlr_gauss_obs_score_f(vec, (int)pdf_i, COMPONENT, &k, gv->nbr_dim, gv) + indep_k;
+
+      Lr = (temp > 0)? 0: LONG2SHORT(temp); /* Q6 */
+
+      if (Lr > gv->jac_component_likelihood ) {
+       gamma_jk = hlr_expn(Lr,6); /* Q15 */
+
+#ifdef BIT8MEAN 
+       vector_unpacking((ushort *)org_mu, org_mu16, gv->scale_mu,  n_mfcc);
+       pmu = org_mu16;
+       vector_unpacking((ushort *)mu, noisy_mu16, gv->scale_mu,  n_mfcc);
+       pnoisymu = noisy_mu16;
+       //      prt_fix("mu 16", noisy_mu16,gv->muScaleP2, gv->nbr_dim);        
+       //      prt_fix("vec", (short*)vec, gv->muScaleP2, gv->nbr_dim);        
+#else  
+       pmu = org_mu;
+       pnoisymu = mu;
+#endif   
+
+       cos_transform(pmu, sp_log_ps, gv->muScaleP2, n_mfcc, gv->n_filter, gv->cosxfm ); /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+       log_spectral_compensation(sp_log_ps, NULL, noisy_log, NULL, log_N, log_H, 1, func_d, gv->n_filter);
+       /*      compensated_log_mean_fx(org_mu, log_N, noisy_log, func_d,log_H); */
+       FOREACH(d,gv->n_filter) {
+         temp = gamma_jk * func_d[d]; /*Q30*/
+         s3 = LONG_RIGHT_SHIFT_N(temp, 15); /* Q15 */
+         s2 = noisy_log[d] - log_vec[d]; /* Q9 */
+
+         temp = s3 * s2; /* Q24 */
+         accum[d] += LONG_RIGHT_SHIFT_N(temp, 12); /* Q12 */
+
+         temp = s2 * func_d[d];   /* Q24 */
+         temp = LONG_RIGHT_SHIFT_N(temp, 9); /*Q15*/
+         s2 += (short) LONG_RIGHT_SHIFT_N((long)func_d[d] - temp, 6);   /*Q9*/
+         temp = s2 * s3; /* Q24 */
+         accum_d[d] += LONG_RIGHT_SHIFT_N(temp, 10); /* Q14 */
+       }
+       /*
+       ** accumulations of Fisher information matrix and   
+       ** score vector for sequential variance adaptation. 
+       */
+#ifdef USE_SVA
+       {  
+
+#ifdef BIT8VAR
+          p_invvar = GET_SIGMA2(gv->base_var, pmix, n_mfcc);
+          vector_unpacking((unsigned short *)p_invvar, invvar, gv->scale_var, n_mfcc);
+#else
+          p_invvar = GET_SIGMA2(gv->base_var, pmix, gv->nbr_dim);
+          for( d=0; d < gv->nbr_dim; d++ )
+             invvar[d] = *p_invvar++;
+#endif
+
+          for ( d = 0 ; d < gv->nbr_dim ; d++ )  {
+           /* (1/sigma^2)(Q9) * gamma(Q15) to weight in Q9 */
+           longtemp = invvar[d] * gamma_jk; /* Q9 x Q15 = Q24 */
+           longtemp = LONG_RIGHT_SHIFT_N(longtemp, 15); /* Q9 */
+           weight = (short)longtemp;
+           long_diff = vec[d] - pnoisymu[d]; /* Q11 */
+           long_diff = MAX(long_diff, -32768); /* clip */ 
+           long_diff = MIN(long_diff, 32767); 
+           diff_s = (short) long_diff;
+           long_diff = diff_s * diff_s; /* Q 22 */ 
+           diff_s = (short)LONG_RIGHT_SHIFT_N(long_diff, 15);  /* Q7 */
+
+           longtemp = weight * diff_s; /* Q9 x Q7 = Q16 */
+           longtemp = LONG_RIGHT_SHIFT_N(longtemp, 7); /* 16 - 7 = Q9 */
+
+           gv->var_fisher_IM_per_utter[d] += longtemp; /* Q9  */
+         }
+       }
+
+#ifdef USE_SBC
+       if (gv->comp_type & SBC)
+         sbc_acc_cep_bias(gv->nbr_dim, T, pnoisymu, invvar, vec, gamma_jk, 
+                          p_transform, gv->sbcState);
+#endif
+#endif
+
+      }
+    }
+    frame += T;
+  }
+
+}
+#else
+/*--------------------------------*/
+static void update_t(HmmType *jac_hmm, short *pdfa, const short ap[], const short bp[], const short vec[],
+             const ushort T, long accum[], const short log_H[], const short log_N[], const short n_mfcc, short tmp_freq[], gmhmm_type *gv)
+{
+  short k, frame = 0, d, j;
+  long indep_k, temp, *accum_d = GET_D_OBJ(accum, gv->n_filter);
+  short pdf_i, *pdf, *pmix, *mu, *org_mu;
+  ushort gamma_jk;
+  short noisy_log[N_FILTER26], *func_d = tmp_freq, Lr;
+  short *pmu, sp_log_ps[ N_FILTER26 ];        /* log power spectrum */  
+  short *pnoisymu;
+#ifdef BIT8MEAN 
+  short org_mu16[ MAX_DIM ];
+  short noisy_mu16[ MAX_DIM ];
+#endif
+
+  FOR_EMS_STATES(j,jac_hmm, gv->base_tran) {
+    indep_k = (long) ap[j] + bp[frame] - pdfa[frame];
+    pdf_i = GET_BJ_IDX(jac_hmm,j);
+    pdf = GET_MIX(gv,pdf_i);
+    FOR_EACH_MIXING(k,pmix,pdf) { 
+#ifdef BIT8MEAN 
+      mu = GET_MU(gv->base_mu,pmix, n_mfcc);
+#else
+      mu = GET_MU(gv->base_mu, pmix, gv->nbr_dim);
+#endif
+      org_mu = ADJ_POINTOR(mu, gv->base_mu,gv->base_mu_orig);
+      temp = hlr_gauss_obs_score_f(vec, (int)pdf_i, COMPONENT, &k, gv->nbr_dim, gv) + indep_k;
+      Lr = (temp > 0)? 0: LONG2SHORT(temp); /* Q6 */
+      if (Lr > gv->jac_component_likelihood) {
+       gamma_jk = hlr_expn(Lr,6); /* Q15 */
+#ifdef BIT8MEAN 
+       vector_unpacking((ushort *)org_mu, org_mu16, gv->scale_mu,  n_mfcc);
+       pmu = org_mu16;
+       vector_unpacking((ushort *)mu, noisy_mu16, gv->scale_mu,  n_mfcc);
+       pnoisymu = noisy_mu16;
+       //      prt_fix("mu 16", noisy_mu16,gv->muScaleP2, gv->nbr_dim);        
+       //      prt_fix("vec", (short*)vec, gv->muScaleP2, gv->nbr_dim);        
+#else  
+       pmu = org_mu;
+       pnoisymu = mu;
+#endif
+       cos_transform(pmu, sp_log_ps, gv->muScaleP2, n_mfcc, gv->n_filter, gv->cosxfm ); /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+       log_spectral_compensation(sp_log_ps, NULL, noisy_log, NULL, log_N, log_H, 1, func_d, gv->n_filter);
+       /*      compensated_log_mean_fx(org_mu, log_N, noisy_log, func_d,log_H); */
+       FOREACH(d,gv->n_filter) {
+         temp = gamma_jk * (long)noisy_log[d]; /* Q24 */
+         /* temp += (1<<13); */
+         accum  [d] += temp >> 14; /* Q10 */
+         temp = gamma_jk * (long) func_d[d];   /* Q30 */
+         /* temp += (1<<13); */
+         accum_d[d] += temp >> 14;            /* Q16 */
+       }
+       /*
+       ** accumulations of Fisher information matrix and   
+       ** score vector for sequential variance adaptation. 
+       */
+#ifdef USE_SVA
+       {  
+         long  long_diff, longtemp; 
+         short diff_s, weight;
+         short invvar[ MAX_DIM ];
+         short *p_invvar;
+
+#ifdef BIT8VAR
+         p_invvar = GET_SIGMA2(gv->base_var, pmix, n_mfcc);
+         vector_unpacking((unsigned short *)p_invvar, invvar, gv->scale_var, n_mfcc);
+#else
+         p_invvar = GET_SIGMA2(gv->base_var, pmix, gv->nbr_dim);
+         for( d=0; d < gv->nbr_dim; d++ )
+            invvar[d] = *p_invvar++;
+#endif
+
+         for ( d = 0 ; d < gv->nbr_dim ; d++ )  {
+           /* (1/sigma^2)(Q9) * gamma(Q15) to weight in Q9 */
+           longtemp = invvar[d] * gamma_jk; /* Q9 x Q15 = Q24 */
+           longtemp = LONG_RIGHT_SHIFT_N(longtemp, 15); /* Q9 */
+           weight = (short)longtemp;
+           long_diff = vec[d] - pnoisymu[d]; /* Q11 */
+           long_diff = MAX(long_diff, -32768); /* clip */ 
+           long_diff = MIN(long_diff, 32767); 
+           diff_s = (short) long_diff;
+           long_diff = diff_s * diff_s; /* Q 22 */ 
+           diff_s = (short)LONG_RIGHT_SHIFT_N(long_diff, 15);  /* Q7 */
+
+           longtemp = weight * diff_s; /* Q9 x Q7 = Q16 */
+           longtemp = LONG_RIGHT_SHIFT_N(longtemp, 7); /* 16 - 7 = Q9 */
+
+           gv->var_fisher_IM_per_utter[d] += longtemp; /* Q9  */
+         }
+       }
+#endif
+      }
+    }
+    frame += T;
+  }
+}
+#endif
+
+/*--------------------------------*/
+/* update sufficient statistics 
+ */
+static Boolean update_statistics(ushort hmm_code, HmmType *jac_hmm,
+                                short *pdfa, 
+                                short *bp, ushort token, int T, 
+                                short alpha[], 
+                                short c_t_beta[], long accum[], 
+                                short log_H[], 
+                                short log_N[], 
+                                short n_mfcc, gmhmm_type *gv)
+{
+  short tmp_freq[N_FILTER26];
+  ushort t, seg;
+  short log_e[N_FILTER26]; 
+  short *alfa_t, *beta_t;
+  short mfcc_feature[ MAX_DIM ]; /* share mfcc vector */
+  short *p_fea; 
+  Boolean bSucc = TRUE; 
+
+#ifdef USE_SBC
+  short obs_enh[MAX_DIM];
+#endif
+
+#if defined(USE_SBC) || defined(USE_IJAC)
+  short sbc_bias[MAX_DIM]; 
+#endif
+
+
+  for (seg = token * n_mfcc, t=0; t<T; t++, seg += n_mfcc) {  
+    alfa_t = EM_alpha_t(pdfa, alpha, t, T, jac_hmm, c_t_beta,gv);
+    beta_t = bp + t;
+#ifdef BIT8FEAT
+    vector_unpacking(gv->mem_feature + seg, mfcc_feature, gv->scale_feat, n_mfcc);          
+#else
+    copy_feature(mfcc_feature, seg, n_mfcc);
+#endif
+
+    p_fea = mfcc_feature; 
+#ifdef USE_SBC
+    if (gv->comp_type & SBC){
+      p_fea = obs_enh; 
+      sbc_re_enhance( gv->sbcState, mfcc_feature, 
+                     p_fea, hmm_code, gv->nbr_dim, sbc_bias); 
+    }
+#endif
+
+#ifdef USE_IJAC
+    cos_transform( p_fea, log_e, gv->muScaleP2, n_mfcc, gv->n_filter, gv->cosxfm);     /* Q 11 -> Q 9 */
+    ijac_update_t(jac_hmm, pdfa + t, alfa_t, beta_t, p_fea, log_e, 
+                 T, accum,log_H,log_N, n_mfcc, tmp_freq, gv, sbc_bias, 0); 
+#else
+    update_t(jac_hmm, pdfa + t, alfa_t, beta_t, p_fea, T, accum,log_H,log_N, n_mfcc, tmp_freq, gv); 
+/* remove DFT of test frame (label: {expand:newton}.
+** this can be raplced by reusing log spectrum in mfcc: 
+*/
+    cos_transform( p_fea , log_e, gv->muScaleP2, n_mfcc, gv->n_filter, gv->cosxfm);     /* Q 11 -> Q 9 */
+    int d;
+    for (d=0; d< gv->n_filter; d++) accum[d] -= log_e[d]<<1; /* Q10 */
+#endif
+  }
+
+  return bSucc; 
+}
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIesrEngineJACStatusType JAC_clear( gmhmm_type *gv, 
+                                   const char* aModelDir,
+                                   const char* aTreeFile )
+{
+   int d;
+
+#ifdef USE_SBC   
+   TIesrEngineHLRStatusType hStatus;
+#endif
+
+   /* clear log spectrum of channel estimate */
+   if (gv->comp_type& JAC) {
+     FOREACH(d, gv->n_filter) gv->log_H[d] = 0;
+
+     /* clear JAC channel estimate global correction accumulators */
+     FOREACH(d, gv->n_filter*2) gv->accum[d] = 0; 
+   }
+   /* This forces the global correction accumulators to initialize
+      with the next file channel estimates */
+   gv->smooth_coef = ONE_Q15; 
+
+#ifdef USE_SVA
+   /* Clear SVA mfcc feature variance accumulators and rho estimate */
+   if (gv->comp_type & SVA) {
+     for (d = 0; d < gv->nbr_dim; d++) 
+       {
+        gv->log_var_rho [ d ] = 0;
+        gv->var_fisher_IM[ d ] = 0;
+        gv->var_fisher_IM_per_utter[ d ] = 0;
+       }
+   }
+#endif
+
+#ifdef USE_SBC
+   /* Try to initialize SBC structure */
+   if (gv->comp_type & SBC) 
+     hStatus = sbc_init_tree( gv->sbcState, aModelDir,
+                             aTreeFile, FALSE,
+                             gv->nbr_dim,
+                             gv->trans->n_hmm_set , TRUE);
+   else
+   {
+
+      if( gv->sbcState->pHMM2phone != NULL )
+      {
+        free( gv->sbcState->pHMM2phone);
+        gv->sbcState->pHMM2phone = NULL;
+      }
+
+      hStatus = sbc_load_hmm2phone(aModelDir, gv->trans->n_hmm_set, 
+                                  gv->sbcState, TRUE); 
+
+   }
+
+   if( hStatus != eTIesrEngineHLRSuccess )
+     return eTIesrEngineJACSBCInitFail;
+        
+#endif
+
+   return eTIesrEngineJACSuccess;
+}
+
+
+/*----------------------------------------------------------------
+  MP_JAC_load
+
+  Read bias from a file, unless !exist, in which case bias is set to
+  zero.  The file contains the channel and SVA information derived
+  from past utterances.
+  ----------------------------------------------------------------*/
+static
+TIesrEngineJACStatusType MP_JAC_load( const char *bias_file, gmhmm_type *gv,
+                                     const char *pNetDir, const char* p_tree_file,
+                                     Boolean bTriphone)
+{
+   ushort d;
+   unsigned short numFilters;
+   unsigned short featDim;
+   size_t numRead;
+   TIesrEngineJACStatusType eStatus = eTIesrEngineJACSuccess; 
+   TIesrEngineJACStatusType eStatusClear;
+
+#ifdef USE_SBC
+   TIesrEngineHLRStatusType hStatus;
+#endif
+
+
+#ifdef USE_WSVA
+   NssType* pNss = (NssType*) gv->pNss; 
+#endif
+  
+   FILE *pf = fopen(bias_file,"rb");
+  
+   if( pf )
+   {
+      /* A channel estimate file exists, read all parameters, 
+       checking to ensure they are appropriate. */
+
+      /* Check number of filters in channel estimate file */
+      numRead = fread( &numFilters, sizeof(short), 1, pf );
+      if( numRead != 1 || numFilters != gv->n_filter )
+       {
+         eStatus = eTIesrEngineJACLoadFail; 
+         goto Failure;
+       }
+
+      /* Check number of features in channel estimate file */
+      numRead = fread( &featDim, sizeof(short), 1, pf );
+      if( numRead != 1 || featDim != gv->nbr_dim )
+       {
+       eStatus = eTIesrEngineJACLoadFail;
+       goto Failure;
+       }
+
+      /* Read the channel log spectral estimate */
+      numRead = fread( gv->log_H, sizeof(short), gv->n_filter, pf );
+      if( numRead != gv->n_filter )
+       {
+         eStatus = eTIesrEngineJACLoadFail;
+         goto Failure;
+       }
+      
+      /* Read the channel estimate global accumulators */
+      numRead = fread( gv->accum, sizeof(long), 2*gv->n_filter, pf );
+      if( numRead != (size_t)2*gv->n_filter )
+       {
+         eStatus = eTIesrEngineJACLoadFail;
+         goto Failure;
+       }
+      /* A running global estimate exists, so continue to 
+       update according to the accumulated estimates */
+      gv->smooth_coef = gv->jac_smooth_coef; 
+
+#ifdef USE_SVA
+      /* Read the SVA log_var_rho parameter */
+      numRead = fread( gv->log_var_rho, sizeof(short), gv->nbr_dim, pf );
+      if( numRead != (size_t)gv->nbr_dim )
+       {
+         eStatus = eTIesrEngineJACLoadFail;
+         goto Failure;
+       }
+      
+      /* Read the SVA Fisher IM parameter */
+      numRead = fread( gv->var_fisher_IM, sizeof(long), gv->nbr_dim, pf );
+      if( numRead != (size_t)gv->nbr_dim )
+       {
+         eStatus = eTIesrEngineJACLoadFail;
+         goto Failure;
+       }
+      
+      /* Clear the temporary accumulators */
+      for (d = 0; d < gv->nbr_dim; d++) 
+       {
+         gv->var_fisher_IM_per_utter[ d ] = 0;
+       }
+#endif      
+
+#ifdef USE_WSVA
+      /* Read the noise level of the previous utterance */
+      if (pNss){
+       pNss->prevMeanEn = 0;
+       numRead = fread(&(pNss->prevMeanEn), sizeof(short), 1, pf);
+       if( numRead != 1 )
+         {
+           eStatus = eTIesrEngineJACLoadFail;
+           goto Failure;
+         }
+      }
+#endif      
+
+
+      /* Initialization of SBC method */
+#ifdef USE_SBC
+      if (gv->comp_type & SBC){
+       hStatus = sbc_init_tree( gv->sbcState, pNetDir, p_tree_file, FALSE,
+                                gv->nbr_dim, 
+                                gv->trans->n_hmm_set , bTriphone); 
+       
+       if( hStatus != eTIesrEngineHLRSuccess )
+         {
+           eStatus = eTIesrEngineJACSBCInitFail;
+           goto Failure;
+         }      
+       
+       hStatus = sbc_load( gv->sbcState, pf);
+      }
+
+      else
+      {
+        if( gv->sbcState->pHMM2phone != NULL )
+        {
+           free( gv->sbcState->pHMM2phone);
+           gv->sbcState->pHMM2phone = NULL;
+        }
+
+        hStatus = sbc_load_hmm2phone(pNetDir, gv->trans->n_hmm_set, 
+                                    gv->sbcState, bTriphone); 
+      }
+
+      if( hStatus != eTIesrEngineHLRSuccess )
+       {
+         eStatus = eTIesrEngineJACSBCLoadFail;
+         goto Failure;
+       }
+
+
+#endif
+
+#ifdef USE_ONLINE_REF
+      rj_load(gv, pf); 
+#endif
+      
+   }
+
+#ifdef USE_CONFIDENCE
+   cm_load(pf, gv);
+#endif
+
+   /* Some failure in the channel estimate file or SBC.  Clear out 
+      all accumulators and channel estimates, and start afresh */
+  Failure:
+
+   if (pf) fclose( pf );
+   /* Clear JAC channel estimates, SVA estimates,
+      and accumulators */
+   eStatusClear = eTIesrEngineJACSuccess;
+   /* 
+      return the error status will results in Recognizer failure. 
+      Instead, reset the recognizer, so comment the error status */
+   if (eStatus == eTIesrEngineJACLoadFail) pf = NULL; 
+   
+   if (eStatus != eTIesrEngineJACSuccess || pf == NULL) 
+      eStatusClear = JAC_clear( gv, pNetDir, p_tree_file );
+
+   if( eStatusClear != eTIesrEngineJACSuccess )
+      return eStatusClear;
+   else{
+     switch(eStatus){
+     case eTIesrEngineJACLoadFail: 
+       return eTIesrEngineJACReset; 
+     default:
+       return eStatus; 
+     }
+   }
+}
+
+/* GMHMM_SI_API */ 
+TIesrEngineJACStatusType JAC_load( const char *bias_file, gmhmm_type *gv,
+                                  const char *pNetDir, const char* p_tree_file)
+{
+   TIesrEngineJACStatusType eStatus = eTIesrEngineJACSuccess; 
+
+#ifdef _MONOPHONE_NET
+   gmhmm_type * gvv = (gmhmm_type*) gv->pAux; 
+   if (gvv)
+     eStatus = MP_JAC_load( bias_file, gvv, pNetDir, p_tree_file, FALSE); 
+   if (eStatus != eTIesrEngineJACSuccess) return eStatus; 
+#endif
+   eStatus = MP_JAC_load( bias_file, gv, pNetDir, p_tree_file, TRUE); 
+   return eStatus; 
+}
+
+/*----------------------------------------------------------------
+  JAC_save
+  
+  Write channel spectral estimate, accumulators, and SVA data
+  to a channel estimate file
+  ----------------------------------------------------------------*/
+/* GMHMM_SI_API */ 
+TIesrEngineJACStatusType JAC_save(const char *bias_file, gmhmm_type *gv)
+{ 
+   size_t numWritten;
+#ifdef USE_WSVA
+   NssType * pNss = (NssType*) gv->pNss; 
+#endif
+
+   FILE *pf = fopen(bias_file,"wb");
+
+   if ( !pf ) 
+   {
+      PRT_ERR(fprintf(stderr,"fail to open %s\n", bias_file));
+      return eTIesrEngineJACSaveFail;
+   }
+
+   else
+   {
+      numWritten = fwrite( &gv->n_filter, sizeof(ushort), 1, pf );
+      if( numWritten != 1 )
+        goto Failure;
+
+      numWritten = fwrite( &gv->nbr_dim, sizeof(short), 1, pf );
+      if( numWritten != 1 )
+        goto Failure;
+
+      numWritten = fwrite(gv->log_H, sizeof(short), gv->n_filter, pf);
+      if( numWritten != gv->n_filter )
+       goto Failure;
+      
+      numWritten = fwrite( gv->accum, sizeof(long), 2*gv->n_filter, pf );
+      if( numWritten != (size_t)2*gv->n_filter )
+       goto Failure;
+
+#ifdef USE_SVA
+      /* Write the SVA log_var_rho parameter */
+      numWritten = fwrite( gv->log_var_rho, sizeof(short), gv->nbr_dim, pf );
+      if( numWritten != (size_t)gv->nbr_dim )
+       goto Failure;
+      
+      /* Read the SVA Fisher IM parameter */
+      numWritten = fwrite( gv->var_fisher_IM, sizeof(long), gv->nbr_dim, pf );
+      if( numWritten != (size_t)gv->nbr_dim )
+       goto Failure;
+#endif      
+
+#ifdef USE_WSVA
+      /* Write the noise level of the current utterance, will be used as the noise 
+        level of the previous utterance in the next iteration */
+      if (pNss) {
+       numWritten = fwrite(&pNss->noiselvl, sizeof(short), 1, pf);
+       if( numWritten != 1)
+         goto Failure;
+      }
+#endif      
+
+#ifdef USE_SBC
+      if (gv->comp_type & SBC) sbc_save(gv->sbcState, pf);
+#endif
+
+#ifdef USE_ONLINE_REF
+      rj_save(gv, pf); 
+#endif
+
+#ifdef USE_CONFIDENCE
+      cm_save(pf, gv);
+#endif
+
+      /* Everything written ok, close file and return success */
+      fclose( pf );
+      PRT_ERR(printf("Channel saved to %s\n", bias_file));
+      return  eTIesrEngineJACSuccess;
+   }
+
+  Failure:
+   fclose(pf);
+   return eTIesrEngineJACSaveFail;
+}
+
+/* ------------------------------ for force alignment --------------------------------------  */
+
+/*--------------------------------*/
+static void JAC_backup_net(gmhmm_type * gv)
+{
+  short i; 
+  gv->base_net_bk = gv->base_net; 
+  gv->trans_bk = gv->trans; 
+
+  for (i=0;i<gv->nbr_ans;i++)
+    gv->answer_bk[i] = gv->answer[i]; 
+  gv->nbr_ans_bk = gv->nbr_ans; 
+}
+
+/*--------------------------------*/
+static void JAC_recover_backuped_net(gmhmm_type * gv)
+{
+  short i; 
+
+  gv->base_net = gv->base_net_bk; 
+  gv->trans = gv->trans_bk; 
+
+  gv->nbr_ans = gv->nbr_ans_bk; 
+  for (i=0;i<gv->nbr_ans;i++)
+    gv->answer[i] = gv->answer_bk[i]; 
+}
+
+
+/* return 0 if fail, 1 if pass */
+static short cap_in_check(char *mesg, ushort value, ushort max_mem)
+{
+#ifdef SHOW_MEMORY
+  printf("%3d words (MAX = %3d) %s\n", value, max_mem, mesg); 
+#endif
+  if (value > max_mem ){
+#ifdef SHOW_MEMORY
+    fprintf(stderr,"maximum size capacity exceeded at \"%s\"\n", mesg);
+    exit(1);
+#endif
+    return 0;
+  }
+  else return 1;
+}
+
+/*
+** make a network for name decoding.
+** n is the number of HMMs including 1 SIL (there are two)
+** silence uses the last code
+*/
+static TIesrEngineStatusType JAC_make_net(gmhmm_type *gv, ushort n, ushort *mem_count, 
+                                         short *mem_base, ushort max_mem)
+{
+  short cnt /* in number of shorts */,
+    i;
+  ushort *p_cnt, s, total_words;
+  SymType *p_sym, *p_sym0; /* the full network (including entry&Exit states) */
+
+  /* point to new network */
+  gv->base_net = mem_base + *mem_count;
+  gv->trans = (TransType *) gv->base_net;
+
+  gv->trans->n_sym = n + 1; /* plus 1, for h#  */
+
+  total_words = TOTAL_NET_SIZE(gv->trans->n_sym);
+  *mem_count += total_words;
+  /*
+  ** print total memory usage: 
+  */
+  if (!cap_in_check("total network memory", *mem_count, max_mem)) return eTIesrEngineNetworkMemorySize;
+  
+//printf("======%d %d  %d\n", gv->trans->n_hmm,  gv->trans->n_hmm_set, gv->trans->n_set );
+  gv->trans->n_hmm = gv->trans_bk->n_hmm; //n;     /* including one h# */
+  gv->trans->n_word = 0;    /* no word information needed for name dialing */
+  gv->trans->n_set = gv->trans_bk->n_set;//1;
+  gv->trans->n_hmm_set =  gv->trans_bk->n_hmm_set; //gv->trans->n_hmm / gv->trans->n_set;
+
+  /* start and atop offset: */
+  cnt = 5 +  /* the 5 previous numbers */
+        2 +  /* offset pointer to start and stop */
+        gv->trans->n_sym; /* -> 10 */
+  gv->trans->start = cnt;
+  /* entry & exit symbols: */
+
+  cnt += NBR_FIELDS + 1; /* start.n_next */ /* -> 13 */
+  gv->trans->stop  = cnt;    /* stop offset  */
+  cnt += NBR_FIELDS + 1; /* stop.n_next  */  /* -> 16 */
+
+  for (p_cnt = &(gv->trans->symlist[0]), s = 0; s < gv->trans->n_sym; s++, p_cnt++) {
+    *p_cnt = cnt;  /* n_sym offsets */
+    cnt += NBR_FIELDS + 1; /* trans.symlist[ i ].n_next; */
+  }
+  
+  /* entry & exit symbols: */
+  p_sym0 = p_sym = (SymType *) p_cnt;
+  /* output_sym( &trans.start, fp); */
+  p_sym->hmm_code = 0; /* non-emitting */
+  p_sym->n_next = 1;
+  p_sym->next[0] = 0;
+  p_sym++;
+  /* output_sym( &trans.stop, fp); */
+  p_sym->hmm_code = 0; /* non-emitting */
+  p_sym->n_next = 1;
+  p_sym->next[0] = gv->trans->n_sym - 1;
+  p_sym++;
+
+  /* HMM code for entry and exit silences: */
+  i = gv->nbr_seg - 1; 
+  for (s=0; s<gv->trans->n_sym ; s++) {
+    p_sym[s].hmm_code = gv->hmm_code[i--];
+    
+    p_sym[s].n_next = 1; /* always one next symbol */
+    p_sym[s].next[0] = s + 1;
+  }
+  p_sym[gv->trans->n_sym - 1].n_next = 0;
+#ifdef OUTPUT_NET
+  //  output_network(base_net); /* write network in vcg format */
+  prt_spot_network(gv->base_net);
+#endif
+  return eTIesrEngineSuccess;
+}
+
+static TIesrEngineStatusType process_a_file_1( gmhmm_type *gv, 
+                                              ushort frm_cnt, ushort start_frame)
+{
+  short mfcc_feature[ MAX_DIM ];   
+  ushort *feat = (ushort *)gv->mem_feature + start_frame * gv->n_mfcc; 
+  ushort fm, status;
+
+  for (fm = 0; fm < frm_cnt; fm++) {
+#ifdef BIT8FEAT
+    vector_unpacking(feat, mfcc_feature, gv->scale_feat, gv->n_mfcc);
+#else
+    copy_feature(mfcc_feature, fm, n_mfcc);
+#endif
+
+    /* search entry */
+//printf(" %d  wbt %d\n", fm, gv->word_backtrace);    
+    status=search_a_frame(mfcc_feature, 1, fm, gv);
+    if (status!=eTIesrEngineSuccess) 
+     { PRT_ERR(printf (" BT fails at frame %d !!! \n\n", fm));
+       return eTIesrEngineAlignmentFail;
+     }
+
+    feat += gv->n_mfcc;
+  }
+  return eTIesrEngineSuccess;
+}
+
+static TIesrEngineStatusType jac_force_alignment(gmhmm_type * gv)
+{
+  ushort mem_count = 0, total_frm = gv->frm_cnt; //gv->stp[0]; 
+  short mem_base[MEM_SIZE_FORCE_ALIGNMENT] ;
+  TIesrEngineStatusType status;
+
+  /* backup original network */
+  JAC_backup_net(gv);
+
+  status = 
+    JAC_make_net(gv, gv->nbr_seg - 1, 
+                &mem_count, mem_base, MEM_SIZE_FORCE_ALIGNMENT);
+  if ( status != eTIesrEngineSuccess ) return status; 
+
+  status = process_a_file_1(gv, total_frm, 0);
+
+  if ( status == eTIesrEngineSuccess ) search_a_frame(NULL, 0, total_frm - 1, gv ); 
+
+  if ( status == eTIesrEngineSuccess && gv->best_sym != USHRT_MAX ) {
+    
+    status = back_trace_beam(gv->best_sym, total_frm - 1,  
+                            gv->hmm_code ,  gv->stt ,  gv->stp , 
+                            &(gv->nbr_seg), &(gv->hmm_dlt), gv);
+  }
+  else {
+    if (status == eTIesrEngineSuccess) status = eTIesrEngineAlignmentFail;
+    PRT_ERR(fprintf(stderr,"\nalignment not found, error code = %d\n", status)); 
+  }
+  
+  PRT_ERR(printf("R:\n"););
+
+  JAC_recover_backuped_net(gv);
+
+  return status;
+}
+
+
+
+
+/* GMHMM_SI_API */ 
+/* HMM-level JAC_update w/wo force alignment */
+TIesrEngineJACStatusType JAC_update(gmhmm_type *gvv)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+  short jac_memory_base[ MAX_EM_MEMORY ];
+  short last_lhd = BAD_SCR, curt_lhd;
+  ushort em_iter, iter, d, coeff_1,  max_seg_len = 0; 
+  long total_like, lld_forward;    /* total likelihood in Q6 */
+  long *glb_accum = gv->accum;
+  long *glb_accum_d = GET_D_OBJ(glb_accum, gv->n_filter);
+  long *loc_accum = glb_accum + 2 * gv->n_filter;
+  HmmType *hmm;
+  ushort  frame_cnt[NBR_TRANSFO] /* total number of frames */;
+  long temp[3*N_FILTER26];
+
+  
+  //IF word based backtrace is used, do a forced alignment here.
+  if (gvv->word_backtrace==WORDBT)
+  { 
+   //printf("before FA %d %d %d %d %d %d!\n", gvv->stt[0], gvv->stp[0], gvv->stt[1], gvv->stp[1], gvv->stt[2], gvv->stp[2]);
+   gvv->word_backtrace=HMMFA;
+
+   /* freeze background scores obtained in the first pass */
+   cm_freeze((ConfType*)gv->pConf); 
+
+   if (jac_force_alignment(gv) != eTIesrEngineSuccess){
+     gvv->word_backtrace=WORDBT;
+     return  eTIesrEngineJACNoAlignment ;
+   }
+
+   gvv->word_backtrace=WORDBT;
+
+   //printf("after FA %d %d %d %d %d %d\n", gvv->stt[0], gvv->stp[0], gvv->stt[1], gvv->stp[1], gvv->stt[2], gvv->stp[2]);
+  }
+
+
+//test code for HMM BT!!!
+ /*  //printf("before FA %d %d %d %d %d %d!\n", gvv->stt[0], gvv->stp[0], gvv->stt[1], gvv->stp[1], gvv->stt[2], gvv->stp[2]);
+   puts("Before FA====");
+   for (int ii=0 ; ii< gvv->nbr_seg; ii++)
+     printf (" %d, hmm: %d, st: %d, ed: %d    ", ii, gvv->hmm_code[ii], gvv->stt[ii], gvv->stp[ii]);
+   puts("");
+      
+    gvv->stt[0]= gvv->stp[0]= gvv->stt[1]= gvv->stp[1]= gvv->stt[2]= gvv->stp[2]=0;
+   gvv->word_backtrace=HMMFA;
+   jac_force_alignment(gv);
+   gvv->word_backtrace=HMMBT; //---- HMM BT !!
+   
+   //printf("after FA %d %d %d %d %d %d\n", gvv->stt[0], gvv->stp[0], gvv->stt[1], gvv->stp[1], gvv->stt[2], gvv->stp[2]);
+     puts("after FA ===");
+   for (int ii=0 ; ii< gvv->nbr_seg; ii++)
+     printf (" %d, st %d, ed: %d    ", ii, gvv->stt[ii], gvv->stp[ii]);
+   puts("");
+ */
+   
+
+
+#ifdef USE_SBC
+  sbc_rst_SBC_stat( gv->sbcState );
+#endif
+
+#ifdef USE_16BITMEAN_DECOD
+  if (load_mean_vec(gv->chpr_Model_Dir, gv, FALSE) != eTIesrEngineSuccess)
+    return eTIesrEngineJACMemoryFail;
+#endif
+
+#if defined(USE_CONFIDENCE) && defined(USE_CONF_DRV_ADP)
+  cm_backup_adp(gv); 
+#endif
+
+  for (em_iter = 0; em_iter < MAX_EM_ITR; em_iter++) {  
+    frame_cnt[0] = 0; 
+    total_like = 0;
+    
+#ifdef USE_IJAC
+    FOREACH(d, gv->n_filter) {
+       /* backup previous estimates of channel distortion */
+       temp[d] = gv->log_H[d];
+
+       gv->log_H[d] = q15_x(gv->jac_discount_factor, gv->log_H[d]); 
+    }
+#else
+    FOREACH(d, gv->n_filter) gv->log_H[d] = 0;
+#endif
+
+    for (iter = 0; iter<MAX_NEWTON_ITR; iter++) {
+      ushort s, seg_len, em_mem; /* active memory size */
+      short *state_lld, *bp, *alpha, *c_t_beta;
+
+      FOREACH(d, gv->n_filter*2) loc_accum[d] = 0;
+      for (s = 0; s < gv->nbr_seg; s++) {  /* for each segment */
+
+       /* is useful for N-best, since there are multiple
+          alignments, which are saved in the vector gv->stp and gv->stt */ 
+       if (s && (gv->stp[s] > gv->stp[s-1])) break; /* only use the top */
+
+       seg_len = gv->stp[s] - gv->stt[s];
+       //      printf("stt = %d, stp = %d\n", gv->stt[s], gv->stp[s]);
+       
+        if (seg_len > gv->jac_max_segment_size) {
+         // fprintf(stderr,"segment %d size limited to %d\n", seg_len,MAX_SEG_SIZE);
+         seg_len  = gv->jac_max_segment_size;
+       }
+       max_seg_len = MAX(max_seg_len, seg_len);
+       hmm = GET_HMM(gv->base_hmms, gv->hmm_code[s], gv->hmm_dlt);
+       em_mem = 0; /* active memory size */
+       state_lld = jac_memory_base + em_mem;     
+       em_mem += (NBR_STATES(hmm, gv->base_tran)-1) * seg_len;
+       bp = jac_memory_base + em_mem;                
+       em_mem += NBR_STATES(hmm,gv->base_tran) * seg_len; /* bwd prob */
+       alpha = jac_memory_base + em_mem ;       
+       em_mem += NBR_STATES(hmm, gv->base_tran) * 2; /* fwd prob, two colums t, t-1 */
+       c_t_beta = jac_memory_base + em_mem;       
+       em_mem += seg_len+1;
+       /* total EM memory == em_mem */
+       
+       if (em_mem> MAX_EM_MEMORY) {
+         PRT_ERR(fprintf(stderr,"maximum size capacity exceeded in JAC\n"));
+         return eTIesrEngineJACMemoryFail;  /* lack of memory */
+       }
+#ifdef USE_SBC
+       sbc_rst_seg_stat( gv->sbcState );
+       sbc_observation_likelihood(gv->stt[s],seg_len,gv->hmm_code[s], 
+                                  hmm,state_lld, gv->n_mfcc,gv ); 
+#else
+       observation_likelihood(gv->stt[s],seg_len,hmm,state_lld, gv->n_mfcc,gv); /* maybe calc twice if shared */
+#endif
+       lld_forward = EM_beta(state_lld,bp,seg_len,hmm, c_t_beta,gv);
+
+       if (lld_forward > -512000000) /* -1e6 in Q9 */ 
+         {
+           if( update_statistics(gv->hmm_code[s], hmm,state_lld, bp, gv->stt[s],
+                                 seg_len,alpha, c_t_beta,loc_accum, gv->log_H, 
+                                 gv->log_N, gv->n_mfcc, gv))
+             { 
+               total_like += lld_forward; 
+               /* info for frame average likelihood */
+               frame_cnt[0] += seg_len;
+               
+#ifdef USE_SBC
+               if (gv->comp_type & SBC) 
+                 if (sbc_acc_SBC(gv->hmm_code[s], gv->nbr_dim, seg_len,
+                                 gv->sbcState , gv->sbc_fgt) == FALSE) 
+                   return eTIesrEngineJACSVAFail;
+#endif
+             }
+           
+#ifdef USE_CONFIDENCE
+           cm_acc_seg_ratio_to_antimodel( gv, gv->hmm_code[s], gv->stt[s], gv->stp[s], lld_forward); 
+
+#ifdef DBG_CONF
+           printf("sym[%d], code[%d], %d->%d, lk=%d\n", s, gv->hmm_code[s], gv->stt[s], gv->stp[s], lld_forward); 
+#endif
+
+#endif
+         }
+       else PRT_ERR(printf("skip low prob segment ")); 
+      }// for seg
+
+#ifdef USE_CONFIDENCE
+      cm_update_status(gv); 
+#endif
+
+#if defined(USE_CONFIDENCE) && defined(USE_CONF_DRV_ADP)
+      if (gv->cm_score > ((ConfType*)gv->pConf)->adp_th ){
+#endif
+
+#ifdef USE_SBC
+       sbc_update_SBC(gv); 
+#endif
+
+       /* garantee: glb_accum is self normalized: */
+       coeff_1 = ONE_Q15 - gv->smooth_coef;
+#ifndef USE_AUDIO // MSC++ GUI  doesn't support stderr 
+       //      if (frm_cnt !=  frame_cnt[0]) 
+       //      fprintf(stderr,"%d frames ignored\n", frm_cnt - frame_cnt[0]);
+#endif
+       
+       FOREACH(d, gv->n_filter*2) { 
+         
+         long top = (gv->frm_cnt == 0)?0:(loc_accum[d] / gv->frm_cnt); /* each utterance has a same weight */
+#ifdef USE_IJAC
+         glb_accum[d] = q15_x(gv->smooth_coef, glb_accum[d]) + top; 
+#else
+         glb_accum[d] = q15_x(coeff_1, glb_accum [d]) + q15_x(gv->smooth_coef, top);
+#endif
+       }
+
+       FOREACH(d,gv->n_filter) { 
+#ifdef USE_IJAC
+         /*  In Q14, avoid div. by zero */
+         if (glb_accum_d[d] > MIN_ACCUM) 
+           {
+             temp[d + gv->n_filter] = glb_accum[d];
+             temp[d + 1 + gv->n_filter] = glb_accum_d[d] >> 2; /* Q 12 */
+             if (gv->jac_bayesian_weight != 0)
+               {
+                 /* use Bayesian IJAC */
+                 lld_forward = q15_x(gv->jac_bayesian_weight, pPriorChannelInvvar[d]); /* Q9 */
+                 temp[d] = lld_forward * (gv->log_H[d] - temp[d]);  /* Q18 */
+                 temp[d] = LONG_RIGHT_SHIFT_N(temp[d], 6);  /* Q18 -> Q12 */
+                 temp[d + gv->n_filter] += temp[d]; /* Q12 */
+                 
+                 temp[d + 1 + gv->n_filter] += (lld_forward << 3); /* Q12 */
+               }
+             
+             temp[d] = div32_32(temp[d + gv->n_filter],
+                                temp[d + 1 + gv->n_filter]);
+             temp[d] = q15_x(gv->jac_deweight_factor, temp[d]); 
+             gv->log_H[d] -= (short)temp[d]; 
+             
+             /* index_obj += loc_accum[d] * loc_accum[d]; */
+           }
+#else
+         
+         /*  In Q16, avoid div. by zero */
+         if (glb_accum_d[d] > MIN_ACCUM) 
+           {
+             gv->log_H[d] -= (short)div32_32(glb_accum[d],(glb_accum_d[d]>>6)); 
+             
+             /* index_obj += loc_accum[d] * loc_accum[d]; */
+           }
+#endif
+         
+       }// for filter 
+       
+       
+       gv->smooth_coef = gv->jac_smooth_coef;
+       
+       /* if (index_obj/N_FILTER < 0.02 ) break;    find max objective function: */
+       
+#ifdef USE_SVA
+       /*
+       ** update scaling factor for sequential variance adaptation:
+       */
+       for ( d = 0; d < gv->nbr_dim; d++ )  {
+#ifdef USE_WSVA
+         gv->var_fisher_IM[d] = q15_x(8192, /* 0.25 in Q15 */
+                                      gv->var_fisher_IM[d]) 
+           + q15_x(24576, gv->var_fisher_IM_per_utter[d]);
+#else
+         gv->var_fisher_IM[d] += gv->var_fisher_IM_per_utter[d];
+#endif
+         
+         /* Sanity check, should not have divisor go to zero */
+         if ( gv->var_fisher_IM[d] == 0 ) {  
+           PRT_ERR(printf("dividing by zero error occurs during sequential variance adaptation!\n"));
+           return eTIesrEngineJACSVAFail;
+         }
+         
+         temp[d] = gv->var_fisher_IM_per_utter[d] - (((long) frame_cnt[0] ) << 9);
+         gv->log_var_rho[d] += (short) div32_32(temp[d], gv->var_fisher_IM[d]);  /* Q9 */   
+         
+#ifndef USE_WSVA
+         /* Limit rho so variance does not get too small. */
+         if( gv->log_var_rho[d] < MIN_SVA_RHO )
+           {
+             gv->log_var_rho[d] = MIN_SVA_RHO;
+           }
+#endif
+         
+#ifdef ISVA
+         /*  APPLYING CONSTRAINTS   */
+         
+         // comments: 15200 14000 is also fine.. or 15360.  jac_prm->ceps.noise_mean[0] > 120)  
+         //under high noise, variance should decrease 
+         if (gv->mfcc_noise[ 0 ] > ISVA_NOISE_TH)    
+           {  
+
+             /* If noise is high, don't let log_var_rho go positive */
+             gv->log_var_rho[d]= gv->log_var_rho[d]<0? gv->log_var_rho[d]:0 ;
+             
+             // add constraint to C0 , which is too sensitive by itself
+             if (d == 0) 
+               gv->log_var_rho[d] =  gv->log_var_rho[d]> -C0LIMIT? gv->log_var_rho[d]: -C0LIMIT;
+           }
+         
+         else
+           {  
+             if (d==0) 
+               gv->log_var_rho[d]=0;
+             
+             /* If noise is low, don't let log_var_rho go negative */
+             gv->log_var_rho[d]= gv->log_var_rho[d]>0? gv->log_var_rho[d]:0 ;
+           } 
+         
+         /*nogoing testing code, not working yet. Setting limits to the rho adaptation*/
+         //gv->log_var_rho[d]= gv->log_var_rho[d]>256? 256: gv->log_var_rho[d];
+         //gv->log_var_rho[d]= gv->log_var_rho[d]< -? -256: gv->log_var_rho[d];        
+         
+         //NO adapt on C0! use the init value ONLY
+         //if (gv->mfcc_noise[ 0 ] > 16700 ) gv->log_var_rho[0]=-100;else gv->log_var_rho[0]=0;
+#endif         
+       }// for dim
+       
+       for ( d = 0; d < gv->nbr_dim; d++ )  
+         {
+#ifndef USE_WSVA
+           /* multiply by the forgetting factor */
+           gv->var_fisher_IM[d] >>= gv->sva_var_forget_factor;
+#endif
+           gv->var_fisher_IM_per_utter[d] = 0;
+         }
+#endif
+
+#if defined(USE_CONFIDENCE) && defined(USE_CONF_DRV_ADP)
+      }else 
+        cm_restore_adp(gv); 
+#endif
+      
+    }// for inner-iter
+    /* printf("max seg lenghth = %d\n", max_seg_len); */
+    curt_lhd = (frame_cnt[0] == 0)?0:(short) (total_like / (long) frame_cnt[0]);
+    //    test_convergence(curt_lhd, last_lhd, em_iter);  
+    last_lhd = curt_lhd;
+
+  }// for outer-iter
+
+#ifdef USE_16BITMEAN_DECOD
+  free(gv->base_mu_orig);
+  gv->base_mu_orig = NULL;
+#endif
+
+  return eTIesrEngineJACSuccess;
+}
+
+
+/*----------------------------------------------------------------
+  JAC_init_params
+
+  Initialize JAC parameters in the gmhmm_type structure.
+  ----------------------------------------------------------------*/
+TIesrEngineJACStatusType JAC_set_default_params( gmhmm_type* gv )
+{
+   gv->jac_vec_per_frame = VEC_PER_FRAME_DEFAULT;
+   gv->jac_component_likelihood = COMPONENT_LIKELIHOOD_DEFAULT;
+   gv->jac_max_segment_size = MAX_SEG_SIZE_DEFAULT;
+   gv->jac_smooth_coef = SMOOTH_COEF_DEFAULT;
+   gv->jac_discount_factor = DISCOUNT_FACTOR_DEFAULT;
+   gv->jac_deweight_factor = DEWEIGHT_FACTOR_DEFAULT;
+   gv->sva_var_forget_factor = VAR_FORGET_FACTOR_DEFAULT;
+   
+   gv->jac_bayesian_weight = BAYESIAN_WEIGHT_DEFAULT;
+
+   return eTIesrEngineJACSuccess;
+}
diff --git a/TIesrEngine/src/jac-estm.h b/TIesrEngine/src/jac-estm.h
new file mode 100644 (file)
index 0000000..2e82c2f
--- /dev/null
@@ -0,0 +1,158 @@
+/*=======================================================================
+ jac-estm.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header provides the information that is specific to the
+ jac_estm API.
+
+======================================================================*/
+
+#ifndef _JAC_ESTM_H
+#define _JAC_ESTM_H
+
+#include "tiesr_config.h"
+
+/*--------------------------------*/
+/* Constants by define */
+
+/*for ISVA*/
+#define ISVA_NOISE_TH  14000
+#define C0LIMIT 200
+
+/* notice: since gtm modified after EM */
+#define MAX_EM_ITR 1 
+
+#define MAX_NEWTON_ITR 1
+
+#define NBR_TRANSFO 1
+
+/* 1.0 in Q15 */
+#define ONE_Q15  32768
+
+/* 1.0 in Q9 */
+#define ONE_Q9   512
+
+/* -1e6 in Q9 */
+#define MINUS_1E6_Q9 -512000000
+
+
+/* This is the minimum value for the SVA log rho to ensure that the
+ * variance does not get too small, (-2 in Q9).  Thus variance is
+ * never multiplied by any number less than exp(-2).  Or since we use
+ * inverse variance, the inverse variance is not multiplied by anything
+ * greater than exp(2).*/
+#define MIN_SVA_RHO  -1024
+
+
+#ifdef USE_IJAC
+
+/* Limit to avoid zero division sensitivity, 0.005 in Q14 */
+#define MIN_ACCUM 81
+
+#else
+
+/* Limit to avoid zero division sensitivity, 0.005 in Q16 */
+#define MIN_ACCUM 328
+
+#endif
+
+/*
+** MEMORY REQUIRMENT: total about 2Kwords, in two parts: 
+** A: for forward/backward variables  B: for accumulators 
+*/
+/*
+** part A: Collect (EM) statistics for a training segment
+**         Total memory requirement: 2 x N (T+1) + 1. e.g. N = 5, T = 30 -> 311 words
+*/
+#define MAX_EM_MEMORY 1000  
+
+/*
+** part B: accumulators:
+** objective function accumulators 
+** funct + derivative funct for numerator and denominator
+** Total: N_FILTER * 2 * 2 + NBR_TRANSFO. e.g. N_FILTER = 20, NBR_TRANSFO = 1 -> 161 words
+*/
+/* #define ACC_MEMORY (N_FILTER * 2 * 2)  */
+
+
+/*--------------------------------*/
+/* JAC SVA parameter defaults */
+
+/* Number of mean vectors to update per input frame */
+static const short VEC_PER_FRAME_DEFAULT = 80;
+
+/* Threshold of component log likelihood required to accum in JAC */
+/* This was originally -1600 and had the note: "-25 in Q6, can
+   be smaller later".  But that made the Q15 gamma = exp(Lr) zero much
+   of the time, which was wasted processing.  It was changed to -667
+   so that wasted processing is not likely to be done. */
+static const short COMPONENT_LIKELIHOOD_DEFAULT = -667;
+
+//#define MAX_SEG_SIZE 50 
+static const short MAX_SEG_SIZE_DEFAULT = 15;
+
+
+#ifdef USE_IJAC
+
+/* Channel correction temporal smoothing filter coefficient, 0.6 in Q15 */
+static const short  SMOOTH_COEF_DEFAULT = 19660;
+
+#else
+
+/* Channel correction temporal smoothing filter coefficient, 0.3 in Q15 */
+static const short SMOOTH_COEF_DEFAULT = 9830;
+
+#endif
+
+/* IJAC channel discount factor */
+static const short DISCOUNT_FACTOR_DEFAULT = 26214;
+
+/* Channel correction deweighting coefficient */
+static const short DEWEIGHT_FACTOR_DEFAULT = 9830;
+
+/* IJAC Bayesian weighting for inverse variance prior */
+/* Specify it as zero in order not to do Bayesian weighting */
+static const short BAYESIAN_WEIGHT_DEFAULT = 327;
+
+/* Q9, inverse variance of channel distortion for Bayesian weighting */
+static const long pPriorChannelInvvar[N_FILTER26] = {
+4179, 7023, 8192, 7574, 8192, 8888, 10579, 9678, 8192, 8192, 12800, 12800, 12800, 12800, 14183, 14183, 8192, 17716, 10579, 7574, 7574, 9678, 10579,   9678,   8192,   568890};
+
+
+/* SVA forgetting factor.  Comments said:  */
+/* forgetting factor = 0.25 */
+/* But this is the power of two to divide by */
+static const short VAR_FORGET_FACTOR_DEFAULT = 4;
+
+
+/*--------------------------------*/
+/* function macros */
+
+/* 
+** The two functions go together (because the storage: top and bottom accumulators)
+** 1. Get the derivative part from objective function
+** 2. Iteration on obj-func + derivative term
+*/
+#define GET_D_OBJ(obj, n_filter) (obj+n_filter)
+
+#define FOREACH(dim_,freq_dim) for (dim_=0; dim_<(freq_dim); dim_++) 
+
+#define GET_NORM(tmp, norm) for ( norm = 0; tmp < 0x40000000; norm++ ) tmp <<= 1;
+
+
+/*-------------------------- for force alignment -----------------------------------*/
+/* network size as function of symbols: 
+** n-1 emission HMM n+2 sym type (2: exit states)
+*/
+#define TOTAL_NET_SIZE(n_sym) (sizeof(TransType)/sizeof(short) /* size of transtype */ \
+                               + (n_sym - 1) /* minus space occupied by symlist[0] */ \
+                               + (n_sym + 2) * sizeof(SymType)/sizeof(short)) /* space for symbtype */
+#define NBR_FIELDS 2  /* used in make_net */
+#define NBR_VAR 2 /* number of variances for the name */
+#define MAX_NBR_STATES (MAX_NBR_EM_STATES + 1)
+#define MEM_SIZE_FORCE_ALIGNMENT 256
+  
+#endif
diff --git a/TIesrEngine/src/jac-estm_user.h b/TIesrEngine/src/jac-estm_user.h
new file mode 100644 (file)
index 0000000..1e9bc2a
--- /dev/null
@@ -0,0 +1,78 @@
+/*=======================================================================
+ jac_estm_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file defines the user interface with the JAC functions.
+
+======================================================================*/
+
+#ifndef _JAC_ESTM_USER_H
+#define _JAC_ESTM_USER_H
+
+#include "gmhmm_type.h"
+
+/* for debug of JAC */
+//#define _JAC_DEBUG 1
+
+/*--------------------------------
+  JAC_default_params
+
+  Initialize the default JAC and SVA parameters used for adaptation of
+  models to present noise and channel conditions.  These may
+  subsequently changed by the API.
+  --------------------------------*/
+/* GMHMM_SI_API */
+TIesrEngineJACStatusType JAC_set_default_params( gmhmm_type *gv );
+
+
+/*--------------------------------
+  JAC_load
+  
+  Load the prior jac channel estimate, global accumulator, and 
+  sva accumulator values so that jac estimation can continue from
+  prior utterances.
+  --------------------------------*/
+/* GMHMM_SI_API */ 
+/*TIesrEngineJACStatusType JAC_load (const char *bias_file, void *g);*/
+TIesrEngineJACStatusType JAC_load (const char *bias_file, gmhmm_type *gv,
+                                  const char* pNetDir, const char* pPhoneticTreeFile);
+
+
+/*--------------------------------
+  JAC_save
+
+  Save the jac channel estimate, global accumulators and sva accumulators
+  to a file, so that jac estimation can continue in the future from 
+  the present accumulated values.
+  --------------------------------*/
+/* GMHMM_SI_API */ 
+TIesrEngineJACStatusType JAC_save(const char *bias_file, gmhmm_type *gv );
+
+
+/*--------------------------------
+  JAC_clear
+
+  Clear the jac channel estimate, global accumulators, and sva accumulators
+  so that jac estimation starts afresh with the next utterance.
+  --------------------------------*/
+/* GMHMM_SI_API */
+TIesrEngineJACStatusType JAC_clear(gmhmm_type *gv, 
+                                  const char* aModelDir, 
+                                  const char* aTreeFile ); 
+
+
+/*--------------------------------
+  JAC_update
+
+  Update the jac channel, global accumulators, and sva accumulators 
+  with the results of the presently recognized utterance.  The updated
+  jac channel and sva corrections can be used for recognition of 
+  subsequent utterances.
+  --------------------------------*/
+/* GMHMM_SI_API */ 
+TIesrEngineJACStatusType JAC_update(gmhmm_type *gv);
+
+#endif
diff --git a/TIesrEngine/src/jac_one.cpp b/TIesrEngine/src/jac_one.cpp
new file mode 100755 (executable)
index 0000000..a1100d0
--- /dev/null
@@ -0,0 +1,526 @@
+/*=======================================================================
+ jac_one.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This source implements a portion of the jac processing.
+
+======================================================================*/
+
+/* Windows OS specific includes */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+/*
+#include "mfcc_f.h"
+#include "gmhmm.h"
+#include "gmhmm_type.h"
+#include "jac_one.h"
+#include "use_audio.h"
+*/
+
+#include "tiesr_config.h"
+
+#include "tiesrcommonmacros.h"
+#include "mfcc_f_user.h"
+#include "pmc_f_user.h"
+#include "jac_one_user.h"
+#include "jac_one.h"
+#include "pack_user.h"
+#include "dist_user.h"
+#include "status.h"
+
+//#ifdef USE_SNR_SS
+#include "noise_sub_user.h"
+//#endif
+
+#if defined(USE_RAPID_SEARCH) || defined(RAPID_JAC)
+#include "rapidsearch_user.h"
+#endif
+
+#if defined(USE_CONFIDENCE)
+#include "confidence_user.h"
+#endif
+
+/*
+** JAC live mode
+*/
+
+/*
+** 1. Estimate noise
+** 2. Convert noise into log-spectral domain
+** 3. Do JAC for a block of mean vectors
+*/
+
+/*----------------------------------------------------------------
+  GetTIesrJacRate
+
+  This function returns the number of model mfcc mean vectors per frame
+  that should be JAC compensated per input frame.  This function is 
+  maintained for compatibility, but GetTIesrJAC should be used in
+  the future.
+  ----------------------------------------------------------------*/
+/* GMHMM_SI_API */ 
+void GetTIesrJacRate(gmhmm_type *gvv, short *number_mu_per_frame)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+  *number_mu_per_frame = gv->jac_vec_per_frame;
+}
+
+/*
+** Channel: N_FILTER (20), in Q9. optimal for WAVES AKG hands-free
+*/
+
+
+/*----------------------------------------------------------------
+  SetTIesrJacRate
+
+  This function sets the number of model mfcc mean vectors per frame
+  that should be JAC compensated per input frame.  This function is 
+  maintained for compatibility, but SetTIesrJAC should be used in
+  the future.
+  ----------------------------------------------------------------*/
+/* GMHMM_SI_API */ 
+void SetTIesrJacRate(gmhmm_type *gvv, short number_mu_per_frame)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+  gv->jac_vec_per_frame = number_mu_per_frame;
+}
+
+#ifdef RAPID_JAC
+/* JAC compensation via cluster-dependent bias */
+TIesrEngineJACStatusType rj_proc( gmhmm_type * gv)
+{
+   TIesrEngineJACStatusType status = eTIesrEngineJACSuccess;
+   
+   rj_noise_compensation(gv);
+
+   status = rj_compensate(gv);
+
+/*  Should not be needed here, since this is done in rj_compensate
+#ifdef USE_16BITMEAN_DECOD
+   if( gv->base_mu_orig )
+   {
+      free(gv->base_mu_orig);
+      gv->base_mu_orig = NULL; 
+   }
+#endif
+*/
+
+   return status;
+}
+#endif
+
+/*----------------------------------------------------------------
+  per_frame_jac_compensate
+
+  This function compensates the next number of model mfcc mean vectors 
+  specified by the jac_vec_per_frame parameter.  It keeps track of
+  the number of complete cycles of compensation of all of the loaded
+  mean vectors in gv->nbr_cpy.
+
+  SVA NOTE!  If SVA is being used, then this function also compensates
+  all model mfcc variance vectors given the SVA parameters.  Note that
+  this compensation only takes place on the first frame of the first
+  JAC compensation cycle, since the variance vectors do not depend on
+  the present file noise estimate.  
+  ----------------------------------------------------------------*/
+TIesrEngineJACStatusType per_frame_jac_compensate(short mfcc_buf[], gmhmm_type *gv)
+{
+   //  void play_beep();        
+   unsigned short i;
+   long  tmp; 
+
+   /* current noise in mfcc  */
+   short curt_noise[ MAX_DIM_MFCC16 ];
+
+#ifdef USE_SVA
+   /* changed to the 10th frame, as it takes at least 10 frames to obtain estimates of the noise
+      level of the current frame. 
+      Used for Weighted SVA,
+   */
+   if (gv->signal_cnt==10 || gv->speech_detected == 1)//   if (gv->speech_detected == 1)
+   {
+      if(gv->comp_type & SVA) sva_compensate( gv );
+   }
+#endif
+
+   
+   /* Smooth the current noise estimate by lowpass filtering */
+#ifdef LIVEMODE
+   if  ( gv->signal_cnt >=MFCC_BUF_SZ){  
+     
+      for ( i = 0; i < gv->n_mfcc; i++ ) {
+        tmp = 1 * mfcc_buf[ i ] + (long) (gv->mfcc_noise)[ i ] * 15;
+        gv->mfcc_noise[ i ] = (short) ( tmp >> 4 );
+       
+        curt_noise[i] = gv->mfcc_noise[ i ]; 
+      }
+     
+   }
+   else if ( gv->signal_cnt <  MFCC_BUF_SZ ) 
+   {      
+       
+      for ( i = 0; i < gv->n_mfcc; i++ ) {
+         if (gv->signal_cnt==0) {
+           gv->mfcc_noise_init_acc[i]=gv->mfcc_buf[0][i];
+           gv->mfcc_noise[ i ]=gv->mfcc_noise_init_acc[i];
+         }
+         else 
+        {
+           gv->mfcc_noise_init_acc[i]+=gv->mfcc_buf[gv->signal_cnt][i] ;
+           gv->mfcc_noise[ i ]=gv->mfcc_noise_init_acc[i]/(gv->signal_cnt+1); 
+        }
+         curt_noise[i]=gv->mfcc_noise[ i ];
+      }
+   }
+#else  
+   /*FILE mode*/
+   if  ( gv->signal_cnt <= FILEMODEWAIT){ 
+      for ( i = 0; i < gv->n_mfcc; i++ ) {
+        if (gv->signal_cnt==0) {
+           gv->mfcc_noise_init_acc[i]=gv->mfcc_buf[0][i];
+           gv->mfcc_noise[ i ]=gv->mfcc_noise_init_acc[i];
+        }
+        else 
+        {gv->mfcc_noise_init_acc[i]+=gv->mfcc_buf[gv->signal_cnt][i] ;
+        gv->mfcc_noise[ i ]=gv->mfcc_noise_init_acc[i]/(gv->signal_cnt+1); 
+        }
+        curt_noise[i]=gv->mfcc_noise[ i ];
+      }
+   }
+   else
+   {
+      for ( i = 0; i < gv->n_mfcc; i++ )
+        curt_noise[i]=gv->mfcc_noise[ i ];
+   }
+#endif
+
+   if ((gv->comp_type & JAC) == 0) 
+      return eTIesrEngineJACSuccess; 
+       
+   /* cepstrum to log mel power spectrum, Q 11 to Q 9 
+   ** verified that log-pow average gives equivalent vector as mfss average.
+   */
+   
+   cos_transform( curt_noise, gv->log_N, gv->muScaleP2, gv->n_mfcc, gv->n_filter, gv->cosxfm );
+
+#ifdef RAPID_JAC
+   /* ready for speaker to speak utterances */
+   if ((gv->signal_cnt >= NOISEWAIT) || (gv->speech_detected == 1)) 
+      gv->nbr_cpy = 1;    
+
+   /* compensate models when the time for recognition begins */
+   if (gv->speech_detected ==1 || gv->signal_cnt >=NOISEWAIT) 
+   {
+      TIesrEngineJACStatusType jacStatus;
+      jacStatus = rj_proc(gv);
+      if( jacStatus != eTIesrEngineJACSuccess )
+        return jacStatus;
+   }
+#else
+
+#ifndef LIVEMODE  /*file mode*/
+   if ( (gv->signal_cnt ==FILEMODEWAIT || gv->speech_detected ==1) &&gv->nbr_cpy==0  ) //The last part is to prevent jac from doing the second round compensation, may not be needed.
+      for (i = 0; i < gv->n_mu ; i++) {  
+#else
+   int j;
+   j=gv->jac_vec_per_frame ;
+       
+   if (gv->speech_detected ==1 && gv->nbr_cpy ==0 ) 
+   {
+      j=gv->n_mu - gv->index_mean; j=j>0? j:0; 
+   } 
+       
+   /*one have to wait for 10 frame before any JAC is done, unless speech has been detected*/
+   if ( (gv->signal_cnt >=NOISEWAIT || gv->speech_detected ==1)  )  
+      for (i = 0; i < j ; i++) {  
+#endif
+        /* Wrap to start at beginning of mean vectors if necessary */
+        if ((gv->index_mean) == gv->n_mu) {
+
+           gv->index_mean = 0;
+        
+           /* Check for end of first cycle of JAC adaptation */
+           if (gv->nbr_cpy == 0) {
+              PRT_ERR(printf("NOW SPEAK ...\n"));
+              /*               printf("%d (ALL) mean vectors adapted\n", n_mu); */
+#ifdef USE_AUDIO 
+              //        play_beep();  /* beep ==> all mean has been adapted */ 
+#endif
+           }
+        
+           /* Completed another cycle of JAC adaptation, track cycle number */
+           gv->nbr_cpy += 1;
+        }
+          
+        jac_one_mean( gv, gv->index_mean );
+       
+        (gv->index_mean)++;
+      }
+
+#endif
+
+   return eTIesrEngineJACSuccess;
+}
+
+/*----------------------------------------------------------------
+  jac_one_mean
+
+  This function compensates a single mfcc vector, specified by 
+  by the index_mean argument, for estimated channel and noise.
+  ----------------------------------------------------------------*/
+void jac_one_mean(gmhmm_type *gv, ushort index_mean)
+{
+  int i = index_mean, k = gv->nbr_dim;
+  Boolean b8bit = FALSE;
+#ifdef BIT8MEAN
+  b8bit = TRUE;
+  k = gv->n_mfcc;
+#endif
+
+  pmc( gv->base_mu_orig + i * gv->n_mfcc, gv->log_N, gv->base_mu + i * k, 
+       gv->log_H, 1, gv->n_mfcc, gv->n_filter, gv->muScaleP2, gv->scale_mu, gv->cosxfm, 
+       NULL, b8bit);
+
+}
+
+#ifdef USE_SVA
+
+#ifdef USE_WSVA
+                       
+/* use the above polynormial to obtain the variance scaling vector 
+ @return the inverse variance scaling value for dimension i, in Q12 */ 
+static short wsva_var_scale(short noiseEn /* in Q9 */ , short i, short nbr_dim)
+{
+  short x, j = i - 1; 
+  ushort ux; 
+  long y, z; 
+
+  if (nbr_dim == 18 && i >= 9) j++;
+  x = noiseEn >> 9; /* Q0 */
+  if (wsva_polycoef[j][0] > 0)
+    y = q15_x(wsva_polycoef[j][0], noiseEn); /* Q9 */
+  else{
+    ux = -wsva_polycoef[j][0]; 
+    y = q15_x(ux, noiseEn); /* Q9 */
+    y = -y; 
+  }
+
+  y *= (noiseEn >> 6); 
+  z = x * wsva_polycoef[j][1]; /* Q12 */
+  y = y + z + wsva_polycoef[j][2]; 
+  /* limit the scaling value */
+  /* change to 1.5 since too large variance scaling will result overflow in SBC estimate */
+  if (y > 6144) y = 6144 ; /* 1.5 in Q12 */
+  else if (y < 1170) y = 1170; /* 1/3.5 in Q12 */
+  return (short) y; 
+}
+
+/* weighted SVA
+   @param log_var_rho variance scaling vector, in log, in Q9,
+   @param linear_rho inverse variance scaling vector, in Q12
+   @param num_dimension Dimension of MFCC + Delta MFCC vectors
+*/
+static void sva_weightedSVA(short * log_var_rho, short * linear_rho, short num_dimension,
+                           gmhmm_type* gv)
+{
+  short dim;
+  short mlogrho;
+  short sInvScale; 
+  short alpha, onemalpha; 
+  ushort 
+    u06 = 19661 /* 0.6 in Q15 */,u002 = 655;
+  NssType * pSS = (NssType*) gv->pNss;
+  short sEn = 0;
+  if (pSS) {
+    sEn = pSS->meanEn; /* sEn noise level of the current utterance, in Q9 */
+    
+    if (sEn - pSS->prevMeanEn > UPPER_NOISE_LEVEL_CHANGE || 
+       pSS->prevMeanEn - sEn > UPPER_NOISE_LEVEL_CHANGE ) 
+      {
+       alpha = u06; 
+      }else{
+       //       alpha = u01; 
+       alpha = u002; 
+       }
+  }else alpha = u002; 
+  
+  onemalpha = 32767 - alpha; 
+  
+  for (dim = START_DIMENSION; dim < num_dimension; dim++) 
+    {
+      sInvScale = wsva_var_scale( sEn, dim, num_dimension); 
+      sInvScale = q15_x(alpha, sInvScale) + q15_x(onemalpha, linear_rho[dim]); 
+      linear_rho[dim] = sInvScale; 
+      
+      mlogrho = log_polyfit( linear_rho[dim], 12) ;
+      mlogrho = LONG_RIGHT_SHIFT_N((long)mlogrho, 3)* (LOG2Q9 >> 6); 
+      //      mlogrho = (mlogrho == -32768)? 32767 : -mlogrho; 
+      mlogrho = -mlogrho; 
+      log_var_rho[dim] = mlogrho; 
+    }
+}
+
+#endif
+
+/*----------------------------------------------------------------
+  sva_compensate
+
+  This function performs sva compensation on all mfcc variance vectors
+  that are presently loaded.
+  ----------------------------------------------------------------*/
+static void sva_compensate( gmhmm_type* gv )
+{
+   short org_precis[ MAX_DIM ];
+   short new_precis[ MAX_DIM ];
+   short linear_rho[ MAX_DIM ];
+   short vecindex;
+   short dim;
+   long prod;
+   short *invvarorig;
+   short *invvar;
+         
+   /* Calculate the linear multiplying factors in linear_rho */
+   sva_init_multipliers( gv->log_var_rho, linear_rho, gv->nbr_dim );
+
+#ifdef USE_WSVA
+   sva_weightedSVA(gv->log_var_rho, linear_rho, gv->nbr_dim, gv); 
+#endif
+   
+   /* Locations of original and compensated inverse variances */
+   invvarorig = gv->base_var_orig;
+   invvar = gv->base_var;
+
+   /* Loop over all inverse variance vectors */
+   for( vecindex = 0; vecindex < gv->n_var; vecindex++ )
+   {
+
+      /* Obtain original clean model inverse variance in short org_precis */
+#ifdef BIT8VAR
+
+      /* Unpack to obtain original clean model inverse variance in short */
+      vector_unpacking((unsigned short *)invvarorig, org_precis, 
+                      gv->scale_var, gv->n_mfcc);
+
+#else
+      /* Copy the original short inverse variance vector */
+      for( dim=0; dim < gv->nbr_dim; dim++ )
+        org_precis[dim] = invvarorig[dim];
+#endif
+
+
+      /* Do not compensate the dimensions of the original 
+        short inverse variance vector before the start dimension */
+      for( dim = 0; dim < START_DIMENSION; dim++ )
+        new_precis[dim] = org_precis[dim];
+      
+
+      /* Compensate all other dimensions */
+      for( dim = START_DIMENSION; dim < gv->nbr_dim; dim++ )     /* make sure start from 0, look the .h file*/
+      {
+        /* Q12 * Q9 = Q21 */
+        prod = linear_rho[ dim ] * org_precis[ dim ];
+        prod = LONG_RIGHT_SHIFT_N(prod, 12);      /* Q9 */
+        prod = MIN(prod, 32767); 
+        new_precis[ dim ] = (short) prod;
+      }
+
+      /* Output the compensated variance vector */
+#ifdef BIT8VAR
+      vector_packing(new_precis, (ushort *)invvar, 
+                    gv->scale_var, gv->n_mfcc);
+
+      /* Go to next original/compensated variance pair */
+      invvarorig += gv->n_mfcc;
+      invvar += gv->n_mfcc;
+
+#else
+      for( dim=0; dim < gv->nbr_dim; dim++ )
+        invvar[dim] = new_precis[dim];
+
+      /* Go to next original/compensated variance pair */
+      invvarorig += gv->nbr_dim;
+      invvar += gv->nbr_dim;
+#endif
+
+
+      /* Recalculate the Gaussian constant based on the
+        compensated variance */
+      //    printf(" %f ", gv->base_gconst[i] / (float)(1<<6));
+      gv->base_gconst[vecindex] = 
+        gauss_det_const( new_precis, 2, gv->muScaleP2, gv->nbr_dim);
+      //    printf(" %f\n", gv->base_gconst[i] / (float)(1<<6));
+  }
+}
+
+
+/*----------------------------------------------------------------
+  sva_init_multipliers
+
+  This function initializes the multipliers for the variance terms
+  from the SVA log_var_rho values.  This needs to be done once, prior
+  to modifying variances for an utterance to be recognized.
+
+  The input logarithmic log_var_rho values are Q9.  The output linear
+  l_rho values are Q12, limited to a maximum of exp(2).
+  ----------------------------------------------------------------*/
+static void sva_init_multipliers( const short* log_var_rho, 
+                                 short* linear_rho,
+                                 short num_dimension )
+{
+   short dim;
+   short mlogrho;
+
+   for (dim = START_DIMENSION; dim < num_dimension; dim++) 
+   {
+      /* Change sign in log domain, since in linear domain the multiplier
+        is multiplying inverse variance. */
+      mlogrho = ( log_var_rho[dim] == -32768 ) ? 32767 : -log_var_rho[dim]; 
+
+
+      /* Limit to ensure that we never decrease the variance (increase the
+        inverse variance) by more than a factor of exp(2) */
+
+      /* Do not do the limiting here!
+         Instead the limiting should be put inside the loop. */
+
+      /* Q12 linear multiplier for inverse variance of hmm model Gaussians */
+      linear_rho[dim] = expn_plus_q9(mlogrho); 
+   }
+}
+
+
+/*----------------------------------------------------------------
+  expn_plus_q9
+
+  This helper function calculates the linear sva multipliers given the
+  log multiplier value.  Input is the log value in Q9.  The returned
+  value is the linear value in Q12, representing exp(input).  The user
+  is responsible for ensuring that the input is never large enough to
+  overflow the Q12 output. 
+  ----------------------------------------------------------------*/
+static unsigned short expn_plus_q9(const short xQ9)
+{
+  short shift = 0, x = xQ9;
+  unsigned short l;
+  
+  if( x > (2 << 9)) x = ( 2 << 9 ); 
+
+  /* Find negative input for hlr_expn.  Not a very accurate method. */
+  while (x > 0) {
+    x -= LOG2Q9;
+    shift++;
+  }
+
+  l = hlr_expn( x, 9 ); /* Q15 */
+  shift -= 3; /* Q15 - Q3 = Q12 */
+  if (shift >= 0) return (l << shift);
+  else return (l >> -shift);
+}  
+
+
+#endif //#ifdef USE_SVA
diff --git a/TIesrEngine/src/jac_one.h b/TIesrEngine/src/jac_one.h
new file mode 100755 (executable)
index 0000000..5b55d23
--- /dev/null
@@ -0,0 +1,89 @@
+/*=======================================================================
+ jac_one.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header was modified as part of the modifications to add
+ sva to the live-mode TIesrSI engine API.  This header contains
+ constants declarations of internal functions used by the jac_one
+ code.  The jac_one code performs jac and sva compensation.
+
+======================================================================*/
+
+#ifndef _JAC_ONE_H
+#define _JAC_ONE_H
+
+#include "tiesr_config.h"
+
+/*--------------------------------*/
+/*  Constants */
+
+/* The number of leading dimensions not to compensate via sva.
+   Found that compensating mfcc parameter c[0] hurt
+   performance */
+const short START_DIMENSION = 1; 
+
+// Now in tiesrcommonmacros.h
+// static const short LOG2Q9 = 355;
+
+/* NOISEWAIT defines the number of frames that will be used to estimate the
+noise spectrum prior to JAC starting.  Values between 5 and 10 frames are typical. */
+#define NOISEWAIT 10  
+
+/*--------------------------------*/
+/*  Helper functions */
+
+
+/*--------------------------------
+  sva_init_multipliers
+
+  Calculates the linear multipliers for SVA compensation in linear_rho
+  from the log multipliers in log_var_rho.  The linear multipliers 
+  multiply the inverse variance vector elements in the Hmm model 
+  Gaussians.
+  --------------------------------*/
+static void sva_init_multipliers( const short* log_var_rho, 
+                                 short* linear_rho,
+                                 short num_dimension );
+
+
+/*--------------------------------
+  expn_plus_q9
+
+  Calculates exp(x) for x represented as Q9. Returns Q12 short.
+  x may be positive or negative.  The user is responsible for
+  ensuring no overflow.
+  --------------------------------*/
+static unsigned short expn_plus_q9( const short x);
+
+/*----------------------------------------------------------------
+  sva_compensate
+
+  This function performs sva compensation on all mfcc variance vectors
+  that are presently loaded.
+  ----------------------------------------------------------------*/
+static void sva_compensate( gmhmm_type* gv );
+
+
+#ifdef USE_WSVA
+
+/* poly[0] * x * x + poly[1] * x + poly[0] ,
+   variance scaling of C[1-9] and delta C[0-9] 
+   poly[0] in Q15,
+   poly[1] in Q12, 
+   poly[2] in Q2 */
+static short wsva_polycoef[19][3] = { { -62 , 720, -556 } , {4, 89, 276 }, { 43, -208, 5945} , 
+                                     { 37, -145, 4678 }, {29, -120, 4515 }, {35, -157, 4963 }, 
+                                     { 43, -225, 5816 }, { 4, 0, 3345 }, { 33, -194, 5780 }, 
+                                     { -117, 809, -6600 }, { -95, 785, -7538 }, {-16, 202, 23 }, 
+                                     { 24, -74, 3305}, {7, 29, 2192 }, { -2, 55, 2250 }, 
+                                     { 15, -38, 3243 }, { 23, -101, 4264 }, { 19, -72, 4088} , 
+                                     { 30, -157, 5383 }}; 
+
+#define UPPER_NOISE_LEVEL_CHANGE 4096 /* 8 in Q9 */
+
+#endif
+                       
+#endif
diff --git a/TIesrEngine/src/jac_one_user.h b/TIesrEngine/src/jac_one_user.h
new file mode 100644 (file)
index 0000000..302cfdd
--- /dev/null
@@ -0,0 +1,29 @@
+/*=======================================================================
+ jac_one_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header defines the interface with the jac_one functions that
+ implement part of the jac functionality.
+
+======================================================================*/
+
+#ifndef _JAC_ONE_USER_H
+#define _JAC_ONE_USER_H
+
+#include "tiesr_config.h"
+#include "status.h"
+#include "gmhmm_type.h"
+
+
+void GetTIesrJacRate(gmhmm_type *gvv, short *number_mu_per_frame);
+
+void SetTIesrJacRate(gmhmm_type *gvv, short number_mu_per_frame);
+
+TIesrEngineJACStatusType per_frame_jac_compensate(short mfcc_buf[], gmhmm_type *gvv);
+
+void jac_one_mean(gmhmm_type *gv, ushort index_mean);
+
+#endif
diff --git a/TIesrEngine/src/liveproc.cpp b/TIesrEngine/src/liveproc.cpp
new file mode 100755 (executable)
index 0000000..b0c0806
--- /dev/null
@@ -0,0 +1,276 @@
+/*=======================================================================
+ liveproc.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This function defines the call to the TIesr SI recognizer.
+
+======================================================================*/
+
+/*  
+** main loop for live version
+*/
+
+/* Windows OS specific includes */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+
+
+#include "tiesr_config.h"
+
+#include "status.h"
+#include "winlen.h"
+#include "gmhmm_type.h"
+#include "mfcc_f_user.h"
+#include "noise_sub_user.h"
+#include "uttdet_user.h"
+#include "search_user.h"
+#include "jac_one_user.h"
+#include "gmhmm_si_api.h"
+#if defined(USE_GAUSS_SELECT) || defined(USE_ORM_VAD) 
+#include "rapidsearch_user.h"
+#endif
+#ifdef USE_CONFIDENCE
+#include "confidence_user.h"
+#endif
+#ifdef BIT8FEAT
+#include "pack_user.h"
+#endif
+
+
+/* for multi-pass decoding */
+static TIesrEngineStatusType 
+MP_CallEachPass(short sig_frm[], gmhmm_type * gvv, Boolean bDoSearch)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+  TIesrEngineStatusType a_status = eTIesrEngineSuccess;
+  short power_spectrum[ WINDOW_LEN ]; /* 1/2 is NOT enough! (in autocorreletion) */  
+  short idx, i, j, log_mel_energy[ N_FILTER26 ], noise_start_time;
+  long  tmp;
+  ushort idx_noise;
+  short reg_mfcc[ MAX_DIM_MFCC16 ]; /* Q 11 */  
+  NormType var_norm;
+  short mfcc_feature[ MAX_DIM ], *p_sp = mfcc_feature;
+  short *p_fea = p_sp; 
+  TIesrEngineJACStatusType jacStatus;
+
+#ifdef WORDBACKTRACE 
+  gvv->word_backtrace=WORDBT; //HMMBT; //WORDBT; 
+#else
+  gvv->word_backtrace=HMMBT;
+#endif
+  /* do nothing but shifting input buffer */
+  if (gv->pred_first_frame) {
+    /* overlap */
+    for (i = 0; i < OVERLAP; i++)  gv->sample_signal[ i ] = sig_frm[ i + (FRAME_LEN - (OVERLAP)) ];
+    gv->pred_first_frame = FALSE;
+
+    return  eTIesrEngineSuccess;
+  }
+  /* pack the input data into proper location */
+  for (i = 0; i < FRAME_LEN; i++)  gv->sample_signal[ i + OVERLAP] = sig_frm[ i ];
+
+  /* put into circular buffer, for regression computation */
+  idx = circ_idx( gv->signal_cnt );
+
+#ifdef USE_SNR_SS
+    ss_mfcc_a_window(gv->sample_signal, gv->mfcc_buf[ idx ], log_mel_energy, gv->n_mfcc, 
+                    gv->n_filter, gv->mel_filter, gv->cosxfm,power_spectrum, 
+                    gv->muScaleP2, &var_norm, &(gv->last_sig), (NssType*) gv->pNss);
+#else
+    mfcc_a_window(gv->sample_signal, gv->mfcc_buf[ idx ], log_mel_energy, gv->n_mfcc, 
+                 gv->n_filter, gv->mel_filter, gv->cosxfm,power_spectrum, 
+                 gv->muScaleP2, &var_norm, &(gv->last_sig), gv->pNss);
+#endif
+
+  /* utterance detection */
+  compute_uttdet( power_spectrum, gv->signal_cnt, gv->signal_cnt+1, gv->mfcc_buf[ idx ], gv, &var_norm);
+
+  if (gv->comp_type & CMN) 
+    for ( i = 0; i <  gv->n_mfcc; i++ )  gv->mfcc_buf[ idx ][ i ] -= gv->mfcc_mean[ i ];     /* CMN */
+
+#ifdef LIVEMODE
+
+  if (gv->speech_detected == 0 && gv->uttdet_state == IN_SPEECH) 
+  {
+      gv->speech_detected = 1; 
+      
+      /*last JAC step, just deal with the rest of the model as much as you can */
+      noise_start_time = gv->signal_cnt - NOISECUSHION ;//ongoing test code, unfinished ( MFCC_BUF_SZ - 1 ) + REG_SPAN;
+      if (noise_start_time >=0) 
+        idx_noise = circ_idx( noise_start_time );
+      else 
+        idx_noise = 0;
+      
+      jacStatus = per_frame_jac_compensate(gv->mfcc_buf[ idx_noise ], gv); 
+      if( jacStatus != eTIesrEngineJACSuccess )
+        return eTIesrEngineCompFail;
+  }
+#else
+  if (gv->speech_detected == 0 && gv->signal_cnt > FILEMODEWAIT  ) 
+     gv->speech_detected = 1;   
+#endif
+  
+  //init noise est with the first frame!
+  if (gv->signal_cnt ==0 ) 
+    for ( i = 0; i < gv->n_mfcc; i++ )  {
+      gv->mfcc_noise[ i ] =  gv->mfcc_buf[ 0 ][ i ];
+      for (j= MFCC_BUF_SZ - 1;j>=1;j--)
+       gv->mfcc_buf[j][i] = gv->mfcc_buf[0][i];
+    }
+
+  /* modified so that CMN vector is accumulated for all frames */
+  if (gv->speech_detected) { /* update CMN mean */
+    if (gv->comp_type & CMN) 
+      for ( i = 0; i < gv->n_mfcc; i++ ) {
+       tmp = gv->mfcc_buf[ idx ][ i ] + (long) gv->mfcc_mean[ i ] * 127;
+       gv->mfcc_mean[ i ] = (short) ( tmp >> 7 );
+      }
+  }
+  else { /* silence, non-speech frame */
+    if (gv->comp_type & JAC) {
+      noise_start_time = gv->signal_cnt - NOISECUSHION;
+      
+      if (noise_start_time >=0) idx_noise = circ_idx( noise_start_time );
+      else {
+       idx_noise = 0;
+      }
+      /* cannot use log_mel_energy, as it is not bufferized */
+#ifndef LIVEMODE  //FILEMODE: update jac every frame or only 10th frame.
+      if (gv->signal_cnt < FILEMODEWAIT )  /*update for the first 10 frames. */
+      {
+        jacStatus = per_frame_jac_compensate(gv->mfcc_buf[ idx_noise ], gv);
+        if( jacStatus != eTIesrEngineJACSuccess )
+           return eTIesrEngineCompFail;
+      }
+#else
+      jacStatus = per_frame_jac_compensate(gv->mfcc_buf[ idx_noise ], gv);
+      if( jacStatus != eTIesrEngineJACSuccess )
+        return eTIesrEngineCompFail;
+#endif
+    }
+  }
+  
+#ifndef LIVEMODE
+  /*FILEMODE: do JAC for all modles at 10th frame!*/
+  if (gv->signal_cnt ==FILEMODEWAIT )
+  {
+     jacStatus = per_frame_jac_compensate(gv->mfcc_buf[ idx_noise ], gv); 
+     if( jacStatus != eTIesrEngineJACSuccess )
+       return eTIesrEngineCompFail;
+  }
+#endif
+
+  if ( gv->speech_detected  ) {
+    
+    /* several frames has already passed detection, go back */
+    idx = circ_idx( idx - ( MFCC_BUF_SZ - 1 ) + REG_SPAN );
+    /* fprintf(pf, "speech = %d\n",  signal_cnt - ( MFCC_BUF_SZ - 1 ) + REG_SPAN); */
+
+    compute_regression( idx, 1, reg_mfcc, gv->n_mfcc, gv->muScaleP2,  gv->mfcc_buf);
+    
+    for (i = 0; i <  gv->n_mfcc; i++)  {
+      mfcc_feature[i] = gv->mfcc_buf[idx][i];
+      mfcc_feature[i +  gv->n_mfcc] = reg_mfcc[i];
+    }
+
+#if defined(USE_GAUSS_SELECT) || defined(USE_ORM_VAD)
+    
+    /* compute Gaussian cluster scores */
+    i = rj_clear_obs_scr(gv, mfcc_feature);
+    /* update scores from an on-line reference model */
+    rj_update_noise(gv, mfcc_feature, i); 
+
+#if defined(USE_ORM_VAD)
+    /* GMM-based VAD */
+    while( (p_fea = rj_vad_proc( gv, mfcc_feature )) != NULL){
+#else
+    {
+#endif
+
+#endif
+
+#ifdef BIT8FEAT
+      if (gv->mem_feature) 
+       vector_packing(p_fea, gv->mem_feature + gv->mfcc_cnt, gv->scale_feat, gv->n_mfcc);
+#else
+      if (mem_mfcc) 
+      {
+       for (i = 0; i < gv->n_mfcc; i++)
+       {
+          mem_mfcc[gv->mfcc_cnt + i]   = p_fea[i];
+          mem_d_mfcc[gv->mfcc_cnt + i] = p_fea[i + gv->n_mfcc];
+       }
+      }
+
+      // Store integer values of features during recognition
+      // TODO: modify to handle static, delta, acc ...
+      if( gv->mem_feature )
+      {
+        short* memFeats = (short*)(gv->mem_feature);
+        for (i = 0; i < 2*gv->n_mfcc; i++)
+        {
+           memFeats[2*gv->mfcc_cnt + i]   = p_fea[i];
+        }
+      }
+#endif  
+
+
+      /* search needs frm_cnt to start with 0 */
+      
+      if (bDoSearch) 
+       a_status = (TIesrEngineStatusType) search_a_frame(p_fea, 1, gv->frm_cnt, gv);
+      gv->frm_cnt++;
+      gv->mfcc_cnt += gv->n_mfcc;
+      if ( gv->frm_cnt == gv->max_frame_nbr) 
+       return (eTIesrEngineFeatureMemoryOut);
+      
+#if defined(USE_GAUSS_SELECT) || defined(USE_ORM_VAD)
+    }
+#endif
+    
+  }
+  
+  (gv->signal_cnt)++;
+  if ( gv->signal_cnt > TIMEOUT) return eTIesrEngineTimeOut;
+  
+  /* overlap */
+  for (i = 0; i <  OVERLAP /* WINDOW_LEN - FRAME_LEN */ ; i++) {
+    gv->sample_signal[ i ] = gv->sample_signal[ i + FRAME_LEN ];
+#ifdef USE_AUDIO
+    if (gv->sample_signal[i] > gv->amplitude_max) gv->amplitude_max = gv->sample_signal[i];
+    else if (gv->sample_signal[i] < gv->amplitude_min) gv->amplitude_min = gv->sample_signal[i];
+#endif
+  }
+  return a_status;
+}
+
+/*
+** recognize one utterance, live
+** return search status:
+** compute regression and search 
+*/ 
+
+/* GMHMM_SI_API */ 
+TIesrEngineStatusType CallSearchEngine(short sig_frm[], gmhmm_type *gvv, 
+                                      unsigned int aFramesQueued ) 
+{
+  TIesrEngineStatusType a_status = eTIesrEngineSuccess;
+  gvv->FramesQueued= aFramesQueued;
+
+#ifdef _MONOPHONE_NET
+  a_status = MP_CallEachPass(sig_frm, (gmhmm_type*) gvv->pAux, TRUE); 
+    /* use triphone to do second-pass */
+  if (a_status != eTIesrEngineSuccess) return a_status; 
+  a_status = MP_CallEachPass(sig_frm, gvv, FALSE); 
+#else
+  a_status = MP_CallEachPass(sig_frm, gvv, TRUE); 
+#endif 
+
+  return a_status;
+}
+
diff --git a/TIesrEngine/src/load.cpp b/TIesrEngine/src/load.cpp
new file mode 100755 (executable)
index 0000000..5e6974e
--- /dev/null
@@ -0,0 +1,925 @@
+/*=======================================================================
+ load.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Load models from files. For embedded devices, one may wish to
+ change this code to define pointers to the data in memory,
+ rather than reading files.
+
+======================================================================*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "tiesr_config.h"
+#include "mfcc_f_user.h"
+#include "pack_user.h"
+#include "load_user.h"
+
+//char *malloc( int );
+
+
+/*--------------------------------*/
+//
+// MS WCE does not support rewind function
+//
+static void myrewind( FILE *fp )
+{
+   fseek(fp, 0L, SEEK_SET);
+   clearerr(fp);
+}
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API TIesrEngineStatusType load_scales( char *fname, gmhmm_type *gv )
+{
+   FILE  *fp;
+   size_t nread;
+   
+   fp = fopen(fname, "rb");
+   if (!fp)
+   {
+      PRT_ERR(fprintf(stderr, "can't open %s\n", fname));
+      PRT_ERR(exit(0));
+      return eTIesrEngineModelFileFail;
+   }
+   
+   
+   gv->scale_mu = (short *) malloc( sizeof(short) * gv->n_mfcc * 2 );
+   if( gv->scale_mu == NULL )
+   {
+      fclose(fp);
+      return eTIesrEngineModelFileFail;
+   }
+   
+   
+   nread = fread(gv->scale_mu, sizeof(short), gv->n_mfcc*2, fp);
+   if( nread != (size_t)gv->n_mfcc*2 )
+   {
+      free(gv->scale_mu);
+      gv->scale_mu = NULL;
+      fclose(fp);
+      return eTIesrEngineModelFileFail;
+   }
+   
+   
+   gv->scale_var =(short *) malloc( sizeof(short) * gv->n_mfcc * 2 );
+   if( gv->scale_var == NULL )
+   {
+      fclose(fp);
+      return eTIesrEngineModelFileFail;
+   }
+   
+   
+   nread = fread( gv->scale_var, sizeof(short), gv->n_mfcc*2, fp);
+   if( nread != (size_t)gv->n_mfcc*2 )
+   {
+      free(gv->scale_var);
+      gv->scale_var = NULL;
+      fclose(fp);
+      return eTIesrEngineModelFileFail;
+   }
+   
+   
+   fclose( fp );
+   return eTIesrEngineSuccess;
+}
+
+
+/*--------------------------------*/
+/*
+ ** return 0 if file open fail
+ */
+TIESRENGINECOREAPI_API unsigned short load_n_mfcc( char *fname )
+{
+   FILE  *fp;
+   unsigned short n_mfcc = 0;
+   
+   fp = fopen(fname, "rb");
+   if (!fp)
+   {
+      PRT_ERR(fprintf(stderr, "can't open %s\n", fname));
+      return n_mfcc;
+   }
+   
+   fread(&n_mfcc, sizeof(unsigned short), 1, fp);
+   fclose( fp );
+   return n_mfcc;
+}
+
+
+
+/*----------------------------------------------------------------*/
+/*
+ ** unpack mean or variance vectors
+ */
+
+TIesrEngineStatusType unpacking(short *base, ushort nbr, short n_mfcc,
+FILE *fp, short scale[])
+{
+   int i;
+   unsigned short tmp_sh[ MAX_DIM_MFCC16 ];
+   short *vec;
+   size_t nread;
+   for (vec = base, i=0; i< nbr; i++, vec += n_mfcc * 2)
+   {
+      nread = fread(tmp_sh, sizeof(short), n_mfcc, fp);
+      if( nread != (size_t)n_mfcc )
+         return eTIesrEngineModelLoadFail;
+      vector_unpacking(tmp_sh, vec, scale, n_mfcc);
+   }
+   //printf("----------n unpaced: %d\n", nbr);
+   return eTIesrEngineSuccess;
+}
+
+
+/* ---------------------------------------------------------------------------
+ load mu
+ ---------------------------------------------------------------------- */
+short *load_mu( char *fname,  gmhmm_type *gv, fileConfiguration_t*  fileConfig )
+{
+   FILE *fp;
+   unsigned int vec_size = gv->n_mfcc;
+   short *mu; /* array of mean vectors  */
+   size_t nread;
+   
+   
+   /* TIesr Engine wants mean vectors as interleaved static/dynamic
+    features in bytes if BIT8MEAN set.  Otherwise, it wants the
+    vectors as non-interleaved shorts.  vec_size is the number of
+    shorts to allocate per vector, assuming a short is two bytes. */
+   #ifndef BIT8MEAN
+   /* TIesr Engine will store means as shorts */
+   vec_size *= 2;
+   #endif
+   
+   
+   fp = fopen(fname, "rb");
+   if( !fp )
+      return NULL;
+   
+   
+   /* Read number of mean vectors */
+   nread = fread(&(gv->n_mu), sizeof(unsigned short), 1, fp);
+   if( nread != 1 )
+   {
+      fclose( fp );
+      return NULL;
+   }
+   
+   
+   
+   /* Allocate space for mean vectors in either short or byte depending
+    on the setting of BIT8MEAN */
+   mu = (short *) malloc( gv->n_mu * vec_size * sizeof(short) );
+   if( !mu )
+   {
+      fclose(fp);
+      return NULL;
+   }
+   
+   
+   /* TIesr Engine wants mean vectors as interleaved static/dynamic
+    features in bytes if BIT8MEAN set */
+   #ifdef BIT8MEAN
+   
+   if( fileConfig->byteMu )
+   {
+      /* file mu is already in proper format, read in directly */
+      nread = fread(mu, sizeof(short), gv->n_mu * vec_size, fp);
+      fclose( fp );
+      if( nread != gv->n_mu*vec_size )
+      {
+         free( mu );
+         return NULL;
+      }
+   }
+   else
+   {
+      /* The file mu data is in non-interleaved shorts.  TIesr Engine
+       does not now have the code to convert from short to
+       interleaved byte format.  It could be put in TIesr Engine.
+       See TIesrFlex for the conversion code.  If that is done,
+       then a call will be put here to convert. */
+      fclose( fp );
+      free( mu );
+      return NULL;
+   }
+   
+   
+   /* TIesr Engine wants mean vectors as non-interleaved short features
+    with static features first followed by dynamic features if
+    BIT8MEAN is not set. */
+   #else
+   
+   if( fileConfig->byteMu )
+   {
+      /* Input data is in interleaved static/dyanamic bytes.  Unpack these
+       into non-interleaved short vectors */
+      TIesrEngineStatusType status;
+      status = unpacking(mu, gv->n_mu, gv->n_mfcc, fp, gv->scale_mu);
+      fclose( fp );
+      if( status != eTIesrEngineSuccess )
+      {
+         free( mu );
+         return NULL;
+      }
+      
+   }
+   
+   else
+   {
+      /* Input data is already in non-interleaved short features,
+       read directly */
+      nread = fread(mu, sizeof(short), gv->n_mu * vec_size, fp);
+      fclose( fp );
+      if( nread != gv->n_mu*vec_size )
+      {
+         free(mu);
+         return NULL;
+      }
+   }
+   
+   #endif
+   
+   /* The loading was a success, return the mean vector location. */
+   return mu;
+}
+
+
+/* ---------------------------------------------------------------------------
+ load var
+ ---------------------------------------------------------------------- */
+static short *load_var( char *fname, gmhmm_type *gv, fileConfiguration_t *fileConfig )
+{
+   FILE               *fp;
+   short *base_var; /* inverse of variance */
+   size_t nread;
+   
+   /* Open binary inverse variances file or failure */
+   fp = fopen(fname, "rb");
+   if( !fp )
+   {
+      return NULL;
+   }
+   
+   
+   /* Load number of inverse variance vectors */
+   nread = fread(&(gv->n_var), sizeof(unsigned short), 1, fp);
+   if( nread != 1 )
+   {
+      fclose( fp );
+      return NULL;
+   }
+   
+   
+   /* TIesr Engine wants inv variance vectors as interleaved static/dynamic
+    features in bytes if BIT8VAR is set.  Otherwise, it wants the
+    vectors as non-interleaved shorts.  Allocate space to hold variance
+    based on the desired size, assuming short is two bytes. */
+   #ifdef BIT8VAR
+   base_var = (short *) malloc( gv->n_var * gv->n_mfcc * sizeof(short) );
+   #else
+   base_var = (short *) malloc( gv->n_var * 2 * gv->n_mfcc * sizeof(short) );
+   #endif
+   if( ! base_var )
+   {
+      fclose(fp);
+      return NULL;
+   }
+   
+   /* TIesr Engine wants inv variance vectors as interleaved static/dynamic
+    features in bytes if BIT8VAR is set */
+   #ifdef BIT8VAR
+   
+   if( fileConfig->byteVar )
+   {
+      /* Input file inv variance is already in byte format, read directly. */
+      nread = fread(base_var, sizeof(short), gv->n_var * gv->n_mfcc, fp);
+      fclose(fp);
+      if( nread != (unsigned int)(gv->n_var*gv->n_mfcc) )
+      {
+         free(base_var);
+         return NULL;
+      }
+   }
+   else
+   {
+      /* The file inv variance data is in non-interleaved shorts.
+       TIesr Engine does not now have the code to convert from short
+       to interleaved byte format.  It could be put in TIesr Engine.
+       See TIesrFlex for the conversion code.  If that is done, then
+       a call will be put here to convert. */
+      fclose( fp );
+      free( base_var );
+      return NULL;
+   }
+   
+   
+   /* TIesr Engine wants inv variance vectors as non-interleaved short
+    features with static features first followed by dynamic features
+    if BIT8VAR is not set. */
+   #else
+   
+   if( fileConfig->byteVar )
+   {
+      /* Input data is in interleaved static/dyanamic bytes.  Unpack these
+       into non-interleaved short vectors */
+      TIesrEngineStatusType status;
+      status = unpacking(base_var, gv->n_var, gv->n_mfcc, fp, gv->scale_var);
+      fclose( fp );
+      if( status != eTIesrEngineSuccess )
+      {
+         free( base_var );
+         return NULL;
+      }
+   }
+   
+   else
+   {
+      /* Input data is already in non-interleaved short features,
+       read directly */
+      nread = fread(base_var, sizeof(short), gv->n_var * 2 * gv->n_mfcc, fp);
+      fclose( fp );
+      if( nread != (size_t)gv->n_var * 2 * gv->n_mfcc )
+      {
+         free(base_var);
+         return NULL;
+      }
+   }
+   
+   #endif
+   
+   /* Loading of variance vectors was successful */
+   return base_var;
+}
+
+
+
+
+/*--------------------------------*/
+/* Testing only */
+/*
+ #define TESTIT
+ */
+
+#ifdef TESTIT
+/*
+ ** access to transition probabilities
+ */
+#define get_pi_gvn_trans(trans) ((short *)(trans+1))
+#define nbr_states_gvn_trans(trans_ptr) (*(unsigned short *)(trans_ptr))
+#define trans_size(trans_ptr) (nbr_states_gvn_trans(trans_ptr) *  nbr_states_gvn_trans(trans_ptr))
+
+#define get_a_gvn_trans(trans)    (trans+nbr_states_gvn_trans(trans))
+#define get_ai_gvn_trans(trans, i) ( get_a_gvn_trans(trans)+(nbr_states_gvn_trans(trans)*(i)))
+#define get_aij_gvn_trans(trans, i, j) (get_ai_gvn_trans(trans, i)[j])
+
+#define SCALE 2
+#define MINV -32768
+
+void trans_weight(short *trans_pool, unsigned short len)
+{
+   unsigned short n, nbr_stts, i, j;
+   short *ptr;
+   int  int_aij;
+   
+   for (n = 0, ptr = trans_pool; ptr < trans_pool + len; ptr += trans_size(ptr), n++)
+   {
+      nbr_stts = nbr_states_gvn_trans(ptr);
+      printf("[%3d] %d\n", n, nbr_stts);
+      /*     for (i=0; i<nbr_stts - 1; i++) printf("%5d ", get_pi_gvn_trans(ptr)[i]);  printf("\n"); */
+      for (i=0; i<nbr_stts - 1; i++)
+      {
+         for (j=0; j<nbr_stts; j++)
+         {
+            printf("%5d ", get_aij_gvn_trans(ptr, i, j));
+            int_aij =  SCALE * get_aij_gvn_trans(ptr, i, j);
+            get_aij_gvn_trans(ptr, i, j) =  MAX(MINV, int_aij);
+            printf("(%5d) ", get_aij_gvn_trans(ptr, i, j));
+         }
+         printf("\n");
+      }
+   }
+}
+
+#endif
+
+
+
+/* ---------------------------------------------------------------------------
+ load obs_scr
+ ---------------------------------------------------------------------- */
+/* -- used Gaussian level cache is enough. no need for pdf level
+
+ static TIesrEngineStatusType
+ load_obs_scr( char *fname, gmhmm_type *gv )
+ {
+ FILE               *fp;
+ unsigned short     len;
+
+ fp = fopen(fname, "rb");
+ if( !fp )
+ return eTIesrEngineModelLoadFail;
+
+ fread(&len, sizeof(unsigned short), 1, fp);
+
+ gv->obs_scr = (short *) malloc( len * sizeof(short) );
+ if( ! gv->obs_scr )
+ {
+ fclose(fp);
+ return eTIesrEngineModelLoadFail;
+ }
+
+ //   fread(obs_scr, sizeof(short), len, fp);
+
+
+ fclose( fp );
+ return eTIesrEngineSuccess;
+ }
+ */
+
+/*--------------------------------*/
+/*
+ ** generic load
+ */
+TIESRENGINECOREAPI_API short *load_model_file(char fname[], unsigned short *len)
+{
+   FILE *fp;
+   short *ptr;
+   size_t nread;
+   
+   
+   fp = fopen(fname, "rb");
+   if( !fp )
+      return NULL;
+   
+   fread(len, sizeof(unsigned short), 1, fp);
+   
+   ptr = (short *) malloc((*len) * sizeof(short) );
+   if( !ptr )
+   {
+      fclose(fp);
+      return NULL;
+   }
+   
+   nread = fread(ptr, sizeof(short), *len, fp);
+   fclose(fp);
+   if( nread != *len )
+   {
+      free(ptr);
+      return NULL;
+   }
+   
+   return ( ptr );
+}
+
+
+/* ---------------------------------------------------------------------------
+ load word list
+ ---------------------------------------------------------------------- */
+static TIesrEngineStatusType
+load_word_list( char *fname, gmhmm_type *gv )
+{
+   FILE      *fp;
+   short     i;
+   int size;
+   char *p_char;
+   
+   if ( gv->trans->n_word == 0)
+      return eTIesrEngineSuccess;
+   
+   fp = fopen(fname, "r");
+   if( !fp )
+      return eTIesrEngineModelLoadFail;
+   
+   fseek(fp, 0, 2);
+   
+   size = ftell(fp); /* count */
+   
+   gv->vocabulary = (char **) malloc( gv->trans->n_word * sizeof(char *) );
+   if( ! gv->vocabulary )
+   {
+      fclose(fp);
+      return eTIesrEngineModelLoadFail;
+   }
+   
+   p_char = (char *) malloc( size * sizeof(char));
+   if( ! p_char )
+   {
+      free( gv->vocabulary );
+      gv->vocabulary = NULL;
+      fclose(fp);
+      return eTIesrEngineModelLoadFail;
+   }
+   
+   
+   myrewind(fp);
+   fread(p_char, sizeof(char), size, fp);
+   fclose( fp );
+   
+   for (i = 0; i < gv->trans->n_word; i++)
+   {
+      gv->vocabulary[ i ] = p_char;
+      while (*p_char != '\n') p_char++;
+      *p_char = '\0'; /* replace line-feed by string end */
+      p_char++;
+   }
+   
+   return eTIesrEngineSuccess;
+   
+}
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void free_scales(gmhmm_type *gv)
+{
+   if( gv->scale_mu )
+      free(  gv->scale_mu );
+   if( gv->scale_var )
+      free(  gv->scale_var );
+}
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void free_models(gmhmm_type *gv)
+{
+   if( gv->base_net )
+      free( gv->base_net );
+   if( gv->base_hmms )
+      free( gv->base_hmms );
+   if( gv->base_mu )
+      free( gv->base_mu );
+   //
+   if( gv->gauss_scr )
+      free( gv->gauss_scr);
+   if( gv->base_mu_orig )
+      free( gv->base_mu_orig );
+   if( gv->base_var )
+      free( gv->base_var );
+   #ifdef USE_SVA
+   if( gv->base_var_orig )
+      free( gv->base_var_orig );
+   #endif
+   if( gv->base_tran )
+      free( gv->base_tran );
+   //   if( gv->obs_scr )
+   //      free( gv->obs_scr );
+   if( gv->base_pdf )
+      free( gv->base_pdf );
+   if( gv->base_mixture )
+      free( gv->base_mixture );
+   if( gv->base_gconst )
+      free( gv->base_gconst );
+   
+   free_scales(gv);
+   
+   if (gv->vocabulary)
+   {
+      if( gv->vocabulary[0] )
+         free(gv->vocabulary[0]);
+      free(gv->vocabulary);
+   }
+}
+
+
+/*----------------------------------------------------------------
+ load_model_config
+
+ This function reads the configuration of the binary model data
+ files.  In this way, the recognizer can adjust for various
+ configurations of model data, such as means and/or variances in
+ short or byte.
+
+ ----------------------------------------------------------------*/
+TIesrEngineStatusType load_model_config(char fname[],
+fileConfiguration_t *fileConfig )
+{
+   FILE *fp;
+   size_t nread;
+   
+   
+   fp = fopen(fname, "rb");
+   
+   
+   /* If configuration file is not available, assume the last assumption for
+    creating models, that is, the models have byte mean and variance. */
+   if( !fp )
+   {
+      fileConfig->byteMu = 1;
+      fileConfig->byteVar = 1;
+      
+      return eTIesrEngineSuccess;
+   }
+   
+   /* Read configuration parameters into configuration structure */
+   nread = fread( &fileConfig->byteMu, sizeof(short), 1, fp);
+   nread = fread( &fileConfig->byteVar, sizeof(short), 1, fp);
+   fclose(fp);
+   
+   
+   /* Check for enough data to read last parameter */
+   if( nread != 1 )
+      return eTIesrEngineModelLoadFail;
+   
+   return eTIesrEngineSuccess;
+}
+
+/* load mean vectors to either base mean for decoding or original mean for adaptation
+ @param mod_dir pointer to model directory
+ @param gv pointer to gmhmm_type
+ @bLoadBaseMu TRUE if load to base mean, FALSE if load to original mean */
+TIESRENGINECOREAPI_API
+TIesrEngineStatusType load_mean_vec(char * mod_dir, gmhmm_type * gv ,
+Boolean bLoadBaseMu )
+{
+   char fname[ MAX_STR ];
+   TIesrEngineStatusType status;
+   fileConfiguration_t fileConfig;
+   
+   /* Read the configuration of input file model data.  For now, if no
+    configuration file is available, byte means and variances are
+    assumed, since this was the last way we were assuming data was
+    written to binary model files. */
+   sprintf(fname, "%s/%s", mod_dir, file_names[11]);
+   status = load_model_config( fname, &fileConfig );
+   if( status != eTIesrEngineSuccess )
+      return eTIesrEngineModelLoadFail;
+   
+   sprintf( fname, "%s/%s", mod_dir, file_names[3] );
+   if (gv->base_mu == NULL && bLoadBaseMu)
+   {
+      gv->base_mu = load_mu( fname, gv, &fileConfig );
+      if( ! gv->base_mu )
+         return eTIesrEngineModelLoadFail;
+   }
+   
+   /* load mu again for PMC */
+   if (gv->base_mu_orig == NULL && bLoadBaseMu == FALSE)
+   {
+      gv->base_mu_orig = load_mu( fname, gv, &fileConfig );
+      if( ! gv->base_mu_orig )
+         return eTIesrEngineModelLoadFail;
+   }
+   return eTIesrEngineSuccess;
+}
+
+
+/*----------------------------------------------------------------*/
+/*
+ ** return the mfcc dimension of the feature, 0 if mfcc dimension file does not exist
+ */
+TIESRENGINECOREAPI_API
+TIesrEngineStatusType load_models(char *mod_dir, gmhmm_type *gv, char bMonoNet,
+char * network_file , char* word_list_file)
+{
+   char fname[ MAX_STR ];
+   unsigned short len;
+   TIesrEngineStatusType status;
+   fileConfiguration_t fileConfig;
+   
+   
+   /* Initialization of byte to short scale vectors */
+   gv->scale_mu = NULL;
+   gv->scale_var = NULL;
+   
+   /* read the dimension of mfcc */
+   sprintf(fname, "%s/%s", mod_dir, file_names[9]);
+   gv->n_mfcc = load_n_mfcc( fname );
+   if (gv->n_mfcc == 0)
+      return  eTIesrEngineModelLoadFail;
+   
+   
+   /* Read the configuration of input file model data.  For now, if no
+    configuration file is available, byte means and variances are
+    assumed, since this was the last way we were assuming data was
+    written to binary model files. */
+   sprintf(fname, "%s/%s", mod_dir, file_names[11]);
+   status = load_model_config( fname, &fileConfig );
+   if( status != eTIesrEngineSuccess )
+      return eTIesrEngineModelLoadFail;
+   
+   /* Read the scaling of mean and variance if mu.bin or var.bin in byte. */
+   if( fileConfig.byteMu || fileConfig.byteVar )
+   {
+      sprintf(fname, "%s/%s", mod_dir, file_names[10]);
+      status = load_scales( fname, gv );
+      if( status != eTIesrEngineSuccess )
+         return eTIesrEngineModelLoadFail;
+   }
+   else
+   {
+      gv->scale_mu = NULL;
+      gv->scale_var = NULL;
+   }
+   
+   /*
+    ** read top level grammar
+    */
+   if (network_file)
+   {
+      gv->base_net =  load_model_file(network_file, &len);
+      if( ! gv->base_net )
+         return eTIesrEngineModelLoadFail;
+      gv->trans = (TransType *) gv->base_net;
+   }else
+   {
+      if (!bMonoNet)
+      {
+         sprintf(fname, "%s/%s", mod_dir, file_names[1]);
+         gv->base_net =  load_model_file(fname, &len);
+         if( ! gv->base_net )
+            return eTIesrEngineModelLoadFail;
+         gv->trans = (TransType *) gv->base_net;
+      }else
+      {
+         gv->base_net= NULL;
+         gv->trans = NULL;
+      }
+   }
+   
+   /* adjust address */
+   /* C54 do it here, but cannot do it here for 32 bits CPU */
+   
+   /*
+    ** load word list, after load_net()
+    */
+   if (word_list_file)
+   {
+      status = load_word_list( word_list_file, gv );
+      if( status != eTIesrEngineSuccess )
+         return eTIesrEngineModelLoadFail;
+   }else if (!bMonoNet)
+   {
+      sprintf(fname, "%s/%s", mod_dir, file_names[0]);
+      status = load_word_list( fname, gv );
+      if( status != eTIesrEngineSuccess )
+         return eTIesrEngineModelLoadFail;
+   }else
+   {
+      gv->vocabulary = NULL;
+   }
+   
+   /*
+    ** read all HMM's used in the top level grammar
+    */
+   
+   sprintf(fname, "%s/%s", mod_dir, file_names[2]);
+   gv->base_hmms =  (unsigned short *)load_model_file(fname, &len);
+   if( ! gv->base_hmms )
+      return eTIesrEngineModelLoadFail;
+   
+   
+   /* load mu, performing conversions as necessary */
+   sprintf( fname, "%s/%s", mod_dir, file_names[3] );
+   gv->base_mu = load_mu( fname, gv, &fileConfig );
+   if( ! gv->base_mu )
+      return eTIesrEngineModelLoadFail;
+   
+   // Gaussian cache
+   gv->gauss_scr =(short *) calloc( gv->n_mu , sizeof(short) );
+   if ( !gv->gauss_scr )
+   {
+      return eTIesrEngineModelLoadFail;
+   }
+   
+   
+   /* load original mu for PMC */
+   #ifdef USE_16BITMEAN_DECOD
+   gv->base_mu_orig = NULL;
+   /*
+    the following code has been commented. Loading the original mu has
+    been a process in cluster-dependent JAC, inside function of
+    rj_compensate(gmhmm_type * gv) */
+   #else
+   gv->base_mu_orig = load_mu( fname, gv, &fileConfig );
+   if( ! gv->base_mu_orig )
+      return eTIesrEngineModelLoadFail;
+   #endif
+   
+   /* load inverse variance vectors  */
+   sprintf( fname, "%s/%s", mod_dir, file_names[4] );
+   gv->base_var = load_var( fname, gv, &fileConfig );
+   if( ! gv->base_var )
+      return eTIesrEngineModelLoadFail;
+   
+   #ifdef USE_SVA
+   
+   /* load var again for SVA */
+   gv->base_var_orig = load_var( fname, gv, &fileConfig );
+   if( ! gv->base_var_orig )
+      return eTIesrEngineModelLoadFail;
+   
+   #endif
+   
+   
+   /*
+    ** transition matrix
+    */
+   sprintf(fname, "%s/%s", mod_dir, file_names[5]);
+   gv->base_tran = load_model_file(fname, &len);
+   if( ! gv->base_tran )
+      return eTIesrEngineModelLoadFail;
+   
+   #ifdef TESTIT
+   trans_weight(gv->base_tran, len);
+   #endif
+   
+   /*
+    ** PDF
+    */
+   sprintf(fname, "%s/%s", mod_dir, file_names[6]);
+   gv->base_pdf = (unsigned short *)load_model_file(fname, &(gv->n_pdf));
+   if( ! gv->base_pdf )
+      return eTIesrEngineModelLoadFail;
+   
+   /*
+    ** observation score buffer, only compute once per pdf per frame
+    */
+   /* Gaussian cache is better ,and this is redendant
+    status = load_obs_scr( fname, gv );
+    if( status != eTIesrEngineSuccess )
+    return eTIesrEngineModelLoadFail;
+    */
+   
+   /*
+    ** mixture
+    */
+   sprintf(fname, "%s/%s", mod_dir, file_names[7]);
+   gv->base_mixture = load_model_file(fname, &len);
+   if( ! gv->base_mixture )
+      return eTIesrEngineModelLoadFail;
+   
+   /*
+    ** gconst
+    */
+   sprintf(fname, "%s/%s", mod_dir, file_names[8]);
+   gv->base_gconst = load_model_file(fname, &len);
+   if( ! gv->base_gconst )
+      return eTIesrEngineModelLoadFail;
+   
+   return eTIesrEngineSuccess;
+}
+
+/*-----------------------------------------------------------
+ mem_alloc
+
+ Manage allocation of a memory area that is viewed as an
+ array of short data.  This function has the capability to
+ align data pointers within the memory to long, int, or short
+ boundaries.  It assumes sizes of short, int, and long are
+ powers of two.
+ ------------------------------------------------------------*/
+short *mem_alloc( short * base_mem, ushort * mem_count,
+   ushort size_in_short, unsigned int max_mem_usage,
+   unsigned short aAlign, char *mesg )
+{
+   unsigned int varLen;
+   unsigned int shrtsPerVar;
+   unsigned int shrtOffset;
+   
+   short *tmp =  base_mem + (*mem_count);
+   
+   
+   /* Checks to ensure alignment of pointer is correct */
+   if( aAlign == LONGALIGN || aAlign == INTALIGN )
+   {
+      varLen = (aAlign == LONGALIGN ) ?  sizeof(long) : sizeof(int);
+      shrtsPerVar = varLen >> (SHORTLEN >> 1);
+      shrtOffset = *mem_count & (shrtsPerVar - 1);
+
+      /* Not aligned, align it to next short */
+      if( shrtOffset )
+      {
+         tmp += shrtsPerVar - shrtOffset;
+         *mem_count = (unsigned short)(tmp - base_mem);
+      }
+      
+      /* Ensure request for exact number of shorts to fill all positions */
+      shrtOffset = size_in_short & (shrtsPerVar-1);
+      if( shrtOffset )
+      {
+         size_in_short += (shrtsPerVar - shrtOffset );
+      }
+   }
+   
+   (*mem_count) += size_in_short;
+   PRT(printf("%5d words, %5d total/%d, in \"%s\"\n", size_in_short,
+   *mem_count, max_mem_usage, mesg));
+   
+   if ((unsigned int) *mem_count > max_mem_usage)
+   {
+      PRT_ERR(printf("%5d words, %5d total/%d, in \"%s\"\n", size_in_short,
+      *mem_count, max_mem_usage, mesg));
+      PRT_ERR(fprintf(stderr, "maximum size capacity exceeded at \"%s\"\n", mesg));
+      return NULL;
+   }
+   
+   return tmp;
+}
+
diff --git a/TIesrEngine/src/load_user.h b/TIesrEngine/src/load_user.h
new file mode 100644 (file)
index 0000000..98ec9d9
--- /dev/null
@@ -0,0 +1,113 @@
+/*=======================================================================
+ load_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header defines the interface with the model and grammar loading
+ functions.
+
+======================================================================*/
+
+#ifndef LOAD_USER_H
+#define LOAD_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+
+#include "status.h"
+#include "gmhmm_type.h"
+
+/* This is included in load_user.h to remind the user that the files
+   containing models and grammar must have fixed names */
+#include "filename.h"
+
+typedef struct fileConfiguration
+{
+      short byteMu;
+      short byteVar;
+} fileConfiguration_t;
+
+/*--------------------------------*/
+/* The user interface to the loading functions */
+
+TIESRENGINECOREAPI_API TIesrEngineStatusType load_scales( char *fname, gmhmm_type *gv );
+
+TIESRENGINECOREAPI_API unsigned short load_n_mfcc( char *fname );
+
+TIESRENGINECOREAPI_API void free_scales(gmhmm_type *gv);
+
+TIESRENGINECOREAPI_API void free_models(gmhmm_type *gv);
+
+/* @param bNotReadNetwork TRUE if the function does not read recognition network 
+ @param network_file char* to name of symbol network file 
+ @param word_list_file char* to the name of word list file
+*/
+TIESRENGINECOREAPI_API TIesrEngineStatusType load_models(char *mod_dir, gmhmm_type *gv,
+                                 char bNotReadNetwork, 
+                                 char * network_file, 
+                                 char * word_list_file );
+
+#ifdef USE_16BITMEAN_DECOD
+/* load mean vectors to either base mean for decoding or original mean for adaptation 
+   @param mod_dir pointer to model directory
+   @param gv pointer to gmhmm_type 
+   @bLoadBaseMu TRUE if load to base mean, FALSE if load to original mean */
+TIESRENGINECOREAPI_API TIesrEngineStatusType load_mean_vec(char * mod_dir, gmhmm_type * gv ,
+                                   Boolean bLoadBaseMu );
+#endif
+
+/* @param fname file name of a model ,
+      @param len pointer to the length of the read data */
+TIESRENGINECOREAPI_API short *load_model_file(char fname[], unsigned short *len);
+
+TIesrEngineStatusType load_model_config(char fname[], 
+                                       fileConfiguration_t *fileConfig );
+
+TIesrEngineStatusType unpacking(short *base, ushort nbr, short n_mfcc,
+                               FILE *fp, short scale[]);
+
+/* allocate a pointer to a space from a block of memory 
+   @param base_mem pointer to the block of memory
+   @param mem_count pointer to the currently used memory size
+   @param size_in_short requested memory size in word
+   @param max_mem_usage the maximum size of the block in word
+   @param aAlign if the requested data needs to adjust for SHORT INT or LONG data format
+   @param mesg message of this operation */
+short *mem_alloc( short * base_mem, ushort * mem_count, 
+                 ushort size_in_short, unsigned int max_mem_usage, 
+                 unsigned short aAlign, char *mesg );
+
+#endif
diff --git a/TIesrEngine/src/mfcc_f.cpp b/TIesrEngine/src/mfcc_f.cpp
new file mode 100755 (executable)
index 0000000..06c8dcf
--- /dev/null
@@ -0,0 +1,1272 @@
+/*=======================================================================
+ mfcc_f.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Functions dealing with mfcc calculation.
+======================================================================*/
+
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "tiesr_config.h"
+
+#include <stdlib.h>
+
+#include "gmhmm_type.h"
+#include "mfcc_f_user.h"
+#include "mfcc_f.h"
+#include "noise_sub_user.h"
+#include "dist_user.h"
+
+
+/* for FFT */
+/*
+const short w_real[ WINDOW_LEN / 2 ] =      
+{
+ 32767,  32757,  32727,  32678,  32609, 
+ 32520,  32412,  32284,  32137,  31970, 
+ 31785,  31580,  31356,  31113,  30851, 
+ 30571,  30272,  29955,  29621,  29268, 
+ 28897,  28510,  28105,  27683,  27244, 
+ 26789,  26318,  25831,  25329,  24811, 
+ 24278,  23731,  23169,  22594,  22004, 
+ 21402,  20787,  20159,  19519,  18867, 
+ 18204,  17530,  16845,  16150,  15446, 
+ 14732,  14009,  13278,  12539,  11792, 
+ 11038,  10278,   9511,   8739,   7961, 
+  7179,   6392,   5601,   4807,   4011, 
+  3211,   2410,   1607,    804,      0, 
+  -804,  -1607,  -2410,  -3211,  -4011, 
+ -4807,  -5601,  -6392,  -7179,  -7961, 
+ -8739,  -9511, -10278, -11038, -11792, 
+-12539, -13278, -14009, -14732, -15446, 
+-16150, -16845, -17530, -18204, -18867, 
+-19519, -20159, -20787, -21402, -22004, 
+-22594, -23169, -23731, -24278, -24811, 
+-25329, -25831, -26318, -26789, -27244, 
+-27683, -28105, -28510, -28897, -29268, 
+-29621, -29955, -30272, -30571, -30851, 
+-31113, -31356, -31580, -31785, -31970, 
+-32137, -32284, -32412, -32520, -32609, 
+-32678, -32727, -32757
+};
+
+const short w_imag[ WINDOW_LEN / 2 ] =
+{
+     0,   -804,  -1607,  -2410,  -3211, 
+ -4011,  -4807,  -5601,  -6392,  -7179, 
+ -7961,  -8739,  -9511, -10278, -11038, 
+-11792, -12539, -13278, -14009, -14732, 
+-15446, -16150, -16845, -17530, -18204, 
+-18867, -19519, -20159, -20787, -21402, 
+-22004, -22594, -23169, -23731, -24278, 
+-24811, -25329, -25831, -26318, -26789, 
+-27244, -27683, -28105, -28510, -28897, 
+-29268, -29621, -29955, -30272, -30571, 
+-30851, -31113, -31356, -31580, -31785, 
+-31970, -32137, -32284, -32412, -32520, 
+-32609, -32678, -32727, -32757, -32766, 
+-32757, -32727, -32678, -32609, -32520, 
+-32412, -32284, -32137, -31970, -31785, 
+-31580, -31356, -31113, -30851, -30571, 
+-30272, -29955, -29621, -29268, -28897, 
+-28510, -28105, -27683, -27244, -26789, 
+-26318, -25831, -25329, -24811, -24278, 
+-23731, -23169, -22594, -22004, -21402, 
+-20787, -20159, -19519, -18867, -18204, 
+-17530, -16845, -16150, -15446, -14732, 
+-14009, -13278, -12539, -11792, -11038, 
+-10278,  -9511,  -8739,  -7961,  -7179, 
+ -6392,  -5601,  -4807,  -4011,  -3211, 
+ -2410,  -1607,   -804
+};
+*/
+
+/* Hamming window */
+/*
+const short hw[ WINDOW_LEN ] = 
+{
+  2621,  2625,  2639,  2662,  2694,  2735,  2785,  2845, 
+  2913,  2990,  3076,  3171,  3275,  3388,  3509,  3639, 
+  3777,  3924,  4079,  4243,  4414,  4594,  4782,  4977, 
+  5180,  5391,  5610,  5835,  6068,  6308,  6555,  6808, 
+  7068,  7335,  7608,  7887,  8172,  8463,  8759,  9061, 
+  9368,  9680,  9997, 10319, 10645, 10975, 11310, 11648, 
+  11990, 12335, 12684, 13036, 13391, 13748, 14107, 14469, 
+  14833, 15198, 15565, 15934, 16303, 16673, 17044, 17415, 
+  17787, 18158, 18529, 18899, 19269, 19638, 20006, 20372, 
+  20737, 21099, 21460, 21819, 22174, 22528, 22878, 23225, 
+  23569, 23909, 24245, 24578, 24906, 25230, 25549, 25864, 
+  26174, 26478, 26777, 27071, 27359, 27641, 27917, 28186, 
+  28450, 28707, 28957, 29200, 29437, 29666, 29888, 30102, 
+  30309, 30509, 30700, 30884, 31060, 31227, 31387, 31538, 
+  31681, 31815, 31940, 32057, 32165, 32265, 32355, 32437, 
+  32510, 32574, 32628, 32674, 32710, 32738, 32756, 32765, 
+  32765, 32756, 32738, 32710, 32674, 32628, 32574, 32510, 
+  32437, 32355, 32265, 32165, 32057, 31940, 31815, 31681, 
+  31538, 31387, 31227, 31060, 30884, 30700, 30509, 30309, 
+  30102, 29888, 29666, 29437, 29200, 28957, 28707, 28450, 
+  28186, 27917, 27641, 27359, 27071, 26777, 26478, 26174, 
+  25864, 25549, 25230, 24906, 24578, 24245, 23909, 23569, 
+  23225, 22878, 22528, 22174, 21819, 21460, 21099, 20737, 
+  20372, 20006, 19638, 19269, 18899, 18529, 18158, 17787, 
+  17415, 17044, 16673, 16303, 15934, 15565, 15198, 14833, 
+  14469, 14107, 13748, 13391, 13036, 12684, 12335, 11990, 
+  11648, 11310, 10975, 10645, 10319,  9997,  9680,  9368, 
+  9061,  8759,  8463,  8172,  7887,  7608,  7335,  7068, 
+  6808,  6555,  6308,  6068,  5835,  5610,  5391,  5180, 
+  4977,  4782,  4594,  4414,  4243,  4079,  3924,  3777, 
+  3639,  3509,  3388,  3275,  3171,  3076,  2990,  2913, 
+  2845,  2785,  2735,  2694,  2662,  2639,  2625,  2621
+};
+*/ 
+
+/*
+#define reg_factor 3276
+*/
+
+/* ---------------------------------------------------------------------------
+   circular index on MFCC_BUF_SZ
+   ---------------------------------------------------------------------- */
+
+TIESRENGINECOREAPI_API short
+circ_idx(short idx)
+{
+  while ( idx < 0 ) idx += MFCC_BUF_SZ;
+  while ( idx >= MFCC_BUF_SZ ) idx -= MFCC_BUF_SZ;
+
+  return idx;
+}
+
+
+/* ---------------------------------------------------------------------------
+   regression
+   ---------------------------------------------------------------------- */
+
+TIESRENGINECOREAPI_API void
+compute_regression(short buf_idx,     /* 0 <=  < MFCC_BUF_SZ */
+                  short type,        /* 0: beg, 1: middle, 2: end */
+                  short *reg_mfcc, short n_mfcc, const short *mu_scale_p2, short mfcc_buf[ /*MFCC_BUF_SZ*/ ][ MAX_DIM_MFCC16 ])
+{
+   short i, j;
+   short i_adv, i_lag;
+   long  sum;
+
+   if ( type == 0 ) {                  /* beg, no lag, simple diff */
+
+     i_adv = circ_idx( buf_idx + 1 );
+     for (i = 0; i < n_mfcc; i++) {
+       reg_mfcc[i] = mfcc_buf[ i_adv ][i] - mfcc_buf[ buf_idx ][i];
+       reg_mfcc[i] <<= mu_scale_p2[ i ] - mu_scale_p2[ i + n_mfcc ];
+     }
+
+   } else if ( type == 1 ) {           /* both adv and lag, full regression */
+
+     for (i = 0; i < n_mfcc; i++) {
+       
+       sum = 0;
+       
+       for (j = 1; j <= REG_SPAN; j++) {
+
+        i_adv = circ_idx( buf_idx + j );
+        i_lag = circ_idx( buf_idx - j );
+        sum += j * ( mfcc_buf[ i_adv ][i] - mfcc_buf[ i_lag ][i] ); 
+       }
+       /* compensate mu_scale_p2[] */
+       sum <<= mu_scale_p2[ i ] - mu_scale_p2[ i + n_mfcc ];
+       
+       sum = reg_factor * sum;                   /* Q 15 * Q 11 = Q 26 */
+       reg_mfcc[ i ] = (short)  LONG_RIGHT_SHIFT_N(sum, 15 );    /* Q 11 */
+     }
+
+   } else if ( type == 2 ) {           /* end, no adv, simple diff */
+
+     i_lag = circ_idx( buf_idx - 1 );
+     for (i = 0; i < n_mfcc; i++) {
+       reg_mfcc[i] = mfcc_buf[ buf_idx ][i] - mfcc_buf[ i_lag ][i];
+       reg_mfcc[i] <<= mu_scale_p2[ i ] - mu_scale_p2[ i + n_mfcc ];
+     }
+
+   } else {
+
+     PRT_ERR(fprintf(stderr, "Error: type has to be 0 1 2\n"));
+   }
+   //   trouncate("D-MFCC", reg_mfcc, n_mfcc, n_mfcc);
+}
+
+#define accumulate_linear_mel_energy(tmp_l, tmp_s, mel_energy,  real_sig,  mel_filter) \
+      tmp_l = mel_filter * real_sig; /* Q14 x Q14 */ \
+      tmp_s = (short) LONG_RIGHT_SHIFT_N( tmp_l, 14 ); /* Q14  */      \
+      tmp_l = tmp_s * tmp_s; /* Q 28 */ \
+      tmp_l = LONG_RIGHT_SHIFT_N( tmp_l, 4 ); /* Q24  */ \
+      mel_energy += tmp_l;
+
+
+/* 
+** apply mel scale to fft spectrum
+*/
+
+void
+mel_scale_fft_spectrum(const short *real_sig, const short *imag_sig, 
+                      long *mel_energy, const short n_filter, const mel_filter_type mel_filter[])
+{
+  short cur_filter, prev_filter;
+  short i, tmp_s;
+  long tmp_l;
+  
+  for (i = 0; i < n_filter; i++)
+    mel_energy[i] = 0;
+
+  for (i = 0; i < WINDOW_LEN / 2; i++) {
+
+    cur_filter = mel_filter[i].num;
+    prev_filter = cur_filter - 1;
+
+    if ( prev_filter >= 0 ) {
+      /* real */
+      accumulate_linear_mel_energy(tmp_l, tmp_s, mel_energy[ prev_filter ],  real_sig[i],  mel_filter[i].x2);
+      /* imag */
+      accumulate_linear_mel_energy(tmp_l, tmp_s, mel_energy[ prev_filter ],  imag_sig[i],  mel_filter[i].x2);
+    }
+    if ( cur_filter < n_filter ) {
+      /* real */
+      accumulate_linear_mel_energy(tmp_l, tmp_s, mel_energy[ cur_filter ],  real_sig[i],  mel_filter[i].x1);
+      /* imag */
+      accumulate_linear_mel_energy(tmp_l, tmp_s, mel_energy[ cur_filter ],  imag_sig[i],  mel_filter[i].x1);
+    }
+  }
+}
+
+
+static void
+mel_scale(const short *power_spectrum, long *mel_energy, const short n_filter, const mel_filter_type mel_filter[])
+{
+  short cur_filter, prev_filter;
+  short i;
+
+  for (i = 0; i < n_filter; i++)
+    mel_energy[i] = 0;
+
+  for (i = 0; i < WINDOW_LEN / 2; i++) {
+
+    cur_filter = mel_filter[i].num;
+    prev_filter = cur_filter - 1;
+
+    if ( prev_filter >= 0 )
+      mel_energy[ prev_filter ] += (long) 
+       ( mel_filter[i].x2 * power_spectrum[i] );
+
+    if ( cur_filter < n_filter )
+      mel_energy[ cur_filter ] += (long) 
+       ( mel_filter[i].x1 * power_spectrum[i] );
+  }
+}
+
+#ifdef USE_FAST_DCT
+/* ---------------------------------------------------------------------------
+   cosine transform, notice the scaling and transpose of matrix
+   ---------------------------------------------------------------------- */
+/* faster cosine transform */
+void
+cos_transform(short *mfcc, short *mel_energy, const short *scale_p2, 
+             const short n_mfcc, const short n_filter,  const short *cosxfm[  MAX_DIM_MFCC16 ])
+{
+  short i, j, mfcc0;
+  long  tmp, sum[ N_FILTER26 ];
+
+  mfcc0 = mfcc[0];
+  mfcc[0] >>= 1;                                /* scale */
+
+  for (i = 0; i < n_filter; i++) {
+   
+    sum[i] = 0;
+
+    for (j = 0; j < n_mfcc; j++) {
+
+      /* Q 15 * Q 11 = Q 26, >> 17 = Q 9 ... see above*/
+      tmp = cosxfm[j][i] * mfcc[j];             /* transpose */
+      tmp >>= ( 13 - scale_p2[j] );             /* scale back -- this scale doesn't allow simplification*/
+      sum[i] += tmp;
+    }
+  }
+  
+  mfcc[0] = mfcc0;  /* restore the value */
+  for (i = 0; i < n_filter; i++) {
+    sum[i]=(( sum[i]*819)  + (sum[i]>>2)- (sum[i]>>4) ) >>17;  //0.05*2^14= 819.2 =>  819+0.25 -0.0625
+    mel_energy[i] = (short) sum[i];
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   inverse cosine transform
+   ---------------------------------------------------------------------- */
+/* faster version of inverse cosine transform */
+void
+inverse_cos_transform(short *log_mel_energy, short *mfcc, const short scale_p2[], 
+                     const short n_mfcc, const short n_filter,  const short *cosxfm[  MAX_DIM_MFCC16 ])
+{
+  short i, j, oe,  n2;
+  long  tmp, sum;
+
+  oe=0;
+  n2=n_filter>>1;
+  
+  for (i = 0; i < n_mfcc; i++) {
+    sum = 0;
+   
+    /* Q 15 * Q 9 = Q 24, >> 13 = Q 11 */
+    if (oe==0)
+      { for (j = 0; j < n2; j++) {
+       tmp = (cosxfm[i][j]>>1) * (log_mel_energy[j]+ log_mel_energy[n_filter-1-j]) ;
+       
+       sum += tmp>>( 7 + scale_p2[i] );
+      }
+      oe=1;
+      }  
+    else
+      {
+       for (j = 0; j < n2; j++) {              
+         tmp = cosxfm[i][j] * (log_mel_energy[j]- log_mel_energy[n_filter-1-j]) ;
+         
+         sum += tmp>>( 8 + scale_p2[i] );
+       }
+       oe=0;
+      }
+    mfcc[i] = (short) ((sum+ 16)>>5);
+  }
+}
+
+/*very specific to 20*9 IDCT*/
+void
+inverse_cos_transform3(short *log_mel_energy, short *mfcc, const short scale_p2[], 
+                     const short n_mfcc, const short n_filter,  const short *cosxfm[  MAX_DIM_MFCC16 ])
+{
+  short i, j, oe,  n2;
+  long  tmp, sum;
+
+  oe=0;
+  n2=n_filter>>1;
+  
+  for (i = 0; i < n_mfcc; i++) {
+    sum = 0;
+   
+    switch (i)
+      {
+      case 1:
+      case 3:
+      case 7:
+       for (j = 0; j < n2; j++) {              
+         tmp = cosxfm[i][j] * (log_mel_energy[j]- log_mel_energy[n_filter-1-j]) ;
+         sum += tmp>>( 8 + scale_p2[i] );
+       }
+       break;
+       
+      case 2:
+       for (j = 0; j < n2; j++) {
+         tmp = (cosxfm[i][j]) * (log_mel_energy[j]+ log_mel_energy[n_filter-1-j]) ;
+         sum += tmp>>( 8 + scale_p2[i] );
+       }
+       break;
+       
+      case 0:
+       for (j = 0; j < n_filter; j++)
+          sum+=log_mel_energy[j];
+       sum= (sum<<14) - (sum>>1); //*32767  then >>1  = *(32768-1) 
+       sum>>=( 7 + scale_p2[i] );
+       break;
+       
+      case 4:
+      
+       tmp=log_mel_energy[0]-log_mel_energy[4]-log_mel_energy[5]+log_mel_energy[9]+log_mel_energy[10]-log_mel_energy[14]-log_mel_energy[15]+log_mel_energy[19];
+       sum+=tmp* cosxfm[i][0];
+      
+       tmp=log_mel_energy[1]-log_mel_energy[3]-log_mel_energy[6]+log_mel_energy[8]+log_mel_energy[11]-log_mel_energy[13]-log_mel_energy[16]+log_mel_energy[18];
+       
+       sum+=tmp* cosxfm[i][1];
+       
+       sum>>= ( 8 + scale_p2[i] );
+       break;
+       
+      case 5:
+
+       tmp=log_mel_energy[0]-log_mel_energy[3]-log_mel_energy[4]+log_mel_energy[7]+log_mel_energy[8]  
+         -log_mel_energy[11]-log_mel_energy[12]+log_mel_energy[15]+log_mel_energy[16]-log_mel_energy[19];
+       sum+=tmp* cosxfm[i][0];
+       
+       tmp=log_mel_energy[1]-log_mel_energy[2]-log_mel_energy[5]+log_mel_energy[6]+log_mel_energy[9]  
+         -log_mel_energy[10]-log_mel_energy[13]+log_mel_energy[14]+log_mel_energy[17]-log_mel_energy[18];
+       
+       sum+=tmp* cosxfm[i][1];
+       
+       sum>>=( 8 + scale_p2[i] );
+       break;
+       
+      case 6:
+       tmp=log_mel_energy[0]-log_mel_energy[9]-log_mel_energy[10]+log_mel_energy[19];
+       
+       sum+=tmp* cosxfm[i][0];
+       
+       tmp=log_mel_energy[1]-log_mel_energy[8]-log_mel_energy[11]+log_mel_energy[18];
+       
+       sum+=tmp* cosxfm[i][1];
+       
+       tmp=log_mel_energy[2]-log_mel_energy[7]-log_mel_energy[12]+log_mel_energy[17];
+       
+       sum+=tmp* cosxfm[i][2];
+      
+       tmp=log_mel_energy[3]-log_mel_energy[6]-log_mel_energy[13]+log_mel_energy[16];
+       
+       sum+=tmp* cosxfm[i][3];
+      
+       tmp=log_mel_energy[4]-log_mel_energy[5]-log_mel_energy[14]+log_mel_energy[15];
+       
+       sum+=tmp* cosxfm[i][4];
+       
+       sum>>=( 8 + scale_p2[i] );
+       break;
+       
+      case 8:
+
+       tmp=log_mel_energy[0]+log_mel_energy[4]+log_mel_energy[5]+log_mel_energy[9]+log_mel_energy[10]+log_mel_energy[14]+log_mel_energy[15]+log_mel_energy[19];
+       
+       sum+=tmp* cosxfm[i][0];
+       
+       tmp=log_mel_energy[1]+log_mel_energy[3]+log_mel_energy[6]+log_mel_energy[8]+log_mel_energy[11]+log_mel_energy[13]+log_mel_energy[16]+log_mel_energy[18];
+      
+       sum+=tmp* cosxfm[i][1];
+       
+       tmp=log_mel_energy[2]+log_mel_energy[7]+log_mel_energy[12]+log_mel_energy[17];
+       
+       sum+= (tmp* cosxfm[i][2]); 
+       
+       sum>>=( 8 + scale_p2[i] );
+       break;
+       
+      default:
+       PRT_ERR(fprintf(stderr,"DCT dimension error"));
+       /* Q 15 * Q 9 = Q 24, >> 13 = Q 11 */
+       
+      }
+   
+    //rounding by adding  1<< 2^4  before >>5
+    mfcc[i] = (short) ((sum+ 16)>>5);
+    
+    
+  }
+
+/*just for verification
+   for (i = 0; i < n_mfcc; i++) {
+
+    sum = 0;
+
+    for (j = 0; j < n_filter; j++) {
+
+      
+      tmp = cosxfm[i][j] * log_mel_energy[j];
+      tmp += (long) 1 << ( 13 + scale_p2[i] - 1 );
+      tmp >>= ( 13 + scale_p2[i] );
+      sum += tmp;
+    }
+    printf("%d========%d, =======new%d\n", i, sum, mfcc[i] ); //= (short) sum;
+  }
+*/
+
+}
+#else
+/*the generic one*/
+void
+cos_transform(short *mfcc, short *mel_energy, const short *scale_p2, 
+             const short n_mfcc, const short n_filter,  const short *cosxfm[  MAX_DIM_MFCC16 ])
+{
+  short i, j, mfcc0;
+  long  tmp, sum[ N_FILTER26 ];
+
+  mfcc0 = mfcc[0];
+  mfcc[0] >>= 1;                                /* scale */
+
+  for (i = 0; i < n_filter; i++) {
+
+    sum[i] = 0;
+
+    for (j = 0; j < n_mfcc; j++) {
+
+      /* Q 15 * Q 11 = Q 26, >> 17 = Q 9 */
+      tmp = cosxfm[j][i] * mfcc[j];             /* transpose */
+      tmp += (long) 1 << ( 17 - scale_p2[j] - 1 );
+      tmp >>= ( 17 - scale_p2[j] );             /* scale back */
+      sum[i] += tmp;
+    }
+  }
+  mfcc[0] = mfcc0;  /* restore the value */
+  for (i = 0; i < n_filter; i++) {
+    sum[i] = sum[i] / n_filter;  /* this is a division ! need to remove */
+    sum[i] <<= 1;
+    mel_energy[i] = (short) sum[i];
+  }
+
+}
+
+void
+inverse_cos_transform(short *log_mel_energy, short *mfcc, const short scale_p2[], 
+                     const short n_mfcc, const short n_filter,  const short *cosxfm[  MAX_DIM_MFCC16 ])
+{
+  short i, j;
+  long  tmp, sum;
+
+  for (i = 0; i < n_mfcc; i++) {
+
+    sum = 0;
+
+    for (j = 0; j < n_filter; j++) {
+
+      /* Q 15 * Q 9 = Q 24, >> 13 = Q 11 */
+      tmp = cosxfm[i][j] * log_mel_energy[j];
+      tmp += (long) 1 << ( 13 + scale_p2[i] - 1 );
+      tmp >>= ( 13 + scale_p2[i] );
+      sum += tmp;
+    }
+    mfcc[i] = (short) sum;
+  }
+}
+
+#endif
+
+/* used for generating MFCC from noise-subtracted spectra */
+void
+ss_power_spectrum_to_mfcc(const short *power_spectrum, 
+                         short *mfcc,            /* Q 11 */
+                         short *log_mel_energy,  /* Q 9 */
+                         const short n_mfcc, const short n_filter, 
+                         const mel_filter_type mel_filter[],
+                         const short *mu_scale_p2, NormType *var_norm, 
+                         const short *cosxfm[  MAX_DIM_MFCC16 ])
+{
+  long  mel_energy[ N_FILTER26 ];          /* variable Q point, see below */
+  short i;
+  long  tmp;
+  short compensate;
+
+  /* power_spectrum : Q norm3,
+     mel_filter : Q 14*/
+  mel_scale(power_spectrum, mel_energy, n_filter, mel_filter);
+  
+  /* mel_energy : Q24 */
+  
+  /* log cannot handle 0, so substitute with min / 2 */
+  tmp = 2147483647;    /* LONG_MAX */
+  for (i = 0; i < n_filter; i++)
+    if ( mel_energy[ i ] != 0 && mel_energy[ i ] < tmp ) 
+      tmp = mel_energy[ i ];
+
+  tmp = tmp >= 2 ? ( tmp >> 1 ) : tmp;
+
+  for (i = 0; i < n_filter; i++)
+    if ( mel_energy[ i ] == 0 ) mel_energy[ i ] = tmp;    
+
+  /* now, mel_energy has scale factor:
+     (norm2 - 2) - 2 * (8 - norm0 - norm1) + 1 - 16 + 14 (x1,x2) = 
+     2 * norm1 + 2 * norm0 + norm2 - 19 */
+
+  compensate = 2 * var_norm->norm0 + 2 * var_norm->norm1 + var_norm->norm2 - 19;
+
+  for (i = 0; i < n_filter; i++) 
+    log_mel_energy[i] = log_polyfit( mel_energy[i], compensate);
+  
+  /* log2() to log10() */
+  for (i = 0; i < n_filter; i++) {
+    tmp = log_mel_energy[i] * LOG2TOLOG10;
+    
+    log_mel_energy[i] = (short) LONG_RIGHT_SHIFT_N(tmp,15);
+  }
+  //  prt_freq("mfcc", log_mel_energy, 9, n_filter);  
+  inverse_cos_transform(log_mel_energy, mfcc, mu_scale_p2, n_mfcc, n_filter, cosxfm);
+}
+
+#ifdef REC
+
+/* ---------------------------------------------------------------------------
+   power_spectrum to mfcc
+   ---------------------------------------------------------------------- */
+
+extern void prt_freq(char *mesg, short x[], unsigned short q, unsigned short N);
+
+extern FILE *pf_sp;
+#include <assert.h>
+
+void
+power_spectrum_to_mfcc(const short *power_spectrum, 
+                      short *mfcc,            /* Q 11 */
+                      short *log_mel_energy,  /* Q 9 */
+                      const short n_mfcc, const short n_filter, 
+                      const mel_filter_type mel_filter[],
+                      const short *mu_scale_p2, NormType *var_norm, const short *cosxfm[  MAX_DIM_MFCC16 ])
+{
+  long  mel_energy[ N_FILTER26 ];          /* variable Q point, see below */
+  short i;
+  long  tmp;
+  short compensate;
+
+  /* power spectrum scaling: */
+  short my_norm3 = ( var_norm->norm0 + var_norm->norm1 - 8 ) * 2 + ( var_norm->norm2 - 2 ) - 15;
+  
+  for (i=0; i< WINDOW_LEN/2; i++) {
+    float spect_f;
+    long tmp_l = (long)  power_spectrum[ i ];
+    short signal_abs_log2;
+    assert( tmp_l >=0);
+    
+    if (tmp_l > 0) /* log, with correction of  normalization factor */
+      signal_abs_log2 = log_polyfit( tmp_l, my_norm3);   /* Q 9 */
+    else 
+      signal_abs_log2 =  /* 20 */ 1<<9 ; /* ~65 dB in Q9 */
+    spect_f = (float)   signal_abs_log2/ (1<<9);
+    fwrite(&spect_f, sizeof(float),1,pf_sp);
+  }
+
+  mel_scale(power_spectrum, mel_energy, n_filter, mel_filter);
+
+  
+  /* log cannot handle 0, so substitute with min / 2 */
+  tmp = 2147483647;    /* LONG_MAX */
+  for (i = 0; i < n_filter; i++)
+    if ( mel_energy[ i ] != 0 && mel_energy[ i ] < tmp ) 
+      tmp = mel_energy[ i ];
+
+  tmp = tmp >= 2 ? ( tmp >> 1 ) : tmp;
+
+  for (i = 0; i < n_filter; i++)
+    if ( mel_energy[ i ] == 0 ) mel_energy[ i ] = tmp;    
+
+  /* now, mel_energy has scale factor:
+     (norm2 - 2) - 2 * (8 - norm0 - norm1) + 1 - 16 + 14 (x1,x2) = 
+     2 * norm1 + 2 * norm0 + norm2 - 19 */
+
+  compensate = 2 * var_norm->norm0 + 2 * var_norm->norm1 + var_norm->norm2 - 19;
+
+  for (i = 0; i < n_filter; i++) 
+    log_mel_energy[i] = log_polyfit( mel_energy[i], compensate);
+  
+  /* log2() to log10() */
+  for (i = 0; i < n_filter; i++) {
+    tmp = log_mel_energy[i] * LOG2TOLOG10;
+    
+    log_mel_energy[i] = (short) LONG_RIGHT_SHIFT_N(tmp,15);
+  }
+
+  inverse_cos_transform(log_mel_energy, mfcc, mu_scale_p2, n_mfcc, n_filter, cosxfm);
+}
+#endif
+
+/*
+** convert fft spectrum to mfcc coefficients
+*/
+void
+fft_spectrum_to_mfcc(const short *real_sig,const short *imag_sig,
+                    short *mfcc,            /* Q 11 */
+                    short *log_mel_energy,  /* Q 9 */
+                    const short n_mfcc, const short n_filter, 
+                    const mel_filter_type mel_filter[],
+                    const short *mu_scale_p2, NormType *var_norm, const short *cosxfm[  MAX_DIM_MFCC16 ])
+{
+  long  mel_energy[ N_FILTER26 ];          /* variable Q point, see below */
+  short i;
+  long  min, tmp;
+  short compensate;
+
+  /* power spectrum scaling: */
+  
+  mel_scale_fft_spectrum(real_sig, imag_sig, mel_energy, n_filter, mel_filter);
+  /* mel_energy is Q24 */
+  /* log cannot handle 0, so substitute with min / 2 */
+  min = 2147483647;    /* LONG_MAX */
+  for (i = 0; i < n_filter; i++)
+    if ( mel_energy[ i ] != 0 && mel_energy[ i ] < min ) 
+      min = mel_energy[ i ];
+
+  min = min >= 2 ? ( min >> 1 ) : min;
+
+  for (i = 0; i < n_filter; i++)
+    if ( mel_energy[ i ] == 0 ) mel_energy[ i ] = min;    
+
+  /* now, mel_energy has scale factor:
+     (norm2 - 2) - 2 * (8 - norm0 - norm1) + 1 - 16 + 14 (x1,x2) = 
+     2 * norm1 + 2 * norm0 + norm2 - 19 */
+
+  /*  compensate = 2 * var_norm->norm0 + 2 * var_norm->norm1 + var_norm->norm2 - 19; */
+  /* norm2 unused, norm2 - 2 + 1 -> -2  */
+  compensate = 2 * var_norm->norm0 + 2 * var_norm->norm1 -1 - 19;
+
+  for (i = 0; i < n_filter; i++) 
+    log_mel_energy[i] = log_polyfit( mel_energy[i], compensate);
+  
+  /* log2() to log10() */
+  for (i = 0; i < n_filter; i++) {
+    tmp = log_mel_energy[i] * LOG2TOLOG10;
+    
+    log_mel_energy[i] = (short) LONG_RIGHT_SHIFT_N(tmp,15);
+  }
+  //  prt_freq("mfcc", log_mel_energy, 9, n_filter);  
+  inverse_cos_transform(log_mel_energy, mfcc, mu_scale_p2, n_mfcc, n_filter, cosxfm);
+}
+
+/* ---------------------------------------------------------------------------
+   bit reverse order, used in FFT
+   ---------------------------------------------------------------------- */
+
+#ifdef REC
+static void
+bit_rev(short *x, short n_fft, short n_stage)
+{
+  short i, j;
+  short idx;
+  short x_rev[ WINDOW_LEN ];
+
+  for (i = 0; i < n_fft; i++) {
+
+    idx = 0;
+
+    for (j = 0; j < n_stage; j++)
+      idx = ( idx << 1 ) | ( ( i >> j ) & 1 );    /* bit reverse */
+
+    x_rev[ i ] = x[ idx ];
+  }
+
+  for ( i = 0; i < WINDOW_LEN; i++)
+    x[i] = x_rev[i];
+}
+
+#endif
+/* ---------------------------------------------------------------------------
+   bit reverse order, used in FFT
+   ---------------------------------------------------------------------- */
+
+static void
+bit_rev(short *x1, short *x2, short n_fft, short n_stage)
+{
+  short i, j, k, n_half, n_minus_one;
+  short idx;
+  short done[ WINDOW_LEN ];
+  short tmp;
+
+  for (i = 0; i < n_fft; i++) done[i] = 0;
+
+  n_half = n_fft >> 1;
+  n_minus_one = n_fft - 1;
+
+  for (i = 1; i < n_half; i++) {
+
+    if ( done[i] == 0 ) {
+
+      idx = 0;
+
+      for (j = 0; j < n_stage; j++)
+        idx = ( idx << 1 ) | ( ( i >> j ) & 1 );    /* bit reverse */
+
+      if ( i != idx ) {                             /* swap i and idx */
+
+        tmp = x1[i];
+        x1[i] = x1[idx];
+        x1[idx] = tmp;
+        tmp = x2[i];
+        x2[i] = x2[idx];
+        x2[idx] = tmp;
+
+        done[i] = 1;                       /* do not repeat */
+        done[idx] = 1;
+
+        k = ( ~ i ) & n_minus_one;         /* do the same for 1's complement */
+        idx = ( ~ idx ) & n_minus_one;
+
+        if ( done[k] == 0 ) {
+
+          tmp = x1[k];
+          x1[k] = x1[idx];
+          x1[idx] = tmp;
+          tmp = x2[k];
+          x2[k] = x2[idx];
+          x2[idx] = tmp;
+
+          done[k] = 1;                     /* do not repeat */
+          done[idx] = 1;
+        }
+      }
+    }
+  }
+}
+
+
+/* ---------------------------------------------------------------------------
+   decimation in time FFT
+   ---------------------------------------------------------------------- */
+    
+TIESRENGINECOREAPI_API void
+fft(short *real, short *imag)
+{
+  short n_fft;
+  short n_stage;
+  short group_cnt, group_size;
+  short idx1, idx2, widx;
+  short i, j;
+  long  r1, i1, r2, i2;
+
+  /* n_stage = log2( n_fft ) */
+
+  n_fft = WINDOW_LEN;
+  n_stage = 0;
+  while ( n_fft >>= 1 ) n_stage++;
+
+  /* decimation in time, bit reverse order input, normal order output */
+
+  bit_rev( real, imag, (short) WINDOW_LEN, n_stage );    /* overwrite */
+  /*   bit_rev( imag, (short) WINDOW_LEN, n_stage ); */
+
+  /* n_stage butterfly */
+
+  group_cnt = WINDOW_LEN >> 1;
+  group_size = 2;
+
+  while ( n_stage-- ) {
+
+    for (i = 0; i < group_cnt; i++) {
+
+      for (j = 0; j < group_size / 2; j++) {
+
+       /* idx1 and idx2 are the butterfly pair, in-place overwrite,
+          widx is the W_n */
+
+       idx1 = group_size * i + j;
+       idx2 = idx1 + group_size / 2;
+       widx = group_cnt * j;
+       
+       /* input data is assumed Q15 */
+       r1 = (long) real[idx1] << 15; /* Q 30 */
+       i1 = (long) imag[idx1] << 15; /* Q 30 */
+
+       /* may need cast (long), depending on machine */
+       /* w_real and w_imag are Q15 DFT twiddle factor coefficients */
+       r2 = real[idx2] * w_real[widx] - imag[idx2] * w_imag[widx]; /* Q 30 */
+       i2 = real[idx2] * w_imag[widx] + imag[idx2] * w_real[widx];
+
+       real[idx1] = (short) LONG_RIGHT_SHIFT_N( (r1 + r2), 16);
+         
+       imag[idx1] = (short) LONG_RIGHT_SHIFT_N( (i1 + i2), 16);
+        
+       real[idx2] = (short) LONG_RIGHT_SHIFT_N( (r1 - r2), 16);
+       imag[idx2] = (short) LONG_RIGHT_SHIFT_N( (i1 - i2), 16);  /* Q30 - Q16 = Q14 */
+      }
+    }
+
+    group_cnt /= 2;
+    group_size *= 2;
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   apply Hamming window
+   ---------------------------------------------------------------------- */
+
+static short hamming_window(short *sig)
+{
+  short i;
+  long  tmp, max;
+  short norm1;
+  max = 0;
+
+  /* find max */
+
+  for (i = 0; i < WINDOW_LEN; i++) {
+    tmp = sig[i] * hw[i];             /* Q 15 * Q 15 = Q 30 */
+    tmp = tmp > 0 ? tmp : (- tmp);
+    if ( tmp > max ) max = tmp;
+  }
+
+  /* normalize to most precision */
+
+  if ( max > 0 ) {
+
+    for (norm1 = 0; max < 0x40000000; norm1++)
+      max <<= 1;
+    
+    norm1 = norm1 > 0 ? norm1 - 1 : norm1;
+
+  } else {
+
+    norm1 = 0;
+  }
+
+  /* Hamming window */
+
+  for (i = 0; i < WINDOW_LEN; i++) {
+    tmp = sig[i] * hw[i];
+    tmp <<= norm1;
+    sig[i] = (short) LONG_RIGHT_SHIFT_N(tmp, 15 );
+  }
+  return norm1;
+}
+
+/* ---------------------------------------------------------------------------
+   preemphasis
+   ---------------------------------------------------------------------- */
+static short preemphasis(short *sig_in, short *sig_out, short *last_sig_0)
+{
+  //  static short last_sig = 0; 
+  short last_sig = *last_sig_0;
+  short  i;
+  long   tmp1, tmp2;
+  short  tmp, max, norm0;
+
+  max = last_sig > 0 ? last_sig : (- last_sig);
+
+  /* find max */
+
+  for (i = 0; i < WINDOW_LEN; i++) {
+    tmp = sig_in[ i ] > 0 ? sig_in[ i ] : (- sig_in[ i ]);
+    if ( tmp > max ) max = tmp;
+  }
+
+  /* normalize to most precision */
+
+  if ( max > 0 ) {
+
+    for (norm0 = 0; max < 0x4000; norm0++)
+      max <<= 1;
+    
+    norm0 = norm0 > 0 ? norm0 - 1 : norm0;
+
+  } else {
+
+    norm0 = 0;
+  }
+
+  tmp1 = (last_sig << norm0) * PREEMPHASIS;          /* Q 15 * Q 15 = Q 30 */
+  tmp2 = (long) (sig_in[0] << norm0) << 15;
+  sig_out[0] =  LONG_RIGHT_SHIFT_N( tmp2 - tmp1, 15);  /* Q 15 */
+
+  for (i = 1; i < WINDOW_LEN; i++) {
+    tmp1 = (sig_in[ i - 1 ] << norm0) * PREEMPHASIS;
+    tmp2 = (long) (sig_in[ i ] << norm0) << 15;
+    sig_out[i] = LONG_RIGHT_SHIFT_N( tmp2 - tmp1, 15);
+  }
+  
+  *last_sig_0 = sig_in[ FRAME_LEN - 1 ];
+  return norm0;
+}
+
+
+/* ---------------------------------------------------------------------------
+   complex fft to power spectrum
+   ---------------------------------------------------------------------- */
+
+static short fft_to_power_spectrum(const short *real, const short *imag, short *power_spectrum)
+{
+  short i, norm2;
+  long  tmp, max;
+
+  max = 0;
+
+  /* find max */
+  
+  for (i = 0; i < WINDOW_LEN >> 1; i++) {
+    tmp = real[i] * real[i] + imag[i] * imag[i];
+    tmp <<= 1; /* Times 2 */
+    if ( tmp > max ) max = tmp;
+  }
+
+  /* normalize to most precision */
+
+  if ( max > 0 ) {
+
+    for (norm2 = 0; max < 0x40000000; norm2++)
+      max <<= 1;
+
+  } else { /* max == 0 */
+
+    norm2 = 2;
+  }
+
+
+  //  assert( ( norm2 - 2 ) < 0);
+  
+  /* power spectrum, normalize */
+
+  for (i = 0; i < WINDOW_LEN >> 1 ; i++) {
+    tmp = real[i] * real[i] + imag[i] * imag[i];
+    tmp <<= 1;
+    tmp <<= ( norm2 - 2 );
+    power_spectrum[i] = (short)LONG_RIGHT_SHIFT_N( tmp, 16 );
+    //    power_spectrum[i] = tmp;
+  }
+  return norm2;
+  
+}
+  
+/* ---------------------------------------------------------------------------
+   speech signal to power_spectrum
+   ---------------------------------------------------------------------- */
+
+void
+signal_to_power_spectrum(short *sig, short real_sig[], short imag_sig[], 
+                        short *power_spectrum, NormType *nv, short *last_sig)
+{
+  short i;
+
+  nv->norm0 = preemphasis(sig, real_sig, last_sig);   /* do not overwrite sig */
+
+  nv->norm1 = hamming_window(real_sig);     /* overwrite real_sig */
+
+  for (i = 0; i < WINDOW_LEN; i++)
+    imag_sig[ i ] = 0;
+
+  fft(real_sig, imag_sig);      /* in-place FFT, overwrite real and imag_sig */
+
+  nv->norm2 = fft_to_power_spectrum(real_sig, imag_sig, power_spectrum);
+}
+
+
+/* ---------------------------------------------------------------------------
+   MFCC is in Q11 
+   ---------------------------------------------------------------------- */
+TIESRENGINECOREAPI_API void
+mfcc_a_window(short *sig, short *mfcc, short *log_mel_energy, const short n_mfcc, 
+             const short n_filter,
+             const mel_filter_type mel_filter[],
+             const short *cosxfm[  MAX_DIM_MFCC16 ],
+              short power_spectrum[], const short *mu_scale_p2, NormType *var_norm, 
+             short *last_sig, short * ctrl)
+{
+  short real_sig[ WINDOW_LEN ], imag_sig[ WINDOW_LEN ], norm, signal_abs_log2;
+
+  signal_to_power_spectrum(sig, real_sig, imag_sig, power_spectrum, var_norm, last_sig);
+
+  norm = ( var_norm->norm0 + var_norm->norm1 - 8 ) * 2 + ( var_norm->norm2 - 2 ) - 15;
+
+  if (ctrl){
+    signal_abs_log2 = ss_est_frmEn(WINDOW_LEN >> 1, power_spectrum, norm);
+    ss_update_meanEn(signal_abs_log2, ctrl);
+  }
+
+  fft_spectrum_to_mfcc(real_sig, imag_sig, mfcc, log_mel_energy, n_mfcc, n_filter, mel_filter, mu_scale_p2, var_norm, cosxfm );
+
+  if (ctrl){
+    ((NssType*)ctrl)->frm_count ++; 
+  }
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void dim_p2_init(const short nbr_mfcc, gmhmm_type *gvv)
+{
+
+  gmhmm_type *gv = (gmhmm_type *)gvv;
+  int i;
+
+  if (nbr_mfcc == MAX_DIM_MFCC16) {
+    //    printf("Using MAX_DIM_MFCC16 x N_FILTER26\n");
+    gv->n_filter = N_FILTER26 ;
+    for (i=0; i<MAX_DIM_MFCC16; i++) gv->cosxfm[ i ] = cosxfm26[ i ];
+    gv->mel_filter = mel_filter26;
+  }
+  else {
+    //    printf("Using MAX_DIM_MFCC10 x N_FILTER20\n");
+    gv->n_filter = N_FILTER20;
+    for (i=0; i<MAX_DIM_MFCC10; i++) gv->cosxfm[ i ] = cosxfm20[ i ];
+    gv->mel_filter = mel_filter20;
+  }
+
+  /* mfcc dimension related: */
+  for (i=0; i<DIM6; i++)  {
+    gv->muScaleP2[ i ] = mu_scale_p2_sta[ i ];
+    gv->muScaleP2[ i+nbr_mfcc ] = mu_scale_p2_dyn[ i ];
+  }
+  for (i = DIM6; i< nbr_mfcc; i++)  {
+    gv->muScaleP2[ i ] = 0;
+    gv->muScaleP2[ i+nbr_mfcc ] = 0;
+  }
+#ifdef REC
+  if (nbr_mfcc == 8)       return mu_scale_p2_dim8;
+  else if (nbr_mfcc == 10) return mu_scale_p2_dim10;
+  else { 
+    PRT_ERR(printf("feature dimension %d not implemented\n", nbr_mfcc));
+    PRT_ERR(exit(0));
+  }
+#endif
+}
+
+short ss_est_frmEn(short dim, short * pds_signal, short norm)
+{
+  short i; 
+  long tmp_l = 0;
+  for (i=0; i < dim ; i++) { /* for each frequency bin */
+    tmp_l = MAX(tmp_l, (long) pds_signal[i]); 
+  }
+
+  if (tmp_l > 0) /* log, with correction of  normalization factor */
+    tmp_l = log_polyfit( tmp_l, norm);   /* Q 9 */
+  else 
+    tmp_l = NSS_MIN_FRAME_ENR;
+  return LONG2SHORT(tmp_l); 
+}
+
+/* return 1/16 (0.5 + 16 * log2(x)) */
+static short ss_frameEn( short s_log )
+{
+  return 16 + s_log ;
+}
+
+short ss_update_meanEn(short frm_eng, short * pNss)
+{
+  short frmEn = ss_frameEn(frm_eng);
+  NssType * ctrl = (NssType*) pNss; 
+
+  if (ctrl->frm_count < MIN_FRAME)
+    ctrl->lambdaLTE = coef_1downto1over10_in_Q15[ ctrl->frm_count] ; 
+  else
+    ctrl->lambdaLTE = LAMBDA_LTE; 
+
+  if (frmEn - ctrl->meanEn < SNR_THRESHOLD_UPD_LTE || ctrl->frm_count < MIN_FRAME){
+    if (frmEn < ctrl->meanEn || ctrl->frm_count < MIN_FRAME)
+      ctrl->meanEn += q15_x(ctrl->lambdaLTE, frmEn - ctrl->meanEn); 
+    else
+      ctrl->meanEn += q15_x(ctrl->lambdaLTEhigherE, frmEn - ctrl->meanEn);
+    if (ctrl->meanEn < ENERGY_FLOOR) 
+      ctrl->meanEn = ENERGY_FLOOR; 
+  }
+
+  if (ctrl->frm_count == SS_NUM_FRM_FOR_NOISE_DET ){
+    PRT_ERR(printf("Noise level (log2) = %d\n", ctrl->meanEn)); 
+    ctrl->noiselvl = ctrl->meanEn; 
+  } 
+
+  return frmEn; 
+}
+
+
+//#define TABULATE_FILTER
+#ifdef TABULATE_FILTER
+
+/* ---------------------------------------------------------------------------
+   create MEL filter
+   ---------------------------------------------------------------------- */
+static  mel_filter_type mel_filter[ WINDOW_LEN / 2 ];
+
+void
+create_mel_filter()
+{
+  float factor, freq;
+  float mel_freq[ N_FILTER26 + 2 ];
+  float x1, x2;
+  short i, j;
+
+  /* solve ( factor ^ 10 = 4 ) */
+  factor = (float) pow( 10.0, 
+                       ( log10( (float) SAM_FREQ / 2 / CUT_FREQ ) 
+                         * (float) 2 / N_FILTER26 ) );
+
+  /* under 1000 Hz, linear */
+  for (i = 0; i <= N_FILTER26 / 2 + 1; i++)
+    mel_freq[ i ] = (float) CUT_FREQ * i * 2 / ( N_FILTER26 + 2 );
+
+  /* above 1000 Hz, factor ^ n */
+  for (i = N_FILTER26 / 2 + 2; i <= N_FILTER26 + 1; i++)
+    mel_freq[ i ] = factor * mel_freq[ i - 1 ];
+
+  /* triangular square window */
+  factor = (float) SAM_FREQ / 2 / ( WINDOW_LEN / 2 );
+
+  for (i = 0; i < WINDOW_LEN / 2; i++) {
+
+    freq = i * factor;
+
+    for (j = 0; j < N_FILTER26 + 1; j++) {
+
+      if ( freq >= mel_freq[ j ] && freq < mel_freq[ j + 1 ] ) {
+
+       mel_filter[i].num = j;
+       x1 = ( freq - mel_freq[j] ) / ( mel_freq[ j + 1 ] - mel_freq[ j ] );
+       x2 = 1 - x1;
+
+       /* square, power spectrum energy domain */
+       //      x1 = x1 * x1;
+       //      x2 = x2 * x2;
+
+       /* Q 14 */
+       mel_filter[i].x1 = (short) ( x1 * 16384 );
+       mel_filter[i].x2 = (short) ( x2 * 16384 );
+      }
+    }
+    printf("{ %5d, %5d, %5d },", mel_filter[i].num, mel_filter[i].x1,mel_filter[i].x2);
+    if (i % 3 == 2) printf("\n");
+  }
+  printf("\n");
+  exit(0);
+  
+}
+
+main()
+{
+  create_mel_filter();
+  
+}
+
+#endif
+
+/*
+** init constants: doesn't have to be called each time dimension changes
+*/
+
+#ifdef REC
+void
+const_init()
+{
+
+  short i, j;
+  /* init Hamming window */
+#ifdef REC
+  for (i = 0; i < WINDOW_LEN; i++)
+    hw[i] = (short) ( 32767 *                                       /* Q 15 */
+      ( 0.54 - 0.46 * cos( (float) 2 * PI * i / ( WINDOW_LEN - 1 ) ) ) );
+
+#endif
+  /* create mel-scaled, triangular-square filter */
+
+  create_mel_filter();
+
+  /* create cosine transform matrix */
+  for (i = 0; i < MAX_DIM_MFCC; i++) {
+    printf("{\n");
+    for (j = 0; j < N_FILTER; j++){
+      cosxfm[i][j] = (short) 
+       ( 32767 * cos( (float) i * ( j + 0.5 ) * PI / N_FILTER ) );
+      printf("%6d, ",   cosxfm[i][j]);
+      if (j == (N_FILTER/2-1)) printf("\n"); 
+    }
+    printf("},\n");
+  }
+  
+#ifdef DO_FFT
+  /* create FFT constants */
+  for (i = 0; i < WINDOW_LEN / 2; i++) {
+    w_real[i] = (short) ( 32767 * cos( (float) 2 * PI * i / WINDOW_LEN ) );
+    w_imag[i] = (short) ( 32767 * ( - sin( (float) 2 * PI * i / WINDOW_LEN )));
+  }    
+
+  /* compute regression factor */
+  reg_factor = 0;
+  for (i = 1; i <= REG_SPAN; i++)
+    reg_factor += i * i;
+  reg_factor = (short) ( (float) 32767 / ( 2 * reg_factor ) );
+#endif
+}
+
+main()
+{
+  const_init();
+}
+
+#endif
+
diff --git a/TIesrEngine/src/mfcc_f.h b/TIesrEngine/src/mfcc_f.h
new file mode 100644 (file)
index 0000000..5e41f6a
--- /dev/null
@@ -0,0 +1,592 @@
+/*=======================================================================
+ mfcc_f.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ Parameters for calculating mfcc vectors and transforms.
+======================================================================*/
+
+
+#ifndef  MFCC_F_H
+#define  MFCC_F_H
+
+#include  <stdio.h>
+#include  <math.h>
+
+#include "winlen.h"
+
+#include "tiesrcommonmacros.h"
+#include "mfcc_f_user.h"
+
+/*--------------------------------*/
+/* These are now in mfcc_f_def_struct_user.h */
+// size of buffer holding 2-byte audio samples that user must allocate
+
+/* window len = FFT len */
+/*
+#define   WINDOW_LEN   256                  
+*/
+
+/* overlap between two frames */
+/*
+#define   OVERLAP  (WINDOW_LEN - FRAME_LEN) 
+*/
+
+/*
+#define   N_FILTER20     20
+*/
+
+/*
+#define   N_FILTER26     26
+*/
+
+/* maximum number of mfcc */
+/*
+#define   MAX_DIM_MFCC10 10         
+*/
+
+/* maximum number of mfcc */
+/*
+#define   MAX_DIM_MFCC16 16          
+*/
+
+/* regression span */
+/*
+#define   REG_SPAN     2                  
+*/
+
+/* #define   MFCC_BUF_SZ  (2 * REG_SPAN + 1) */
+/*
+#define   MFCC_BUF_SZ  (2 * REG_SPAN + 10)
+*/
+
+/*--------------------------------*/
+/* Local constants for mfcc processing */
+
+#define   PI           3.1415926
+
+// Cingular 2125 Windows audio capture already seems to be doing
+// preemphasis
+#if defined (WIN32) || defined (WINCE)
+#define   PREEMPHASIS  33                   /* 0.001 in Q 15 */
+#else
+  #define   PREEMPHASIS  31457              /* 0.96 in Q 15 */
+#endif
+
+
+#define   SAM_FREQ     8000
+#define   CUT_FREQ     1000
+
+#define   LOGPOLYORD   8
+#define   MAX_COEF_LOGPOLY  24103         /* 94.15, Q8 */
+
+/* log10(2) = 0.30103 in Q 15 */
+/*
+#define   LOG2TOLOG10  9864               
+*/
+
+/* log2(10) = 3.3219 in Q 13 */
+/*
+#define   LOG10TOLOG2  27213              
+*/
+
+/* 0.6 in Q 15, 0.6 for wvdig, 1 for wvcmd */
+/* Presently this is not used anywhere */
+#define   PMC_GAIN     19661              
+
+/* for JAC */
+/*
+#define ACC_MEMORY (N_FILTER26 * 2 * 2)  
+*/
+
+
+/*  log2(10)/ln(10) in Q13 */
+/*
+#define LC   11818  
+*/
+
+/* ln 10 in Q13 */
+/*
+#define LN10 18863 
+*/
+
+
+#define reg_factor 3276
+
+
+/* These were originally in set_dim.cpp */
+#ifdef REC
+/* DIM MFCC == 8 */
+static const short mu_scale_p2_dim8 [ ] = { 4, 2, 2, 1, 1, 1, 0, 0,
+                                      2, 1, 1, 0, 0, 0, 0, 0};
+
+/* DIM MFCC == 10 */
+static const short mu_scale_p2_dim10[ ] = { 4, 2, 2, 1, 1, 1, 0, 0, 0, 0,
+                                      2, 1, 1, 0, 0, 0, 0, 0, 0, 0};
+
+#endif
+
+#define DIM6 6
+static const short mu_scale_p2_sta[ ] = { 4, 2, 2, 1, 1, 1, };
+static const short mu_scale_p2_dyn[ ] = { 2, 1, 1, 0, 0, 0, };
+
+
+/*--------------------------------*/
+/* These were originally in frontend_const.h */
+
+/* filter with 20 frequency bins (to be used with 8, 10 dimension mfcc): */
+
+static const mel_filter_type mel_filter20[ WINDOW_LEN / 2 ] =
+  {
+{     0,     0, 16384 },{     0,  5632, 10752 },{     0, 11264,  5120 },
+{     1,   512, 15872 },{     1,  6144, 10240 },{     1, 11776,  4607 },
+{     2,  1024, 15359 },{     2,  6656,  9727 },{     2, 12288,  4095 },
+{     3,  1536, 14847 },{     3,  7168,  9215 },{     3, 12800,  3583 },
+{     4,  2048, 14335 },{     4,  7680,  8703 },{     4, 13312,  3071 },
+{     5,  2560, 13823 },{     5,  8192,  8191 },{     5, 13824,  2559 },
+{     6,  3072, 13311 },{     6,  8704,  7680 },{     6, 14335,  2048 },
+{     7,  3583, 12800 },{     7,  9216,  7167 },{     7, 14848,  1535 },
+{     8,  4096, 12287 },{     8,  9728,  6655 },{     8, 15359,  1024 },
+{     9,  4608, 11776 },{     9, 10240,  6143 },{     9, 15872,   511 },
+{    10,  5120, 11263 },{    10, 10752,  5631 },{    11,     0, 16384 },
+{    11,  3443, 12940 },{    11,  6886,  9497 },{    11, 10329,  6054 },
+{    11, 13772,  2611 },{    12,   724, 15659 },{    12,  3721, 12662 },
+{    12,  6719,  9664 },{    12,  9716,  6667 },{    12, 12714,  3669 },
+{    12, 15711,   672 },{    13,  2024, 14359 },{    13,  4633, 11750 },
+{    13,  7243,  9140 },{    13,  9852,  6531 },{    13, 12462,  3921 },
+{    13, 15071,  1312 },{    14,  1129, 15254 },{    14,  3400, 12983 },
+{    14,  5672, 10711 },{    14,  7944,  8439 },{    14, 10215,  6168 },
+{    14, 12487,  3896 },{    14, 14759,  1624 },{    15,   563, 15820 },
+{    15,  2540, 13843 },{    15,  4518, 11865 },{    15,  6495,  9888 },
+{    15,  8473,  7910 },{    15, 10451,  5932 },{    15, 12428,  3955 },
+{    15, 14406,  1977 },{    16,     0, 16383 },{    16,  1721, 14662 },
+{    16,  3443, 12940 },{    16,  5164, 11219 },{    16,  6886,  9497 },
+{    16,  8608,  7775 },{    16, 10329,  6054 },{    16, 12051,  4332 },
+{    16, 13772,  2611 },{    16, 15494,   889 },{    17,   724, 15659 },
+{    17,  2223, 14160 },{    17,  3721, 12662 },{    17,  5220, 11163 },
+{    17,  6719,  9664 },{    17,  8218,  8165 },{    17,  9716,  6667 },
+{    17, 11215,  5168 },{    17, 12714,  3669 },{    17, 14213,  2170 },
+{    17, 15711,   672 },{    18,   719, 15664 },{    18,  2024, 14359 },
+{    18,  3329, 13054 },{    18,  4633, 11750 },{    18,  5938, 10445 },
+{    18,  7243,  9140 },{    18,  8547,  7836 },{    18,  9852,  6531 },
+{    18, 11157,  5226 },{    18, 12462,  3921 },{    18, 13766,  2617 },
+{    18, 15071,  1312 },{    18, 16376,     7 },{    19,  1129, 15254 },
+{    19,  2265, 14118 },{    19,  3400, 12983 },{    19,  4536, 11847 },
+{    19,  5672, 10711 },{    19,  6808,  9575 },{    19,  7944,  8439 },
+{    19,  9080,  7303 },{    19, 10215,  6168 },{    19, 11351,  5032 },
+{    19, 12487,  3896 },{    19, 13623,  2760 },{    19, 14759,  1624 },
+{    19, 15895,   488 },{    20,   563, 15820 },{    20,  1551, 14832 },
+{    20,  2540, 13843 },{    20,  3529, 12854 },{    20,  4518, 11865 },
+{    20,  5507, 10876 },{    20,  6495,  9888 },{    20,  7484,  8899 },
+{    20,  8473,  7910 },{    20,  9462,  6921 },{    20, 10451,  5932 },
+{    20, 11439,  4944 },{    20, 12428,  3955 },{    20, 13417,  2966 },
+{    20, 14406,  1977 },{    20, 15395,   988 }
+};
+
+/*
+
+    {    0,     0, 16384}, {    0,  1936,  7056}, {    0,  7744,  1600}, 
+    {    1,    16, 15376}, {    1,  2304,  6400}, {    1,  8464,  1295}, 
+    {    2,    64, 14399}, {    2,  2704,  5775}, {    2,  9216,  1023}, 
+    {    3,   144, 13455}, {    3,  3136,  5183}, {    3, 10000,   783}, 
+    {    4,   256, 12543}, {    4,  3600,  4623}, {    4, 10816,   575}, 
+    {    5,   400, 11663}, {    5,  4096,  4095}, {    5, 11664,   399}, 
+    {    6,   576, 10815}, {    6,  4624,  3600}, {    6, 12543,   256}, 
+    {    7,   783, 10000}, {    7,  5184,  3135}, {    7, 13456,   143}, 
+    {    8,  1024,  9215}, {    8,  5776,  2703}, {    8, 14399,    64}, 
+    {    9,  1296,  8464}, {    9,  6400,  2303}, {    9, 15376,    15}, 
+    {   10,  1600,  7743}, {   10,  7056,  1935}, {   11,     0, 16384}, 
+    {   11,   723, 10221}, {   11,  2894,  5505}, {   11,  6512,  2237}, 
+    {   11, 11577,   416}, {   12,    32, 14967}, {   12,   845,  9785}, 
+    {   12,  2755,  5701}, {   12,  5762,  2713}, {   12,  9866,   821}, 
+    {   12, 15067,    27}, {   13,   250, 12585}, {   13,  1310,  8427}, 
+    {   13,  3202,  5099}, {   13,  5925,  2603}, {   13,  9479,   938}, 
+    {   13, 13864,   105}, {   14,    77, 14203}, {   14,   705, 10288}, 
+    {   14,  1963,  7002}, {   14,  3851,  4347}, {   14,  6369,  2322}, 
+    {   14,  9517,   926}, {   14, 13295,   161}, {   15,    19, 15277}, 
+    {   15,   394, 11696}, {   15,  1246,  8593}, {   15,  2575,  5967}, 
+    {   15,  4382,  3819}, {   15,  6666,  2148}, {   15,  9428,   954}, 
+    {   15, 12667,   238}, {   16,     0, 16383}, {   16,   180, 13121}, 
+    {   16,   723, 10221}, {   16,  1628,  7682}, {   16,  2894,  5505}, 
+    {   16,  4522,  3690}, {   16,  6512,  2237}, {   16,  8864,  1145}, 
+    {   16, 11577,   416}, {   16, 14653,    48}, {   17,    32, 14967}, 
+    {   17,   301, 12239}, {   17,   845,  9785}, {   17,  1663,  7606}, 
+    {   17,  2755,  5701}, {   17,  4122,  4069}, {   17,  5762,  2713}, 
+    {   17,  7677,  1630}, {   17,  9866,   821}, {   17, 12329,   287}, 
+    {   17, 15067,    27}, {   18,    31, 14976}, {   18,   250, 12585}, 
+    {   18,   676, 10402}, {   18,  1310,  8427}, {   18,  2152,  6659}, 
+    {   18,  3202,  5099}, {   18,  4459,  3747}, {   18,  5925,  2603}, 
+    {   18,  7598,  1667}, {   18,  9479,   938}, {   18, 11567,   418}, 
+    {   18, 13864,   105}, {   18, 16368,     0}, {   19,    77, 14203}, 
+    {   19,   313, 12167}, {   19,   705, 10288}, {   19,  1256,  8566}, 
+    {   19,  1963,  7002}, {   19,  2829,  5596}, {   19,  3851,  4347}, 
+    {   19,  5032,  3256}, {   19,  6369,  2322}, {   19,  7865,  1545}, 
+    {   19,  9517,   926}, {   19, 11327,   465}, {   19, 13295,   161}, 
+    {   19, 15420,    14}, {   20,    19, 15277}, {   20,   147, 13427}, 
+    {   20,   394, 11696}, {   20,   760, 10085}, {   20,  1246,  8593}, 
+    {   20,  1851,  7220}, {   20,  2575,  5967}, {   20,  3419,  4833}, 
+    {   20,  4382,  3819}, {   20,  5464,  2924}, {   20,  6666,  2148}, 
+    {   20,  7987,  1491}, {   20,  9428,   954}, {   20, 10988,   537}, 
+    {   20, 12667,   238}, {   20, 14466,    59}
+  };
+*/
+/* filter with 26 frequency bins (to be used with 16 dimension mfcc) : */
+
+static const mel_filter_type mel_filter26[ WINDOW_LEN / 2 ] = {
+
+{     0,     0, 16384 },{     0,  7168,  9216 },{     0, 14336,  2048 },
+{     1,  5119, 11264 },{     1, 12287,  4096 },{     2,  3071, 13312 },
+{     2, 10239,  6144 },{     3,  1023, 15360 },{     3,  8191,  8192 },
+{     3, 15359,  1024 },{     4,  6143, 10240 },{     4, 13312,  3072 },
+{     5,  4096, 12288 },{     5, 11263,  5120 },{     6,  2047, 14336 },
+{     6,  9215,  7168 },{     7,     0, 16384 },{     7,  7167,  9216 },
+{     7, 14335,  2048 },{     8,  5119, 11264 },{     8, 12288,  4095 },
+{     9,  3072, 13311 },{     9, 10240,  6143 },{    10,  1024, 15359 },
+{    10,  8192,  8192 },{    10, 15359,  1024 },{    11,  6143, 10240 },
+{    11, 13311,  3072 },{    12,  4095, 12288 },{    12, 11264,  5119 },
+{    13,  2048, 14335 },{    13,  9216,  7167 },{    14,     0, 16384 },
+{    14,  4549, 11834 },{    14,  9099,  7284 },{    14, 13649,  2734 },
+{    15,  1631, 14752 },{    15,  5721, 10662 },{    15,  9811,  6572 },
+{    15, 13900,  2483 },{    16,  1443, 14940 },{    16,  5119, 11264 },
+{    16,  8795,  7588 },{    16, 12471,  3912 },{    16, 16147,   236 },
+{    17,  3091, 13292 },{    17,  6395,  9988 },{    17,  9700,  6683 },
+{    17, 13004,  3379 },{    17, 16308,    75 },{    18,  2901, 13482 },
+{    18,  5871, 10512 },{    18,  8841,  7542 },{    18, 11811,  4572 },
+{    18, 14781,  1602 },{    19,  1229, 15154 },{    19,  3898, 12485 },
+{    19,  6568,  9815 },{    19,  9237,  7146 },{    19, 11907,  4476 },
+{    19, 14576,  1807 },{    20,   775, 15608 },{    20,  3174, 13209 },
+{    20,  5574, 10809 },{    20,  7973,  8410 },{    20, 10373,  6010 },
+{    20, 12772,  3611 },{    20, 15172,  1211 },{    21,  1067, 15316 },
+{    21,  3224, 13159 },{    21,  5381, 11002 },{    21,  7538,  8845 },
+{    21,  9694,  6689 },{    21, 11851,  4532 },{    21, 14008,  2375 },
+{    21, 16165,   218 },{    22,  1741, 14642 },{    22,  3680, 12703 },
+{    22,  5619, 10764 },{    22,  7557,  8826 },{    22,  9496,  6887 },
+{    22, 11435,  4948 },{    22, 13373,  3010 },{    22, 15312,  1071 },
+{    23,   779, 15604 },{    23,  2521, 13862 },{    23,  4264, 12119 },
+{    23,  6007, 10376 },{    23,  7749,  8634 },{    23,  9492,  6891 },
+{    23, 11234,  5149 },{    23, 12977,  3406 },{    23, 14719,  1664 },
+{    24,    70, 16313 },{    24,  1636, 14747 },{    24,  3203, 13180 },
+{    24,  4769, 11614 },{    24,  6335, 10048 },{    24,  7901,  8482 },
+{    24,  9468,  6915 },{    24, 11034,  5349 },{    24, 12600,  3783 },
+{    24, 14167,  2216 },{    24, 15733,   650 },{    25,   823, 15560 },
+{    25,  2230, 14153 },{    25,  3638, 12745 },{    25,  5046, 11337 },
+{    25,  6454,  9929 },{    25,  7862,  8521 },{    25,  9270,  7113 },
+{    25, 10678,  5705 },{    25, 12085,  4298 },{    25, 13493,  2890 },
+{    25, 14901,  1482 },{    25, 16309,    74 },{    26,  1198, 15185 },
+{    26,  2464, 13919 },{    26,  3729, 12654 },{    26,  4994, 11389 },
+{    26,  6260, 10123 },{    26,  7525,  8858 },{    26,  8791,  7592 },
+{    26, 10056,  6327 },{    26, 11322,  5061 },{    26, 12587,  3796 },
+{    26, 13853,  2530 },{    26, 15118,  1265 }
+};
+
+  /*
+
+{     0,     0, 16384 },{     0,  3136,  5184 },{     0, 12544,   256 },
+{     1,  1599,  7744 },{     1,  9215,  1024 },{     2,   575, 10816 },
+{     2,  6399,  2304 },{     3,    63, 14400 },{     3,  4095,  4096 },
+{     3, 14399,    64 },{     4,  2303,  6400 },{     4, 10816,   576 },
+{     5,  1024,  9216 },{     5,  7743,  1600 },{     6,   255, 12544 },
+{     6,  5183,  3136 },{     7,     0, 16384 },{     7,  3135,  5184 },
+{     7, 12543,   256 },{     8,  1599,  7744 },{     8,  9216,  1023 },
+{     9,   576, 10815 },{     9,  6400,  2303 },{    10,    64, 14399 },
+{    10,  4096,  4096 },{    10, 14399,    64 },{    11,  2303,  6400 },
+{    11, 10815,   576 },{    12,  1023,  9216 },{    12,  7744,  1599 },
+{    13,   256, 12543 },{    13,  5184,  3135 },{    14,     0, 16384 },
+{    14,  1263,  8547 },{    14,  5053,  3238 },{    14, 11371,   456 },
+{    15,   162, 13283 },{    15,  1997,  6939 },{    15,  5874,  2636 },
+{    15, 11793,   376 },{    16,   127, 13623 },{    16,  1599,  7744 },
+{    16,  4721,  3514 },{    16,  9493,   934 },{    16, 15914,     3 },
+{    17,   583, 10783 },{    17,  2496,  6089 },{    17,  5742,  2726 },
+{    17, 10321,   697 },{    17, 16232,     0 },{    18,   513, 11094 },
+{    18,  2104,  6744 },{    18,  4771,  3472 },{    18,  8515,  1275 },
+{    18, 13335,   156 },{    19,    92, 14017 },{    19,   927,  9514 },
+{    19,  2633,  5880 },{    19,  5208,  3116 },{    19,  8653,  1223 },
+{    19, 12969,   199 },{    20,    36, 14870 },{    20,   615, 10649 },
+{    20,  1896,  7132 },{    20,  3880,  4317 },{    20,  6567,  2205 },
+{    20,  9957,   795 },{    20, 14050,    89 },{    21,    69, 14318 },
+{    21,   634, 10569 },{    21,  1767,  7388 },{    21,  3468,  4776 },
+{    21,  5736,  2731 },{    21,  8573,  1253 },{    21, 11977,   344 },
+{    21, 15949,     2 },{    22,   185, 13085 },{    22,   826,  9849 },
+{    22,  1927,  7072 },{    22,  3486,  4754 },{    22,  5504,  2895 },
+{    22,  7981,  1494 },{    22, 10916,   553 },{    22, 14311,    70 },
+{    23,    37, 14862 },{    23,   388, 11728 },{    23,  1109,  8964 },
+{    23,  2202,  6572 },{    23,  3665,  4550 },{    23,  5499,  2898 },
+{    23,  7703,  1618 },{    23, 10278,   708 },{    23, 13224,   169 },
+{    24,     0, 16243 },{    24,   163, 13274 },{    24,   626, 10604 },
+{    24,  1388,  8233 },{    24,  2449,  6162 },{    24,  3811,  4391 },
+{    24,  5471,  2919 },{    24,  7431,  1746 },{    24,  9691,   873 },
+{    24, 12250,   299 },{    24, 15108,    25 },{    25,    41, 14779 },
+{    25,   303, 12225 },{    25,   808,  9914 },{    25,  1554,  7845 },
+{    25,  2542,  6017 },{    25,  3773,  4432 },{    25,  5245,  3088 },
+{    25,  6959,  1987 },{    25,  8915,  1127 },{    25, 11113,   509 },
+{    25, 13553,   134 },{    25, 16235,     0 },{    26,    87, 14074 },
+{    26,   370, 11826 },{    26,   848,  9773 },{    26,  1522,  7916 },
+{    26,  2392,  6255 },{    26,  3456,  4789 },{    26,  4717,  3518 },
+{    26,  6173,  2443 },{    26,  7824,  1563 },{    26,  9671,   879 },
+{    26, 11713,   390 },{    26, 13951,    97 }, };
+
+*/
+
+/*
+** COS transformation, to be used with (8, 10) x 20 transformations
+*/
+
+static const short cosxfm20[ MAX_DIM_MFCC10 ][ N_FILTER20 ] = /* cosine transform */
+{
+
+{32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 
+ 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,},
+
+
+{32665, 31861, 30272, 27938, 24916, 21280, 17120, 12539, 7649, 2570, 
+ -2570, -7649, -12539, -17120, -21280, -24916, -27938, -30272, -31861, -32665, },
+
+
+{32363, 29195, 23169, 14875, 5125, -5125, -14875, -23169, -29195, -32363, 
+ -32363, -29195, -23169, -14875, -5125, 5125, 14875, 23169, 29195, 32363,} ,
+
+{31861, 24916, 12539, -2570, -17120, -27938, -32665, -30272, -21280, -7649, 
+ 7649, 21280, 30272, 32665, 27938, 17120, 2570, -12539, -24916, -31861, },
+
+{31163, 19259, 0, -19259, -31163, -31163, -19259, 0, 19259, 31163, 
+ 31163, 19259, 0, -19259, -31163, -31163, -19259, 0, 19259, 31163, },
+
+{30272, 12539, -12539, -30272, -30272, -12539, 12539, 30272, 30272, 12539, 
+ -12539, -30272, -30272, -12539, 12539, 30272, 30272, 12539, -12539, -30272, },
+
+{29195, 5125, -23169, -32363, -14875, 14875, 32363, 23169, -5125, -29195, 
+ -29195, -5125, 23169, 32363, 14875, -14875, -32363, -23169, 5125, 29195, },
+
+{27938, -2570, -30272, -24916, 7649, 31861, 21280, -12539, -32665, -17120, 
+ 17120, 32665, 12539, -21280, -31861, -7649, 24916, 30272, 2570, -27938, },
+
+{26509, -10125, -32766, -10125, 26509, 26509, -10125, -32766, -10125, 26509, 
+ 26509, -10125, -32766, -10125, 26509, 26509, -10125, -32766, -10125, 26509, },
+
+{24916, -17120, -30272, 7649, 32665, 2570, -31861, -12539, 27938, 21280, 
+ -21280, -27938, 12539, 31861, -2570, -32665, -7649, 30272, 17120, -24916}
+};
+
+
+/*
+** COS transformation, to be used with 16 x 26 transformations
+*/
+static const short cosxfm26[ MAX_DIM_MFCC16][ N_FILTER26 ] =  /* cosine transform */
+{
+{
+ 32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767, 
+ 32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767,  32767, },
+{
+ 32707,  32230,  31283,  29880,  28041,  25793,  23169,  20208,  16951,  13447,   9748,   5906,   1978, 
+ -1978,  -5906,  -9748, -13447, -16951, -20208, -23169, -25793, -28041, -29880, -31283, -32230, -32707, },
+{
+ 32528,  30637,  26966,  21728,  15227,   7841,      0,  -7841, -15227, -21728, -26966, -30637, -32528, 
+-32528, -30637, -26966, -21728, -15227,  -7841,      0,   7841,  15227,  21728,  26966,  30637,  32528, },
+{
+ 32230,  28041,  20208,   9748,  -1978, -13447, -23169, -29880, -32707, -31283, -25793, -16951,  -5906, 
+  5906,  16951,  25793,  31283,  32707,  29880,  23169,  13448,   1978,  -9748, -20208, -28041, -32230, },
+{
+ 31814,  24526,  11619,  -3949, -18613, -29013, -32766, -29013, -18613,  -3949,  11619,  24526,  31814, 
+ 31814,  24526,  11619,  -3949, -18613, -29013, -32766, -29013, -18613,  -3949,  11619,  24526,  31814, },
+{
+ 31283,  20208,   1978, -16951, -29880, -32230, -23169,  -5906,  13447,  28041,  32707,  25793,   9748, 
+ -9748, -25793, -32707, -28041, -13448,   5906,  23169,  32230,  29880,  16951,  -1978, -20208, -31283, },
+{
+ 30637,  15227,  -7841, -26966, -32528, -21728,      0,  21728,  32528,  26966,   7841, -15227, -30637, 
+-30637, -15227,   7841,  26966,  32528,  21728,      0, -21728, -32528, -26966,  -7841,  15227,  30637, },
+{
+ 29880,   9748, -16951, -32230, -25793,  -1978,  23169,  32707,  20208,  -5906, -28041, -31283, -13448, 
+ 13447,  31283,  28041,   5906, -20208, -32707, -23169,   1978,  25793,  32230,  16951,  -9748, -29880, },
+{
+ 29013,   3949, -24526, -31814, -11619,  18613,  32766,  18613, -11619, -31814, -24526,   3949,  29013, 
+ 29013,   3949, -24526, -31814, -11619,  18613,  32766,  18613, -11619, -31814, -24526,   3949,  29013, },
+{
+ 28041,  -1978, -29880, -25793,   5906,  31283,  23169,  -9748, -32230, -20208,  13447,  32707,  16951, 
+-16951, -32707, -13448,  20208,  32230,   9748, -23169, -31283,  -5906,  25793,  29880,   1978, -28041, },
+{
+ 26966,  -7841, -32528, -15227,  21728,  30637,      0, -30637, -21728,  15227,  32528,   7841, -26966, 
+-26966,   7841,  32528,  15227, -21728, -30637,      0,  30637,  21728, -15227, -32528,  -7841,  26966, },
+{
+ 25793, -13447, -32230,  -1978,  31283,  16951, -23169, -28041,   9748,  32707,   5906, -29880, -20208, 
+ 20208,  29880,  -5906, -32707,  -9748,  28041,  23169, -16951, -31283,   1978,  32230,  13448, -25793, },
+{
+ 24526, -18613, -29013,  11619,  31814,  -3949, -32766,  -3949,  31814,  11619, -29013, -18613,  24526, 
+ 24526, -18613, -29013,  11619,  31814,  -3949, -32766,  -3949,  31814,  11619, -29013, -18613,  24526, },
+{
+ 23169, -23169, -23169,  23169,  23169, -23169, -23169,  23169,  23169, -23169, -23169,  23169,  23169, 
+-23169, -23169,  23169,  23169, -23169, -23169,  23169,  23169, -23169, -23169,  23169,  23169, -23169, },
+{
+ 21728, -26966, -15227,  30637,   7841, -32528,      0,  32528,  -7841, -30637,  15227,  26966, -21728, 
+-21728,  26966,  15227, -30637,  -7841,  32528,      0, -32528,   7841,  30637, -15227, -26966,  21728, },
+{
+ 20208, -29880,  -5906,  32707,  -9748, -28041,  23169,  16951, -31283,  -1978,  32230, -13447, -25793, 
+ 25793,  13448, -32230,   1978,  31283, -16951, -23169,  28041,   9748, -32707,   5906,  29880, -20208, },
+
+};
+
+
+
+const short w_real[ WINDOW_LEN / 2 ] =      /* for FFT */
+{
+ 32767,  32757,  32727,  32678,  32609, 
+ 32520,  32412,  32284,  32137,  31970, 
+ 31785,  31580,  31356,  31113,  30851, 
+ 30571,  30272,  29955,  29621,  29268, 
+ 28897,  28510,  28105,  27683,  27244, 
+ 26789,  26318,  25831,  25329,  24811, 
+ 24278,  23731,  23169,  22594,  22004, 
+ 21402,  20787,  20159,  19519,  18867, 
+ 18204,  17530,  16845,  16150,  15446, 
+ 14732,  14009,  13278,  12539,  11792, 
+ 11038,  10278,   9511,   8739,   7961, 
+  7179,   6392,   5601,   4807,   4011, 
+  3211,   2410,   1607,    804,      0, 
+  -804,  -1607,  -2410,  -3211,  -4011, 
+ -4807,  -5601,  -6392,  -7179,  -7961, 
+ -8739,  -9511, -10278, -11038, -11792, 
+-12539, -13278, -14009, -14732, -15446, 
+-16150, -16845, -17530, -18204, -18867, 
+-19519, -20159, -20787, -21402, -22004, 
+-22594, -23169, -23731, -24278, -24811, 
+-25329, -25831, -26318, -26789, -27244, 
+-27683, -28105, -28510, -28897, -29268, 
+-29621, -29955, -30272, -30571, -30851, 
+-31113, -31356, -31580, -31785, -31970, 
+-32137, -32284, -32412, -32520, -32609, 
+-32678, -32727, -32757
+};
+
+const short w_imag[ WINDOW_LEN / 2 ] =
+{
+     0,   -804,  -1607,  -2410,  -3211, 
+ -4011,  -4807,  -5601,  -6392,  -7179, 
+ -7961,  -8739,  -9511, -10278, -11038, 
+-11792, -12539, -13278, -14009, -14732, 
+-15446, -16150, -16845, -17530, -18204, 
+-18867, -19519, -20159, -20787, -21402, 
+-22004, -22594, -23169, -23731, -24278, 
+-24811, -25329, -25831, -26318, -26789, 
+-27244, -27683, -28105, -28510, -28897, 
+-29268, -29621, -29955, -30272, -30571, 
+-30851, -31113, -31356, -31580, -31785, 
+-31970, -32137, -32284, -32412, -32520, 
+-32609, -32678, -32727, -32757, -32766, 
+-32757, -32727, -32678, -32609, -32520, 
+-32412, -32284, -32137, -31970, -31785, 
+-31580, -31356, -31113, -30851, -30571, 
+-30272, -29955, -29621, -29268, -28897, 
+-28510, -28105, -27683, -27244, -26789, 
+-26318, -25831, -25329, -24811, -24278, 
+-23731, -23169, -22594, -22004, -21402, 
+-20787, -20159, -19519, -18867, -18204, 
+-17530, -16845, -16150, -15446, -14732, 
+-14009, -13278, -12539, -11792, -11038, 
+-10278,  -9511,  -8739,  -7961,  -7179, 
+ -6392,  -5601,  -4807,  -4011,  -3211, 
+ -2410,  -1607,   -804
+};
+
+const short hw[ WINDOW_LEN ] =       /* Hamming window */
+{
+  2621,  2625,  2639,  2662,  2694,  2735,  2785,  2845, 
+  2913,  2990,  3076,  3171,  3275,  3388,  3509,  3639, 
+  3777,  3924,  4079,  4243,  4414,  4594,  4782,  4977, 
+  5180,  5391,  5610,  5835,  6068,  6308,  6555,  6808, 
+  7068,  7335,  7608,  7887,  8172,  8463,  8759,  9061, 
+  9368,  9680,  9997, 10319, 10645, 10975, 11310, 11648, 
+  11990, 12335, 12684, 13036, 13391, 13748, 14107, 14469, 
+  14833, 15198, 15565, 15934, 16303, 16673, 17044, 17415, 
+  17787, 18158, 18529, 18899, 19269, 19638, 20006, 20372, 
+  20737, 21099, 21460, 21819, 22174, 22528, 22878, 23225, 
+  23569, 23909, 24245, 24578, 24906, 25230, 25549, 25864, 
+  26174, 26478, 26777, 27071, 27359, 27641, 27917, 28186, 
+  28450, 28707, 28957, 29200, 29437, 29666, 29888, 30102, 
+  30309, 30509, 30700, 30884, 31060, 31227, 31387, 31538, 
+  31681, 31815, 31940, 32057, 32165, 32265, 32355, 32437, 
+  32510, 32574, 32628, 32674, 32710, 32738, 32756, 32765, 
+  32765, 32756, 32738, 32710, 32674, 32628, 32574, 32510, 
+  32437, 32355, 32265, 32165, 32057, 31940, 31815, 31681, 
+  31538, 31387, 31227, 31060, 30884, 30700, 30509, 30309, 
+  30102, 29888, 29666, 29437, 29200, 28957, 28707, 28450, 
+  28186, 27917, 27641, 27359, 27071, 26777, 26478, 26174, 
+  25864, 25549, 25230, 24906, 24578, 24245, 23909, 23569, 
+  23225, 22878, 22528, 22174, 21819, 21460, 21099, 20737, 
+  20372, 20006, 19638, 19269, 18899, 18529, 18158, 17787, 
+  17415, 17044, 16673, 16303, 15934, 15565, 15198, 14833, 
+  14469, 14107, 13748, 13391, 13036, 12684, 12335, 11990, 
+  11648, 11310, 10975, 10645, 10319,  9997,  9680,  9368, 
+  9061,  8759,  8463,  8172,  7887,  7608,  7335,  7068, 
+  6808,  6555,  6308,  6068,  5835,  5610,  5391,  5180, 
+  4977,  4782,  4594,  4414,  4243,  4079,  3924,  3777, 
+  3639,  3509,  3388,  3275,  3171,  3076,  2990,  2913, 
+  2845,  2785,  2735,  2694,  2662,  2639,  2625,  2621
+};
+
+
+
+
+
+
+/*--------------------------------*/
+/* These are now moved to mfcc_f_user.h */
+
+//typedef struct 
+//{
+//  short norm0;  /* preemphasis */
+//  short norm1;  /* Hamming */
+//  short norm2;  /* power spectrum */
+//} NormType;
+
+/* mel filter, mel scale, triangular square */
+/*
+typedef struct {   
+  short num;
+  short x1;
+  short x2;
+} mel_filter_type;
+*/
+
+/*--------------------------------*/
+/* Now in tiesrcommonmacros.h */
+/* right shift with rounding: */
+/*
+#define LONG_RIGHT_SHIFT_N(_val_,_n_) (((_val_) + ((long)1<<((_n_)-1))) >>(_n_))
+*/
+
+/*--------------------------------*/
+/* Now in mfcc_f_user.h */
+/*
+extern short log_polyfit(long value, short compensate);
+// extern long pow_polyfit( short value );
+
+
+extern void mfcc_a_window(short *sig, short *mfcc, short *log_mel_energy, const short n_mfcc, const short n_filter, 
+                         const mel_filter_type mel_filter[], const short *cosxfm[  MAX_DIM_MFCC16 ],
+                          short [], const short [], NormType *, short * );
+
+extern void 
+cos_transform(short *mfcc, short *mel_energy, const short *scale_p2, 
+             const short n_mfcc, const short n_filter,  const short *cosxfm[  MAX_DIM_MFCC16 ]);
+extern void
+inverse_cos_transform(short *log_mel_energy, short *mfcc, const short scale_p2[], 
+                     const short n_mfcc, const short n_filter,  const short *cosxfm[  MAX_DIM_MFCC16 ]);
+*/
+//extern void 
+//pmc(short *sp_mfcc_o,     /* original non-PMC MFCC mean */
+//    short *noise_log_ps, /* noise log mel energy */
+//    short *pmc_mfcc,     /* PMC-compensated MFCC mean */
+//    short *chn,          /* channel estimate  */
+//    short jac,           /* jac/pmc switch  */
+//    short n_mfcc, short n_filter, const short *mu_scale_p2, short *scale_mu,
+//    const short *cosxfm[  MAX_DIM_MFCC16 ]);
+
+/*
+extern void 
+log_spectral_compensation(short sp_log_ps[], short reg_sp_log_ps[],  short pmc_log_ps[],  short reg_pmc_log_ps[], 
+                         const short noise_log_ps[], const short chn[], short jac, short *log_df, short n_filter);
+*/
+
+#endif
diff --git a/TIesrEngine/src/mfcc_f_def_struct_user.h b/TIesrEngine/src/mfcc_f_def_struct_user.h
new file mode 100644 (file)
index 0000000..1c16a2c
--- /dev/null
@@ -0,0 +1,73 @@
+/*=======================================================================
+ mfcc_f_def_struct_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header file encapsulates and exposes the portion of the mfcc
+ feature processor that contains global constants and structures.
+ These are split from mfcc_f_user, since these are needed by
+ the gmhmm_type structure, and that structure is used within the 
+ function interface of the mfcc feature processor.
+
+======================================================================*/
+
+#ifndef MFCC_F_DEF_STRUCT_USER_H
+#define MFCC_F_DEF_STRUCT_USER_H 
+
+
+/* Actually defines FRAME_LEN for application designer */
+#include "winlen.h"
+
+/*--------------------------------*/
+/* Constants that need to be exposed so they can be used elsewhere */
+
+/* window len = FFT len */
+#define   WINDOW_LEN   256                  
+
+/* overlap between two frames */
+#define   OVERLAP  (WINDOW_LEN - FRAME_LEN) 
+
+#define   N_FILTER20     20
+
+#define   N_FILTER26     26
+
+/* for JAC */
+#define ACC_MEMORY (N_FILTER26 * 2 * 2)  
+
+/* maximum number of mfcc */
+#define   MAX_DIM_MFCC10 10         
+
+/* maximum number of mfcc */
+#define   MAX_DIM_MFCC16 16          
+
+/* static + dynamic feature vector size*/
+#define   MAX_DIM  (2 * MAX_DIM_MFCC16) 
+
+/* regression span */
+#define   REG_SPAN     2                  
+
+/* #define   MFCC_BUF_SZ  (2 * REG_SPAN + 1) */
+#define   MFCC_BUF_SZ  (2 * REG_SPAN + 10)
+
+
+/*--------------------------------*/
+
+/* Structure used in both mfcc and uttdet */
+typedef struct 
+{
+  short norm0;  /* preemphasis */
+  short norm1;  /* Hamming */
+  short norm2;  /* power spectrum */
+} NormType;
+
+
+/* mel filter structure used in gmhmm_type structure */
+typedef struct {   /* mel filter, mel scale, triangular square */
+  short num;
+  short x1;
+  short x2;
+} mel_filter_type;
+
+
+#endif
diff --git a/TIesrEngine/src/mfcc_f_user.h b/TIesrEngine/src/mfcc_f_user.h
new file mode 100644 (file)
index 0000000..6564b93
--- /dev/null
@@ -0,0 +1,130 @@
+/*=======================================================================
+ mfcc_f_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header file defines the interface with the tiesr mfcc feature
+ processor.  This is separated from mfcc_f.h, so that fundamental
+ constants are not exposed to the user of the functions.
+ Some constants here are used throughout other code, and so these are not
+ encapsulated.
+
+======================================================================*/
+
+#ifndef MFCC_F_USER_H
+#define MFCC_F_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+
+#include "tiesr_config.h"
+#include "mfcc_f_def_struct_user.h"
+#include "gmhmm_type.h"
+
+
+/*--------------------------------*/
+/* The user interface functions */
+
+TIESRENGINECOREAPI_API void mfcc_a_window( short *sig, short *mfcc, short *log_mel_energy,
+                   const short n_mfcc, const short n_filter, 
+                   const mel_filter_type mel_filter[], 
+                   const short *cosxfm[],
+                   short [], const short [], NormType *, short * ,
+                   short *pNss);
+
+
+TIESRENGINECOREAPI_API void cos_transform( short *mfcc, short *mel_energy, const short *scale_p2,
+                   const short n_mfcc, const short n_filter,  
+                   const short *cosxfm[]);
+
+
+TIESRENGINECOREAPI_API void inverse_cos_transform( short *log_mel_energy, short *mfcc,
+                          const short scale_p2[], const short n_mfcc, 
+                          const short n_filter,  
+                          const short *cosxfm[] );
+
+
+TIESRENGINECOREAPI_API void fft(short *real, short *imag);
+
+TIESRENGINECOREAPI_API short circ_idx(short idx);
+
+
+/* void dim_p2_init( const short nbr_mfcc, gmhmm_type *gvv ); */
+TIESRENGINECOREAPI_API void dim_p2_init( const short nbr_mfcc, gmhmm_type *gvv );
+
+
+// Now defined in dist.cpp
+/* log2()
+   @param value fixed-point value
+   @param compensate Q number of the value
+   @return log2(value) in Q9 */
+// TIESRENGINECOREAPI_API short log_polyfit(long value, short compensate);
+
+
+TIESRENGINECOREAPI_API void compute_regression(short buf_idx, short type,  short *reg_mfcc,
+                       short n_mfcc, const short *mu_scale_p2, 
+                       short mfcc_buf[ /*MFCC_BUF_SZ*/ ][ MAX_DIM_MFCC16 ]);
+
+void signal_to_power_spectrum(short *sig, short real_sig[], short imag_sig[], 
+                             short *power_spectrum, NormType *nv, short *last_sig);
+
+void
+mel_scale_fft_spectrum(const short *real_sig, const short *imag_sig, 
+                      long *mel_energy, const short n_filter, 
+                      const mel_filter_type mel_filter[]);
+
+void
+fft_spectrum_to_mfcc(const short *real_sig,const short *imag_sig,
+                    short *mfcc,            /* Q 11 */
+                    short *log_mel_energy,  /* Q 9 */
+                    const short n_mfcc, const short n_filter, 
+                    const mel_filter_type mel_filter[],
+                    const short *mu_scale_p2, NormType *var_norm, 
+                    const short *cosxfm[  MAX_DIM_MFCC16 ]);
+
+void
+ss_power_spectrum_to_mfcc(const short *power_spectrum, 
+                      short *mfcc,            /* Q 11 */
+                      short *log_mel_energy,  /* Q 9 */
+                      const short n_mfcc, const short n_filter, 
+                      const mel_filter_type mel_filter[],
+                      const short *mu_scale_p2, NormType *var_norm, 
+                      const short *cosxfm[  MAX_DIM_MFCC16 ]);
+
+short ss_est_frmEn(short dim, short * pds_signal, short norm);
+short ss_update_meanEn(short frm_eng, short * ctrl);
+
+
+#endif
diff --git a/TIesrEngine/src/noise_sub.cpp b/TIesrEngine/src/noise_sub.cpp
new file mode 100755 (executable)
index 0000000..806dca9
--- /dev/null
@@ -0,0 +1,494 @@
+/*=======================================================================
+ noise_subs.cpp
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+ Noise subtraction operating in power spectral domain. Added noise
+ subtraction with VAD.
+======================================================================*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+
+#include "tiesr_config.h"
+#include "tiesrcommonmacros.h"
+#include "mfcc_f_user.h"
+#include "uttdet_user.h"
+#include "dist_user.h"
+#include "noise_sub_user.h"
+#include "noise_sub.h"
+#include "load_user.h"
+
+//#define _DBG_NSS
+
+#ifndef USE_AUDIO /* when audio on, disable print trace */
+// #define PRT_TRACE  
+#endif
+
+#ifdef PRT_TRACE 
+static FILE  *psm;
+static FILE  *pns;
+static FILE  *psi;
+static FILE  *pso;
+/* log2, in Q9, to dB, in float: */
+#define log2todB(x) ((x)/(float)(1<<9) * log10(2) * 10)
+/* norm: scaling */
+#define power2dB(x,norm) 10*log10( ( (x)==0? 1: (x)) * pow(2., -norm))
+#endif
+
+TIESRENGINECOREAPI_API void init_spect_sub(short *noise_smooth)
+{
+  *noise_smooth =  NOISE_SMOOTH;
+}
+
+/*
+** in-place spectral subtraction:
+** both in log2 domain:
+short *ps_noisy_smoothed;
+short *noise_floor;
+*/
+
+TIESRENGINECOREAPI_API void noise_subs(short *ps_signal, short norm,
+               short *ps_noisy_smoothed, short *noise_floor, unsigned short count_frm, short *noise_smooth)
+{
+  long  tmp_l;
+  long  reference_lin, signal_lin, noise_lin, clean_lin, diff_lin;
+  short i, dim = WINDOW_LEN >> 1;
+  short signal_abs_log2, noise_abs_log2;
+  short counter_sh, max_abs, norm_pow, total_norm;
+
+#ifdef PRT_TRACE
+  if (count_frm == 0) {
+    psm = fopen("SMOf.d","w");
+    pns = fopen("NYSf.d","w");
+    psi = fopen("SIGIf.d","w");
+    pso = fopen("SIGOf.d","w");
+  }
+#endif
+  for (i=0; i < dim ; i++) { /* for each frequency bin */
+      tmp_l = (long) ps_signal[i]; 
+      if (tmp_l > 0) /* log, with correction of  normalization factor */
+       signal_abs_log2 = log_polyfit( tmp_l, norm);   /* Q 9 */
+      else 
+       signal_abs_log2 = (count_frm == 0)? 20 <<9 : noise_floor[i]; /* ~65 dB in Q9 */
+      
+      if (count_frm == 0) noise_floor[i] = ps_noisy_smoothed[i] = signal_abs_log2;
+
+      /* The smoothing and dip tracking are in absolute dB: */
+      /* filtered PS of noisy speech, in log2  */
+      tmp_l = SMOOTHING(ps_noisy_smoothed[i],(*noise_smooth),signal_abs_log2);
+      ps_noisy_smoothed[i] = LONG_RIGHT_SHIFT_N(tmp_l,15);
+
+      /* noise floor: */
+      noise_floor[i] = update_level(ps_noisy_smoothed[i], noise_floor[i], SSNLUPTC, SSNLDNTC); 
+      
+      /* we have signal and noise estimate, in log2, both in Q9 */
+
+      noise_abs_log2 =  noise_floor[i];
+
+      max_abs = MAX(noise_abs_log2 /* Q9 */, signal_abs_log2 /* Q9 */);
+
+      tmp_l = max_abs;
+      tmp_l -= 15870; /* max value w/o overflowing pow_poly */
+      if (tmp_l < 0) norm_pow = 0;
+      else if (tmp_l == 0) norm_pow =1;
+      else norm_pow = (tmp_l >> 9) + 1; 
+
+      noise_abs_log2 -= 512 * norm_pow; /* norm_pow is dim-specific */
+      signal_abs_log2   -= 512 * norm_pow;
+      /* linear noise and signal: */
+      signal_lin = pow_polyfit((short)signal_abs_log2);
+      noise_lin  = pow_polyfit((short)noise_abs_log2);
+
+      // Test whether new noise_lin >> 3 vs. old signal_lin >> 6 is causing problems with VAD
+      // reference_lin = signal_lin >> 6;
+      reference_lin = noise_lin >> 3; 
+
+      counter_sh = 0;
+      while (noise_lin & 0xfc000000){ /* make sure no overflow after mult by ALPHA (6bits) */
+       signal_lin >>= 1;
+       noise_lin >>= 1;
+       counter_sh++;
+      }
+      
+      diff_lin = signal_lin -  ALPHA * noise_lin;
+
+      if (diff_lin < 0) clean_lin = reference_lin;
+
+      else {
+       diff_lin <<= counter_sh;
+       /* clean_lin: cleaned-up speech signal */
+       if (diff_lin < reference_lin)  clean_lin = reference_lin;
+       else  clean_lin = diff_lin;
+      }
+      
+      total_norm = norm_pow + norm;
+      if (total_norm >= 0) clean_lin <<= total_norm;
+      else clean_lin >>= (-total_norm);
+
+#ifdef PRT_TRACE      
+      fprintf(psm,"%f ", log2todB(ps_noisy_smoothed[i]));
+      fprintf(pns,"%f ", log2todB(noise_floor[i]));
+      fprintf(pso,"%f ", power2dB(clean_lin,norm));
+      fprintf(psi,"%f ", power2dB(ps_signal[i],norm));
+#endif
+      if (clean_lin > 32767) { /* should not happen */
+       ps_signal[i] =  32767;
+       //      printf("clean limited\n");
+      }
+      else ps_signal[i] = (short) clean_lin; /* output cleaned, normalized speech */
+  }
+
+  if (count_frm == 9) *noise_smooth = MIN_SMOOTH;
+  
+#ifdef PRT_TRACE
+  fprintf(psm,"\n");
+  fprintf(pns,"\n");
+  fprintf(psi,"\n");
+  fprintf(pso,"\n");
+#endif  
+}
+
+static void ss_init(NssType * ctrl)
+{
+  ctrl->nbSpeechFrame = 0; 
+  ctrl->hangOver = 0;
+  ctrl->meanEn = 0;
+  ctrl->prevMeanEn = 0;
+
+  ctrl->prob_sp = 0; 
+  ctrl->frm_count = 0;
+}
+
+void ss_reset(NssType * ctrl)
+{
+  ctrl->nbSpeechFrame = 0; 
+  ctrl->hangOver = 0;
+  ctrl->prob_sp = 0; 
+  ctrl->frm_count = 0;
+}
+
+void ss_set_parm( ushort sAlpha, short sBeta, NssType* p_ss_crtl)
+{
+  if (p_ss_crtl){
+    p_ss_crtl->sAlpha = sAlpha;
+    p_ss_crtl->sBeta = sBeta ;     
+  }
+}
+
+static Boolean ss_VAD(short frm_eng, NssType * ctrl)
+{
+  short frmEn = ss_update_meanEn(frm_eng, (short*)ctrl);
+  Boolean flagVADnest = 0; 
+
+  ctrl->frmEn = frmEn; 
+  if (ctrl->frm_count > 4){
+    if (frmEn - ctrl->meanEn > SNR_THRESHOLD_VAD){
+      flagVADnest = 1; 
+      ctrl->nbSpeechFrame ++; 
+    }else{
+      if (ctrl->nbSpeechFrame > MIN_SPEECH_FRAME_HANGOVER)
+       ctrl->hangOver = HANGOVER; 
+      ctrl->nbSpeechFrame = 0; 
+      if (ctrl->hangOver != 0){
+       ctrl->hangOver --; 
+       flagVADnest = 1; 
+      }
+      else
+       flagVADnest = 0;
+    }
+  }
+  return flagVADnest;
+}
+
+/* spectral subtraction, code implemented according to X. Huang's book. 
+   with VAD to contral smoothing parameter in noise estimation.
+*/
+static void ss_noise_subs(short *pds_signal, short norm, 
+                         short *noise_floor, short *snr, 
+                         unsigned short count_frm, NssType * ctrl)
+{
+  long  tmp_l, ltmp2;
+  long  signal_lin, clean_lin;
+  long  lIndic;
+  ushort Q15 = 32767;
+  short i, dim = WINDOW_LEN >> 1;
+  short signal_abs_log2, noise_abs_log2;
+  short norm_pow, total_norm;
+  ushort onemalpha_p= Q15 - ctrl->alpha_p; 
+  long lgain_fm1 ; /* the gain at frequency f-1 */
+  long gain; 
+  short *sLongTermNoise = ctrl->ps_long_term_noise; 
+
+  signal_abs_log2 = ss_est_frmEn(dim, pds_signal, norm); 
+  if (ss_VAD(signal_abs_log2, ctrl))
+    lIndic = 32767;
+  else lIndic = 0; 
+
+#ifdef DBG_SS
+  printf("gain : ");
+#endif
+
+  /* calculate speech presence probability */
+  ctrl->prob_sp = q15_x( onemalpha_p, lIndic ) + 
+    q15_x( ctrl->alpha_p, ctrl->prob_sp ) ;
+  for (i=0; i < dim ; i++) { /* for each frequency bin */
+      tmp_l = (long) pds_signal[i]; 
+      if (tmp_l > 0) /* log, with correction of  normalization factor */
+       signal_abs_log2 = log_polyfit( tmp_l, norm);   /* Q 9 */
+      else 
+       signal_abs_log2 = (ctrl->frm_count == 0)? -3401 : noise_floor[i]; /* 0.01 in log2 in Q9 */
+
+      unsigned short alpha_smooth; 
+      if (count_frm == 0) {
+       noise_floor[i] = signal_abs_log2 ; 
+       sLongTermNoise[i] = noise_floor[i]; 
+      }
+      else{
+       if (count_frm <= 10){
+         tmp_l = count_frm << 15 ; 
+         tmp_l /= (count_frm + 1);
+         alpha_smooth = LONG2SHORT(tmp_l);  /* 1-1/t in Q15 */
+
+         noise_floor[i] = q15_x(alpha_smooth, noise_floor[i]) 
+           + q15_x(32768 - alpha_smooth, signal_abs_log2);
+
+       }else if ( ctrl->prob_sp < 6553 /* 0.2 in probability */){
+         if (sLongTermNoise[i] <= signal_abs_log2)
+           tmp_l = div32_32_Q(sLongTermNoise[i], signal_abs_log2, 9); /* Q9 */
+         else 
+           tmp_l = div32_32_Q(signal_abs_log2, sLongTermNoise[i], 9); /* Q9 */
+         tmp_l = (1<<9) - tmp_l; 
+         gain = tmp_l * tmp_l ; 
+         gain >>= 9; /* the 1 - 2*long_term_noise/y^l + (long_term_noise/y^l)^2 */
+           
+         tmp_l = noise_floor[i] - sLongTermNoise[i]; 
+         if (sLongTermNoise[i] <= signal_abs_log2)
+           tmp_l = div32_32_Q(tmp_l, signal_abs_log2, 9);
+         else
+           tmp_l = div32_32_Q(tmp_l, sLongTermNoise[i], 9);
+         tmp_l *= tmp_l; 
+         tmp_l >>= 9; 
+         tmp_l += gain; 
+         
+         if (tmp_l ==0) alpha_smooth = 0; 
+         else 
+           alpha_smooth = div32_32_Q(gain, tmp_l, 15); 
+       
+         alpha_smooth = MAX(9830, alpha_smooth);
+         alpha_smooth = MIN(31785, alpha_smooth); 
+
+         noise_floor[i] = q15_x(alpha_smooth, noise_floor[i]) 
+           + q15_x(32768 - alpha_smooth, signal_abs_log2);
+
+       }
+       
+       if (count_frm <= 10) {
+         tmp_l = count_frm << 15 ; 
+         tmp_l /= (count_frm + 1);
+         alpha_smooth = LONG2SHORT(tmp_l);  /* 1-1/t in Q15 */
+       }
+       else 
+         alpha_smooth = 29491; 
+       sLongTermNoise[i] = q15_x(alpha_smooth, sLongTermNoise[i]) + 
+         q15_x(32768 - alpha_smooth, noise_floor[i]); 
+      }
+
+      noise_abs_log2 =  noise_floor[i];
+
+      if (count_frm == 0)
+       snr[i] = signal_abs_log2 - noise_abs_log2; 
+      else// if (count_frm <= 9)// time smoothing 
+       snr[i] = q15_x(3276, snr[i]) + q15_x(29491, signal_abs_log2 - noise_abs_log2);
+      tmp_l = -snr[i]; 
+
+      /* the noise to signal threshold is computed as 
+        N^l - Y^l > log2(1 - a) 
+        where a is 10^(-A/10) and A is the minimum SNR gain. 
+        The A is set to -15dB in the current setup. 
+        The following setup can be used 
+        [ -8dB -127 -1361 ]
+        [ -10dB -77 -1701 ]
+        [ -13.86dB -31  -2358]
+        [ -15dB -23 -2551]
+        [ -20dB -7 -3401 ] 
+      */
+
+      if (tmp_l >= -127){
+       tmp_l = -1361; 
+      }else{
+       tmp_l = LOG2Q9 * tmp_l;
+       tmp_l >>= 9; /* log(N/Y) in Q9 */
+       tmp_l = hlr_expn(tmp_l, 9); /* Q15 */
+       tmp_l = Q15 - tmp_l; /* 1 - N/Y in Q15 */
+       tmp_l = log_polyfit(tmp_l, 15); /* Q9 */
+       tmp_l = MAX(tmp_l, -1361);
+      }
+
+      ltmp2 = tmp_l; 
+      if (i > 0) {
+       /* smoothing across frequency */
+       gain = 7*ltmp2 + lgain_fm1 ;
+       gain >>= 3; 
+      }else gain = tmp_l; 
+      lgain_fm1 = gain; 
+
+#ifdef DBG_SS
+      printf("%d ", gain);
+#endif
+
+      /* enhanced signal */
+      ltmp2 = signal_abs_log2 + gain; 
+      
+      /* transform to linear spectral domain */
+      tmp_l = ltmp2; 
+      tmp_l -= 15870; /* max value w/o overflowing pow_poly */
+      if (tmp_l < 0) norm_pow = 0;
+      else if (tmp_l == 0) norm_pow =1;
+      else norm_pow = (tmp_l >> 9) + 1; 
+    
+      signal_abs_log2 = ltmp2; 
+      signal_abs_log2 -= 512 * norm_pow;
+      signal_lin = pow_polyfit((short)signal_abs_log2);
+    
+      clean_lin = signal_lin; 
+    
+      total_norm = norm_pow + norm;
+      if (total_norm >= 0) clean_lin <<= total_norm;
+      else clean_lin >>= (-total_norm);
+    
+      pds_signal[i] = LONG2SHORT(clean_lin);
+  }
+
+#ifdef DBG_SS
+  printf("\n");
+#endif
+  /* output noise level at the 10th frame */
+  //  if (count_frm == SS_NUM_FRM_FOR_NOISE_DET ){
+  if (count_frm <= SS_NUM_FRM_FOR_NOISE_DET ){
+    PRT_ERR(printf("Noise level (log2) = %d\n", ctrl->meanEn)); 
+    ctrl->noiselvl = ctrl->meanEn; 
+  } 
+}
+
+#ifdef SS_OUT_PSD
+static void ss_dump_power_spectrum(short norm_log, short norm_lin, 
+                                  const short* power_spectrum, 
+                                  short size, FILE *pf_sp, Boolean bLogDomain){
+  short i; 
+  float spect_f;
+  long tmp_l; 
+  short signal_abs_log2; 
+  if (pf_sp == NULL) return; 
+
+  for (i=0; i< size; i++) {
+    tmp_l = (long)  power_spectrum[ i ];
+    if (bLogDomain) signal_abs_log2 = tmp_l; 
+    else{
+      if (tmp_l > 0) /* log, with correction of  normalization factor */
+       signal_abs_log2 = log_polyfit( tmp_l, norm_log);   /* Q 9 */
+      else 
+       signal_abs_log2 =  /* 20 */ 1<< 9 ; /* ~65 dB in Q9 */
+    }
+    if (!bLogDomain) spect_f = (float)   signal_abs_log2/ (1<< 9);
+    else spect_f = (float)   signal_abs_log2/ (1<< norm_lin);
+    fwrite(&spect_f, sizeof(float),1,pf_sp);
+  }
+}
+#endif
+
+/* ---------------------------------------------------------------------------
+   MFCC is in Q11 
+   ---------------------------------------------------------------------- */
+
+/* return TRUE if the frame is speech */
+TIESRENGINECOREAPI_API Boolean
+ss_mfcc_a_window(short *sig, short *mfcc, short *log_mel_energy,
+                const short n_mfcc, const short n_filter,
+                const mel_filter_type mel_filter[],
+                const short *cosxfm[  MAX_DIM_MFCC16 ],
+                short power_spectrum[], const short *mu_scale_p2, 
+                NormType *var_norm, short *last_sig, NssType * p_ss_crtl)
+{
+  short real_sig[ WINDOW_LEN ], imag_sig[ WINDOW_LEN ];
+  short ps_psd[WINDOW_LEN >> 1];
+  short is; 
+  short norm;
+
+  signal_to_power_spectrum(sig, real_sig, imag_sig, power_spectrum, var_norm, last_sig);
+
+  for (is=((WINDOW_LEN>>1) - 1);is>=0;is--) ps_psd[is] = power_spectrum[is]; 
+
+  norm = ( var_norm->norm0 + var_norm->norm1 - 8 ) * 2 + ( var_norm->norm2 - 2 ) - 15;
+
+  /* in-place spectral subtraction */
+  ss_noise_subs(ps_psd, norm, p_ss_crtl->s_noise_floor, p_ss_crtl->snr, 
+               p_ss_crtl->frm_count, p_ss_crtl);
+
+  ss_power_spectrum_to_mfcc(ps_psd, mfcc, 
+                           log_mel_energy, n_mfcc, n_filter, mel_filter, 
+                           mu_scale_p2, var_norm, cosxfm); 
+#ifdef SS_OUT_PSD
+  ss_dump_power_spectrum(norm, 9, ps_psd, WINDOW_LEN/2, p_ss_crtl->fp, FALSE);
+  ss_dump_power_spectrum(9, 9, p_ss_crtl->s_noise_floor, WINDOW_LEN/2, p_ss_crtl->fp2, TRUE);
+  ss_dump_power_spectrum(15, 15, (short*) & (p_ss_crtl->prob_sp), 1, p_ss_crtl->fp3, TRUE);
+#endif
+
+#ifdef _DBG_NSS
+  for (is=0;is < 10;is++) printf("%d ", mfcc[is]);
+  printf("\n");
+#endif
+
+  p_ss_crtl->frm_count ++; 
+
+  return TRUE;
+}
+
+void ss_set_default( NssType * ns ) 
+{
+
+  ns->sAlpha = NSS_ALPHA;
+  ns->sBeta =  NSS_BETA ; 
+
+  ns->alpha_p = PROB_ALPHA; 
+  ns->lambdaLTEhigherE = LAMBDA_LTE_HIGHER_E; 
+
+}
+
+TIESRENGINECOREAPI_API void ss_open( NssType * ns , gmhmm_type * gv )
+{
+  ns->mem_count = 0; 
+  ns->s_noise_floor = mem_alloc(ns->base_mem, &ns->mem_count, 
+                               NSS_HALF_WINDOW, NSS_HALF_WINDOW * 3, 
+                               SHORTALIGN, 
+                               "noise floor" );
+  ns->snr = mem_alloc(ns->base_mem, &ns->mem_count, 
+                     NSS_HALF_WINDOW, NSS_HALF_WINDOW * 3, 
+                     SHORTALIGN, 
+                     "noise floor" );
+
+  ns->ps_long_term_noise = mem_alloc(ns->base_mem, &ns->mem_count, 
+                                    NSS_HALF_WINDOW, NSS_HALF_WINDOW * 3, 
+                                    SHORTALIGN, 
+                                    "noise floor" );
+
+  ss_set_default(ns);
+  ss_init( ns ); 
+}
+
+TIESRENGINECOREAPI_API void ss_close(gmhmm_type * gv)
+{
+#ifdef SS_OUT_PSD
+  NssType * p_ss_crtl = (NssType*)gv->pNss; 
+  fclose(p_ss_crtl->fp);
+  fclose(p_ss_crtl->fp2);
+  fclose(p_ss_crtl->fp3);
+#endif
+}
+
diff --git a/TIesrEngine/src/noise_sub.h b/TIesrEngine/src/noise_sub.h
new file mode 100755 (executable)
index 0000000..03bda96
--- /dev/null
@@ -0,0 +1,117 @@
+/*=======================================================================
+ noise_sub.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header holds the parameters needed for the noise_sub
+ functionality.
+
+======================================================================*/
+
+#ifndef NOISE_SUB_H
+#define NOISE_SUB_H
+
+#include "tiesr_config.h"
+
+#define SS_NUM_FRM_FOR_NOISE_DET 9
+
+/* 1/16, Q15 */
+#define MIN_SMOOTH 2048    
+
+/* 0.5 in Q15 */
+#define NOISE_SMOOTH 16384 
+
+/* 0.96, Q15  */
+#define  SSNLUPTC 31457 
+
+/* used NLDNTC from uttdet, but this should be a separate 
+   constant in case one desires to set the two differently */
+/* exp(-1) = 0.3679, Q 15 */
+#define  SSNLDNTC       12055
+
+/* ----------------------- Spectral Subtraction ---------------------------------------------------------- 
+   The following functions are added to spectral subtraction: 1) VAD for noise estimation, which is 
+   copied from ETSI advanced front end, 2) Noise estimation with the VAD information, which basically
+   updates noise estimates only in non-speech intervals. 3) Bernotti-style noise removal. 
+
+   The parameters of the noise subtraction were tuned with 10dB 9 types noise plus WAVES noise in three
+   driving conditions, namely highway, stopngo and parked. In all noise conditions, except for TIMIT noise,
+   word error rates for 90 English name recognition with phone-book trained models was below 2 percent. 
+
+   ------------------------------------------------------------------------------------------------------*/
+
+//#define SS_OUT_PSD /* dump spectral subtraction results */
+
+static const short coef_1downto1over10_in_Q15[ 10 ] = 
+  { 32767 /* 1 in Q15 */, 16384 /*1/2 in Q15 */, 10923 /*1/3 in Q15*/,
+    8192 /* 1/4 in Q15 */, 6554 /* 1/5 in Q15 */, 5461 /* 1/6 in Q15*/,
+    4681 /* 1/7 in Q15 */, 4096 /* 1/8 in Q15 */, 
+    3641 /* 1/9 in Q15 */, 3277 /* 1/10 in Q15 */};
+
+/* ---------------- parameters of VAD for noise supression ---------------------------*/
+#define BUFFER_SIZE 7     // Number of frames in analysis buffer
+#define SNR_THRESHOLD_UPD_LTE 640 /* 20/16 in Q9 */
+#define MIN_FRAME 10 
+#define ENERGY_FLOOR 2560 /* 80/16 in Q9 */
+#define SNR_THRESHOLD_VAD 480 /* 15/16 * Q9*/
+#define MIN_SPEECH_FRAME_HANGOVER 15 
+#define LAMBDA_LTE 31785 /* 0.97 in Q15 */
+#define LAMBDA_LTE_HIGHER_E 32440 /* 0.99 in Q15 */
+#define HANGOVER 5
+
+#define PROB_ALPHA 6554 // 0.2 in Q15 used for speech presence probability
+
+#define NSS_MIN_FRAME_ENR -3401 /* 0.01 in log2 in Q9 used for frame energy estimation*/
+
+/* ---------------- Beroutti-style noise supression parameters -------------------------*/
+/* must be <= 32 */
+#define ALPHA 30
+#define NSS_ALPHA 29491 /* 0.9 in Q15 */
+//#define NSS_ALPHA 0 /* 0.9 in Q15 */
+#define NSS_BETA 3 /* 2^{-3} = 1/8 */
+
+#define NSS_HALF_WINDOW (WINDOW_LEN>>1)
+typedef struct 
+{
+  short base_mem[NSS_HALF_WINDOW * 3 ]; 
+  ushort mem_count; 
+  /* parameters */
+
+  ushort alpha_p; /* for averaging over VAD decision, in Q15 */
+  ushort sAlpha; /* alpha for noise removal with sAlpha * N, sAlpha in Q0 */
+  short sBeta;  /* beta for noise removal with N * 2^(- sBeta), sBeta in Q0*/
+  short lambdaLTEhigherE ;  /* forgetting factor, Q15 */
+
+#ifdef SS_OUT_PSD
+  FILE* fp;
+  FILE * fp2; 
+  FILE * fp3; 
+#endif
+
+  /* status */
+  short frm_count;
+
+  ushort prob_sp; /* speech presence probability, in Q15 */
+
+  short *s_noise_floor; /* estimated noise level, log2 in Q9 */ 
+
+  short *snr ; /* smoothed SNR estimate, log2 in Q9 */
+
+  short *ps_long_term_noise;  /* long-term noise estimate, log2 in Q9 */
+
+  short frmEn; /* energy of the current frame , log2 in Q9 */
+  short meanEn; /* long-term energy , log2 in Q9 */
+  short prevMeanEn; /* long-term energy of the previous utterance at the 10th frame, log2 in Q9 */
+  short noiselvl; /* noise level at the 10th frame of the current utterance */
+  short lambdaLTE; /* forgetting factor for long-term average, Q15 */
+  short nbSpeechFrame; /* number of speech frames */
+  short hangOver ;   /* hangover frames */
+
+} NssType;
+
+
+#endif
+
+
diff --git a/TIesrEngine/src/noise_sub_user.h b/TIesrEngine/src/noise_sub_user.h
new file mode 100755 (executable)
index 0000000..17abb68
--- /dev/null
@@ -0,0 +1,105 @@
+/*=======================================================================
+ noise_sub_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header exposes the functions of the noise_sub.cpp file.
+
+======================================================================*/
+
+#ifndef NOISE_SUB_USER_H
+#define NOISE_SUB_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+
+#endif
+/*--------------------------------------------------------------------*/
+
+#include "noise_sub.h"
+#include "gmhmm_type.h"
+
+TIESRENGINECOREAPI_API void init_spect_sub(short *noise_smooth);
+
+TIESRENGINECOREAPI_API void noise_subs(short *ps_signal, short norm,
+               short *ps_noisy_smoothed, short *noise_floor, 
+               unsigned short count_frm, short *noise_smooth);
+
+/* ------------- user interface for the Berotti-style noise supression ---------------- */
+/* Open space for noise supression. Parameters for noise supression is also initialized. 
+*/
+TIESRENGINECOREAPI_API void ss_open( NssType * ns , gmhmm_type *gv) ;
+
+/* reset status */
+void ss_reset(NssType * ctrl);
+
+/* set default parameters for noise supression 
+   The following parameters are set by default
+  ns->sAlpha = ALPHA;
+  ns->sBeta =  NSS_BETA ; 
+
+  ns->alpha_p = PROB_ALPHA; 
+  ns->lambdaLTEhigherE = LAMBDA_LTE_HIGHER_E; 
+*/
+void ss_set_default( NssType * ns ) ;
+
+/* set SS parameters 
+   @param sAlpha : factor to times reference signal. sAlpha = 0, corresponds to no SS
+                   default is NSS_ALPHA.
+                  x = y - sAlpha * n
+   @param sBeta :  factor to times noise, sBeta * n            
+*/
+void ss_set_parm( ushort sAlpha, short sBeta, NssType* p_ss_crtl);
+
+/* Close spectral subtraction
+   @param gv pointer to recognizer structure 
+*/
+TIESRENGINECOREAPI_API void ss_close(gmhmm_type *gv);
+
+#ifdef USE_SNR_SS
+
+/* The function extracts enhanced MFCC, which is obtained from noise removed spectra. 
+   @param mfcc pointer to generated MFCC 
+   @param power_spectrum pointer to enhanced spectra
+   return Frame Dropping decision: TRUE if the frame is speech, FALSE if the frame is non-speech */
+TIESRENGINECOREAPI_API
+Boolean ss_mfcc_a_window(short *sig, short *mfcc, short *log_mel_energy,
+                const short n_mfcc, const short n_filter,
+                const mel_filter_type mel_filter[],
+                const short *cosxfm[  MAX_DIM_MFCC16 ],
+                short power_spectrum[], const short *mu_scale_p2, 
+                NormType *var_norm, short *last_sig, NssType * p_ss_crtl);
+
+#endif
+
+#endif
diff --git a/TIesrEngine/src/obsprob.cpp b/TIesrEngine/src/obsprob.cpp
new file mode 100755 (executable)
index 0000000..6a24224
--- /dev/null
@@ -0,0 +1,78 @@
+/*=======================================================================
+ obsprob.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ HMM state observation likelihood calculation.
+======================================================================*/
+
+/*
+#include "mfcc_f.h"
+#include "gmhmm.h"
+#include "gmhmm_type.h"
+#include "hlr_dist.h"
+#include "pack.h"
+*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "tiesr_config.h"
+#include "obsprob_user.h"
+#include "pack_user.h"
+#include "dist_user.h"
+
+#ifdef BIT8FEAT
+
+#else
+
+extern short *mem_mfcc;
+extern short *mem_d_mfcc;
+
+/*
+** this could be avoided by usinge DIM-dim mfcc (currently DIM/2)
+*/
+void copy_feature(short feature[], ushort crt_vec, short n_mfcc)
+{
+  ushort d;
+
+  for (d = 0; d < n_mfcc; d++) { /* copy static and dynamic */
+    feature[d] = mem_mfcc[ crt_vec + d];
+    feature[d + n_mfcc] = mem_d_mfcc [crt_vec + d];
+  }
+}
+#endif
+
+/*
+** MFCC the whole file
+*/
+
+/*
+** compute pdf and for one state pdf.
+*/
+
+void observation_likelihood(ushort seg_stt, short T, HmmType *hmm, short pdf[], short n_mfcc, gmhmm_type *gv)
+{
+  ushort t, i, crt_vec;        
+  short x, pdf_i, nbr_dim = n_mfcc * 2;
+  short mfcc_feature[ MAX_DIM ]; /* mfcc vector */
+  
+  FOR_EMS_STATES(i,hmm,gv->base_tran) { 
+    pdf_i = GET_BJ_IDX(hmm,i);
+    for (t=0, crt_vec = seg_stt * n_mfcc; t<T; t++, crt_vec += n_mfcc) {
+#ifdef BIT8FEAT
+      vector_unpacking(gv->mem_feature + crt_vec, mfcc_feature, gv->scale_feat, n_mfcc); 
+#else
+      copy_feature(mfcc_feature, crt_vec, n_mfcc);
+#endif
+      pdf[t] = hlr_gauss_obs_score_f(mfcc_feature, (int)pdf_i, FULL, &x, nbr_dim, gv);
+    }
+    pdf += T;
+  }
+}
+
diff --git a/TIesrEngine/src/obsprob_user.h b/TIesrEngine/src/obsprob_user.h
new file mode 100644 (file)
index 0000000..283c561
--- /dev/null
@@ -0,0 +1,58 @@
+/*=======================================================================
+ obsprob_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header defines the interface with the obsprob functions.
+
+======================================================================*/
+
+#ifndef _OBSPROB_USER
+#define _OBSPROB_USER
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+#include "tiesr_config.h"
+
+#include "tiesrcommonmacros.h"
+#include "search_user.h"
+#include "gmhmm_type.h"
+
+TIESRENGINECOREAPI_API void copy_feature(short feature[], ushort crt_vec, short n_mfcc);
+
+TIESRENGINECOREAPI_API void observation_likelihood(ushort seg_stt, short T, HmmType *hmm, short pdf[], short n_mfcc, gmhmm_type *gv);
+
+#endif
diff --git a/TIesrEngine/src/pack.cpp b/TIesrEngine/src/pack.cpp
new file mode 100755 (executable)
index 0000000..9622529
--- /dev/null
@@ -0,0 +1,189 @@
+/*=======================================================================
+ pack.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Model parameter packing functions for byte and 16-bit parameter representation.
+
+======================================================================*/
+
+/*
+#include <stdio.h>
+#include "load.h"
+#include "pack.h"
+*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include <stdio.h>
+#include "tiesr_config.h"
+#include "pack_user.h"
+
+#ifdef REC
+extern short  *scale_mu;
+
+#define SHC 1
+void trouncate(char *mesg, short *mfcc, int n_mfcc, int delta)
+  
+  { 
+    int i;
+    
+    short x,y, scl;
+    
+    //    printf("%s\n", mesg);
+    for (i=0; i<n_mfcc; i++) {
+      //      printf("old = %d, ", mfcc[i]);
+      y = mfcc[i];
+      scl = scale_mu[delta + i] - SHC;
+      if (scl<0) scl=0;
+      
+      mfcc[i] = nbr_coding(mfcc[i], scl, 0 );
+      x = mfcc[i] >>= scl;
+      
+      //      printf("new = %d\n", mfcc[i]>>scale_mu[delta + i]);
+
+      // printf("SC=%2d o=%5d (%5x) n=%5d (%5x) , %5d %9.5f\n", scale_mu[delta + i], 
+      //    y,y,x, x, x - y,    y == 0? 0.: (x-y)/(float)(x>0? x:-x)*100.);
+    }
+  }
+
+#endif
+
+
+/*----------------------------------------------------------------
+  nbr_coding
+
+  This function accepts a short value o_mu, and codes it into an 8-bit
+  representation with scaling according to the shift amount specified
+  by max_mu, and rounding.  The resultant 8-bit value will be placed
+  in the msbyte of the returned short.
+
+  --------------------------------*/
+TIESRENGINECOREAPI_API short nbr_coding(short o_mu, short max_mu, int prt )
+{
+  short a_mu = o_mu,  sign = 0;
+  int tmp;
+  short clipped = 0;
+  
+  if (a_mu<0) { /* make a positiver number */
+    a_mu = -a_mu;
+    sign = 1;
+  }
+  tmp = (a_mu << max_mu); /* shift */
+  if (tmp > 32767) {
+    a_mu = 32767;
+    clipped = 1;
+  }
+  else a_mu = (short) tmp;
+  if (a_mu < 0x7f00) a_mu += (1<<7);
+  /*  else printf("a_mu = %x, no rounding\n", a_mu); */
+
+  /* 8 bits precision coding, with 8 bits in the msbyte */
+  a_mu &= 0xff00; 
+
+
+/* This code does not appear to have any impact anymore and so it is
+   commented out.  Its function would be to rescale the 8-bit value in
+   the msbyte back to the original short scaling position, creating a
+   short value with 8-bit reduced precision representing the original
+   input short. Is not used anywhere. Removed the COMPACT definition. */
+
+//#ifndef   COMPACT 
+// a_mu >>= max_mu; /* restore */
+//  if (sign) a_mu = - a_mu;
+//  if (prt) */ /*  printf("ZZ=%d, %5d %5d, %5d %9.5f\n", max_mu, a_mu, o_mu, a_mu - o_mu, 
+//              o_mu == 0? 0.: (a_mu - o_mu)/(float)(o_mu>0? o_mu:-o_mu)*100.) */;
+//#else
+//  if (sign) a_mu = - a_mu;
+//#endif
+
+
+  if (sign) a_mu = - a_mu;
+
+
+  /*
+ if (clipped) 
+    fprintf(stderr,"clipping: original = %x (%d), actual = %x (%d) scale = %d)\n",
+           o_mu, o_mu, a_mu>> max_mu, a_mu>> max_mu, max_mu );
+  */
+
+
+  return a_mu;
+}
+
+
+/*----------------------------------------------------------------
+  vector_packing
+
+  This function implements packing of a non-interleaved vector
+  consisting of static features followed by dynamic features in
+  shorts, into a vector of shorts where each short contains the
+  interleaved static/dynamic features in bytes.  It is assumed that a
+  short is two bytes.  The max_scale argument is a vector of scales
+  that determines how to scale each original dimension prior to
+  truncating it to a byte feature.   If the vector is NULL, then
+  no scaling is done prior to truncating. 
+
+  TODO: This function should be changed so that it can accommodate
+  static, delta, acc..., which means that the values should not be
+  interleaved.
+
+  --------------------------------*/
+TIESRENGINECOREAPI_API void vector_packing(const short v_in[], unsigned short v_out[],  const short max_scale[], short D)
+{
+   short j;
+   char tmp1, tmp2;
+  
+   if( max_scale == NULL )
+   {
+      for (j = 0; j<D; j++) 
+      {
+        tmp1 = nbr_coding( v_in[j], 0, 0 ) >> 8;
+        tmp2 = nbr_coding( v_in[j + D], 0, 0 ) >> 8;
+        v_out[j] = (tmp1 << 8) + (tmp2 & 0xff);
+      }
+   }
+   else
+   {
+      for (j = 0; j<D; j++) 
+      {
+        tmp1 = nbr_coding( v_in[j], max_scale[j], 0 ) >> 8;
+        tmp2 = nbr_coding( v_in[j + D], max_scale[j+D], 0 ) >> 8;
+        v_out[j] = (tmp1 << 8) + (tmp2 & 0xff);
+      }
+   }
+}
+
+
+/*----------------------------------------------------------------
+  vector_unpacking
+
+  This function implements the inverse of vector_packing.  It unpacks
+  an interleaved static/dynamic feature vector where each static or
+  dynamic feature is a byte, into a non-interleaved vector of shorts
+  where the static features come first in the vector followed by the
+  dynamic features.  It is assumed that a short is two bytes. The
+  argument scale is an array of scales that determines the amount to
+  shift the resulting short value in order to obtain the original Q
+  point of the short values.
+
+  --------------------------------*/
+TIESRENGINECOREAPI_API void vector_unpacking(const unsigned short v_in[], short v_out[], const short scale[], short D)
+{
+   short d;
+
+   for (d = 0; d < D ; d++) {
+      DECODE_STDY(v_in[d], v_out[d], v_out[d + D]);
+
+      if( scale != NULL )
+      {
+        v_out[d] >>= scale[d];
+        v_out[d+D] >>= scale[d+D];
+      }
+   }
+}
diff --git a/TIesrEngine/src/pack_user.h b/TIesrEngine/src/pack_user.h
new file mode 100644 (file)
index 0000000..b3c676b
--- /dev/null
@@ -0,0 +1,77 @@
+/*=======================================================================
+ pack_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Encapsulates the user interface for pack functionality.
+
+======================================================================*/
+
+#ifndef PACK_USER_H
+#define PACK_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+
+
+/*--------------------------------*/
+/* Define a helper macro, for those using pack functionality */
+/*
+** separate static and dynamic mean values from a short word
+*/
+#define DECODE_STDY(tmp_sh, mu_static, mu_dynamic) \
+    mu_static  = (tmp_sh & 0xff00); \
+    mu_dynamic = (tmp_sh) << 8;
+
+
+/*--------------------------------*/
+/* User interface to packing functionality */
+
+
+TIESRENGINECOREAPI_API void vector_packing(const short v_in[], unsigned short v_out[],
+                   const short max_scale[], short D);
+
+TIESRENGINECOREAPI_API void vector_unpacking(const unsigned short v_in[],
+                            short v_out[], const  
+                            short scale[], short D);
+
+TIESRENGINECOREAPI_API short nbr_coding(short o_mu, short max_mu, int prt);
+
+
+void trouncate(char *mesg, short *mfcc, int n_mfcc, int delta);
+
+
+#endif
diff --git a/TIesrEngine/src/pmc_f.cpp b/TIesrEngine/src/pmc_f.cpp
new file mode 100755 (executable)
index 0000000..c2a52d3
--- /dev/null
@@ -0,0 +1,454 @@
+/*=======================================================================
+ pmc_f.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ PMC processing.
+======================================================================*/
+
+/*
+#include "mfcc_f.h"
+#include "gmhmm.h"
+#include "gmhmm_type.h"
+#include "pack.h"
+#include "jac_one.h"
+*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "tiesr_config.h"
+#include "pmc_f_user.h"
+#include "pmc_f.h"
+#include "pack_user.h"
+
+
+/* 
+extern void prt_vec(char *str, short *v, unsigned short n)
+
+{
+  int i;
+  printf("%s ", str);
+  for (i=0; i<n; i++) printf("%5d ", v[i]);
+  printf("\n");
+}
+*/
+
+/*================================================================
+  pmc_log_add
+
+  This function accepts as input the log2 value of the speech model
+  power spectrum and the log2 value of the noise estimate power
+  spectrum, both in long Q9 format.  It outputs an approximation of
+  the log-add value log2( speech ps + noise ps ).  The approximation
+  should be much faster than the present implementation, because it
+  does not require converting to linear power spectra.
+
+  This function also accepts a pointer to the short beta value for
+  doing regression, and returns a quick estimate of the beta factor
+  in Q15, in order to handle all pmc power spectra computations in
+  this function.
+
+  ----------------------------------------------------------------*/
+/* parameters to specify the log-add operation */
+
+/* -10 in Q9, limit where the correction term is negligible */
+/* #define PMCLIMIT  -5120 */
+
+/* -5 in Q9, where to split the evaluation of the log polynomial function */
+/* #define LOGSPLIT  -2560 */
+
+/* midranges of polynomial evaluations */
+/* -7.5, for lower segment */
+/* #define LOOFFSET  -3840 */
+
+/* -2.5 for upper segment */
+/* #define HIOFFSET  -1280  */
+
+/* coefficients for two subdivisions of log2(1+2^x) */
+/* first for -10<=x<-5 , then -5<=x<=0, Q19 */
+/* fist segment is Q19 */
+/* second segment is Q15 */
+/* #define LOG_ORDER  3 */
+/*
+static const short coef_log[2][4] = { { 265, 1223, 2826, 4014 },
+                                     { 211, 1503, 4955, 7665 } };
+*/
+/* coefficients for 2^-x, Q15 for -1<x<=0 */
+/* #define TWO_ORDER 2 */
+
+/*
+static const short coef_twomx[3] = { 5615, -21873, 32702 };
+*/
+
+/*--------------------------------*/
+static short pmc_log_add( long splog, long nslog, short *beta )
+{
+   long diff, tmp;
+   short alog, blog, slog, stmp;
+   short correction, lsum;
+   short poly, idx, sdiff, result;
+   
+   /* short values for splog and nslog */
+   /* these should not limit */
+   if( splog > 32767 )
+      alog = 32767;
+   else if( splog < -32768 )
+      alog = -32768;
+   else
+      alog = (short)splog;
+
+   slog = alog;
+   
+   if( nslog > 32767 )
+      blog = 32767;
+   else if( nslog < -32768 )
+      blog = -32768;
+   else
+      blog = (short)nslog;
+
+
+   /* alog holds max value */
+   if( alog >= blog )
+   {
+      /* difference in Q9 */
+      diff = (long)blog - alog;
+      
+      /* blog too small to be noticeable */
+      if( diff < PMCLIMIT )
+      {
+        *beta = 32767;
+        return alog;
+      }
+   }
+   else
+   {
+      /* difference in Q9 */
+      diff = (long)alog - blog;
+      
+      /* alog too small to be noticeable */
+      if( diff < PMCLIMIT )
+      {
+        *beta = 0;
+        return blog;
+      }
+
+      /* swap blog and alog, blog is greater */
+      stmp = blog;
+      blog = alog;
+      alog = stmp;
+   }
+
+   /* calculate an approximation to log-add */
+
+   /* choose which cubic polynomial to use */
+   if( diff < LOGSPLIT )
+   {
+      poly = 0;
+      stmp = (short)(diff - LOOFFSET );
+   }  
+   else
+   {
+      poly = 1;
+      stmp = (short)( diff - HIOFFSET );
+   }
+
+   /* correction factor polynomial evaluation */
+   /*  Qx is Q19 for poly=0, and Q15 for poly=1 */
+   correction = coef_log[poly][0];
+   for( idx = 1; idx <= LOG_ORDER; idx++ )
+   {
+      /* Qx * Q9 = Q9+x */
+      tmp = correction * stmp;
+
+      /* next coefficient at Q9+x */
+      tmp += (coef_log[poly][idx] << 9 );
+
+      /* readjust result to Qx */
+      //      tmp += 1<<8;
+      //      tmp >>= 9;
+
+      /* in Qx, should never overflow */
+      //      correction = (short)tmp;
+      correction = (short)LONG_RIGHT_SHIFT_N(tmp, 9);
+   }
+
+   /* readjust correction back to Q9 */
+   if( poly == 0 )
+   {
+      /* correction was Q19 */
+      correction += (1<<9);
+      correction = (unsigned short)correction >> 10;
+   }
+   else
+   {
+      /* correction was Q15 */
+      correction += (1<<5);
+      correction = (unsigned short)correction >> 6;
+   }
+
+   /* add correction to larger log value */
+   /* parameters should be chosen for no overflow */
+   tmp = (long)correction + alog;
+
+   if( tmp > 32767 )
+      lsum =  32767;
+   else
+      lsum = (short)tmp;
+
+
+   /* do a quick calculation of the beta factor between 0 and 1 */
+
+   /* should be in range 0 to PMCLIMIT */
+   /* in Q9 */
+   sdiff = slog - lsum;
+   if( sdiff >= 0 )
+   {
+      *beta = 32767;
+   }
+   else
+   {
+      /* quick polynomial approx. to 2^sdiff ( sdiff < 0 ) */
+
+      /* work with positive numbers */
+      sdiff = -sdiff;
+      
+      /* fractional portion to Q15*/
+      stmp = sdiff & 0x1ff;
+      stmp <<= 6;
+
+      result = coef_twomx[0];
+      for( idx = 1; idx <= TWO_ORDER; idx++ )
+      {
+        /* Q15 coef * Q15 number */
+        tmp = result * stmp;
+
+        /* add coefficient, Q30 */
+        tmp += (coef_twomx[idx] << 15);
+
+        /* adjust to Q15 */
+        result = (short) LONG_RIGHT_SHIFT_N(tmp, 15);
+      }         
+
+      /* now scale result by the integer power */
+      stmp = sdiff >> 9;
+      if( stmp == 0 )
+      {
+        *beta = result;
+      }
+      else
+      {
+        result = (unsigned short)result + ( 1 << ( stmp - 1 ) );
+        *beta = ( (unsigned short)result >> stmp );
+      }
+   }
+
+   return lsum;
+}
+
+
+/*----------------------------------------------------------------
+  log_spectral_compensation
+
+  This function compensates an input clean log spectral signal vector
+  to compensate for the estimates of additive noise and channel bias.
+
+  This function is used by three functionalities:
+  1. PMC: (jac == 0)
+  2. JAC compensation: (jac != 0) && log_df == NULL
+
+  3. JAC estimation:   (jac != 0) && log_df != NULL,
+  (This setting also calculates the objective function, which is the 
+   ratio of the linear channel biased signal to the channel biased signal
+   plus noise for each vector component)
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API void log_spectral_compensation(short sp_log_ps[], short reg_sp_log_ps[],
+                              short pmc_log_ps[],  short reg_pmc_log_ps[], 
+                              const short noise_log_ps[], const short chn[], 
+                              short jac, short *log_df, short n_filter)
+{
+  short i, scale;
+  long  tmp, tmp2;
+  short beta, norm, tmp_s;
+
+  if (jac) scale = LC;
+  else     scale = LOG10TOLOG2;
+
+  /* parallel model combination, log-add approximation */
+  for (i = 0; i < n_filter; i++) {
+
+    /* log-add for MFCC */
+    short sum_sh = sp_log_ps[i] + chn[i]; /* tried clip, no help */
+    
+    tmp = sum_sh * scale;   /* log10() to log2(), then div. by ln 10, Q9 * Q13 = Q22 */
+    tmp = LONG_RIGHT_SHIFT_N(tmp, 13);                         /* Q 9 */
+
+    tmp2 = noise_log_ps[i] * scale;
+    tmp2 = LONG_RIGHT_SHIFT_N(tmp2, 13);
+    /* at this point both tmp and tmp2 are bounded within short */
+
+    /* 
+       tmp contains log2 of speech power spectrum, in Q9. tmp2 contains
+       log2 of noise power spectrum, in Q9. The function below is a
+       simplification that should reduce computational load for pmc.
+       It produces an approximation of log2( 2^( log2(speech ps)) +
+       2^( log2(noise ps)) ), in Q9.  Actually the function has
+       parameters that may be modified to provide a better estimate
+       than log-add approximation, by taking into consideration a
+       global estimate of noise and speech variances.
+    */
+
+    pmc_log_ps[i] = pmc_log_add( tmp, tmp2, &beta );
+
+
+// the old way of doing log-add:
+//    /* linear power spectrum larger than 32 bits, compensate */
+//
+//    tmp3 = MAX(tmp, tmp2);
+//
+//    /* requires Q9 (512 is 1 in Q9) input for pow_polyfit
+//    for ( norm_pow = 0; tmp3 >= 15870; norm_pow++ )  tmp3 -= 512;
+//       (replaced by next 4 lines)   */
+//
+//    tmp3 -= 15870;
+//    if (tmp3 < 0) norm_pow = 0;
+//    else if (tmp3 == 0) norm_pow =1;
+//    else norm_pow = (tmp3 >> 9) + 1; 
+//
+//    tmp  -= 512 * norm_pow;
+//    tmp2 -= 512 * norm_pow;
+//
+//    sp_lin = pow_polyfit( (short) tmp );
+//    noise_lin = pow_polyfit( (short) tmp2 );
+//
+//    /* PMC_GAIN, need longer than long. 
+//       So use rational number: 5 / 8 instead.
+//       Use PMC gain = 1, not much difference */
+//    /* tmp = 5 * ( sp_lin >> 3 ) + noise_lin; */
+//    tmp = sp_lin + noise_lin;
+//    if ( tmp < 0 ) tmp = 2147483647;  /* overflow clip */
+//    pmc_log_ps[i] = log_polyfit( tmp, 0 );         /* log-add */
+//
+//    pmc_log_ps[i] += norm_pow << 9;
+
+
+    tmp = pmc_log_ps[i] * LOG2TOLOG10;  /* log2() to log10(), Q9 * Q15 = Q24 */
+    tmp =  LONG_RIGHT_SHIFT_N(tmp, 15);                         /* Q 9 */
+
+    if (jac) {
+      tmp = tmp * LN10; /* Q9 * Q13 = Q22 */
+      tmp =  LONG_RIGHT_SHIFT_N(tmp, 13);                         /* Q 9 */
+    }
+    pmc_log_ps[i] = (short) tmp;
+
+//    /* beta factor for regression MFCC, 
+//       it is simply beta = sp_lin / ( sp_lin + noise_lin ).
+//       But has to go through the scaling trouble because of fixed-point long */
+//
+//    tmp = sp_lin + noise_lin;
+//
+//    if ( tmp < 0 ) tmp = 2147483647;  /* overflow clip */
+//
+//    if (tmp != 0 ) {
+//      for ( norm = 0; tmp < 0x40000000; norm++ )
+//     tmp <<= 1;
+//      sp_lin <<= norm;
+//      tmp >>= 15;                          /* Q -15 */
+//      beta = (short) ( sp_lin / tmp );     /* Q 15 */
+//      if ( beta < 0 ) beta = 32767;        /* overflow clip */
+//    }
+//    else beta = 0;
+    
+    if (log_df)  log_df[i] = beta;    
+    else /* PMC or JAC */
+    if ( reg_sp_log_ps[ i ] != 0 ) {
+      tmp = reg_sp_log_ps[i] > 0 ? reg_sp_log_ps[i] : - reg_sp_log_ps[i];
+      for ( norm = 0; tmp < 0x40000000; norm++ )
+       tmp <<= 1;
+      tmp_s = (short)(tmp >> 16);
+      tmp = beta * tmp_s;  /* Q 15 * Q -16 = Q -1 */
+      tmp <<= 1;           /* Q 0 */
+      tmp >>= norm;
+      reg_pmc_log_ps[ i ] = reg_sp_log_ps[i] > 0 ? tmp : -tmp;
+
+    } else reg_pmc_log_ps[ i ] = 0;
+  }
+}
+
+/*
+** compensated_log_mean
+*/
+
+
+
+/*----------------------------------------------------------------
+  pmc
+
+  This function compensates a clean speech mfcc vector for the effects
+  of channel and noise, creating a compensated mfcc vector.  The
+  function requires the log spectral estimates of noise and channel.
+
+  It performs log-add approximation of PMC, and can be switched to do
+  either JAC or PMC
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API void
+pmc(short *sp_mfcc_o,     /* original non-PMC MFCC mean */
+    short *noise_log_ps, /* noise log mel energy */
+    short *pmc_mfcc,     /* PMC-compensated MFCC mean */
+    short *chn,          /* channel estimate  */
+    short jac,           /* jac/pmc switch  */
+    short n_mfcc, short n_filter, const short *mu_scale_p2, short *scale_mu,
+    const short *cosxfm[  MAX_DIM_MFCC16 ],
+    short * sp_bias      /* bias between JAC-compensated MFCC and the original MFCC */ ,
+    Boolean b8bitMean
+    )
+{
+  short sp_log_ps[ N_FILTER26 ];        /* log power spectrum */
+  short reg_sp_log_ps[ N_FILTER26 ];    /* regression coeff */
+  short pmc_log_ps[ N_FILTER26 ];
+  short reg_pmc_log_ps[ N_FILTER26 ];
+  short *po = pmc_mfcc, *sp_mfcc = sp_mfcc_o;
+  short sp_clean[ MAX_DIM ] , i; 
+  short pmc_mfcc16[ MAX_DIM ];
+
+  if (b8bitMean){
+    po = pmc_mfcc16;
+    vector_unpacking((ushort*) sp_mfcc_o, pmc_mfcc16, scale_mu, n_mfcc);
+    sp_mfcc = pmc_mfcc16;
+  }
+
+  if (sp_bias) {
+    /* save the clean MFCC */
+    for (i=2*n_mfcc - 1; i>= 0; i--)
+      sp_clean[i] = sp_mfcc[i]; 
+  }
+
+  /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+
+  cos_transform( sp_mfcc, sp_log_ps, mu_scale_p2, n_mfcc,  n_filter, cosxfm );
+  /* regression coeff */
+  cos_transform( sp_mfcc + n_mfcc, reg_sp_log_ps, mu_scale_p2 + n_mfcc, n_mfcc, n_filter, cosxfm);
+
+  log_spectral_compensation(sp_log_ps, reg_sp_log_ps, pmc_log_ps, reg_pmc_log_ps, noise_log_ps, chn, jac, NULL, n_filter);
+  
+  /* log mel power spectrum to cepstrum */
+
+  inverse_cos_transform(pmc_log_ps, po, mu_scale_p2, n_mfcc, n_filter, cosxfm);
+  inverse_cos_transform(reg_pmc_log_ps, po + n_mfcc, mu_scale_p2 + n_mfcc, n_mfcc, n_filter, cosxfm);
+
+  if (sp_bias){
+    /* record the bias */
+    for (i=2*n_mfcc - 1; i>= 0; i--)
+      sp_bias[i] = po[i] - sp_clean[i]; 
+  }
+
+  if (b8bitMean)
+    vector_packing(po, (ushort *) pmc_mfcc,  scale_mu, n_mfcc);
+
+}
+
diff --git a/TIesrEngine/src/pmc_f.h b/TIesrEngine/src/pmc_f.h
new file mode 100644 (file)
index 0000000..a1a887d
--- /dev/null
@@ -0,0 +1,45 @@
+/*=======================================================================
+ pmc_f.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header file contains constants and parameters that are local
+ to the pmc_f.cpp file. 
+
+======================================================================*/
+
+
+#ifndef PMC_F_H
+#define PMC_F_H
+
+/* parameters to specify the log-add operation */
+
+/* -10 in Q9, limit where the correction term is negligible */
+#define PMCLIMIT  -5120
+
+/* -5 in Q9, where to split the evaluation of the log polynomial function */
+#define LOGSPLIT  -2560
+
+/* midranges of polynomial evaluations */
+/* -7.5, for lower segment */
+#define LOOFFSET  -3840
+
+/* -2.5 for upper segment */
+#define HIOFFSET  -1280 
+
+/* coefficients for two subdivisions of log2(1+2^x) */
+/* first for -10<=x<-5 , then -5<=x<=0, Q19 */
+/* fist segment is Q19 */
+/* second segment is Q15 */
+#define LOG_ORDER  3
+static const short coef_log[2][4] = { { 265, 1223, 2826, 4014 },
+                                     { 211, 1503, 4955, 7665 } };
+
+/* coefficients for 2^-x, Q15 for -1<x<=0 */
+#define TWO_ORDER 2
+
+static const short coef_twomx[3] = { 5615, -21873, 32702 };
+
+#endif
diff --git a/TIesrEngine/src/pmc_f_user.h b/TIesrEngine/src/pmc_f_user.h
new file mode 100644 (file)
index 0000000..d705442
--- /dev/null
@@ -0,0 +1,74 @@
+/*=======================================================================
+ pmc_f_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file exposes the interface for the pmc operations.
+
+======================================================================*/
+
+#ifndef PMC_F_USER_H
+#define PMC_F_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+#include "tiesrcommonmacros.h"
+#include "gmhmm_type.h"
+#include "mfcc_f_user.h"
+
+TIESRENGINECOREAPI_API void log_spectral_compensation(short sp_log_ps[], short reg_sp_log_ps[],
+                              short pmc_log_ps[],  short reg_pmc_log_ps[], 
+                              const short noise_log_ps[], const short chn[],
+                              short jac, short *log_df, short n_filter);
+
+TIESRENGINECOREAPI_API void pmc(short *sp_mfcc_o,     /* original non-PMC MFCC mean */
+    short *noise_log_ps, /* noise log mel energy */
+    short *pmc_mfcc,     /* PMC-compensated MFCC mean */
+    short *chn,          /* channel estimate  */
+    short jac,           /* jac/pmc switch  */
+    short n_mfcc, short n_filter, const short *mu_scale_p2, short *scale_mu,
+    const short *cosxfm[  MAX_DIM_MFCC16 ], short * sp_bias ,
+        Boolean b8bitMean );
+
+void SFB_pmc(short *sp_mfcc_o,     /* original non-PMC MFCC mean */
+    short *noise_log_ps, /* noise log mel energy */
+    short *pmc_mfcc,     /* PMC-compensated MFCC mean */
+    short *chn,          /* channel estimate  */
+    short jac,           /* jac/pmc switch  */
+    short n_mfcc, short n_filter, const short *mu_scale_p2, short *scale_mu,
+    const short *cosxfm[  MAX_DIM_MFCC16 ]);
+
+#endif
diff --git a/TIesrEngine/src/rapidsearch.cpp b/TIesrEngine/src/rapidsearch.cpp
new file mode 100755 (executable)
index 0000000..03cd973
--- /dev/null
@@ -0,0 +1,2121 @@
+/*=======================================================================
+ rapidsearch.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Rapid likelihood calculation by clustered Gaussian representation.
+
+======================================================================*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "tiesr_config.h"
+#include "search_user.h"
+#include "dist_user.h"
+#include "gmhmm.h"
+#include "gmhmm_type.h"
+#include "sbc_user.h"
+#include "load_user.h"
+#include "pmc_f_user.h"
+#ifdef USE_NBEST
+#include "nbest_user.h"
+#endif
+#include "rapidsearch_user.h"
+#include "confidence_user.h"
+#include "jac-estm.h"
+#include "pack_user.h"
+
+//#define DEV_CONFIDENCE
+//#define DEV_NONSTATIONARY
+//#define DEV_PRIOR_SHOW
+//#define TEST_PU
+//#define TEST_CM_LOGISTIC
+//#define DBG_CONF
+
+
+
+void rj_noise_compensation( gmhmm_type* gv)
+{ 
+  short j;
+  short imeans, *sp;
+  short mu16[MAX_DIM];
+  OFFLINE_VQ_HMM_type* pOffline = (OFFLINE_VQ_HMM_type*)gv->offline_vq; 
+  imeans = pOffline->n_cs; 
+  Boolean b8bitMean = FALSE; 
+
+  if (pOffline->bCompensated) return; 
+
+  for (j=0;j<imeans;j++){
+    sp = pOffline->vq_centroid + j * gv->nbr_dim; 
+    pmc( sp, gv->log_N, mu16,
+        gv->log_H, 1, gv->n_mfcc, gv->n_filter, gv->muScaleP2, gv->scale_mu, gv->cosxfm, 
+        pOffline->vq_bias + j * gv->nbr_dim, b8bitMean);
+  }
+}
+
+
+/*----------------------------------------------------------------
+  rj_compensate
+
+ compensate triphone mean with the cluster-dependent JAC bias vectors 
+ ----------------------------------------------------------------*/
+TIesrEngineJACStatusType rj_compensate(gmhmm_type * gv)
+{
+  OFFLINE_VQ_HMM_type *vqhmm = (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  short mixture[4], *mu, *mu8, *sp_bias; 
+
+#ifdef BIT8MEAN 
+  short mu16[MAX_DIM];
+#endif
+
+  short  mumu[MAX_DIM], k, i, j;
+
+  if (vqhmm->bCompensated)
+     return eTIesrEngineJACSuccess; 
+
+#ifdef USE_16BITMEAN_DECOD
+  {
+     TIesrEngineStatusType loadStatus;
+     loadStatus = load_mean_vec(gv->chpr_Model_Dir, gv, FALSE); 
+     if( loadStatus != eTIesrEngineSuccess )
+     {
+       return eTIesrEngineJACRJLoadFail;
+     }
+  }
+#endif
+
+  for (i = 0; i < gv->n_mu; i++){
+    mixture[2] = i; 
+#ifndef BIT8MEAN
+    mu = get_mean(gv->base_mu_orig, mixture, gv->nbr_dim, 0);
+#else
+    mu8 = get_mean(gv->base_mu_orig,mixture, gv->nbr_dim, 0);
+    vector_unpacking((const unsigned short *)mu8, mu16, gv->scale_mu, gv->n_mfcc);
+    mu = mu16;
+#endif
+    /* mean vectors are in Q11 */
+    
+    j = (short) vqhmm->pRAM2Cls[i];  /* locate ROM mean index to cluster index mapping */
+
+    /* get the bias, obtained from function rs_noise_compensation for monophones  */
+    sp_bias = vqhmm->vq_bias + j * gv->nbr_dim; 
+
+    /* compensate bias */
+    for (k=gv->nbr_dim-1;k>=0;k--) 
+       mumu[k] = mu[k] + sp_bias[k];
+
+    /* save the compensated mean  */
+    mu8 = get_mean(gv->base_mu, mixture, gv->nbr_dim, 0);
+#ifdef BIT8MEAN
+    vector_packing(mumu, (ushort*) mu8, gv->scale_mu, gv->n_mfcc);
+#else
+    for (k=gv->nbr_dim-1;k>=0;k--) 
+       mu8[k] = mumu[k]; 
+#endif
+  }
+  vqhmm->bCompensated = TRUE; 
+
+#ifdef USE_16BITMEAN_DECOD
+  if( gv->base_mu_orig )
+  {
+     free(gv->base_mu_orig);
+     gv->base_mu_orig = NULL;
+  }
+#endif
+
+  return eTIesrEngineJACSuccess;
+}
+
+static void rj_offline_inv_of_average_var(gmhmm_type * gv, OFFLINE_VQ_HMM_type *vqhmm)
+{
+  register short i, j;
+  short mixture[4];
+#ifdef BIT8VAR
+  short invvar[ MAX_DIM ];
+#endif
+  short *inv;
+  long ave_cov[MAX_DIM], ltmp;
+  ushort stmp, Q15 = 32767;
+  
+  for (j=gv->nbr_dim-1;j>=0;j--) ave_cov[j] = 0;
+  for (i=gv->n_var-1;i>=0;i--){
+    mixture[2] = i; mixture[3] = i; 
+    inv = get_var(gv->base_var_orig, mixture, gv->nbr_dim, 0);
+#ifdef BIT8VAR
+    vector_unpacking((unsigned short *)inv, invvar, gv->scale_var, gv->n_mfcc);
+    inv = invvar; 
+#endif
+
+    for (j=gv->nbr_dim-1;j>=0;j--){
+      if (inv[j] == 0) stmp = Q15; 
+      else
+       stmp = Q15/inv[j]; /* Q6 */
+      ave_cov[j] += stmp; 
+    }
+  }
+  for (j=gv->nbr_dim-1;j>=0;j--){
+    //    ltmp = (ave_cov[j])/gv->n_var; /* Q6 */
+    ltmp = (ave_cov[j])/vqhmm->n_cs; /* Q6, energy conservation */
+    ltmp = (ltmp==0)?Q15:((long)Q15)/ltmp; /* Q9 */
+    vqhmm->inv_ave_var[j] = LONG2SHORT(ltmp); 
+  }
+
+  vqhmm->gconst = 
+    gauss_det_const( vqhmm->inv_ave_var, 2, gv->muScaleP2, gv->nbr_dim);
+}
+
+/* @param p_ava_mem : pointer to the next avaliable memory space
+   return TRUE if success, else return FALSE
+*/
+static TIesrEngineStatusType rj_open_ROM( gmhmm_type *gv )
+{
+  Boolean failed = FALSE; 
+
+#ifdef OFFLINE_CLS
+  char buf[MAX_STR], *dirname = gv->chpr_Model_Dir;
+  unsigned char *pChr; 
+  FILE *fp;
+  OFFLINE_VQ_HMM_type * pOffline = (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  short nread, *p_short; 
+
+  /* read table mapping RAM mean to cluster */
+  strcpy( buf, dirname);
+  strcat( buf, "/o2amidx.bin" );
+  fp = fopen( buf, "rb" );
+  failed |= ( fp == NULL );
+  fread(&pOffline->sz_RamMean, sizeof(short), 1, fp);
+  nread = ((pOffline->sz_RamMean + 1) >> 1) + 1;
+  p_short = mem_alloc( pOffline->base_mem, &pOffline->mem_count, 
+                      nread, VQHMM_SIZE, SHORTALIGN, "RAM2Cls");
+  pOffline->pRAM2Cls = (unsigned char*) p_short; 
+  pChr = (unsigned char*) pOffline->pRAM2Cls; 
+  nread = fread(pChr, sizeof(unsigned char), pOffline->sz_RamMean, fp);
+  failed |= (nread != pOffline->sz_RamMean); 
+  fclose( fp );
+
+
+  /* read cluster to ROM mean mapping */
+  strcpy( buf, dirname);
+  strcat( buf, "/vqcentr.bin"); 
+  fp = fopen( buf, "rb" );
+  failed |= ( fp == NULL );
+  fread(&pOffline->n_cs, sizeof(short), 1, fp);
+  fread(&pOffline->nbr_dim, sizeof(short), 1, fp); 
+  nread = pOffline->n_cs * pOffline->nbr_dim;
+  pOffline->vq_centroid = mem_alloc( pOffline->base_mem, &pOffline->mem_count, 
+                                    nread, VQHMM_SIZE, SHORTALIGN, "VQ Centroid");
+  nread = fread(pOffline->vq_centroid, sizeof(short), pOffline->n_cs * pOffline->nbr_dim, fp);
+  failed |= (nread != pOffline->n_cs * pOffline->nbr_dim);
+  fclose( fp );
+  pOffline->vq_bias = mem_alloc( pOffline->base_mem, &pOffline->mem_count, 
+                                pOffline->n_cs * pOffline->nbr_dim, VQHMM_SIZE, 
+                                SHORTALIGN, "VQ bias");
+  failed |= (pOffline->vq_bias == NULL);
+
+  pOffline->dist = mem_alloc( pOffline->base_mem, &pOffline->mem_count, 
+                             pOffline->n_cs, VQHMM_SIZE, 
+                             SHORTALIGN, "VQ dist");
+  failed |= (pOffline->dist == NULL);
+
+  pOffline->inv_ave_var = mem_alloc( pOffline->base_mem, &pOffline->mem_count, 
+                             pOffline->nbr_dim, VQHMM_SIZE, 
+                             SHORTALIGN, "VQ inv");
+  failed |= (pOffline->inv_ave_var == NULL);
+
+  pOffline->category = (char*)mem_alloc( pOffline->base_mem, &pOffline->mem_count,
+                                 (pOffline->n_cs + 1)>>SHORTSHIFT, VQHMM_SIZE, SHORTALIGN, "VQ category");
+  failed |= (pOffline->category == NULL); 
+
+  pOffline->bCompensated = FALSE; 
+
+#ifdef USE_ONLINE_REF
+  pOffline->imax_10 = (short*)mem_alloc(pOffline->base_mem, &pOffline->mem_count,
+                                       GBG_NUM_IDS, VQHMM_SIZE, SHORTALIGN, "ORM index obtained from the current utterance");
+  failed |= (pOffline->imax_10 == NULL); 
+
+#endif
+
+#ifdef USE_ORM_PU
+  pOffline->iprior = (short*) mem_alloc(pOffline->base_mem, &pOffline->mem_count,
+                                       3 * GBG_NUM_IDS, VQHMM_SIZE, SHORTALIGN, 
+                                       "ORM index after posterior updating");
+  failed |= (pOffline->iprior == NULL); 
+
+  pOffline->pprior = (short*) mem_alloc(pOffline->base_mem, &pOffline->mem_count,
+                                       3 * GBG_NUM_IDS, VQHMM_SIZE, SHORTALIGN, 
+                                       "ORM index probabilities");
+  failed |= (pOffline->pprior == NULL); 
+#endif
+
+#ifdef USE_ORM_VAD
+  pOffline->mfcc_buf = (short*)mem_alloc( pOffline->base_mem, &pOffline->mem_count,
+                                         MFCC_BUF_SZ * MAX_DIM, VQHMM_SIZE, SHORTALIGN, "MFCC buffer");
+  failed |= (pOffline->mfcc_buf == NULL); 
+  
+#endif
+
+#endif 
+
+  if (failed)
+    return eTIesrEngineVQHMMMemorySize;
+  else return  eTIesrEngineSuccess;
+}
+
+static TIesrEngineStatusType rj_vq(gmhmm_type * gv)
+{
+  TIesrEngineStatusType bSucc = eTIesrEngineVQHMMMemorySize; 
+  
+  if ((bSucc = rj_open_ROM(gv))!= eTIesrEngineVQHMMMemorySize)
+    /* prepare VQ HMM */
+    rj_offline_inv_of_average_var(gv, (OFFLINE_VQ_HMM_type*) gv->offline_vq);
+
+  return bSucc; 
+}
+
+/* @param perc_core_clusters_q15 precentage of core clusters, value in Q15,
+   @param perc_inter_clusters_q15 percentage of intermediate clusters, value in Q15 
+   @param num_frms_gbg: number of begining frames to construct gabage model 
+*/
+Boolean rj_set_param( ushort perc_core_clusters_q15,
+                     ushort perc_inter_clusters_q15, 
+                     gmhmm_type * gv )
+{
+
+#ifdef RAPID_JAC
+  OFFLINE_VQ_HMM_type * vqhmm = (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  
+  vqhmm->sVQ_CLS_TO_EVAL =  q15_x(perc_core_clusters_q15, vqhmm->n_cs);
+  vqhmm->sVQ_NUM_INTER = q15_x(perc_inter_clusters_q15, vqhmm->n_cs) ;
+#endif
+
+  return TRUE; 
+}
+
+/* @param l_cnter pointer to a counter, each time, the function is evaluated, the counter will be added with one. If the pointer is NULL, no operation on the counter. 
+   @param iargmix the mixture index corresponding to the largest likelihood score
+   the function evaluates CI/GI-HMM score */
+short rj_gauss_obs_score_f(short *feature, int pdf_idx, gmhmm_type*gv, long * l_cnter, short * iargmix)
+{
+   short total_scr = 0;
+
+#ifdef RAPID_JAC
+  register short i, l, k, m;
+  short *mixture;
+  short nbr_dim = gv->nbr_dim;
+  short n_mix;
+  short *p2wgt;
+#ifndef BIT8MEAN
+  register short *mu, *invvar, *feat, j;
+  short gconst;
+  short diff_s;
+  long  diff;
+#endif
+  long  scr, min_scr = LZERO;
+  OFFLINE_VQ_HMM_type * vqhmm = (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  
+  total_scr = BAD_SCR;
+
+  mixture = GET_MIX(gv,pdf_idx);
+  n_mix = MIX_SIZE(mixture);
+  p2wgt = mixture + 1;
+
+  //  for (i = 0; i < n_mix; i++) {      /* n mixtures */
+  for (i = n_mix-1; i >= 0; i--) {      /* n mixtures */
+    k = mixture[i * 3 + 2];
+    scr=(long) gv->gauss_scr[ k ] ;
+    
+    if (scr == LZERO) {
+#ifdef  USE_GAUSS_SELECT
+      l = (short)vqhmm->pRAM2Cls[k]; /* RAM mean index -> cluster index */
+      if (vqhmm->category[l] == 0){
+#endif
+#ifndef BIT8MEAN
+       mu = get_mean(gv->base_mu, mixture, nbr_dim, i);   
+       invvar = get_var(gv->base_var, mixture, nbr_dim, i);
+       gconst = gv->base_gconst[ mixture[ i * 3 + 3 ] ];
+       feat = feature;
+            
+       GAUSSIAN_DIST(gv, scr, feat, j, nbr_dim, diff, diff_s, gconst, mu, invvar);
+#else
+       GAUSSIAN_DIST(gv, scr, nbr_dim, mixture, i, feature);
+#endif
+
+       if (l_cnter) (*l_cnter)++;
+#if defined(USE_GAUSS_SELECT) || defined(USE_ONLINE_REF)
+       vqhmm->low_score = MIN(vqhmm->low_score, scr);
+#if defined(USE_GAUSS_SELECT)
+      }
+      else
+       scr = (long) vqhmm->dist[l];
+#endif
+#endif
+
+#if defined(USE_ONLINE_REF) || defined(DEV_CLS2PHONE)
+      if (gv->frm_cnt > vqhmm->inum_frms_gbg){
+#if defined(DEV_CLS2PHONE)
+       if (vqhmm->bRefCloseToSilence == FALSE)
+#endif
+
+#ifdef USE_ORM_PU
+       for (m=vqhmm->inum_prior-1;m>=0;m--){
+         if (l == vqhmm->iprior[m]){ /* belongs to the ORM model */
+           scr = MAX(scr, vqhmm->ga_score);
+           break; 
+         }
+       }
+#else
+       for (m=vqhmm->inum_diff_cls-1;m>=0;m--){
+         if (l == vqhmm->imax_10[m]){ /* belongs to the ORM model */
+           scr = MAX(scr, vqhmm->ga_score);
+           break; 
+         }
+       }
+#endif
+      }
+
+#endif
+
+      gv->gauss_scr[k] = LONG2SHORT(scr); 
+    }
+    
+    if (iargmix && scr > min_scr){
+      min_scr = scr; *iargmix = i; 
+    }
+
+
+    scr += p2wgt[ i * 3 ];         /* mixture weight */
+
+    if ( scr > (long) total_scr ) total_scr = LONG2SHORT(scr);
+  }
+
+#endif
+
+  return total_scr;
+}
+
+#if defined(RAPID_JAC) || defined(USE_CONFIDENCE)
+/* got the approximated Gaussian score */
+static short rj_dist(short *mfcc_feat, short* mean, short * inv, short gconst, short dm)
+{
+  register long td; 
+  register long dist = 0; 
+  register short i; 
+
+  for (i=dm-1;i>=0;i--){
+    td = mfcc_feat[i] - mean[i]; /* Q11 */
+    td *= td; /* Q22 */
+    td >>= 11; /* Q11 */
+    td *= inv[i]; /* Q20 */
+    td >>= 14 ; /* Q6 */
+    dist -= td; 
+  }
+  dist -= gconst; 
+  dist >>= 1; /* times 0.5 */
+  
+  return LONG2SHORT(dist); 
+}
+#endif
+
+
+#ifdef DEV_CLS2PHONE
+/* check if the reference model contains silence model,
+   if so, return TRUE,
+   else return FALSE */
+static Boolean rj_reference_close_to_silence_model(OFFLINE_VQ_HMM_type* vqhmm)
+{
+  short i, j, k, inum = vqhmm->inum_frms_gbg; 
+  short m, bCount = 0; 
+  Boolean bClose = FALSE; 
+
+  for (i=vqhmm->inum_diff_cls-1;i>=0;i--){
+    m = vqhmm->imax_10[i];
+    j=(short)vqhmm->cls_nphone[m];
+    //    printf("cls[%d] -> phone: ", m);
+    for(--j;j>=0;j--){
+      k = (short)vqhmm->cls_phone[PHONEPERCLS * m + j];
+      //printf(" %d ", k);
+      if (k==0){
+       bCount ++; 
+       if (bCount > GBG_NUM_SIL){ bClose = TRUE; break; }
+      }
+    }
+    //    printf(" Close = %d\n", bClose);
+  }
+  return bClose; 
+}
+
+/* obtain cluster to phone mapping */
+static void rj_cls2phone(gmhmm_type * gv)
+{
+  HmmType * hmm; 
+  ushort hmmcode, hmm_dlt = 0, n_state, pdf_idx; 
+  short n1, *mixture, n_mix, i, k, l, j, m, monophone_index;
+  short * hmm2phone =  sbc_rtn_hmm2phone(gv->sbcState);
+  Boolean bFound ; 
+  OFFLINE_VQ_HMM_type *vqhmm =  (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+
+  for (hmmcode = 0; hmmcode < gv->trans->n_hmm_set;hmmcode++){
+    hmm = GET_HMM(gv->base_hmms, hmmcode, hmm_dlt);
+
+    monophone_index = *( hmm2phone + hmmcode ); 
+    monophone_index++; 
+
+    n_state = NBR_STATES(hmm,gv->base_tran);
+      
+    n1 =  n_state - 1;
+
+    for (j = 0; j < n1; j++){
+      
+      pdf_idx = hmm->pdf_idx[ j ];
+
+      mixture = GET_MIX(gv,pdf_idx);
+      n_mix = MIX_SIZE(mixture);
+      
+      for (i = n_mix-1; i >= 0; i--) {      /* n mixtures */
+       k = mixture[i * 3 + 2]; /* mean index */
+       l = (short)vqhmm->pRAM2Cls[k]; /* corresponding cluster index */
+       bFound = FALSE; 
+       for (m=((short)vqhmm->cls_nphone[l])-1;m>=0;m--){
+         if ((short)vqhmm->cls_phone[l*PHONEPERCLS + m] == monophone_index){ 
+           bFound = TRUE; break; 
+         }
+       }
+       if (bFound == FALSE){
+         m = (short)vqhmm->cls_nphone[l];
+         m++; 
+         if (m>=PHONEPERCLS){
+           printf("out of boundary \n");
+           m = PHONEPERCLS; 
+         }
+         vqhmm->cls_nphone[l] = (char)m;
+         vqhmm->cls_phone[l * PHONEPERCLS + m - 1] = (char)monophone_index; 
+       }
+      }
+    }
+  }
+}
+#endif
+
+TIesrEngineStatusType rj_load(gmhmm_type * gv, FILE * pf)
+{
+#ifdef USE_ORM_PU
+  size_t nread;
+  OFFLINE_VQ_HMM_type* vqhmm = ( OFFLINE_VQ_HMM_type* ) gv->offline_vq;
+  
+  if (vqhmm && pf){
+    fread(&(vqhmm->inum_prior), sizeof(short), 1, pf);
+    if (vqhmm->inum_prior > 0){
+
+      nread = fread(vqhmm->iprior, sizeof(short), vqhmm->inum_prior, pf);
+      if( nread != (size_t)vqhmm->inum_prior )
+       return eTIesrEngineVQHMMLoad;
+
+      nread = fread(vqhmm->pprior, sizeof(short), vqhmm->inum_prior, pf);
+      if( nread != (size_t)vqhmm->inum_prior )
+       return eTIesrEngineVQHMMLoad; 
+
+    }
+  }
+#endif
+  return eTIesrEngineSuccess;
+}
+
+TIesrEngineStatusType rj_save(gmhmm_type * gv, FILE * pf)
+{
+#ifdef USE_ORM_PU
+  size_t nwrite;
+  OFFLINE_VQ_HMM_type* vqhmm = ( OFFLINE_VQ_HMM_type* ) gv->offline_vq;
+  if (vqhmm && pf){
+    fwrite(&(vqhmm->inum_prior), sizeof(short), 1, pf);
+    if (vqhmm->inum_prior > 0){
+      nwrite = fwrite(vqhmm->iprior, sizeof(short), vqhmm->inum_prior, pf);
+      if( nwrite != (size_t)vqhmm->inum_prior )
+       return eTIesrEngineVQHMMSave;
+      nwrite = fwrite(vqhmm->pprior, sizeof(short), vqhmm->inum_prior, pf);
+      if( nwrite != (size_t)vqhmm->inum_prior )
+       return eTIesrEngineVQHMMSave; 
+    }
+  }
+#endif
+  return eTIesrEngineSuccess;
+}
+#ifdef USE_ORM_PU
+/* update prior probability of the reference model */
+static void rj_update_prior(OFFLINE_VQ_HMM_type* vqhmm)
+{
+  short i, j, k, inum = vqhmm->inum_frms_gbg; 
+  short imax[GBG_NUM_IDS], iprev_num = inum;
+  short cnt[GBG_NUM_IDS]; 
+  short npost = 0, prb_sum = 0;
+
+  /* back up */
+  for (i=inum-1;i>=0;i--) {
+    imax[i] = vqhmm->imax_10[i]; 
+    cnt[i] = 0; 
+  }
+
+  /* compact the reference model of this utterance */
+  inum = uniq(vqhmm->imax_10, NULL, vqhmm->inum_frms_gbg);
+#if defined(DEV_NONSTATIONARY) || defined(DEV_PRIOR_SHOW) 
+  printf("current cluster: ");
+  for (i=0;i<inum;i++) 
+    printf("%d ", vqhmm->imax_10[i]);
+  printf("\n");
+#endif
+
+  /* obtain prabilities of clusters in the reference model in this utterance */
+  for (i=iprev_num-1;i>=0;i--){
+    for (j=inum-1;j>=0;j--)
+      if (imax[i] == vqhmm->imax_10[j])
+       cnt[j] ++; 
+  }
+  for (i=inum-1;i>=0;i--){
+    j = (cnt[i] << 6); 
+    cnt[i] = j / iprev_num; /* the probability of cluster i */
+  }
+
+  /* prepare the posterior */
+  j = vqhmm->inum_prior; 
+#ifdef TEST_PU
+  if (j==0){
+    vqhmm->inum_prior = 14; 
+    short fakeidx[14]={0, 45, 50, 62 , 30, 127, 32, 39, 107, 65,  124, 64, 59, 7 };
+    for (i=0;i<vqhmm->inum_prior;i++){
+      vqhmm->iprior[i] = fakeidx[i]; 
+      vqhmm->pprior[i] = (2<<6)/14;
+    }
+    j = vqhmm->inum_prior; 
+  }
+#endif
+  for (i=0;i<inum;i++){
+    vqhmm->iprior[j + i] = vqhmm->imax_10[i]; 
+    vqhmm->pprior[j + i] = cnt[i] ; 
+  }
+
+
+  npost = inum + vqhmm->inum_prior; 
+
+  npost = uniq(vqhmm->iprior, vqhmm->pprior, npost); 
+
+  for (i=npost-1;i>=0;i--)
+    prb_sum += vqhmm->pprior[i]; 
+  vqhmm->inum_prior = 0; 
+  for (i=0;i<npost;i++){
+    j = (vqhmm->pprior[i] << 6);
+    vqhmm->pprior[i] = j/prb_sum; /* Q6 */
+    /* the threshold is 10% in Q6 */
+    if (vqhmm->pprior[i] <  GBG_post_threshold) {
+      for (k=i;k<npost-1;k++){
+       vqhmm->iprior[k] = vqhmm->iprior[k+1];
+       vqhmm->pprior[k] = vqhmm->pprior[k+1]; 
+      }
+      npost--;
+      i--;
+      continue; 
+    }else{
+      if (vqhmm->inum_prior >= 3*GBG_NUM_IDS) 
+       break; /* no more space for saving the reference clusters */
+      vqhmm->inum_prior++;
+    }
+  }
+
+#ifdef  DEV_PRIOR_SHOW
+  printf("updated ");
+  for (i=0;i<vqhmm->inum_prior;i++)
+    printf("%d ", vqhmm->iprior[i]);
+#endif
+
+}
+
+#endif
+
+#ifdef USE_ORM_VAD
+
+static Boolean rj_low_conf_seg(OFFLINE_VQ_HMM_type* vqhmm, gmhmm_type * gv)
+{
+  if (vqhmm->is_speech < u_low_is_speech){
+    vqhmm->i_low_is_speech ++; 
+  }else vqhmm->i_low_is_speech = 0; 
+
+  if (vqhmm->i_low_is_speech > GBG_NUM_SIL) return TRUE; 
+  else return FALSE; 
+}
+
+/* GMM-based VAD
+   Speech event is triggered by a preliminary energy-based method. This function further
+   verifies the event. 
+   A speech event is verified if
+   1) log-likeliood ratio of the best matched cluster relative to a reference model is
+   above a certain threshold. 
+   The threshold dependes on the background noise level. 
+   After verification of speech event, a long pause may occur. This function thus detects
+   the exisitence of long pause by looking at how many frames of speech falls below a threshold
+   of log-likelihood ratio. If so, the VAD is checked as FALSE, and incoming frames are
+   buffered untill a speech event is verified again by the function. 
+   
+*/
+static Boolean rj_voice_begining(gmhmm_type * gv)
+{
+  OFFLINE_VQ_HMM_type *vqhmm =  (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  NssType* pNss = (NssType*) gv->pNss ; 
+  short noiselvl = pNss->noiselvl;
+
+  if (vqhmm->bVADVerified == FALSE ){
+    /* noise-dependent threshold */
+    if ((noiselvl >= vqhmm->th_noise_lvl) && (vqhmm->is_speech >  vqhmm->th_llr_in_high_noise))
+      vqhmm->bVADVerified = TRUE; 
+    else 
+      if ((noiselvl < vqhmm->th_noise_lvl) && (vqhmm->is_speech >  vqhmm->th_llr_in_low_noise))
+       vqhmm->bVADVerified = TRUE; 
+  }else
+    /* check if LLRs of the incomming frames continiously below a threshold, then trigger
+       VAD again */
+    if (rj_low_conf_seg(vqhmm, gv) == TRUE) 
+      vqhmm->bVADVerified = FALSE; 
+
+  /* could trigger end of speech because of such long segments of low confidence */
+  if (vqhmm->is_speech < vqhmm->ending_llr_th){
+    vqhmm->ending_low_llr_cnt++;
+  }else vqhmm->ending_low_llr_cnt = 0;
+  
+  if (vqhmm->ending_low_llr_cnt > vqhmm->ending_cnt_th)
+    gv->gbg_end_of_speech = TRUE; 
+
+  if (vqhmm->ending_cnt > vqhmm->ending_cnt_after_peak)
+    gv->gbg_end_of_speech = TRUE; 
+
+  return vqhmm->bVADVerified; 
+}
+
+static void rj_voice_buffering(gmhmm_type* gv, short *mfcc_feat)
+{
+  OFFLINE_VQ_HMM_type *vqhmm =  (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  short idx = vqhmm->voice_idx, j; 
+
+  if (vqhmm->bVADVerified == FALSE){
+
+    idx = circ_idx( idx ); 
+    for (j=gv->nbr_dim-1;j>=0;j--)
+      vqhmm->mfcc_buf[idx * gv->nbr_dim + j] = mfcc_feat[j] ; 
+    vqhmm->voice_idx++; 
+    if (vqhmm->voice_idx <= MFCC_BUF_SZ)
+      vqhmm->iPushed ++; 
+    vqhmm->bSynced = FALSE; 
+  }
+}
+
+static short* rj_vad_pop_buf(gmhmm_type *gv)
+{
+  OFFLINE_VQ_HMM_type *vqhmm =  (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  short idx = vqhmm->voice_idx; 
+
+  if (vqhmm->bSynced) return NULL; 
+
+  /* several frames has already passed detection, go back */
+  if (vqhmm->iPushed > 0)
+    idx = circ_idx( idx - vqhmm->iPushed ); 
+  else idx = -1; 
+
+  if (idx >= 0){
+    vqhmm->iPushed--; 
+    return &(vqhmm->mfcc_buf[idx * gv->nbr_dim]) ; 
+  }
+  else{
+    vqhmm->bSynced = TRUE; 
+    vqhmm->voice_idx = 0;
+    return NULL; 
+  }
+}
+#endif
+
+/* GMM-based VAD
+   if SAD is not verified, buffer the input speech and return NULL,
+   if SAD is verified, then pop up buffered speech frames untill the buffer is clear. 
+   the status is called synchronized to the current frame. After synchronization, 
+   just forward the incoming frame as the output. 
+   
+*/
+TIESRENGINECOREAPI_API short* rj_vad_proc(gmhmm_type * gv, short * mfcc_feat)
+{
+#ifdef USE_ORM_VAD
+  OFFLINE_VQ_HMM_type *vqhmm =  (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  Boolean bSpeech = rj_voice_begining(gv);
+  short * pMfcc;
+
+  if (bSpeech == FALSE) {
+    rj_voice_buffering(gv, mfcc_feat);
+    return NULL; 
+  }
+  else{
+    pMfcc = rj_vad_pop_buf(gv);
+    if(pMfcc) {
+      /* compute cluster scores for the popped frame */
+      rj_clear_obs_scr(gv, pMfcc);
+      
+      return pMfcc;
+    }
+    else{
+      if (vqhmm->b_orig_done == FALSE){
+       vqhmm->b_orig_done = TRUE; 
+       return mfcc_feat; 
+      }else{
+       vqhmm->b_orig_done = FALSE ; 
+       return NULL;
+      }
+    }
+  }
+#else
+  return NULL;
+#endif
+}
+
+/* The function conducts two operations: 
+   1) if the current frame number is smaller than a threshold,
+   it records the best matched Gaussian cluster and put it to construct a reference model
+   2) else, it updates score of the online reference model 
+   Also, it computes the log-likelihood ratio of the best matched cluster w.r.t.
+   the reference model
+*/
+TIESRENGINECOREAPI_API void rj_update_noise(gmhmm_type * gv, short * mfcc_feat, short imax)
+{
+#ifdef USE_ONLINE_REF
+  register short j; 
+  register short bkscore = LZERO;
+  OFFLINE_VQ_HMM_type *vqhmm =  (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+
+  if (vqhmm->fd_frms  >= vqhmm->inum_frms_gbg){
+#ifdef USE_ORM_PU
+    for (j=vqhmm->inum_prior-1;j>=0;j--){
+      bkscore = MAX(bkscore, vqhmm->dist[vqhmm->iprior[j]]); 
+    }
+#else
+    for (j=vqhmm->inum_diff_cls-1;j>=0;j--){
+      bkscore = MAX(bkscore, vqhmm->dist[vqhmm->imax_10[j]]);
+    }
+#endif
+  }
+
+  if (vqhmm->fd_frms < vqhmm->inum_frms_gbg){
+    vqhmm->imax_10[vqhmm->fd_frms] = imax; 
+    bkscore = 0;
+    vqhmm->ga_score = LZERO; 
+
+    if (vqhmm->fd_frms == (vqhmm->inum_frms_gbg - 1)){
+#ifdef USE_ORM_PU
+      rj_update_prior(vqhmm); 
+#else
+      vqhmm->inum_diff_cls = uniq(vqhmm->imax_10, NULL, vqhmm->inum_frms_gbg);
+#endif
+#ifdef DEV_CLS2PHONE
+      vqhmm->bRefCloseToSilence = rj_reference_close_to_silence_model(vqhmm);
+#endif
+
+#if defined(DEV_NONSTATIONARY) || defined(DEV_PRIOR_SHOW) 
+      if (vqhmm->inum_diff_cls > 0){
+       printf("current cluster: ");
+       for (j=0;j<vqhmm->inum_diff_cls;j++) 
+         printf("%d ", vqhmm->imax_10[j]);
+       printf("\n");
+      }
+#endif
+    }
+  }else{
+    vqhmm->ga_score = bkscore; 
+    bkscore = vqhmm->max_dist - bkscore; 
+  }
+
+  vqhmm->is_speech >>= 1; 
+  vqhmm->is_speech += (bkscore >> 1);
+
+#ifdef USE_ORM_VAD
+  if ((vqhmm->is_speech < vqhmm->max_llr) && ( gv->frm_cnt > GBG_END_SPEECH_START )){
+    vqhmm->ending_cnt ++; 
+  }else{
+    vqhmm->ending_cnt = 0; 
+    vqhmm->i_low_is_speech = 0;
+    vqhmm->ending_low_llr_cnt = 0; 
+    vqhmm->max_llr = MAX(vqhmm->max_llr, vqhmm->is_speech); 
+    vqhmm->ending_llr_th = q15_x(GBG_END_SPEECH_TH_PERC, vqhmm->max_llr);
+  }
+#endif
+
+#ifdef DEV_NONSTATIONARY
+  FILE *fp;
+  short sp_log_ps[ N_FILTER26 ];
+
+  /* get the S^-1 * C^-1 in log-spectral domain */
+  cos_transform(mfcc_feat, sp_log_ps, gv->muScaleP2, gv->n_mfcc, gv->n_filter, gv->cosxfm ); /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+
+  fp = fopen("logs/tstnoisy.dat","ab");
+  fwrite(sp_log_ps, sizeof(short), gv->n_filter, fp);
+  fclose(fp);
+
+  fp = fopen("logs/tstclean.dat","ab");
+  fwrite(&vqhmm->ga_score, sizeof(short), 1, fp);
+  fclose(fp);
+
+  fp = fopen("logs/tstlog.dat","ab");
+  fwrite(&vqhmm->is_speech, sizeof(short), 1, fp);
+  fclose(fp);
+
+#ifdef  USE_ORM_VAD
+  fp = fopen("logs/tstcleaned.dat","ab");
+  fwrite(&vqhmm->bVADVerified, sizeof(short), 1, fp);
+  fclose(fp);
+
+  fp = fopen("logs/tstnoise.dat","at");
+  if (vqhmm->bVADVerified)
+    fprintf(fp, "%d\n", imax); 
+  else fprintf(fp, "%d\n", -1);
+  fclose(fp);
+#endif
+
+#endif
+
+  vqhmm->fd_frms ++; 
+
+#endif
+}
+
+#ifdef DEV_ONLINE_GARBAGE
+void SFB_rj_update_noise(gmhmm_type * gv, short * mfcc_feat)
+{
+  OFFLINE_VQ_HMM_type *vqhmm =  (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  short i, imin, u07 = 22938, j; 
+  short mindist= LZERO, Q15 = 32767;
+  short bkscore = LZERO;
+  short *sp, *spbias, x[MAX_DIM], s_sqrt[MAX_DIM], po[MAX_DIM]; 
+  short sp_log_inv[N_FILTER26], sp_log_ps[ N_FILTER26 ], x_log_ps[N_FILTER26],
+    noisy_log[N_FILTER26], func_d[N_FILTER26];        /* log power spectrum */  
+  long ltmp, accum, ltmp2, *accum_d ;//= vqhmm->lAccum; 
+  short a01 = 6554, a10 = 3277, a11 = 32767 - a10, a00 = 32767 - a01; 
+  short ifactor; 
+
+  for (i=vqhmm->n_cs -1; i>=0; i--){
+    if (vqhmm->dist[i] > mindist) {
+      mindist = vqhmm->dist[i]; 
+      imin = i; 
+    }
+    if (gv->frm_cnt > 10){
+      for (j=9;j>=0;j--){
+       bkscore = MAX(bkscore, vqhmm->dist[vqhmm->imax_10[j]]);
+      }
+    }
+  }
+  
+  if (gv->frm_cnt <= 10){
+    vqhmm->imax_10[gv->frm_cnt - 1] = imin; 
+    bkscore = 0;
+    vqhmm->ga_score = LZERO; 
+  }else{
+    vqhmm->ga_score = bkscore; 
+    //    bkscore = MAX(0, mindist - bkscore); 
+    bkscore = mindist - bkscore; 
+  }
+    
+  /* get the compensated mean */
+  sp = vqhmm->vq_centroid + imin * gv->nbr_dim; 
+  spbias = vqhmm->vq_bias + imin * gv->nbr_dim; 
+  for (i=vqhmm->nbr_dim-1;i>=0;i--){
+    x[i] = sp[i] + spbias[i]; 
+    x[i] = mfcc_feat[i] - x[i]; 
+    ltmp = x[i] *  vqhmm->inv_ave_var[i]; /* Q11 * Q9 = Q20 */
+    x[i] = LONG2SHORT(LONG_RIGHT_SHIFT_N(ltmp, 9));
+    s_sqrt[i] = fx_sqrt(vqhmm->inv_ave_var[i]<< 1); /* Q5 */
+    s_sqrt[i] <<= 6; /* Q11 */
+  }
+
+  /* get the (y-x)*S^-2*C^-1 in log-spectral domain */
+  cos_transform(x, sp_log_ps, gv->muScaleP2, gv->n_mfcc, gv->n_filter, gv->cosxfm ); /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+
+  /* get the S^-1 * C^-1 in log-spectral domain */
+  cos_transform(s_sqrt, sp_log_inv, gv->muScaleP2, gv->n_mfcc, gv->n_filter, gv->cosxfm ); /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+
+  /* get the S^-1 * C^-1 in log-spectral domain */
+  cos_transform(sp, x_log_ps, gv->muScaleP2, gv->n_mfcc, gv->n_filter, gv->cosxfm ); /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+
+  /* obtain the first order differential of noisy speech w.r.t. to noise */
+  log_spectral_compensation(x_log_ps, NULL, noisy_log, NULL, gv->log_N, gv->log_H, 1, func_d, gv->n_filter);
+
+  for (i=gv->n_filter-1;i>=0;i--){
+    ltmp = Q15 - func_d[i]; /*Q15, exp(n)/(exp(n) + exp(h + x)) */
+    ltmp *= sp_log_ps[i]; /* Q24 */
+    accum = LONG_RIGHT_SHIFT_N(ltmp, 10); /* Q14 */
+
+    ltmp = sp_log_inv[i] * (Q15 - func_d[i]);   /* Q24 */
+    ltmp = LONG_RIGHT_SHIFT_N(ltmp, 15); /*Q9*/
+    ltmp *= ltmp; /* Q18 */
+    ltmp = LONG_RIGHT_SHIFT_N(ltmp, 4); /* Q14 */
+
+    //    ltmp2 = (accum >> 4) * func_d[i]; /* Q25 */
+    //ltmp2 = LONG_RIGHT_SHIFT_N(ltmp2, 11); /* Q14 */
+    //ltmp = ltmp - ltmp2; /* Q14 */
+
+    accum_d[i] = (((accum_d[i] >> 1) + accum_d[i] )>>1)  + ltmp; 
+
+    if (accum_d[i] > 0)
+      ltmp = -div32_32_Q(accum, accum_d[i], 9);
+    else ltmp = 0;
+    ltmp >>= 1; /* discounting factor*/
+    ltmp = MAX(0, ltmp);
+
+    accum = ltmp * (Q15 - func_d[i]); /* Q24 */
+    accum = LONG_RIGHT_SHIFT_N(accum, 15); /* Q9 */
+
+    noisy_log[i] = LONG2SHORT(accum);
+
+  }
+
+  inverse_cos_transform(noisy_log, po, gv->muScaleP2, gv->n_mfcc, gv->n_filter, gv->cosxfm);
+
+#ifdef DEV_NONSTATIONARY
+  /* get the S^-1 * C^-1 in log-spectral domain */
+  cos_transform(mfcc_feat, sp_log_inv, gv->muScaleP2, gv->n_mfcc, gv->n_filter, gv->cosxfm ); /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+#endif
+
+  //  for (i=gv->n_mfcc-1;i>=0;i--) mfcc_feat[i] -= po[i];
+
+  /* update VAD status */
+
+  /*
+  ltmp = gv->frm_cnt - 1; 
+  ltmp <<= 15;
+  ltmp /= gv->frm_cnt; 
+    
+  vqhmm->is_speech = q15_x(LONG2SHORT(ltmp), vqhmm->is_speech) + bkscore / gv->frm_cnt; 
+  */
+  vqhmm->is_speech >>= 1; 
+  vqhmm->is_speech += (bkscore >> 1);
+
+#ifdef DEV_NONSTATIONARY
+  /* get the S^-1 * C^-1 in log-spectral domain */
+  cos_transform(mfcc_feat, sp_log_ps, gv->muScaleP2, gv->n_mfcc, gv->n_filter, gv->cosxfm ); /* cepstrum to log mel power spectrum, Q 11 to Q 9 */
+
+  FILE *fp;
+  fp = fopen("logs/tstnoise.dat","ab");
+  fwrite(noisy_log, sizeof(short), gv->n_filter, fp);
+  fclose(fp);
+
+  fp = fopen("logs/tstclean.dat","ab");
+  fwrite(x_log_ps, sizeof(short), gv->n_filter, fp);
+  fclose(fp);
+
+  fp = fopen("logs/tstnoisy.dat","ab");
+  fwrite(sp_log_inv, sizeof(short), gv->n_filter, fp);
+  fclose(fp);
+
+  fp = fopen("logs/tstcleaned.dat","ab");
+  fwrite(sp_log_ps, sizeof(short), gv->n_filter, fp);
+  fclose(fp);
+
+  fp = fopen("logs/tstlog.dat","ab");
+  fwrite(&vqhmm->is_speech, sizeof(short), 1, fp);
+  //fwrite(&vqhmm->viterbi_weight,sizeof(short), 1, fp);
+  fclose(fp);
+#endif
+}
+#endif
+
+/* This function conducts scoring of Gaussian clusters,
+   It also assigns Gaussian clusters into categories such as core, intermedium, and outmost. */
+short rj_clear_obs_scr(gmhmm_type * gv, short *mfcc_feat)
+{
+   short imax = 0;
+#ifdef RAPID_JAC
+
+  /* find the closest clusters */
+  OFFLINE_VQ_HMM_type *vqhmm =  (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  ushort uthre, uthre_exp;
+  long  tmp; 
+  short k, i, thre , thre_exp, gconst = vqhmm->gconst;
+  short * sp_bias, tsp[MAX_DIM], *sp, maxdist = -32767, mindist = 32767; 
+
+  for (i=vqhmm->n_cs-1;i>=0;i--){
+    sp = vqhmm->vq_centroid + i * gv->nbr_dim; 
+    sp_bias = vqhmm->vq_bias + i * gv->nbr_dim; 
+    for (k=vqhmm->nbr_dim-1;k>=0;k--) tsp[k] = sp[k] + sp_bias[k]; 
+
+    vqhmm->dist[i] = rj_dist(mfcc_feat, tsp, vqhmm->inv_ave_var, gconst, gv->nbr_dim); 
+    if (vqhmm->dist[i] > maxdist){
+      maxdist = vqhmm->dist[i]; 
+      imax = i; 
+    }
+    mindist = MIN(vqhmm->dist[i], mindist);
+  }
+
+  /* caculate threshold for the intermediate clusters , above this threshold, 
+   clusters are core. Below this threshold, they belong to either intermediate or outmost clusters. */
+
+#if defined(USE_ONLINE_REF) || defined(USE_ORM_VAD)
+  k = (vqhmm->fd_frms < 1)? vqhmm->n_cs : vqhmm->sVQ_CLS_TO_EVAL;
+#else
+  k = (gv->frm_cnt <= 1)? vqhmm->n_cs : vqhmm->sVQ_CLS_TO_EVAL;
+#endif
+
+  tmp = k; tmp <<= 5; tmp /= vqhmm->n_cs; 
+  tmp *= (maxdist - mindist); tmp >>= 5; 
+  uthre = (short) tmp; 
+  thre = maxdist - uthre; 
+
+  /* caculate threshold to select out-most clusters*/
+  if (vqhmm->sVQ_NUM_INTER == 0) thre_exp = thre;
+  else{
+    k = MIN(k + vqhmm->sVQ_NUM_INTER, vqhmm->n_cs);
+    tmp = k; tmp <<= 5; tmp /= vqhmm->n_cs; 
+    tmp *= (maxdist - mindist); tmp >>= 5; 
+    uthre_exp = (short) tmp; 
+    thre_exp = maxdist - uthre_exp; 
+  }
+
+  for (i=vqhmm->n_cs-1;i>=0;i--) {
+    if (vqhmm->dist[i] >= thre) vqhmm->category[i] = 0; /* core clusters */
+    else if (vqhmm->dist[i] < thre_exp && vqhmm->low_score != -LZERO) {
+      vqhmm->dist[i] = vqhmm->low_score ; /* outmost clusters */
+      vqhmm->category[i] = 2; 
+    }
+    else vqhmm->category[i] = 1; /* intermediate clusters */
+  }
+
+  /* the correct lowest score is obtained during decoding. 
+     if the decoding has not yet conducted, use the GS_LOW_SCORE instead 
+     as the lowest score */
+  if (gv->frm_cnt > 0)
+    vqhmm->low_score = -LZERO; 
+  else 
+    vqhmm->low_score =  GS_LOW_SCORE;
+
+  vqhmm->max_dist = maxdist; 
+
+#endif
+
+  return imax; 
+}
+
+void rj_init(gmhmm_type *gv)
+{
+  short i; 
+  OFFLINE_VQ_HMM_type * vqhmm = (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+  
+  for (i = vqhmm->n_cs -1;i>=0;i--) {
+    vqhmm->dist[i] = LZERO ; 
+#ifdef DEV_CLS2PHONE
+    vqhmm->cls_nphone[i] = 0; 
+#endif
+  }
+
+#if defined(DEV_CLS2PHONE)
+  vqhmm->bRefCloseToSilence = TRUE; 
+#endif
+
+  vqhmm->low_score = -LZERO;
+
+#ifdef  USE_ONLINE_REF
+  vqhmm->is_speech = 0; 
+  vqhmm->i_low_is_speech = 0; 
+  gv->gbg_end_of_speech = FALSE;
+
+  vqhmm->fd_frms = 0; 
+
+#ifdef USE_ORM_VAD
+  vqhmm->bVADVerified = FALSE; 
+  vqhmm->voice_idx = 0;
+  vqhmm->bSynced= FALSE; 
+  vqhmm->iPushed= 0; 
+  vqhmm->b_orig_done = FALSE; 
+
+  vqhmm->ending_low_llr_cnt = 0; 
+  vqhmm->max_llr = LZERO; 
+  vqhmm->ending_cnt = 0;
+  vqhmm->ending_llr_th = LZERO; 
+
+#endif
+
+#endif
+
+#ifdef DEV_CLS2PHONE
+  rj_cls2phone(gv); 
+#endif
+
+#ifdef DEV_NONSTATIONARY
+  FILE *fp;
+  fp = fopen("logs/tstnoise.dat","wb");
+  fclose(fp);
+
+  fp = fopen("logs/tstclean.dat","wb");
+  fclose(fp);
+
+  fp = fopen("logs/tstnoisy.dat","wb");
+  fclose(fp);
+
+  fp = fopen("logs/tstcleaned.dat","wb");
+  fclose(fp);
+
+  fp = fopen("logs/tstlog.dat","wb");
+  fclose(fp);
+#endif
+}
+  
+/* @param pFlexModelPath The path saving models for TIesrFlex
+   @param perc_core_clusters_q15 precentage of core clusters, value in Q15,
+   @param perc_inter_clusters_q15 percentage of intermediate clusters, value in Q15 
+   @param gv pointer to decoder
+   @param pMem pointer to avaliable memory space 
+   return TRUE if success, else return FALSE
+*/
+TIesrEngineStatusType rj_open(ushort u_perc_cor, 
+                             ushort u_perc_inte, 
+                             gmhmm_type *gv )
+{
+  TIesrEngineStatusType bSucc ; 
+  OFFLINE_VQ_HMM_type * pOffline = (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+
+  pOffline->mem_count = 0;
+
+  bSucc = rj_vq(gv);
+  if (bSucc == eTIesrEngineVQHMMMemorySize) return bSucc; 
+
+  if(rj_set_param(u_perc_cor, u_perc_inte, gv) == FALSE)
+    return eTIesrEngineVQHMMGarbage;
+
+#ifdef USE_ORM_PU
+  pOffline->inum_prior = 0; 
+#endif
+
+  return bSucc; 
+}
+
+/* setup parameters for online reference modeling, VAD and EOS detection
+   @param num_frms_gbg: number of begining frames to construct gabage model 
+   @param noise_level : the noise level threshold to choose an LLR threshold
+   @param th_llr_low_noise: the LLR threshold in low noise level
+   @param th_llr_high_noise: the LLR threshold in high noise level 
+   @param ctn_th : number of frames that continuously below a threshold
+   @param llr_perc_th : the threshold is computed as $llr_perc_th * max_llr, where max_llr
+   is the score of the best matched cluster 
+   @param start_from : don't do EOS decision making untill $start_from of frames have
+   passed the peak of LLR 
+   @param th_nbr_frm_after_peak EOS will be triggered if more than the number of 
+   frames have been processed
+   return TRUE if sucess
+*/
+TIESRENGINECOREAPI_API Boolean rj_set_ORM(short num_frms_gbg,
+                  short noise_level,
+                  short th_llr_low_noise, short th_llr_high_noise,
+                  short cnt_th, ushort llr_perc_th, short start_from, 
+                  short th_nbr_frm_after_peak, 
+                  gmhmm_type * gv)
+{
+  OFFLINE_VQ_HMM_type * pOffline = (OFFLINE_VQ_HMM_type*) gv->offline_vq;
+
+  if (pOffline){
+#ifdef USE_ONLINE_REF
+    if ( GBG_NUM_IDS >= num_frms_gbg) {
+      pOffline->inum_frms_gbg = num_frms_gbg; 
+    }else{
+      return FALSE; 
+    }
+#endif
+
+#ifdef USE_ORM_VAD
+    pOffline->th_noise_lvl = noise_level;
+    pOffline->th_llr_in_low_noise = th_llr_low_noise; 
+    pOffline->th_llr_in_high_noise = th_llr_high_noise; 
+
+    pOffline->ending_cnt_th = cnt_th; 
+    pOffline->ending_llr_th = 0; 
+    pOffline->ending_llr_perc = llr_perc_th; 
+    pOffline->ending_cnt_stt = start_from; 
+
+    pOffline->ending_cnt_after_peak = th_nbr_frm_after_peak;
+#endif
+  }
+  return TRUE; 
+}
+
+void rj_close(gmhmm_type* gv)
+{
+
+  gv->offline_vq = NULL; 
+
+}
+
+#ifdef MODEL_LEVEL_PRUNE
+void mlp_set_param(ushort uPercentage, gmhmm_type * gv)
+{
+  MODEL_PRUNE_type * pMLP = (MODEL_PRUNE_type*)gv->pPhoneLevelPrune; 
+  pMLP->uPercentage = uPercentage; 
+}
+
+/* reset phone-level pruning */
+void mlp_reset(gmhmm_type* gv)
+{
+  register short i; 
+  MODEL_PRUNE_type * pMLP = (MODEL_PRUNE_type*)gv->pPhoneLevelPrune; 
+
+  for (i=MLP_NUM_MONOPHONE-1;i>=0;i--) {
+    pMLP->p_s_active[i] = 0;
+    pMLP->p_s_cur_mono[i] = LZERO >> 1;
+  }
+}
+
+#endif
+
+/* update model level prunning */
+void mlp_update(gmhmm_type* gv, short hmm_idx, long score)
+{
+#ifdef MODEL_LEVEL_PRUNE
+  short monophone_index; 
+  short * hmm2phone =  sbc_rtn_hmm2phone(gv->sbcState);
+  short scr = LONG2SHORT(score);
+  MODEL_PRUNE_type * pMLP = (MODEL_PRUNE_type*)gv->pPhoneLevelPrune; 
+
+  monophone_index = *( hmm2phone + hmm_idx ); 
+  monophone_index++; 
+
+  pMLP->p_s_active[monophone_index] = 1; 
+
+  pMLP->p_s_cur_mono[monophone_index] = MAX(scr, pMLP->p_s_cur_mono[monophone_index]);
+#endif
+}
+
+/* open phone-level pruning */
+void mlp_open(gmhmm_type* gv)
+{
+#ifdef MODEL_LEVEL_PRUNE
+  MODEL_PRUNE_type * pMLP = (MODEL_PRUNE_type*)gv->pPhoneLevelPrune; 
+
+  pMLP->mem_count = 0;
+  pMLP->p_s_active = mem_alloc( pMLP->base_mem, &pMLP->mem_count, 
+                               MLP_NUM_MONOPHONE, MLP_SIZE, SHORTALIGN, "active phone idx");
+  pMLP->p_s_cur_mono = mem_alloc( pMLP->base_mem, &pMLP->mem_count, 
+                                 MLP_NUM_MONOPHONE, MLP_SIZE, SHORTALIGN, "phone score");
+  
+  mlp_reset(gv); 
+  mlp_set_param( MLP_uPercentage, gv);
+#endif
+}
+
+void mlp_init(gmhmm_type *gv)
+{
+#ifdef MODEL_LEVEL_PRUNE
+  MODEL_PRUNE_type * pMLP = (MODEL_PRUNE_type*)gv->pPhoneLevelPrune; 
+  pMLP->prevBeam = 0;
+#endif
+}
+
+/* close phone-level pruning */
+void mlp_close(gmhmm_type * gv)
+{
+#ifdef MODEL_LEVEL_PRUNE
+  gv->pPhoneLevelPrune = NULL; 
+#endif
+}
+
+/* calculate pruning threshold 
+   @param gv pointer to decoder
+   @param th_default the pruning threshold by default beam-width pruning 
+   @param beam_width beam width for pruning
+   return pruning threshold
+ */
+short mlp_threshold(gmhmm_type *gv , long th_default , short beam_width)
+{
+#ifdef MODEL_LEVEL_PRUNE
+  MODEL_PRUNE_type * pMLP = (MODEL_PRUNE_type*)gv->pPhoneLevelPrune; 
+  register short max_v = LZERO >> 1, min_v = -LZERO >> 1, i , j = 0, threshold;
+
+  for (i=MLP_NUM_MONOPHONE-1;i>=0;i--){
+    if (pMLP->p_s_active[i]){
+      max_v = MAX(pMLP->p_s_cur_mono[i], max_v);
+      min_v = MIN(pMLP->p_s_cur_mono[i], min_v);
+      j++;
+    }
+  }
+  
+  if (j==0){
+    PRT_ERR(printf("%d", th_default));
+    return LONG2SHORT(th_default); 
+  }
+  threshold = max_v - min_v; 
+  threshold = q15_x(pMLP->uPercentage, threshold);
+  threshold = min_v + threshold; 
+
+  //  threshold = threshold + (MLP_PRUNE * (1 << 6)) * gv->nbr_dim;
+  threshold = threshold + beam_width; 
+
+  //  i = threshold - gv->best_prev_scr; /* the beam width to the best path */
+  //pMLP->prevBeam = MIN(pMLP->prevBeam, i); 
+  //threshold = gv->best_prev_scr + pMLP->prevBeam; 
+
+  return threshold; 
+#else
+  return 0;
+#endif
+}
+
+#ifdef _MONOPHONE_NET
+gmhmm_type* rs_get_monophone_search_space(gmhmm_type * gvv){
+  if (gvv->pRapidSearch){
+    return (gmhmm_type*) gvv->pRapidSearch;
+  }else return NULL;
+}
+#endif
+
+TIESRENGINECOREAPI_API void cm_freeze(ConfType* pconf)
+{
+   if( pconf )
+      pconf->bNeedUpdate = FALSE; 
+}
+
+short * cm_antiscr(ConfType* pconf, ushort frm_cnt)
+{
+#ifdef USE_CONFIDENCE
+  if (frm_cnt >= CM_MAX_FRM) return NULL; 
+  return  & (pconf->cm_anti_scr[frm_cnt]); 
+#else
+  return NULL;
+#endif
+}
+
+TIESRENGINECOREAPI_API TIesrEngineStatusType cm_open( ConfType* pconf,
+        gmhmm_type * gv )
+{
+#ifdef USE_CONFIDENCE
+  short i; 
+
+  pconf->bCalced = FALSE ; 
+
+  pconf->mem_count = 0 ; 
+  pconf->cm_anti_scr = mem_alloc(pconf->base_mem, &pconf->mem_count,
+                                CM_MAX_FRM, CM_SIZE, SHORTALIGN, "anti score");
+  if (pconf->cm_anti_scr == NULL) return eTIesrEngineCMMemorySize;
+
+  pconf->answers = (ushort*)mem_alloc(pconf->base_mem, &pconf->mem_count,
+                                CM_MAX_WORD, CM_SIZE, SHORTALIGN, "answers");
+  if (pconf->answers == NULL) return eTIesrEngineCMMemorySize;
+
+  pconf->uStp = (ushort*) mem_alloc(pconf->base_mem, &pconf->mem_count,
+                                   CM_MAX_WORD, CM_SIZE, SHORTALIGN, "stop at frame");
+  if (pconf->uStp == NULL) return eTIesrEngineCMMemorySize;
+
+  pconf->cm_scr = mem_alloc(pconf->base_mem, &pconf->mem_count,
+                           CM_SCRS, CM_SIZE, SHORTALIGN, "stop at frame");
+  if (pconf->cm_scr == NULL) return eTIesrEngineCMMemorySize;
+
+  pconf->lgBeta = mem_alloc(pconf->base_mem, &pconf->mem_count,
+                           CM_NBR_BETA, CM_SIZE, SHORTALIGN, "stop at frame");
+  if (pconf->lgBeta == NULL) return eTIesrEngineCMMemorySize;
+
+  pconf->acc_dif2_beta = (long*)mem_alloc(pconf->base_mem, &pconf->mem_count,
+                                         CM_NBR_BETA<<LONGSHIFT, CM_SIZE, LONGALIGN, "stop at frame");
+  if (pconf->acc_dif2_beta == NULL) return eTIesrEngineCMMemorySize;
+
+  for (i=CM_NBR_BETA-1;i>=0;i--){
+    pconf->lgBeta[i] = CM_LOGIST_PARA[i];
+    pconf->acc_dif2_beta[i] = 0;
+  }
+
+  gv->cm_score = 0;
+
+#ifdef  USE_CONF_DRV_ADP
+  pconf->sCH = mem_alloc( pconf->base_mem, &pconf->mem_count, 
+                         N_FILTER26, CM_SIZE, SHORTALIGN, "channel");
+  if (pconf->sCH == NULL) return eTIesrEngineCMMemorySize;
+
+  pconf->lAccum = (long*)mem_alloc(pconf->base_mem, &pconf->mem_count, 
+                           (2*N_FILTER26)<<LONGSHIFT, CM_SIZE, LONGALIGN, "channel accum"); 
+  if (pconf->lAccum == NULL) return eTIesrEngineCMMemorySize;
+
+#ifdef USE_SVA
+  /* backup the SVA parameters */
+  pconf->sLogVarRho = mem_alloc(pconf->base_mem, &pconf->mem_count,
+                               gv->nbr_dim , CM_SIZE, SHORTALIGN, "SVA rho"); 
+  if (pconf->sLogVarRho == NULL) return eTIesrEngineCMMemorySize;
+
+  /* backup the SVA fisher IM parameters */
+  pconf->lVarFisherIM = (long*)mem_alloc(pconf->base_mem, &pconf->mem_count, 
+                                 gv->nbr_dim << LONGSHIFT, CM_SIZE, LONGALIGN, "SVA fisher"); 
+  if (pconf->lVarFisherIM == NULL) return eTIesrEngineCMMemorySize;
+
+#endif      
+
+#endif
+
+#endif
+  return eTIesrEngineSuccess;
+}
+
+/* @param th_adp, the threshold for unsupervised adaptation 
+   @param th_nbest, the threshold of number of N-bests to declare low 
+                    confidence of an uttearnce 
+*/
+TIESRENGINECOREAPI_API void cm_set_param( short th_adp,
+                  short th_nbest,
+                  gmhmm_type * gv )
+{
+  ConfType * pconf = (ConfType*)gv->pConf; 
+#ifdef USE_CONF_DRV_ADP
+  pconf->adp_th  = th_adp; 
+#endif
+  pconf->th_nbest = th_nbest ; 
+}
+
+TIESRENGINECOREAPI_API void cm_backup_adp( gmhmm_type * gv)
+{ 
+#ifdef USE_CONF_DRV_ADP
+  ConfType * pconf = (ConfType*)gv->pConf; 
+  register short i; 
+  
+  for (i=N_FILTER26-1; i>=0;i--) {
+    pconf->sCH[i] = gv->log_H[i]; 
+    pconf->lAccum[2*i] = gv->accum[2*i]; 
+    pconf->lAccum[2*i+1] = gv->accum[2*i + 1]; 
+#ifdef USE_SVA
+    pconf->sLogVarRho[i] = gv->log_var_rho[i]; 
+    pconf->lVarFisherIM[i] = gv->var_fisher_IM[i]; 
+#endif
+  }
+#ifdef USE_SBC
+  if (gv->comp_type & SBC)
+    sbc_backup(gv->sbcState);
+#endif
+#endif
+}
+
+TIESRENGINECOREAPI_API void cm_restore_adp(gmhmm_type * gv)
+{
+#ifdef USE_CONF_DRV_ADP
+  ConfType * pconf = (ConfType*)gv->pConf; 
+  register short i; 
+
+#ifdef DEV_CONFIDENCE
+  printf("SKIP ADAPTATION ");
+#endif
+
+  for (i=N_FILTER26-1; i>=0;i--){
+    gv->log_H[i] = pconf->sCH[i];
+    gv->accum[2*i] = pconf->lAccum[2*i] ;
+    gv->accum[2*i + 1] = pconf->lAccum[2*i+1];
+#ifdef USE_SVA
+    gv->log_var_rho[i] = pconf->sLogVarRho[i] ;
+    gv->var_fisher_IM[i] = pconf->lVarFisherIM[i] ;
+#endif
+  }
+#ifdef USE_SBC
+  if (gv->comp_type & SBC)
+    sbc_restore(gv->sbcState);
+#endif
+#endif
+}
+
+TIESRENGINECOREAPI_API void cm_load(FILE* fp, gmhmm_type *gv)
+{
+#ifdef USE_CONFIDENCE
+  ConfType * pconf = (ConfType*)gv->pConf; 
+  short i; 
+
+  if (fp){
+    fread(&pconf->H0.mean, sizeof(short), 1, fp);
+    fread(&pconf->H0.inv, sizeof(short), 1, fp);
+    fread(&pconf->H0.gconst, sizeof(short), 1, fp);
+    fread(&pconf->H1.mean, sizeof(short), 1, fp);
+    fread(&pconf->H1.inv, sizeof(short), 1, fp);
+    fread(&pconf->H1.gconst, sizeof(short), 1, fp);
+    fread(&pconf->NSNR, sizeof(short), 1, fp);
+    fread(&pconf->lgBeta[0], sizeof(short), CM_NBR_BETA, fp); 
+    fread(&pconf->acc_dif2_beta[0], sizeof(long), CM_NBR_BETA, fp); 
+
+  }else{
+  
+    pconf->H0.mean = CM_UV_ACC[0]; 
+    pconf->H0.inv = CM_UV_ACC[1];
+    pconf->H0.gconst = CM_UV_ACC[2]; 
+    
+    pconf->H1.mean = CM_UV_REJ[0]; 
+    pconf->H1.inv = CM_UV_REJ[1];
+    pconf->H1.gconst = CM_UV_REJ[2]; 
+
+    for (i=CM_NBR_BETA-1;i>=0;i--){
+      pconf->lgBeta[i] = CM_LOGIST_PARA[i];
+      pconf->acc_dif2_beta[i] = 0; 
+    }
+  }
+#endif
+}
+
+TIESRENGINECOREAPI_API void cm_save(FILE *fp,
+            gmhmm_type* gv)
+{
+#ifdef USE_CONFIDENCE
+  ConfType * pconf = (ConfType*)gv->pConf; 
+
+  if (fp){
+    fwrite(&pconf->H0.mean, sizeof(short), 1, fp);
+    fwrite(&pconf->H0.inv, sizeof(short), 1, fp);
+    fwrite(&pconf->H0.gconst, sizeof(short), 1, fp);
+    fwrite(&pconf->H1.mean, sizeof(short), 1, fp);
+    fwrite(&pconf->H1.inv, sizeof(short), 1, fp);
+    fwrite(&pconf->H1.gconst, sizeof(short), 1, fp);
+    fwrite(&pconf->NSNR, sizeof(short), 1, fp);
+    fwrite(&pconf->lgBeta[0], sizeof(short), CM_NBR_BETA, fp); 
+    fwrite(&pconf->acc_dif2_beta[0], sizeof(long), CM_NBR_BETA, fp); 
+  }
+
+#endif
+}
+
+void cm_init( gmhmm_type * gv )
+{
+#ifdef USE_CONFIDENCE
+  short i;
+  ConfType * pconf = (ConfType*)gv->pConf; 
+  pconf->bCalced = FALSE; 
+
+  pconf->bNeedUpdate = TRUE; 
+  for (i=CM_MAX_FRM-1;i>=0;i--)
+    pconf->cm_anti_scr[i] = LZERO; 
+
+  pconf->nS = 0;
+
+  pconf->cm_bk_scr = 0; 
+  pconf->cm_fg_scr = 0;
+
+  pconf->speech_power = 0; 
+  pconf->noise_power = 0;
+  pconf->noise_power_sqr = 0;
+  pconf->nSpeech = 0;
+  pconf->nNoise = 0;
+
+  gv->cm_score = 0; 
+#endif
+}
+
+TIESRENGINECOREAPI_API void cm_close( gmhmm_type* gv )
+{
+}
+
+TIESRENGINECOREAPI_API void cm_acc_seg_ratio_to_antimodel(gmhmm_type *gv,
+        ushort hmm_code, short stt,
+        short stp, long scaling)
+{
+#ifdef USE_CONFIDENCE
+  ushort crt_vec; 
+  short i, j, seg_len = stp - stt; 
+  short mfcc_feature[ MAX_DIM ];
+  ConfType * pConf = (ConfType*) gv->pConf; 
+  
+  /* accumulate speech and noise power */
+  for (j=0, crt_vec = stt * gv->n_mfcc; j<seg_len; j++, crt_vec += gv->n_mfcc) {
+#ifdef BIT8FEAT
+    vector_unpacking(gv->mem_feature + crt_vec, mfcc_feature, gv->scale_feat, gv->n_mfcc); 
+#else
+    copy_feature(mfcc_feature, crt_vec, gv->n_mfcc);
+#endif
+
+    /* Q6 */
+    i = (mfcc_feature[0] >> 5); /* Q11 -> Q6 */
+    if (hmm_code == 0) {
+      pConf->noise_power += i; 
+      pConf->noise_power_sqr += (i * i);/* Q12 */
+    }
+    else {
+      pConf->speech_power += i; 
+      if (pConf->speech_power < 0){
+       //      printf("find");
+      }
+    }
+  }
+  if (hmm_code == 0) pConf->nNoise += seg_len; 
+  else pConf->nSpeech += seg_len; 
+
+  if (hmm_code == 0) return; 
+  if (stp >= CM_MAX_FRM) return; 
+
+  for (i=stt;i<stp;i++){
+    pConf->cm_bk_scr += pConf->cm_anti_scr[i];
+    pConf->nS++;
+  }
+
+  pConf->cm_fg_scr += scaling; 
+
+#ifdef DBG_CONF
+  printf("%d -> %d : fg = %d, bg = %d\n", stt, stp, pConf->cm_fg_scr, pConf->cm_bk_scr);
+#endif
+
+#endif
+}
+
+#ifdef USE_CONFIDENCE
+/* return Q6 */
+static short cm_logistic(short *x, gmhmm_type * gv)
+{
+   long ltmp = 0;
+
+  ConfType * pConf = (ConfType*) gv->pConf; 
+  long ltmp2; 
+  short lsum, stmp;
+  ushort Q15 = 32767, utmp; 
+
+  for (lsum=1;lsum<=CM_NBR_BETA-1;lsum++){
+    ltmp2 = pConf->lgBeta[lsum] * x[lsum-1]; /* Q12 */
+    ltmp -= LONG_RIGHT_SHIFT_N(ltmp2 , 6); /* Q6 */
+  }
+  ltmp -= pConf->lgBeta[0]  ; 
+
+  /* to get Q6 output, 
+     15 - l + y = 6
+     y = l - 9
+     where l = lsum, y = stmp
+  */
+  utmp = hlr_expn_q(LONG2SHORT(ltmp), 6, &lsum); /* Q lsum */
+  ltmp = (long) utmp + (1 << lsum); 
+  stmp = lsum - 9; 
+  if (stmp > 0)
+    ltmp = Q15 / (ltmp >> stmp); /* to get Q6 output */
+  else 
+    ltmp = Q15 / (ltmp << (-stmp)); 
+
+
+  return LONG2SHORT(ltmp);
+}
+#endif
+
+
+#ifdef USE_CONFIDENCE
+/* online updating of parameters for hypothesis testing */
+static void cm_update_hypo(short *feat, CM_hypo *hp)
+{
+  long mu, fea ; 
+
+#ifdef CM_UPDATE_MEAN
+  mu = hp->mean; 
+  fea = (*feat); 
+  fea <<= 5; 
+  //  mu = q15_x(u098, mu) + q15_x(u002, fea);
+  mu = mu*127 + fea; 
+  mu >>= 7;
+
+  hp->mean = LONG2SHORT(mu); 
+#endif
+
+#ifdef CM_UPDATE_VAR
+  /* update variance */
+  fea = (fea - mu);
+  fea *= fea; 
+  fea >>= 13; /* Q9 */
+  
+  mu = (1<<18) / hp->inv; /* Q9 */
+  mu *= 255;
+
+  fea += mu; /* Q9 */
+  fea >>= 8; /* normalize */
+
+  fea = (1<<18)/fea; 
+  hp->inv = LONG2SHORT(fea); /* Q9 */
+
+  hp->gconst = 
+    gauss_det_const( &hp->inv, 2, NULL, 1);
+#endif  
+
+}
+#endif
+
+
+#ifdef USE_CONFIDENCE
+/* @param feat Q6 score
+   return log-likelihood ratio between H0 and H1 hypothesis, Q6 */
+static short cm_hypo_ratio(short *feat, CM_hypo *h0, CM_hypo *h1)
+{
+  short scr_h0, scr_h1, gconst, *mu, *invvar;
+  short fea, *pfea;
+  long diff;
+  
+  fea = *feat; 
+  fea <<= 5; /* Q11 */
+  pfea = &fea; 
+  gconst = h0->gconst; 
+  mu = &h0->mean; 
+  invvar = &h0->inv; 
+  scr_h0 = rj_dist(pfea, mu, invvar, gconst, 1);
+
+  fea = *feat; 
+  fea <<= 5; /* Q11 */
+  pfea = &fea; 
+  gconst = h1->gconst; 
+  mu = &h1->mean; 
+  invvar = &h1->inv; 
+  scr_h1 = rj_dist(pfea, mu, invvar, gconst, 1);
+
+  diff = scr_h0 - scr_h1; 
+
+  return LONG2SHORT(diff);
+}
+#endif
+
+
+#ifdef USE_CONFIDENCE
+/* calculate distance of
+   p(H0|X)*(log(p(X|H0) - log(p(X|H1))
+*/
+static short cm_calc_proddiff(ConfType* pConf){
+  long ltmp;
+
+  ltmp = pConf->cm_scr[3] * pConf->cm_scr[2]; /* Q12 */
+
+  return LONG2SHORT(ltmp >> 6);
+}
+#endif
+
+
+#ifdef USE_CONFIDENCE
+/* return the confidence score due to N-best numbers. 
+   works as a bias to the confidence score reported from else */
+static short cm_score_nbest(gmhmm_type * gv)
+{
+  NB_words * nbest; 
+  ConfType * pconf = (ConfType*) gv->pConf; 
+  
+  if (gv->bUseNBest){
+    nbest = &gv->nbest; 
+    if (nbest->n_bests >= pconf->th_nbest)
+      return CM_NBEST_LOW_CONF;
+    //    else if (nbest->n_bests >= (pconf->th_nbest >> 1))
+    //return (CM_NBEST_LOW_CONF >> 1); 
+    else return 0;
+  }
+  return 0; 
+}
+#endif
+
+#ifdef USE_CONFIDENCE
+static void cm_calc_confidence( gmhmm_type * gv)
+{
+  ConfType * pConf = (ConfType*) gv->pConf; 
+  long ltmp; 
+  long sAve, nAve; 
+  short lsum ;
+
+#ifdef DBG_CONF
+  printf("conf = ");
+  for (ltmp = 0; ltmp < pConf->nSpeech + pConf->nNoise; ltmp ++)
+    printf("%d ", pConf->cm_anti_scr[(short)ltmp]);
+  printf("\n");
+#endif
+
+  ltmp = pConf->cm_fg_scr - pConf->cm_bk_scr;
+  if (pConf->nS == 0) ltmp = LZERO; 
+  else ltmp /= pConf->nS; 
+  lsum = LONG2SHORT(ltmp);
+
+  pConf->cm_scr[0] = lsum;
+
+
+  /* calculate difference between the averaged log energies of speech and noise segments */
+  sAve = (pConf->nSpeech==0)?0:(pConf->speech_power / pConf->nSpeech); 
+  nAve = (pConf->nNoise ==0)?0:(pConf->noise_power / pConf->nNoise); 
+  lsum = sAve - nAve; 
+
+  /* calcualte non-stationarity */
+  ltmp = sAve; /* Q6 */
+  ltmp *= ltmp;  /* Q12 */
+  ltmp -= ((sAve * nAve) << 1); /* Q12 */
+  ltmp += (pConf->nNoise == 0)?0:(pConf->noise_power_sqr / pConf->nNoise);  /* Q12 */
+  ltmp -= (lsum * lsum);/* Q12 */
+  ltmp = fx_sqrt(ltmp); /* Q6 */
+  pConf->NSNR = LONG2SHORT(ltmp); 
+
+  pConf->cm_scr[1] = pConf->NSNR; 
+
+  pConf->cm_scr[2] = cm_hypo_ratio(&pConf->cm_scr[0], &pConf->H0, &pConf->H1);
+  pConf->cm_scr[3] = cm_logistic(&pConf->cm_scr[0], gv); 
+
+  pConf->cm_scr[4] = cm_score_nbest(gv);
+
+  gv->cm_score = cm_calc_proddiff(pConf); 
+  
+  gv->cm_score += pConf->cm_scr[4]; 
+
+}
+#endif
+
+
+/* @param iTrue indicator of the acceptance or rejection, Q6 
+   @param pCM output of the CM module, Q6
+   @param pConf pointer to the CM module
+*/
+#ifdef TEST_CM_LOGISTIC
+static void cm_update_logistic( short iTrue, short pCM, ConfType * pConf )
+{
+  short * x = pConf->cm_scr; 
+  short i, dim = CM_NBR_BETA; 
+  short diff, Q6 = 64;
+  long first_diff, pp, W;
+  ushort u098 = 32440, u002 = 32768 - u098;
+  ushort u07 = 22938, u03 = 9830; 
+
+  diff = iTrue - pCM; /* Q6 */
+  diff = q15_x(u07, Q6 - pCM) - q15_x(u03, pCM); /* integrate the uncertainty of acceptance */
+
+  pp = pCM*(Q6 - pCM); /* Q12 */
+  for (i=dim-1;i>=0;i--) {
+    if (i==0) {
+      first_diff = Q6 * diff; 
+      W = Q6 * Q6; 
+    }else{
+      first_diff = x[i] * diff; /* Q12 */
+      W = x[i] * x[i]; /* Q12 */
+    }
+    W *= pp;   /* Q24 */
+    if (pConf->acc_dif2_beta[i] == 0) pConf->acc_dif2_beta[i] = (W >> 12); 
+    else 
+      pConf->acc_dif2_beta[i] = q15_x(u098, pConf->acc_dif2_beta[i]) + 
+       q15_x(u002, (W >> 12));  /* Q12 */
+    if ((first_diff == 0) || (pConf->acc_dif2_beta[i] == 0)) W = 0;
+    else W = (first_diff << 12) / pConf->acc_dif2_beta[i]; /* Q12 */
+    pConf->lgBeta[i] += LONG2SHORT(W >> 6);
+  }
+    
+}
+#endif
+
+short cm_score(gmhmm_type *gv)
+{
+  ConfType * pConf = (ConfType*) (gv->pConf);
+  if (pConf->bCalced == FALSE) cm_update_status(gv);
+  return gv->cm_score; 
+}
+
+/* update confidence measure status */
+TIESRENGINECOREAPI_API void cm_update_status(gmhmm_type *gv)
+{
+#ifdef USE_CONFIDENCE
+  ConfType * pConf = (ConfType*) (gv->pConf);
+
+  if (pConf == NULL) return ;
+
+  if (pConf->bCalced == FALSE){/* not yet calculated */
+    cm_calc_confidence(gv); 
+
+#ifdef DEV_CONFIDENCE
+    short cm; 
+    for (cm=0;cm<CM_SCRS;cm++)
+      printf("CM[%d] = %d ", cm, pConf->cm_scr[cm]); 
+    printf("CM = %d ", gv->cm_score); 
+#endif
+    cm_update_hypo(&pConf->cm_scr[0], (pConf->cm_scr[2] >= 0)?&pConf->H0:&pConf->H1);
+
+#ifdef TEST_CM_LOGISTIC
+    cm_update_logistic( (pConf->cm_scr[1] >=0)?64:0, 
+                       pConf->cm_scr[3], pConf);
+#endif
+
+    pConf->bCalced = TRUE; 
+
+  }
+#endif
+}
+
+
+#ifdef USE_AVL_TREE
+
+void 
+avl_MakeEmpty( TreeSpaceType * pTree)
+{
+  if( pTree != NULL )
+    {
+      pTree->mem_count = 0; 
+    }
+}
+
+Position
+avl_Find( ElementType X, AvlTree T , TreeSpaceType * pTree)
+{
+  if( T == NULL )
+    return NULL;
+  if( X < T->Element )
+    return avl_Find( X, (T->Left < 0)?NULL:(AvlTree) ((short*)pTree + T->Left), pTree);
+  else
+    if( X > T->Element )
+      return avl_Find( X, (T->Right < 0)?NULL:(AvlTree)((short*)pTree + T->Right), pTree);
+    else
+      return T;
+}
+
+Position
+avl_FindMin( AvlTree T , TreeSpaceType* pTree)
+{
+  if( T == NULL )
+    return NULL;
+  else
+    if( T->Left == -1 )
+      return T;
+    else
+      return avl_FindMin( (AvlTree) ((short*)pTree + T->Left), pTree);
+}
+
+Position
+avl_FindMax( AvlTree T , TreeSpaceType * pTree)
+{
+  if( T != NULL )
+    while( T->Right != -1 )
+      T = (AvlTree) ((short*)pTree + T->Right);
+  
+  return T;
+}
+
+/* START: fig4_36.txt */
+static short
+avl_Height( Position P )
+{
+  if( P == NULL )
+    return -1;
+  else
+    return P->Height;
+}
+/* END */
+
+/* This function can be called only if K2 has a left child */
+/* Perform a rotate between a node (K2) and its left child */
+/* Update heights, then return new root */
+
+static Position
+avl_SingleRotateWithLeft( Position K2 , short * pTree)
+{
+  Position K1;
+
+  K1 = (Position) (pTree + K2->Left);
+  K2->Left = K1->Right;
+  K1->Right = (short*)K2 - (short*)pTree;
+  
+  K2->Height = MAX( avl_Height( (AvlTree) (K2->Left + pTree)), avl_Height( (AvlTree) (K2->Right + pTree ) )) + 1;
+  K1->Height = MAX( avl_Height( (AvlTree) (K1->Left + pTree)), K2->Height ) + 1;
+  
+  return K1;  /* New root */
+}
+/* END */
+
+/* This function can be called only if K1 has a right child */
+/* Perform a rotate between a node (K1) and its right child */
+/* Update heights, then return new root */
+
+static Position
+avl_SingleRotateWithRight( Position K1 , short * pTree)
+{
+  Position K2;
+  
+  K2 = (Position) (K1->Right + pTree);
+  K1->Right = K2->Left;
+  K2->Left = (short*)K1 - pTree;
+  
+  K1->Height = MAX( avl_Height( (AvlTree) (K1->Left + pTree)), avl_Height( (AvlTree)(K1->Right + pTree)) ) + 1;
+  K2->Height = MAX( avl_Height( (AvlTree) (K2->Right + pTree) ), K1->Height ) + 1;
+  
+  return K2;  /* New root */
+}
+
+/* This function can be called only if K3 has a left */
+/* child and K3's left child has a right child */
+/* Do the left-right double rotation */
+/* Update heights, then return new root */
+
+static Position
+avl_DoubleRotateWithLeft( Position K3 , short *pTree)
+{
+  /* Rotate between K1 and K2 */
+  K3->Left = (short*)avl_SingleRotateWithRight( (Position)(K3->Left + pTree), pTree ) - pTree;
+  
+  /* Rotate between K3 and K2 */
+  return avl_SingleRotateWithLeft( K3 , pTree);
+}
+/* END */
+
+/* This function can be called only if K1 has a right */
+/* child and K1's right child has a left child */
+/* Do the right-left double rotation */
+/* Update heights, then return new root */
+
+static Position
+avl_DoubleRotateWithRight( Position K1 , short *pTree)
+{
+  /* Rotate between K3 and K2 */
+  K1->Right = (short*) avl_SingleRotateWithLeft( (Position) (K1->Right + pTree), pTree) - pTree;
+  
+  /* Rotate between K1 and K2 */
+  return avl_SingleRotateWithRight( K1 , pTree);
+}
+
+
+/* START: fig4_37.txt */
+short 
+avl_Insert( ElementType X, ElementType Val, short T_idx , 
+           short elem_size_in_short, TreeSpaceType * pTreeSpace,
+           TIesrEngineStatusType * status)
+{
+  short * p_short; 
+  AvlTree T = (AvlTree)((T_idx == -1) ? NULL: ((short*)pTreeSpace) + T_idx); 
+
+  if( T_idx == -1)
+    {
+      /* Create and return a one-node tree */
+      p_short = mem_alloc( pTreeSpace->base_mem, &pTreeSpace->mem_count, 
+                          elem_size_in_short, TREE_SPACE_SIZE, SHORTALIGN, "elem");
+      T = (AvlTree) p_short; 
+      if( T == NULL ){
+       *status = eTIesrEngineVALTreeMemorySize; 
+       return -1; 
+      }
+      else
+       {
+         T->Element = X; T->Height = 0;
+         T->Left = T->Right = -1;
+         T->Value = Val; 
+         *status = eTIesrEngineSuccess;
+         return pTreeSpace->mem_count - elem_size_in_short;
+       }
+    }
+  else
+    if( X < T->Element )
+      {
+       T->Left = avl_Insert( X, Val, T->Left , elem_size_in_short, pTreeSpace, status);
+       if( avl_Height( (T->Left < 0)?NULL:(AvlTree)(T->Left + (short*)pTreeSpace)) 
+           - avl_Height( (T->Right < 0)?NULL:(AvlTree)(T->Right + (short*)pTreeSpace)) == 2 )
+         if( X < ((AvlTree)(T->Left + (short*)pTreeSpace))->Element )
+           T = avl_SingleRotateWithLeft( T , (short*)pTreeSpace);
+         else
+           T = avl_DoubleRotateWithLeft( T , (short*)pTreeSpace);
+      }
+    else
+      if( X > T->Element )
+       {
+         T->Right = avl_Insert( X, Val, T->Right,  elem_size_in_short, pTreeSpace, status );
+         if( avl_Height( (T->Right<0)?NULL:(AvlTree)(T->Right + (short*)pTreeSpace)) 
+             - avl_Height( (T->Left<0)?NULL:(AvlTree)(T->Left + (short*)pTreeSpace)) == 2 )
+           if( X > ((AvlTree)(T->Right + (short*)pTreeSpace))->Element )
+             T = avl_SingleRotateWithRight( T , (short*)pTreeSpace);
+           else
+             T = avl_DoubleRotateWithRight( T , (short*)pTreeSpace);
+       }
+  /* Else X is in the tree already; we'll do nothing */
+  
+  T->Height = MAX( avl_Height( (T->Left<0)?NULL:(AvlTree)(T->Left + (short*)pTreeSpace)),
+                  avl_Height( (T->Right<0)?NULL:(AvlTree)(T->Right + (short*)pTreeSpace)) ) + 1;
+
+  if (T==NULL) return -1; 
+  else return (short*)T - (short*)pTreeSpace;
+}
+/* END */
+
+ElementType
+avl_Retrieve( Position P )
+{
+  return P->Element;
+}
+
+
+#endif
diff --git a/TIesrEngine/src/rapidsearch.h b/TIesrEngine/src/rapidsearch.h
new file mode 100755 (executable)
index 0000000..ed33504
--- /dev/null
@@ -0,0 +1,229 @@
+/*=======================================================================
+ rapidsearch.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header contains parameters used with the rapid search likelihood
+ calculation based on Gaussian clustering.
+
+======================================================================*/
+
+#ifndef _RAPID_SEARCH_H
+#define _RAPID_SEARCH_H
+
+#include "tiesr_config.h"
+#include "noise_sub.h"
+
+/* --------------------------------------------------
+   data structure for offline VQ-based HMM processing
+   saves VQ information of mean vectors 
+   -------------------------------------------------- */
+
+#define VQHMM_SIZE 10000
+
+/* ------------------------------------------------- 
+   for Gaussian selection 
+   ------------------------------------------------- */
+const ushort u_rj_perc_core = 16384; /* 50% core clusters */ 
+const ushort u_rj_perc_inte = 0; /* 0% intermedium clusters */ 
+
+/* --------------------------------------------------
+   parameters for on-line reference modeling 
+   ------------------------------------------------- */
+#define GBG_NUM_IDS 10  /* the maximum number of begining frames for a garbage model */
+const ushort GBG_num_ids = 9; /* number of frames to construct a garbage model */
+
+/* --------------------------------------------------
+   parameters for GMM-based VAD 
+   ------------------------------------------------*/
+const ushort GBG_HNOISE = 12000; /* Q9, threshold of noise level in log2, larger than the
+                                 number is considered as high noise level. */
+const ushort GBG_VAD_VERIFY_TH_HNOISE = 80; 
+/* Threshold of the log-likelihood ratio for high noise level */
+const ushort GBG_VAD_VERIFY_TH_LNOISE = 150;
+/* Threshold of the log-likelihood ratio for low noise level */
+
+const ushort GBG_NUM_SIL = 20; 
+/* minimum number of frames to declare long pause */
+const ushort u_low_is_speech = 6; 
+/* threshold of log-likelihood ratio to declare long pause */
+
+const short GBG_NUM_AFTER_PEAK_TO_TRIGGER_END_SPEECH = 150; 
+/* the maximum number of ending_cnt, which is increased after peak of LLR, 
+   that is allowed for VAD. 
+   above the number will trigger EOS */
+
+/* parameters for end-of-speech detection */
+const short GBG_END_SPEECH_START = 30; /* the minimum number of frame counter in decoder */
+const short GBG_END_SPEECH_CNT_TH = 80; 
+/* the number of frames that are continuously below the threshold */
+const ushort GBG_END_SPEECH_TH_PERC = 3277; /* threshold of LLR to declare EOS, 
+                                              the threshold is computed as a certain
+                                              percentage of the maximum LLR. 
+                                              10% in Q15 */
+
+/* parameters for updating reference model */
+const short GBG_post_threshold = 6; /* 10% in Q6 */
+
+const short  GS_LOW_SCORE = -8104; /* the default lowest score */
+
+#ifdef DEV_CLS2PHONE
+#define PHONEPERCLS 20
+#endif
+
+typedef struct _OFFLINE_VQ_HMM{
+  short  base_mem[VQHMM_SIZE];
+  ushort  mem_count ; 
+
+  ushort n_cs; /* number of clusters */
+  ushort nbr_dim; /* dimension of the vectors */
+
+  short sz_RamMean; /* number of RAM mean vectors */
+  unsigned char * pRAM2Cls; /* mapping of RAM mean to cluster index */
+
+  short sz_ROMMean; /* number of ROM mean vectors */
+
+  short gconst; 
+  short *inv_ave_var; /* inverse of the average covarianc of the acoustic model */
+
+  short *vq_centroid; /* centroid of clusters */
+  short *vq_bias; /* JAC compensation bias */
+  Boolean bCompensated; 
+
+  /* ------------ Gaussian selection ---------------------------------------*/
+  short low_score; 
+  short max_dist; /* maximum score of Gaussian clusters */
+  short * dist ; /* distance of clusters to observation feature */
+  char * category; /* cluster category, 0 - core, 1 - intermediate, 2 - outmost */
+
+  ushort sVQ_CLS_TO_EVAL ; /* number of core clusters */
+  ushort sVQ_NUM_INTER; /* number of intermedidate clusters */
+  /* -----------------------------------------------------------------------*/
+
+#ifdef  USE_ONLINE_REF
+  /* --------------- On-line reference modeling -----------------------------*/
+  short *imax_10; /* indices of clusters for the reference model */
+  short inum_diff_cls; /* number of different clusters in the first GBG_NUM_IDS frames */
+  short inum_frms_gbg; /* number of frames to construct a garbage model */
+  short i_low_is_speech; /* number of frames with is_speech continuously below a threshold */
+  short is_speech; /* averaged log-likelihood ratio of the best matched cluster relative 
+                     to a reference model */
+  short ga_score; /* garbage model score */
+
+#ifdef USE_ORM_PU
+  short *iprior; /* prior list for reference model */
+  short *pprior; /* prior prabobility of clusters in the reference model */
+  short inum_prior; 
+#endif
+
+  /* ---------------------------------------------------------------------- */
+
+#if defined(DEV_CLS2PHONE)
+  /* cluster to phone mapping */
+  char cls_phone[128 * PHONEPERCLS];
+  char cls_nphone[128];
+
+  Boolean bRefCloseToSilence; /* TRUE if the reference model has silence model */
+#endif
+
+  short fd_frms; /* number of frames input for ORM */
+
+#ifdef USE_ORM_VAD 
+  /* ---------------------------- GMM-based VAD ----------------------------- */
+  Boolean bVADVerified; /* if the VAD has been verified by the VQ method */
+  short voice_idx; /* processed frames */
+  Boolean bSynced; /* if the following mfcc_buf has been dumped */
+  short iPushed; /* number of frames that have been pushed */
+  short *mfcc_buf ; //[ MFCC_BUF_SZ ][ MAX_DIM ]; /* MFCC buffer */
+  Boolean b_orig_done; /* if the current MFCC has been used */
+  
+  /* some threshold for begining of speech detection and frame dropping */
+  short th_noise_lvl; /* the noise level threshold to select an LLR threshold */
+  short th_llr_in_low_noise; /* the LLR threshold in low noise level */
+  short th_llr_in_high_noise;  /* the LLR threshold in high noise level */
+
+  /* ------------------------- end-of-speech detection ----------------------- */
+  /* for end of speech detection */
+  /* parameters */
+  short max_llr; /* the maximum value of LLR */
+  short ending_cnt; /* the number of frames after the peak of LLR */
+
+  short ending_cnt_stt; /* don't do EOS untill ending_cnt_stt of frames have passed
+                          peak of LLR */
+  short ending_llr_perc; /* the percentage to compute ending_llr_th */
+  short ending_llr_th; /* the threshold of LLR to declare end of speech */
+  short ending_cnt_th; /* the threshold for $ending_cnt, above it, a different threshold
+                         of LLR is used, as compared to a tighter threshold for 
+                         near frames */
+
+  short ending_low_llr_cnt;
+  /* the number of frames that continuoulsy with LLR below $ending_llr_th */
+  short ending_cnt_after_peak; /* the threshold to stop decoder if 
+                                 more than the number of frames have been processed 
+                                 fter peak of LLR has been reached */
+
+  /* ------------------------------------------------------------------------ */
+#endif
+
+#endif
+
+} OFFLINE_VQ_HMM_type; 
+
+/* ---------------------------------------------------------------
+   Phone-level pruning 
+   --------------------------------------------------------------- */
+/* the maximum number of monophones */
+#ifdef MODEL_LEVEL_PRUNE
+
+#define MLP_NUM_MONOPHONE 64
+#define MLP_SIZE (MLP_NUM_MONOPHONE << 1)
+const ushort MLP_uPercentage = 22938; /* 70% of active phones are removed */
+
+/* data structure of the phone-level pruning */
+typedef struct _MODEL_PRUNE{
+  short  base_mem[MLP_SIZE];
+  ushort  mem_count ; 
+
+  ushort uPercentage; /* percentage of phone removed active phones */
+  short *p_s_active; /* indicator of active status of monophones */
+  short *p_s_cur_mono; /* score of each monophone at the current frame */
+
+  short prevBeam; /* previous beamwidth */
+}MODEL_PRUNE_type; 
+
+#endif
+
+#ifdef USE_AVL_TREE
+
+#define TREE_SPACE_SIZE 20000
+typedef struct _TREE_SPACE{
+  short  base_mem[TREE_SPACE_SIZE];
+  ushort  mem_count ; 
+
+} TreeSpaceType; 
+
+struct AvlNode; 
+typedef short ElementType;
+typedef struct AvlNode *Position;
+typedef struct AvlNode *AvlTree;
+
+struct AvlNode
+{
+  ElementType Element; /* the index */
+
+  ElementType Value;   /* the value */
+
+  /* the indices in the TreeSpaceType */
+  short  Left;
+  short  Right;
+
+  short      Height;
+};
+
+
+
+#endif
+
+#endif
diff --git a/TIesrEngine/src/rapidsearch_user.h b/TIesrEngine/src/rapidsearch_user.h
new file mode 100755 (executable)
index 0000000..311a1b1
--- /dev/null
@@ -0,0 +1,162 @@
+/*=======================================================================
+ rapidsearch_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header exposes the function interface for rapid calculation of
+ likelihoods using Gaussian clustering.
+
+======================================================================*/
+
+#ifndef _RAPID_SEARCH_USER_H
+#define _RAPID_SEARCH_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+
+/*-----------------------------------------------------------------*/
+#include "tiesr_config.h"
+#include "search_user.h"
+#include "dist_user.h"
+#include "gmhmm.h"
+#include "sbc_user.h"
+#include "load_user.h"
+#include "pmc_f_user.h"
+#include "rapidsearch.h"
+
+/* --------------- cluster-dependent JAC ------------------------------- */
+TIESRENGINECOREAPI_API void rj_noise_compensation(gmhmm_type *cd_hmms);
+TIESRENGINECOREAPI_API TIesrEngineJACStatusType rj_compensate(gmhmm_type * gv);
+
+/* @param pFlexModelPath The path saving models for TIesrFlex
+   @param perc_core_clusters_q15 precentage of core clusters, value in Q15,
+   @param perc_inter_clusters_q15 percentage of intermediate clusters, value in Q15 
+   @param gv pointer to decoder
+   @param pMem pointer to avaliable memory space 
+   return TRUE if success, else return FALSE
+*/
+
+TIESRENGINECOREAPI_API TIesrEngineStatusType rj_open(ushort u_perc_cor,
+                             ushort u_perc_inte, 
+                             gmhmm_type *gv );
+
+
+TIESRENGINECOREAPI_API void rj_close(gmhmm_type * gv);
+
+TIESRENGINECOREAPI_API short rj_clear_obs_scr(gmhmm_type * gv, short *mfcc_feat);
+
+
+TIESRENGINECOREAPI_API TIesrEngineStatusType rj_load(gmhmm_type * gv, FILE* pf);
+TIESRENGINECOREAPI_API TIesrEngineStatusType rj_save(gmhmm_type * gv, FILE* pf);
+
+short rj_gauss_obs_score_f(short *feature, int pdf_idx, gmhmm_type*gv, long * l_cnter, short * iargmix);
+
+void rj_init(gmhmm_type *gv);
+
+/* @param perc_core_clusters_q15 precentage of core clusters, value in Q15,
+   @param perc_inter_clusters_q15 percentage of intermediate clusters, value in Q15 
+   return TRUE if sucess, FALSE if can not meet the requirement
+*/
+Boolean rj_set_param( ushort perc_core_clusters_q15,
+                  ushort perc_inter_clusters_q15, 
+                  gmhmm_type * gv );
+
+/* setup parameters for online reference modeling, VAD and EOS detection
+   @param num_frms_gbg: number of begining frames to construct gabage model 
+   @param noise_level : the noise level threshold to choose an LLR threshold
+   @param th_llr_low_noise: the LLR threshold in low noise level
+   @param th_llr_high_noise: the LLR threshold in high noise level 
+   @param ctn_th : number of frames that continuously below a threshold
+   @param llr_perc_th : the threshold is computed as $llr_perc_th * max_llr, where max_llr
+   is the score of the best matched cluster 
+   @param start_from : don't do EOS decision making untill $start_from of frames have
+   passed the peak of LLR 
+   @param nbr_frm_after_peak, the threshold which declares end of speech if more than 
+   then number of frames have been processsed after the peak of LLR has been reached 
+   ever since. 
+   return TRUE if sucess
+*/
+
+TIESRENGINECOREAPI_API Boolean rj_set_ORM(short num_frms_gbg,
+                  short noise_level,
+                  short th_llr_low_noise, short th_llr_high_noise,
+                  short cnt_th, ushort llr_perc_th, short start_from, 
+                  short nbr_frm_after_peak, gmhmm_type * gv);
+
+
+/* The function conducts two operations: 
+   1) if the current frame number is smaller than a threshold,
+   it records the best matched Gaussian cluster and put it to construct a reference model
+   2) else, it updates score of the online reference model 
+   Also, it computes the log-likelihood ratio of the best matched cluster w.r.t.
+   the reference model
+*/
+TIESRENGINECOREAPI_API void rj_update_noise(gmhmm_type * gv, short * mfcc_feat, short imax);
+
+/* if SAD is not confirmed, buffering the input speech and return NULL,
+   if SAD is confirmed, then pop up buffered speech and synchronise to the current frame
+*/
+TIESRENGINECOREAPI_API short* rj_vad_proc(gmhmm_type * gv, short * mfcc_feat);
+
+/* ---------------------------------------------------------------------- */
+
+
+TIESRENGINECOREAPI_API void mlp_open(gmhmm_type* gv);
+TIESRENGINECOREAPI_API void mlp_close(gmhmm_type * gv);
+
+void mlp_init(gmhmm_type *gv);
+void mlp_reset(gmhmm_type* gv);
+void mlp_update(gmhmm_type* gv, short hmm_idx, long score);
+
+/* calculate pruning threshold 
+   @param gv pointer to decoder
+   @param th_default the pruning threshold by default beam-width pruning 
+   @param beam_width beam width for pruning
+   return pruning threshold
+ */
+short mlp_threshold(gmhmm_type *gv , long th_default , short beam_width);
+
+#ifdef USE_AVL_TREE
+
+void avl_MakeEmpty( TreeSpaceType* );
+Position avl_Find( ElementType X, AvlTree T, TreeSpaceType * );
+Position avl_FindMin( AvlTree T , TreeSpaceType* pTree);
+Position avl_FindMax( AvlTree T , TreeSpaceType* pTree);
+short avl_Insert( ElementType X, ElementType Val, short T_idx , short elem_size_in_short, 
+                 TreeSpaceType * pTreeSpace,
+                 TIesrEngineStatusType * status);
+ElementType avl_Retrieve( Position P );
+#endif
+
+#endif
diff --git a/TIesrEngine/src/sbc.cpp b/TIesrEngine/src/sbc.cpp
new file mode 100755 (executable)
index 0000000..451783d
--- /dev/null
@@ -0,0 +1,1358 @@
+/*=======================================================================
+ sbc.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Implementation of stochastic bias compensation (SBC)
+
+======================================================================*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "sbc_user.h"
+#include "sbc.h"
+#include "noise_sub_user.h"
+#include "stdlib.h"
+#include "search_user.h"
+#include "gmhmm_type.h"
+#include "dist_user.h"
+#include "pack_user.h"
+#include "load_user.h"
+
+
+//#define _SBC_DEBUG
+#ifdef _SBC_DEBUG
+static void sbc_assert(char expr, short dim){
+  if (expr == 0) {
+    PRT_ERR(fprintf(stdout, "overflow at dif2[%d]\n", dim));
+  }
+}
+#endif
+
+
+/*--------------------------------*/
+static char sbc_is_marked(short a)
+{
+  short b; 
+  b = a & 0x8000;
+  if (b != 0) return TRUE;
+  else return FALSE;
+}
+
+
+/*--------------------------------*/
+static ushort sbc_mark(ushort* a, FeaHLRAccType* sa)
+{
+  short ix;
+
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+  ushort b = *a; 
+  /* check all terminal nodes that have the same transformation index */
+  if (sbc_is_marked(*a)) return *a; 
+  for (ix = tree->n_nodes - 1;ix>=0;ix--){
+    if (sa->hlrTransformIndex[ix] == b){
+      sa->hlrTransformIndex[ix] |= 0x8000;
+    }
+  }
+  return b;
+}
+
+
+/*--------------------------------*/
+static void sbc_unmark(FeaHLRAccType* sa)
+{
+  short ix ; 
+  if ( sa == NULL || sa->hlrTreeBase == NULL ) return;
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+  for (ix=tree->n_nodes - 1; ix >= 0; ix--)
+    sa->hlrTransformIndex[ix] &= 0x7fff;
+}
+
+
+/*--------------------------------*/
+short sbc_phone2terminalidx(ushort hmm_idx, FeaHLRAccType * sa)
+{
+  short monophone_index; 
+  short terminal_index; 
+
+  monophone_index = *( sa->pHMM2phone + hmm_idx ); 
+  monophone_index++; 
+
+  terminal_index = (short) sa->hlrTerminal[ monophone_index ];
+  return terminal_index;
+}
+
+/*--------------------------------*/
+static ushort sbc_parent_is(sbcTreeNode* node){
+  ushort a;
+  a = node->parent_node_and_transform_idx & 0xff00;
+  a = a >> 8;
+  return a;
+}
+
+
+/*--------------------------------*/
+/* Code only used in sbc_dump */
+#ifdef _SBC_DEBUG
+static ushort sbc_tranform_idx_is(sbcTreeNode* node){
+  ushort a;
+  a = node->parent_node_and_transform_idx & 0xff;
+  return a;
+}
+#endif
+
+/*--------------------------------*/
+static sbcTreeNode* sbc_get_tree_node(ushort inodeidx, FeaHLRAccType* sa)
+{
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase; 
+
+  if (inodeidx < tree->n_nodes){
+    return tree->node[inodeidx];
+  }
+  else
+    return NULL;
+}
+
+
+/*--------------------------------*/
+static ushort sbc_get_reliable_node(ushort iTerminalIdx, FeaHLRAccType* sa)
+{
+  ushort i = iTerminalIdx, iparent;
+  sbcTree *tree = (sbcTree*) sa->hlrTreeBase;
+
+  while(tree->node[i]->vector_count < SBC_MINTOKENS &&
+       i < tree->n_nodes){
+    iparent = sbc_parent_is(tree->node[i]);
+    if (iparent >= tree->n_nodes) break; 
+    i = iparent;
+  }
+  return i; 
+}
+
+
+/*--------------------------------
+   Find the transformation index corresponding to the hmm of hmm_index.
+   The physical hmm index is used to determine the monophone index, 
+   and thus define the mapping of the hmm to the hlr tree terminal 
+   node.
+   
+   The sil model has monophone index of -1, so
+   the monophone index is incremented to have zero-based
+   indices into the hlrTerminal array.
+   --------------------------------*/
+
+/* Code not used at this time */
+/*
+static ushort sbc_set_phone2transformidx(ushort hmm_code, FeaHLRAccType *sa)
+{
+  ushort transform_index; 
+  short terminal_index = sbc_phone2terminalidx(hmm_code, sa); 
+  
+  transform_index = sbc_get_reliable_node(terminal_index, sa); 
+
+  sa->hlrTransformIndex[terminal_index] = transform_index; 
+  
+  return transform_index; 
+}
+*/
+
+/*--------------------------------*/
+static ushort sbc_phone2transidx(ushort hmm_idx, FeaHLRAccType * sa)
+{
+  ushort transform_index; 
+  short terminal_index = sbc_phone2terminalidx(hmm_idx, sa); 
+
+  transform_index = sa->hlrTransformIndex[terminal_index];
+
+  return transform_index ; 
+}
+
+
+/*--------------------------------*/
+static void sbc_nbr_of_vec_under_the_node(short iTerminalIdx, 
+                                         short seg_length,
+                                         FeaHLRAccType* sa)
+{
+  ushort ascend, i = iTerminalIdx; 
+  sbcTree*   tree = (sbcTree *)sa->hlrTreeBase;
+
+  ascend = iTerminalIdx;
+  while(ascend < tree->n_nodes){
+    ascend = sbc_parent_is(tree->node[i]); 
+    if (ascend >= tree->n_nodes) break; 
+    tree->node[ascend]->vector_count += seg_length; //tree->node[i]->vector_count; 
+    /* to protect from overflow */
+    tree->node[ascend]->vector_count = MIN(tree->node[ascend]->vector_count,
+                                          SBC_MINTOKENS);
+    i = ascend; 
+  }
+}
+
+
+/*--------------------------------*/
+static ushort sbc_map_to_hiera(ushort hmm_code, FeaHLRAccType* sa, 
+                              ushort seg_length, 
+                              char bUpdate)
+{
+  short iTerminalIdx = sbc_phone2terminalidx(hmm_code, sa);
+  sbcTreeNode * node = sbc_get_tree_node(iTerminalIdx, sa); 
+  if (bUpdate) {
+    node->vector_count += seg_length;
+    node->vector_count = MIN(node->vector_count,
+                            SBC_MINTOKENS);
+  }
+  return iTerminalIdx; 
+}
+
+
+/*--------------------------------*/
+static ushort sbc_determine_reliable_node(ushort hmm_code, FeaHLRAccType* sa, 
+                                         ushort useglength, char bUpdate)
+{
+  ushort inode; 
+  short iTerminalIdx = sbc_map_to_hiera(hmm_code, sa, useglength, bUpdate);
+
+  if (bUpdate) sbc_nbr_of_vec_under_the_node(iTerminalIdx, useglength , sa);
+
+  inode = sbc_get_reliable_node(iTerminalIdx, sa);
+
+  return iTerminalIdx; 
+}
+
+
+/*--------------------------------*/
+static long * sbc_get_transform_stat_dif1(ushort iNode, FeaHLRAccType* sa)
+{
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+  sbcTreeNode* p_node; 
+
+  p_node = tree->node[iNode];
+  return p_node->p_acc_dif1; 
+}
+
+
+/*--------------------------------*/
+static long * sbc_get_transform_stat_dif2(ushort iNode, FeaHLRAccType* sa)
+{
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+  sbcTreeNode* p_node; 
+
+  p_node = tree->node[iNode];
+  return p_node->p_acc_dif2; 
+}
+
+
+/*--------------------------------*/
+static short * sbc_get_transform(ushort i_txm_idx, FeaHLRAccType* sa)
+{
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+  ushort ioffset = i_txm_idx * sa->hlr_TRANSFORM_SIZE ; 
+  if (i_txm_idx >= tree->n_nodes) return NULL;
+  return &sa->hlrTransforms[ioffset]; 
+}
+
+
+
+/*--------------------------------*/
+static void sbc_update_SBC_phone2trans( gmhmm_type* gv)
+{
+  short s;
+  ushort t_index; 
+  FeaHLRAccType* sa = gv->sbcState;
+  
+  for (s=sa->n_terminals-1;s>=0;s--){
+    t_index = sbc_get_reliable_node(s, sa); 
+    sa->hlrTransformIndex[s] = t_index;
+  }
+}
+
+/* return pointer to the HMM2phone */
+short * sbc_rtn_hmm2phone(FeaHLRAccType *sa)
+{
+  if (sa)
+    return sa->pHMM2phone; 
+  else return NULL;
+}
+
+/*--------------------------------
+  @param bTriphone: TRUE if the HMM2phone maps triphone to monophone
+                    FALSE if the HMM2phone maps monophone to itself
+*/
+TIESRENGINECOREAPI_API
+TIesrEngineHLRStatusType sbc_load_hmm2phone(const char gdir[], 
+                                           ushort n_hmms, 
+                                           FeaHLRAccType *sa,
+                                           Boolean bTriphone )
+{
+   char fname[ MAX_STR ];
+   size_t nread;
+   short si; 
+   FILE *fp;
+
+#ifdef _DYN_ALLOC_SBC
+   if( sa->pHMM2phone )
+   {
+      free( sa->pHMM2phone );
+      sa->pHMM2phone = NULL;
+   }
+#endif
+
+   /* !! load the hmm to monophone mapping; should be done in gmhmm */
+   //   extern short     *base_net;
+
+#ifndef _DYN_ALLOC_SBC
+   sa->pHMM2phone = (short*) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                       n_hmms, SBC_SIZE, SHORTALIGN, 
+                                       "HMM to phone index" );
+   if( sa->pHMM2phone == NULL )
+      return eTIesrEngineHLRMemoryBase;
+#else
+
+   /* use dynamic memory allocation, because n_hmms is varying */
+   sa->pHMM2phone = (short*) malloc(n_hmms * sizeof(short));
+
+   if( sa->pHMM2phone == NULL )
+      return eTIesrEngineHLRFail;
+
+#endif
+
+   /* Open the hmm to phone mapping file */
+   if (bTriphone){
+     sprintf(fname,"%s/%s",gdir,"hmm2phone.bin");
+     
+     if (  (fp = fopen( fname, "rb" )) == NULL )
+       {
+#ifdef _DYN_ALLOC_SBC
+        free( sa->pHMM2phone );
+        sa->pHMM2phone = NULL;
+#endif
+         return eTIesrEngineHLRFail;
+       }
+
+     nread = fread( sa->pHMM2phone, sizeof(short), n_hmms, fp );
+     fclose( fp );
+
+   /*   if( nread != n_hmms )
+       {
+       #ifdef _DYN_ALLOC_SBC
+       free( sa->pHMM2phone );
+       #endif
+       return eTIesrEngineHLRFail;
+       }
+       modified on Feb/15/2006 */
+     if (nread == 0){
+#ifdef _DYN_ALLOC_SBC
+       free( sa->pHMM2phone );
+#endif
+       return eTIesrEngineHLRFail;
+     }
+   }else{
+     for (si=0;si< n_hmms; si++)
+       sa->pHMM2phone[si] = si - 1; 
+   }
+
+   return eTIesrEngineHLRSuccess;
+}
+
+/*--------------------------------*/
+static FeaHLRAccType* sbc_set_parent_node(ushort inodeidx, ushort parent_node, 
+                                         FeaHLRAccType* sa){
+  sbcTreeNode * node; 
+  ushort pp; 
+
+  node = sbc_get_tree_node(inodeidx, sa);
+  pp = parent_node << 8;
+  node->parent_node_and_transform_idx =
+    (node->parent_node_and_transform_idx & 0x00ff) + pp;
+  return sa;
+}
+  
+
+/*--------------------------------*/
+static FeaHLRAccType* sbc_set_transform_idx(ushort inodeidx, ushort transform_idx, 
+                                           FeaHLRAccType* sa){
+  sbcTreeNode * node; 
+  ushort pp; 
+
+  node = sbc_get_tree_node(inodeidx, sa);
+  pp = 0x00ff & transform_idx; 
+  node->parent_node_and_transform_idx =
+    (node->parent_node_and_transform_idx & 0xff00) + pp;
+  return sa;
+}
+
+
+/*--------------------------------
+  sbc_open
+
+  This function clears the contents of the FeaHLRAccType structure
+  that holds the SBC state information.
+  --------------------------------*/
+TIESRENGINECOREAPI_API void sbc_open( FeaHLRAccType *sa )
+{
+  sa->mem_count = 0;
+  sa->max_mem_usage = SBC_SIZE;
+
+  sa->n_terminals = 0;
+  sa->hlrTreeBase = NULL;
+  sa->hlrTerminal = NULL;
+  sa->pHMM2phone = NULL;
+  sa->hlr_TRANSFORM_SIZE = 0;
+  sa->hlrTransforms = NULL;
+  sa->pSegStat_dif1 = NULL;
+  sa->pSegStat_dif2 = NULL;
+  sa->pEnhanced = NULL;
+
+  return;
+}
+
+
+/*--------------------------------*/
+static short* sbc_get_enhanced(FeaHLRAccType *pSBC, 
+                      ushort itrans)
+{
+  ushort ix;
+  sbcTree* tree = (sbcTree*) pSBC->hlrTreeBase;
+
+  if (itrans >= tree->n_nodes) return NULL;
+  ix = itrans * pSBC->hlr_TRANSFORM_SIZE; 
+  return &(pSBC->pEnhanced[ix]); 
+}
+
+/*--------------------------------*/
+void sbc_backup(FeaHLRAccType * sa)
+{
+#ifdef USE_CONF_DRV_ADP
+  sbcTree* tree = (sbcTree *)sa->hlrTreeBase;
+  register short i; 
+  for (i= tree->n_nodes - 1; i>=0; i--)
+    sa->bk_node_cnt[i] = tree->node[i]->vector_count; 
+#endif
+}
+
+/*--------------------------------*/
+void sbc_restore(FeaHLRAccType * sa)
+{
+#ifdef USE_CONF_DRV_ADP
+  sbcTree* tree = (sbcTree *)sa->hlrTreeBase;
+  register short i; 
+  for (i= tree->n_nodes - 1; i>=0; i--)
+    tree->node[i]->vector_count = sa->bk_node_cnt[i];
+#endif
+}
+
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_save(FeaHLRAccType* sa, FILE *pf)
+{
+   size_t nwrite;
+   short ix, *pShortObj, *p_trans, cep_dim = sa->hlr_TRANSFORM_SIZE; 
+   long  *dif1, *dif2; 
+   sbcTree* tree = (sbcTree *)sa->hlrTreeBase;
+#ifdef _DYN_ALLOC_SBC
+  if (sa->pHMM2phone) free(sa->pHMM2phone);
+  sa->pHMM2phone = NULL;
+#endif
+
+  if (sa && pf){
+    fwrite(&(tree->n_utt), sizeof(ushort), 1, pf);
+    nwrite = fwrite(&(tree->n_nodes), sizeof(ushort), 1, pf);
+    if( nwrite != 1 )
+      return eTIesrEngineHLRFail;
+    nwrite = fwrite(&(sa->hlr_TRANSFORM_SIZE), sizeof(ushort), 1, pf);
+    if( nwrite != 1 )
+      return eTIesrEngineHLRFail;
+    
+    for (ix=0;ix<tree->n_nodes;ix++){
+      fwrite(&(tree->node[ix]->vector_count), sizeof(ushort), 1, pf);
+      fwrite(&(tree->node[ix]->parent_node_and_transform_idx), sizeof(short), 1, pf);
+      p_trans = sbc_get_transform(ix, sa); 
+      dif1 = sbc_get_transform_stat_dif1(ix, sa); 
+      dif2 = sbc_get_transform_stat_dif2(ix, sa); 
+      fwrite(dif1, sizeof(long), cep_dim, pf); 
+      fwrite(dif2, sizeof(long), cep_dim, pf); 
+      fwrite(p_trans, sizeof(short), cep_dim,pf);
+    }
+    
+    /* save Terminal transformation index information */
+    fwrite(&(sa->n_monophones), sizeof(ushort), 1, pf);
+    nwrite = fwrite(sa->hlrTerminal, sizeof(ushort), sa->n_monophones, pf); 
+    if( nwrite != sa->n_monophones) return eTIesrEngineHLRFail;
+    
+    nwrite = fwrite(sa->hlrTransformIndex, sizeof(ushort), tree->n_nodes, pf); 
+    if (nwrite != tree->n_nodes) return  eTIesrEngineHLRFail;
+    
+    pShortObj = sa->hlrTransforms; 
+    nwrite = fwrite(pShortObj, sizeof(short), 
+                   tree->n_nodes * sa->hlr_TRANSFORM_SIZE, pf); 
+    if (nwrite != (size_t)tree->n_nodes * sa->hlr_TRANSFORM_SIZE ) 
+      return  eTIesrEngineHLRFail;
+  }
+  
+  return eTIesrEngineHLRFail; 
+}
+
+/*--------------------------------
+
+TIesrEngineHLRStatusType sbc_save(FeaHLRAccType* sa , FILE* pf)
+{
+   size_t nwrite;
+
+#ifdef _DYN_ALLOC_SBC
+  if (sa->pHMM2phone) free(sa->pHMM2phone);
+  sa->pHMM2phone = NULL;
+#endif
+
+  if (sa && pf){
+     nwrite = fwrite(&(sa->mem_count), sizeof(ushort), 1, pf);
+     if( nwrite != 1 )
+       return eTIesrEngineHLRFail;
+
+     nwrite = fwrite(sa->hlrTreeBase, sizeof(short), sa->mem_count, pf);
+     if( nwrite == sa->mem_count )
+       return eTIesrEngineHLRSuccess;
+  }
+
+  return eTIesrEngineHLRFail;
+}
+*/
+
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_load(FeaHLRAccType* sa, FILE *pf)
+{
+   size_t nread;
+   short *pShortObj, sNodes, sCepDim, ix, *p_trans; 
+   ushort utmp; 
+   long *dif1, *dif2; 
+   sbcTree* tree = (sbcTree *)sa->hlrTreeBase;
+   Boolean bOverWrite = TRUE; /* if overwrite the original values using the saved values */
+
+   if (sa && pf){
+      if (!feof(pf)){
+       nread = fread(&utmp, sizeof(ushort), 1, pf);
+       if (nread!= 1) return eTIesrEngineHLRLoadTree;
+
+       utmp ++; 
+       tree->n_utt = utmp;
+       
+#ifdef SBC_REFRESH
+       /* refresh SBC for every 128 utterances */
+       if ((utmp >> 7) != 0){
+         tree->n_utt = 0; 
+         bOverWrite = FALSE ; 
+       }
+#endif
+
+       nread = fread(&(sNodes), sizeof(ushort), 1, pf);
+       if( nread != 1 )
+         return eTIesrEngineHLRLoadTree;
+       if (sNodes != tree->n_nodes) return eTIesrEngineHLRLoadTree;
+         
+       nread = fread(&(sCepDim), sizeof(short), 1, pf);
+       if (nread != 1)
+         return eTIesrEngineHLRLoadTree;
+       if (sCepDim != sa->hlr_TRANSFORM_SIZE) return eTIesrEngineHLRLoadTree;
+         
+       for (ix=0;ix<tree->n_nodes;ix++){
+         if (bOverWrite) {
+           nread = fread(&(tree->node[ix]->vector_count), sizeof(ushort), 1, pf);
+           if (nread != 1) return eTIesrEngineHLRLoadTree;
+         }
+         else 
+           fseek(pf, sizeof(ushort), SEEK_CUR); 
+
+         if (bOverWrite) {
+           nread = fread(&(tree->node[ix]->parent_node_and_transform_idx), 
+                         sizeof(short), 1, pf);
+           if (nread != 1) return eTIesrEngineHLRLoadTree;
+         }else 
+           fseek(pf, sizeof(short), SEEK_CUR); 
+
+         if (bOverWrite){
+           dif1 = sbc_get_transform_stat_dif1(ix, sa); 
+           dif2 = sbc_get_transform_stat_dif2(ix, sa); 
+           p_trans = sbc_get_transform(ix, sa); 
+           nread = fread(dif1, sizeof(long), sCepDim, pf); 
+           if (nread != (size_t)sCepDim) return eTIesrEngineHLRLoadTree;
+           nread = fread(dif2, sizeof(long), sCepDim, pf); 
+           if (nread != (size_t)sCepDim) return eTIesrEngineHLRLoadTree;
+           nread = fread(p_trans, sizeof(short), sCepDim, pf);
+           if (nread != (size_t)sCepDim) return eTIesrEngineHLRLoadTree;
+         }else
+           fseek(pf, sizeof(long)*(sCepDim << 1) + sizeof(short)*sCepDim, SEEK_CUR); 
+       }
+         
+       if (bOverWrite){
+         /* read Terminal transformation index information */
+         fread(&(sa->n_monophones), sizeof(ushort), 1, pf); 
+         nread = fread(sa->hlrTerminal, sizeof(ushort), sa->n_monophones, pf); 
+         if( nread != sa->n_monophones) return eTIesrEngineHLRLoadTree;
+         
+         nread = fread(sa->hlrTransformIndex, sizeof(ushort), tree->n_nodes, pf); 
+         if (nread != tree->n_nodes) return  eTIesrEngineHLRLoadTree;
+         
+         pShortObj = sa->hlrTransforms; 
+         nread = fread(pShortObj, sizeof(short), 
+                       tree->n_nodes * sa->hlr_TRANSFORM_SIZE, pf); 
+         if (nread != (size_t) tree->n_nodes * sa->hlr_TRANSFORM_SIZE) 
+           return eTIesrEngineHLRLoadTree;
+       }else
+         fseek(pf, sizeof(short)*(1 + sa->n_monophones + tree->n_nodes + tree->n_nodes*sa->hlr_TRANSFORM_SIZE), SEEK_CUR); 
+
+       return eTIesrEngineHLRSuccess;
+      }
+   }
+   return eTIesrEngineHLRLoadTree;
+}
+
+#ifdef _SBC_DEBUG
+void sbc_dump_each_transform(FeaHLRAccType *sa, ushort inode)
+{
+  ushort ix, jx; 
+  short    *ptrans; 
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+  sbcTreeNode* p_node; 
+
+  ix = inode;
+  p_node = tree->node[ix];
+  if (tree->node[ix]) {
+    printf("node[%d] : ", inode);
+    ptrans = sbc_get_transform(inode, sa);
+    for (ix = 0;ix<20;ix++)
+      printf("%d ", ptrans[ix]);
+  }
+}
+
+void sbc_dump_transform(FeaHLRAccType *sa)
+{
+  short i; 
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+
+  for( i = 0; i <  tree->n_nodes; i++)
+    {
+      sbc_dump_each_transform(sa, i); 
+    }
+  printf("\n");
+}
+
+/* a^b for both a and b are Q0 */
+static short sPOW(short a, short b){
+  short x;
+  if (b > 0) 
+    x = a*sPOW(a,b-1);
+  else x = 1; 
+  
+  return x; 
+}
+
+/*--------------------------------
+  sbc_dump is only used during debug, so is commented out now.
+  --------------------------------*/
+
+void sbc_dump(FeaHLRAccType *sa, ushort inode)
+{
+  ushort ix, jx; 
+  short QDIF1 = sPOW(2, DIF1_PREC), QDIF2 = sPOW(2, DIF2_PREC), div,
+    *ptrans; 
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+  sbcTreeNode* p_node; 
+  long* dif1, *dif2;
+
+  /*  if (sa->hlrTerminal){
+    for (ix=0;ix<sa->n_terminals;ix++){
+      fprintf( stdout, "%d ", (short) sa->hlrTerminal[ix]); 
+    }
+    fprintf(stdout, "\n");
+  }
+  */
+
+  ix = inode;
+  p_node = tree->node[ix];
+  if (tree->node[ix]) {
+    fprintf( stdout, "node %d\n", ix);
+#ifndef SBC_PRIOR
+    fprintf( stdout, "vec count = %d, parent = %d, trans idx = %d\n ", 
+            tree->node[ix]->vector_count, 
+            sbc_parent_is(tree->node[ix]), 
+            sbc_tranform_idx_is(tree->node[ix]));
+    
+    dif1 = sbc_get_transform_stat_dif1(ix, sa); 
+    dif2 = sbc_get_transform_stat_dif2(ix, sa); 
+    fprintf(stdout, "dif1\n");
+    for (ix=0;ix<16;ix++){
+      fprintf(stdout, "%5.4f\t", (float)dif1[ix]/QDIF1);
+    }
+    fprintf(stdout, "\n");
+    fprintf(stdout, "dif2\n");
+    for (ix=0;ix<16;ix++){
+      fprintf(stdout, "%5.4f\t", (float)dif2[ix]/QDIF2);
+    }
+    fprintf(stdout, "\n");
+#else
+    printf("node[%d] : ", inode);
+    ptrans = sbc_get_transform(inode, sa);
+    for (ix = 0;ix<20;ix++)
+      printf("%d ", ptrans[ix]);
+#endif
+
+#ifndef SBC_PRIOR
+    if (sa->hlrTransforms){
+      fprintf(stdout, "bias\n");
+      jx = sbc_tranform_idx_is(p_node);
+      for (ix=0;ix<16;ix++){
+       div = (short) div32_32_Q(dif1[ix], 
+                                dif2[ix]<<(DIF1_PREC - DIF2_PREC),
+                                MEAN_PREC);
+       fprintf(stdout, "%5.4f\t", (float)div/MEAN_PREC);
+      }
+      fprintf(stdout, "\n");
+    }
+#endif
+  }
+}
+
+void sbc_dbg_dump(FeaHLRAccType *sa)
+{
+  short i; 
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+
+  for( i = 0; i <  tree->n_nodes; i++)
+    {
+      sbc_dump(sa, i); 
+    }
+}
+
+
+#endif
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void sbc_rst_SBC_stat(FeaHLRAccType *sa)
+{
+  sbc_unmark(sa); 
+}
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void sbc_rst_seg_stat(FeaHLRAccType* sa)
+{
+  short ix;
+  if (sa == NULL || sa->hlrTreeBase == NULL ) return; 
+  for (ix=sa->hlr_TRANSFORM_SIZE-1;ix>=0;ix--){
+    sa->pSegStat_dif1[ix] = 0;
+    sa->pSegStat_dif2[ix] = 0;
+  }
+}
+
+#ifdef SBC_PRIOR 
+
+static short sbc_prior_invvar(short dim, short cep_dim)
+{
+  /* support 20 dimensional MFCC + delta MFCC */
+  /* support 18 dimensional MFCC + delta MFCC */
+
+  if (cep_dim == 18 && dim >= 9) 
+    return SBC_PRIOR_INVVAR[dim + 1];
+  else {
+    if (dim < 20)
+      return SBC_PRIOR_INVVAR[dim]; 
+    else
+      return SBC_PRIOR_INVVAR[19];
+  }  
+}
+
+#endif
+
+/*================================================================
+  sbc_init_tree (from hlr_init_tree)
+   
+  This function loads the structure of the regression tree, and the
+  monophone to tree terminal node array. Note that it must be
+  compatible with the monophone index assignment in flexphone.
+   
+  Notes:
+   
+  The hlr information is as follows: The first unsigned short is the
+  number of terminal nodes in the binary tree.  ( In concept, each
+  terminal node corresponds to one of the monophones in the flexphone
+  list, but this is not really necessary. The only thing required is
+  a mapping of phone models to terminal nodes of the tree. )  This is
+  followed by the tree structure, which consists of a listing of the
+  parent node number of each of the 2*number_terminal_nodes - 1 nodes
+  in the tree.  The order of nodes in the binary tree is such that
+  all terminal nodes are listed first, and progression is from left
+  to right and lower to higher branches in the tree, with no branches
+  overlapping.  This makes it possible to simplify tree operations.
+
+  The next entry in the binary file is the number of monophones in
+  the underlying phonetic model set, including silence.  This is
+  followed by an index of the terminal node of the tree for each of
+  the monophones, in the order in which the monophones are indexed in
+  the underlying model set.
+
+  Memory is allocated from base memory which is a short array. Some data
+  allocated is long data.  It is assumed that long data and short data
+  are powers of two bytes in size.
+
+  if (load_monophone_only) then memory for tree is not allocated. 
+
+  @param bTriphone: TRUE if maps triphone to monophone
+                  FALSE if maps monophone to itself
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_init_tree( FeaHLRAccType *sa,
+                                       const char* fnDir, 
+                                       const char *fname, 
+                                       short load_monophone_only,
+                                       ushort cep_dim, ushort n_hmms,
+                                       Boolean bTriphone )
+{
+   FILE *fp;
+   ushort n_monophones, p_node, utmp[SBC_MAX_MONOPHONES];
+   size_t nread;
+   sbcTree *tree = NULL;
+   sbcTreeNode *treenode; 
+   short i;
+   short* pShortObj;
+   long* pLongObj;
+   int clearCount;
+
+   /* debug purpose , void SBC */
+   /*   return eTIesrEngineHLRFail; */
+
+   /* Initialize the sbcState structure */
+#ifdef _DYN_ALLOC_SBC
+   if( sa->pHMM2phone )
+     {
+       free( sa->pHMM2phone );
+       sa->pHMM2phone = NULL;
+     }
+#endif
+
+
+   /* Initialize all SBC parameters to null state */
+   sbc_open( sa ); 
+
+   /* If user input NULL for tree file, no SBC will be used */
+   if( fname == NULL )
+      return eTIesrEngineHLRSuccess;
+
+   /* check for valid hlr input file */
+   if( ( fp = fopen(fname, "rb") ) == NULL )
+      return eTIesrEngineHLRFail;
+
+
+   sa->hlr_TRANSFORM_SIZE = cep_dim; 
+   /* Load the number of terminal nodes in the tree. */
+   nread = fread( &(sa->n_terminals), sizeof(ushort), 1, fp );
+   if( nread != 1 )
+      goto InitFail;
+
+   /* read the structure of the 2*n_terminals-1 node tree */
+   /* sizeof(short) holds the size */
+   /* the next two arraies are in ROM: */
+   if (!load_monophone_only) 
+   {
+      sa->hlrTreeBase = (short*) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                           sizeof(sbcTree) >> SHORTSHIFT, SBC_SIZE, LONGALIGN, 
+                                           "tree" );
+
+      if( sa->hlrTreeBase == NULL )
+        goto InitMemoryFail;
+
+      tree = (sbcTree *)sa->hlrTreeBase;
+      tree->n_utt = 0; 
+      tree->n_nodes = 2*sa->n_terminals - 1;
+      tree->node = (psbcTreeNode*) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                             (tree->n_nodes*sizeof(psbcTreeNode)) >> SHORTSHIFT,
+                                             SBC_SIZE, LONGALIGN, 
+                                             "node");
+      
+      if( tree->node == NULL )
+        goto InitMemoryFail;
+   }
+
+   for( i = 0; i <  tree->n_nodes; i++)
+   {
+      tree->node[i] = (psbcTreeNode)  mem_alloc( sa->base_mem, &sa->mem_count, 
+                                                sizeof(sbcTreeNode) >> SHORTSHIFT, 
+                                                SBC_SIZE, LONGALIGN, 
+                                                "node");
+
+      if( tree->node[i] == NULL )
+        goto InitMemoryFail;
+
+      nread = fread( &p_node, sizeof(ushort), 1, fp );
+      if( nread != 1 )
+        goto InitFail;
+
+      treenode = sbc_get_tree_node(i, sa); 
+      treenode->vector_count = (ushort) 0;
+      treenode->parent_node_and_transform_idx = 0; 
+
+      /* Initialize diff 1 accumulator */
+      treenode->p_acc_dif1 = (long*) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                               sa->hlr_TRANSFORM_SIZE << LONGSHIFT,
+                                               SBC_SIZE, LONGALIGN, 
+                                               "diff 1");
+
+      if( treenode->p_acc_dif1 == NULL )
+        goto InitMemoryFail;
+
+      /* Initialize the accumulator to zeros */
+      pLongObj = treenode->p_acc_dif1;
+      for( clearCount=0; clearCount < sa->hlr_TRANSFORM_SIZE; clearCount++ )
+      {
+        *pLongObj++ = 0;
+      }
+
+
+      /* Initialize diff2 accumulator */
+      treenode->p_acc_dif2 = (long*) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                               sa->hlr_TRANSFORM_SIZE << LONGSHIFT,
+                                               SBC_SIZE, LONGALIGN, 
+                                               "diff 2");
+
+      if( treenode->p_acc_dif2 == NULL )
+        goto InitMemoryFail;
+
+      /* Initialize the accumulator to zeros */
+      pLongObj = treenode->p_acc_dif2;
+      for( clearCount=0; clearCount < sa->hlr_TRANSFORM_SIZE; clearCount++ )
+      {
+        *pLongObj++ = 0;
+      }
+
+
+      if (!load_monophone_only){
+       
+        sbc_set_parent_node(i, p_node, sa); 
+        sbc_set_transform_idx(i, tree->n_nodes - 1, sa); 
+      }
+   }
+
+   /* read the mapping from monophones to tree terminal nodes */
+   nread = fread( &n_monophones, sizeof( ushort), 1, fp );
+   if( nread != 1 )
+      goto InitFail;
+
+   sa->hlrTerminal = (ushort *) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                          n_monophones, 
+                                          SBC_SIZE, SHORTALIGN, 
+                                          "monophone list" );
+   if( sa->hlrTerminal == NULL )
+      goto InitMemoryFail;
+
+   /* note: (n_monophones != n_terminals) is possible */
+   sa->n_monophones = n_monophones; 
+
+   nread = fread( utmp, sizeof(ushort), n_monophones, fp );
+   if( nread != n_monophones )
+      goto InitFail;
+
+   fclose( fp );
+
+   /* make sure of the range: */
+   for( i = 0; i < n_monophones; i++ ) {
+     sa->hlrTerminal[i] = (uchar) utmp[i]; 
+     if( (short) sa->hlrTerminal[ i ] >= sa->n_terminals ) {
+       PRT(fprintf( stderr, "HLR: exceeded maximum (%d) terminals: %d\n", sa->n_terminals, i));
+       goto InitFail;
+     }
+   }
+
+
+   /* Initialize first order statistic */
+   sa->pSegStat_dif1 = (short*)  mem_alloc( sa->base_mem, &sa->mem_count, 
+                                           cep_dim, 
+                                           SBC_SIZE, SHORTALIGN, 
+                                           "suff. 1st order stat. for current seg" );
+                                             
+   if( sa->pSegStat_dif1 == NULL )
+      goto InitMemoryFail;
+
+   /* Initialize the statistic to zeros */
+   pShortObj = sa->pSegStat_dif1;
+   for( clearCount=0; clearCount < cep_dim; clearCount++ )
+   {
+      *pShortObj++ = 0;
+   }
+
+
+   /* Initialize second order statistic */
+   sa->pSegStat_dif2 = (short*) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                          cep_dim, 
+                                          SBC_SIZE, SHORTALIGN, 
+                                          "suff. 2st order stat. for current seg" );
+
+   if( sa->pSegStat_dif2 == NULL )
+      goto InitMemoryFail;
+
+   /* Initialize the statistic to zeros */
+   pShortObj = sa->pSegStat_dif2;
+   for( clearCount=0; clearCount < cep_dim; clearCount++ )
+   {
+      *pShortObj++ = 0;
+   }
+
+
+   /* initialize terminal-to-transformation index */
+   sa->hlrTransformIndex = (ushort *) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                                tree->n_nodes, 
+                                                SBC_SIZE, SHORTALIGN, 
+                                                "transform index" );
+                                                   
+   if( sa->hlrTransformIndex == NULL )
+      goto InitMemoryFail;
+
+   /* All terminals initially use top tree node transform */
+   for (i=tree->n_nodes-1; i >= 0; i--)
+      sa->hlrTransformIndex[i] = tree->n_nodes - 1; 
+
+
+   /* Initialize the transformations for all tree nodes */
+   sa->hlrTransforms = (short*) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                          tree->n_nodes * sa->hlr_TRANSFORM_SIZE, 
+                                          SBC_SIZE, SHORTALIGN, 
+                                          "bias" );
+
+   if( sa->hlrTransforms == NULL )
+      goto InitMemoryFail;
+
+   /* Initialize the transformations to zeros */
+   pShortObj = sa->hlrTransforms;
+   for( clearCount=0; clearCount < tree->n_nodes * sa->hlr_TRANSFORM_SIZE; clearCount++ )
+      *pShortObj++ = 0;
+
+
+   /* Enhanced features memory does not need to be initialized, it will be set by SBC. */
+   sa->pEnhanced = (short*) mem_alloc( sa->base_mem, &sa->mem_count, 
+                                      tree->n_nodes * sa->hlr_TRANSFORM_SIZE, 
+                                      SBC_SIZE, SHORTALIGN, 
+                                      "enhanced feature" );
+                                         
+   if (sa->pEnhanced == NULL) 
+      goto InitMemoryFail;
+
+#if defined(USE_CONF_DRV_ADP) && defined(USE_CONFIDENCE)
+   sa->bk_node_cnt = (short*) mem_alloc(sa->base_mem, &sa->mem_count,
+                                       tree->n_nodes, SBC_SIZE, SHORTALIGN, 
+                                       "backup node cnt");
+   if (sa->bk_node_cnt == NULL)
+     goto InitMemoryFail; 
+#endif
+
+   /* Load the hmm to phone mapping. This is available from HMM binary model directory. */
+   if(sbc_load_hmm2phone(fnDir, n_hmms, sa, bTriphone) == eTIesrEngineHLRSuccess )
+     return eTIesrEngineHLRSuccess;
+
+  InitFail:
+   /* Clear all sbc structure parameters */
+   sbc_open( sa );
+   return eTIesrEngineHLRLoadTree;
+
+  InitMemoryFail:
+   sbc_open( sa );
+   return eTIesrEngineHLRMemoryBase;
+}
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_re_enhance( FeaHLRAccType * pSBC,
+                                        short *obs,
+                                        short *obs_enh,
+                                        ushort physical_hmm, 
+                                        short nbr_dim, 
+                                        short* p_sbc_bias)
+{
+  short ix;
+  short * transform; 
+
+  if (pSBC == NULL || pSBC->hlrTreeBase == NULL ) {
+    for (ix=nbr_dim-1;ix>=0;ix--) obs_enh[ix] = obs[ix]; 
+    return eTIesrEngineHLRFail;
+  }
+
+  ix = sbc_phone2transidx(physical_hmm, pSBC); 
+  transform = sbc_get_transform(ix, pSBC);
+  for (ix=nbr_dim-1;ix>=0; ix--){
+    obs_enh[ix] = obs[ix] - transform[ix]; 
+    if (p_sbc_bias != NULL) p_sbc_bias[ix] = transform[ix];
+  }
+  return( eTIesrEngineHLRSuccess );
+}
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API short* sbc_enhance(
+                 FeaHLRAccType * pSBC, 
+                 short *obs,
+                 ushort physical_hmm, 
+                 short nbr_dim, 
+                 short* p_sbc_bias)
+{
+  short ix;
+  short * transform, *obs_enh; 
+
+  if (pSBC == NULL || pSBC->hlrTreeBase == NULL ) return obs; 
+
+  ix = sbc_phone2transidx(physical_hmm, pSBC); 
+  obs_enh = sbc_get_enhanced(pSBC, ix);
+
+  if (p_sbc_bias){
+    transform = sbc_get_transform(ix, pSBC);
+    for (ix=nbr_dim-1;ix>=0; ix--){
+      p_sbc_bias[ix] = transform[ix];
+    }
+  }
+  return( obs_enh );
+}
+
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_enhance_all_trans( FeaHLRAccType * pSBC,
+                                               short *obs,
+                                               short nbr_dim)
+{
+  short ix, jx;
+  ushort itrans;
+  short * transform, *penh; 
+  short iprev_trans = -1; 
+
+  if (obs == NULL) return eTIesrEngineHLRFail;
+  if (pSBC == NULL || pSBC->hlrTreeBase == NULL ) return eTIesrEngineHLRFail;
+  for (ix=pSBC->n_terminals-1;ix>=0;ix--){
+    itrans =  pSBC->hlrTransformIndex[ix] ; 
+    if (iprev_trans == itrans) continue;
+
+    transform = sbc_get_transform(itrans, pSBC);
+    penh = sbc_get_enhanced(pSBC, itrans); 
+    if (penh != NULL && transform != NULL)
+      for (jx=nbr_dim-1;jx>=0; jx--) penh[jx] = obs[jx] - transform[jx]; 
+    else
+      return eTIesrEngineHLRFail; 
+
+    iprev_trans = itrans; 
+  }  
+  return( eTIesrEngineHLRSuccess );
+}
+
+/*--------------------------------*/
+/* accumulate statistics 
+   @param nbr_dim dimension of cepstral vector
+   @param T number of frames of the current segment
+   @param p_mean pointer to mean vector, Q11
+   @param p_invvar pointer to inverse variance vector, Q9
+   @param mfcc MFCC cepstral, Q11
+   @param gamma posterior probabilty, Q15
+   @param p_bias pointer to the bias of SBC method for the current model, Q11
+   @param sa pointer to FeaHLRAccType. 
+
+ */
+TIESRENGINECOREAPI_API void sbc_acc_cep_bias(ushort nbr_dim, ushort T, short * p_mean,
+                     short *p_invvar, const short * mfcc, 
+                     ushort gamma, short * p_bias, FeaHLRAccType* sa)
+{
+  short i ;
+  short ftmp;
+  long f1, f2; 
+  if (sa == NULL || sa->hlrTreeBase == NULL ) return;
+
+  for (i = nbr_dim - 1;i>= 0; i--){
+    ftmp = mfcc[i] - p_mean[i] + p_bias[i];
+    ftmp /= T; 
+    f1 = (long) ftmp * p_invvar[i]; /* Q11 * Q9 */
+    f1 = LONG_RIGHT_SHIFT_N(f1, 9); /* Q20 -> Q11 */
+    f1 = q15_x(gamma, f1); /* Q11*/
+    sa->pSegStat_dif1[i] += f1; 
+    
+    f2 = q15_x(gamma, p_invvar[i]); 
+    f2 /= T; /* Q9*/
+    sa->pSegStat_dif2[i] += f2; 
+  }
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API Boolean sbc_acc_SBC(ushort hmm_code, ushort cep_dim,
+                ushort seglength, FeaHLRAccType * sa,
+                ushort fgtrho )
+{
+  ushort ix;
+  short jx;
+  long *dif1, *dif2, ltmp; 
+  sbcTree *tree;
+  ushort iterminalidx ; 
+
+  if (sa == NULL || sa->hlrTreeBase == NULL ) return FALSE; 
+
+  tree = (sbcTree*) sa->hlrTreeBase; 
+  iterminalidx = 
+    sbc_determine_reliable_node(hmm_code, sa, seglength, TRUE); 
+  
+  for (ix=iterminalidx;ix<tree->n_nodes;){
+    dif1 = sbc_get_transform_stat_dif1(ix, sa); 
+    dif2 = sbc_get_transform_stat_dif2(ix, sa); 
+    for (jx = cep_dim - 1; jx >= 0; jx --){
+
+      ltmp = (long) sa->pSegStat_dif1[jx];
+      dif1[jx] += ltmp; 
+      ltmp = (long) sa->pSegStat_dif2[jx];
+      dif2[jx] += ltmp; 
+      if (dif2[jx] < 0) {
+       PRT_ERR(fprintf(stdout, "Error : HMM[%d] dif2[%d] = %d\n", hmm_code, jx));
+       return FALSE  ; 
+      }
+
+    }
+    ix = sbc_parent_is(tree->node[ix]);
+    if (ix >= tree->n_nodes) break; 
+  }
+
+  return TRUE; 
+}
+
+static ushort sbc_update_SBC_seg(ushort hmm_code, ushort cep_dim, 
+                                FeaHLRAccType* sa, unsigned short afgt)
+{
+  ushort inode, iprec = 2 , ihier;
+  short jx;
+  sbcTree* tree = (sbcTree*) sa->hlrTreeBase;
+  short* p_trans;
+  long *dif1, *dif2, ltmp, ltmp3; 
+  short div;
+     
+#ifdef SBC_PRIOR
+     long ltmp2;
+#endif
+
+  short iTerminalIdx = sbc_phone2terminalidx(hmm_code, sa); 
+
+  for (ihier=iTerminalIdx;ihier < tree->n_nodes; ){
+
+    if (sbc_is_marked(sa->hlrTransformIndex[ihier]))
+      return iTerminalIdx;  
+
+    inode = sa->hlrTransformIndex[ihier];
+    p_trans = sbc_get_transform(inode, sa); 
+    dif1 = sbc_get_transform_stat_dif1(inode, sa); 
+    dif2 = sbc_get_transform_stat_dif2(inode, sa); 
+
+    /* by default, dif1 is Q11 and dif2 is Q9 */
+    for (jx= cep_dim -1 ;jx>=0;jx--){
+      ltmp = dif2[jx] << iprec ; 
+      ltmp3 = dif1[jx] ; 
+
+#ifdef SBC_PRIOR
+      ltmp2 = sbc_prior_invvar(jx, cep_dim);
+      ltmp2 = LONG_RIGHT_SHIFT_N(ltmp2, 2); /* 0.25 * the variance */
+      ltmp3 += LONG_RIGHT_SHIFT_N(ltmp2, 11) * p_trans[jx];
+      div = (short) div32_32_Q(ltmp3, ltmp + ltmp2, MEAN_PREC);
+#else
+      div = (short) div32_32_Q(ltmp3, ltmp, MEAN_PREC);
+#endif
+      p_trans[jx] = div; 
+
+      dif1[jx] = q15_x(afgt, dif1[jx]);
+      dif2[jx] = q15_x(afgt, dif2[jx]);
+
+    }
+
+    sbc_mark(&(sa->hlrTransformIndex[ihier]), sa);
+
+    ihier = sbc_parent_is(tree->node[ihier]);
+  }
+
+  return iTerminalIdx; 
+}
+
+/*--------------------------------*/
+TIESRENGINECOREAPI_API void sbc_update_SBC(gmhmm_type* gv)
+{
+  short s;
+
+  if (gv->sbcState == NULL || gv->sbcState->hlrTreeBase == NULL ) return; 
+  sbc_update_SBC_phone2trans(gv);
+
+  for (s = gv->nbr_seg -1; s >=0 ; s--){ /* for each segment */
+    sbc_update_SBC_seg(gv->hmm_code[s], gv->nbr_dim, 
+                      gv->sbcState, gv->sbc_fgt );
+  }
+
+  sbc_unmark( gv->sbcState );
+
+#ifdef _SBC_DEBUG
+  sbc_dbg_dump(gv->sbcState);
+#endif
+
+  /*
+    used to generate SBC for learning prior statistics 
+    #ifdef SBC_PRIOR
+    #ifdef USE_SNR_SS
+    printf("NoiseLvl = %d ", noiselvl);
+    #endif
+    sbc_dump_transform( gv->sbcState);
+    #endif
+  */
+}
+
+/*--------------------------------
+  compute pdf for one state pdf.
+  --------------------------------*/
+TIESRENGINECOREAPI_API void sbc_observation_likelihood(ushort seg_stt, short T, ushort hmm_code,
+                               HmmType *hmm, 
+                               short pdf[], short n_mfcc, gmhmm_type *gv )
+{
+  ushort t, i, crt_vec;        
+  short x, pdf_i, nbr_dim = n_mfcc * 2;
+  short mfcc_feature[ MAX_DIM ];
+  short obs_enh[MAX_DIM]; 
+  
+  FOR_EMS_STATES(i,hmm,gv->base_tran) { 
+    pdf_i = GET_BJ_IDX(hmm,i);
+    for (t=0, crt_vec = seg_stt * n_mfcc; t<T; t++, crt_vec += n_mfcc) {
+#ifdef BIT8FEAT
+      vector_unpacking(gv->mem_feature + crt_vec, mfcc_feature, gv->scale_feat, n_mfcc); 
+#else
+      copy_feature(mfcc_feature, crt_vec, n_mfcc);
+#endif
+      sbc_re_enhance( gv->sbcState, mfcc_feature, obs_enh, hmm_code, nbr_dim, NULL);
+      pdf[t] = hlr_gauss_obs_score_f(obs_enh, (int)pdf_i, FULL, &x, nbr_dim, gv);
+    }
+    pdf += T;
+  }
+}
+
+
+/*--------------------------------
+  sbc_set_default_params
+
+  Initialize SBC parameters with default values.
+  --------------------------------*/
+TIESRENGINECOREAPI_API void sbc_set_default_params( gmhmm_type *gv )
+{
+   gv->sbc_fgt = SBC_FGT_DEFAULT;
+}
+
+
+/*--------------------------------
+  sbc_free
+
+  Free any allocated memory during sbc operation.
+  --------------------------------*/
+TIESRENGINECOREAPI_API void sbc_free( FeaHLRAccType *aSBC )
+{
+
+   if( aSBC == NULL )
+      return;
+
+#ifdef _DYN_ALLOC_SBC
+   if( aSBC->pHMM2phone )
+   {
+      free( aSBC->pHMM2phone );
+      aSBC->pHMM2phone = NULL;
+
+      sbc_open( aSBC );
+   }
+#endif
+
+}
diff --git a/TIesrEngine/src/sbc.h b/TIesrEngine/src/sbc.h
new file mode 100755 (executable)
index 0000000..5460727
--- /dev/null
@@ -0,0 +1,121 @@
+/*=======================================================================
+ sbc.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ Header for internal components of stochastic bias compensation. 
+======================================================================*/
+
+
+#ifndef _SBC_H
+#define _SBC_H
+
+#include "tiesr_config.h"
+#include "tiesrcommonmacros.h"
+
+#include "sbc_user.h"
+
+/* Use malloc to dynamic allocate space because n_hmms is varying, 
+   it may be better to do so. */
+#define _DYN_ALLOC_SBC 1
+
+/*--------------------------------
+  Constants used by the method, not subject to change with different applications.
+  --------------------------------*/
+
+
+static const unsigned short DIF1_PREC = 11;
+
+static const unsigned short DIF2_PREC = 9;
+/* 
+   If the above precisions are changed, need to check at least the following command
+   div = (short) div32_32_Q(dif1[jx], dif2[jx]<<iprec, MEAN_PREC);
+   in sbc.cpp.
+*/
+
+static const unsigned short MEAN_PREC = 11;
+
+static const unsigned short MAX_TRANSFOM_MEM = 5000;
+
+static const short SBC_MINTOKENS = 700; 
+
+
+static const short SBC_MAX_MONOPHONES = 75;
+
+
+/* Parameter defaults of SBC */
+
+/* 0.8 in Q15 */
+static const unsigned short SBC_FGT_DEFAULT = 26214;
+
+
+/*--------------------------------
+  Structures used locally within SBC
+  --------------------------------*/
+
+/* SBC node structure */
+
+typedef struct{
+  /* pointer to the allocated sufficient statistics for SBC */
+  long * p_acc_dif1 ; /* Q DIF1_PREC */
+  long * p_acc_dif2 ; /* Q DIF2_PREC */
+
+  ushort vector_count; 
+  short parent_node_and_transform_idx; /* the upper byte contains parent node
+                                         the lower byte contains transform index */
+}sbcTreeNode, *psbcTreeNode;
+
+
+/*  SBC Tree structure */
+
+typedef struct
+{
+  psbcTreeNode *node; 
+  ushort n_nodes;
+  ushort n_utt; /* number of utterances used for SBC updating and adaptation */
+} sbcTree;
+
+/* Set this flag refresh SBC for every 128 utterances.  This completely resets
+   all transformations. */
+//#define SBC_REFRESH
+
+#ifdef SBC_PRIOR
+
+/* prior inverse variance of SBC vector, 
+   in Q11 */
+const short SBC_PRIOR_INVVAR[20] = {23331, 13709, 27631, 16671, 17975, 
+                                   28147, 6042, 6384, 10980, 13018,
+                                   32508, 32508, 32508, 32508, 32508, 
+                                   32508, 32508, 32508, 32508, 32508};
+#endif
+
+/*--------------------------------
+  Macros used locally
+  --------------------------------*/
+
+/*--------------------------------
+  Local function prototypes
+  --------------------------------*/
+
+/* Division of two longs, and return long with specific Q precision.
+   This should be defined within a math core API */
+
+//static long div32_32_Q(long num, long den, ushort q_prec);
+
+/**
+   given hmm_idx, obtain corresponding bias removal vector 
+   @param hmm_idx hmm code
+   @param sa pointer to FeaHLRAccType
+   return transformation index */
+static ushort sbc_phone2transidx(ushort hmm_idx, FeaHLRAccType * sa);
+
+#ifdef _SBC_DEBUG
+
+void sbc_dbg_dump(FeaHLRAccType *sa);
+void sbc_dump(FeaHLRAccType *sa, ushort inode);
+
+#endif
+
+#endif
diff --git a/TIesrEngine/src/sbc_struct_user.h b/TIesrEngine/src/sbc_struct_user.h
new file mode 100755 (executable)
index 0000000..c6d8f7e
--- /dev/null
@@ -0,0 +1,68 @@
+/*=======================================================================
+ sbc_struct_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This header file defines the FeaHLRAccType structure used to contain
+ the SBC state.  This structure is defined separately from the
+ sbc_user.h file since the sbc_user.h file also uses gmhmm_type.h,
+ and gmhmm_type.h includes the FeaHLRAccType structure.  (This is part
+ of the lack of modularity of TIesr at this time.)
+
+======================================================================*/
+
+#ifndef _SBC_STRUCT_USER_H
+#define _SBC_STRUCT_USER_H
+
+#include "tiesr_config.h"
+#include "tiesrcommonmacros.h"
+
+/* Memory required to store sbc transform management data */
+#define SBC_SIZE 23000
+
+
+/*--------------------------------
+  Structures defined and used by the interface
+  --------------------------------*/
+
+typedef struct { 
+  short   base_mem[SBC_SIZE];
+  ushort mem_count; /* memory top level index */
+  ushort max_mem_usage; /* max size */
+  
+  ushort n_terminals;
+
+  ushort n_monophones;
+
+  /* HLR globals */
+  /* HLR regression Tree memory info */
+  short *hlrTreeBase;
+  /* The monophone index to tree terminal node index */
+  ushort *hlrTerminal;
+  
+  /* pointer to hmm2phone index */
+  short *pHMM2phone; 
+
+  /* mapping from terminal tree nodes to transforms */
+  ushort *hlrTransformIndex; // [0..n_nodes] index of transformation by hlrTransform
+  /* pointer to the index of transformation for phones */
+  ushort hlr_TRANSFORM_SIZE;
+
+  short *hlrTransforms; /* Q11 */
+  
+  short* pSegStat_dif1; /* 1st order statistics of this segment , Q11 */
+  short* pSegStat_dif2; /* 2nd order statistics of this segment , Q9 */
+
+  short *pEnhanced;    /*  space allocated for enhanced feature at current frame by bias removal */
+  /* should have 97*16*2 = 3104 byte = 1052 short*/
+
+  /* ------------- for confidence driven adaptation -------------- */
+#ifdef USE_CONF_DRV_ADP
+  short * bk_node_cnt; /* node count */
+#endif
+
+} FeaHLRAccType ;
+
+#endif
diff --git a/TIesrEngine/src/sbc_user.h b/TIesrEngine/src/sbc_user.h
new file mode 100755 (executable)
index 0000000..bcb22a2
--- /dev/null
@@ -0,0 +1,239 @@
+/*=======================================================================
+ sbc_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file provides the SBC user API interface.
+
+======================================================================*/
+
+#ifndef _SBC_USER_H
+#define _SBC_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+
+#include "tiesr_config.h"
+#include "tiesrcommonmacros.h"
+#include "hlr_status.h"
+
+#include "gmhmm_type.h"
+#include "search_user.h"
+
+#include "sbc_struct_user.h"
+
+/* for debug of SBC */
+//#define _SBC_DEBUG 1
+
+/*--------------------------------
+  Function interface to the SBC API
+  --------------------------------*/
+
+/* dump temporary information - only used for debugging so not used now */
+/* void sbc_dump(FeaHLRAccType *pSBC, ushort i_node_idx); */
+
+
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_save(FeaHLRAccType* pSBC , FILE* pf );
+
+
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_load(FeaHLRAccType* pSBC , FILE* pf );
+
+
+/* reset sufficient statistics before accumulating statistics for the current utterance.
+   @param pSBC pointer to FeaHLRAccType
+*/
+TIESRENGINECOREAPI_API void sbc_rst_SBC_stat(FeaHLRAccType* pSBC );
+
+
+/* reset sufficient statistics before accumulating for the current segment
+   @param pSBC pointer to FeaHLRAccType
+*/
+TIESRENGINECOREAPI_API void sbc_rst_seg_stat(FeaHLRAccType* pSBC );
+
+
+/*----------------------------------------------------------------
+  sbc_open
+  
+  Set all elements of the FeaHLRAccType to opening values.  This 
+  ensures that the structure is constructed correctly.
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API void sbc_open( FeaHLRAccType *pSBC );
+
+
+/* 
+   initialization of SBC method
+   @param pSBC Pointer to FeaHLRAccTYpe structure holding sbc state
+   @param fnDir path of network, hmms
+   @param fname file name of phonenetic clustering tree
+   @param load_monophone_only TRUE if only load monophone, FALSE also load clustering tree
+   @param cep_dim cepstral feature vector size
+   @param nbr_hmms number of HMMs
+   @param bTriphone: TRUE if maps triphone to monophone
+   FALSE if maps monophone to itself
+
+   return NULL if the process is failed, otherwise, 
+          return pointer to the address of FeaHLRAccType
+*/
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_init_tree( FeaHLRAccType* pSBC,
+                                       const char* fnDir, 
+                                       const char *fname, 
+                                       short load_monophone_only,
+                                       ushort cep_dim, 
+                                       ushort n_hmms, 
+                                       Boolean bTriphone );
+
+/* load triphone to monophone mapping list */
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_load_hmm2phone(const char gdir[],
+                                           ushort n_hmms, 
+                                           FeaHLRAccType *sa,
+                                           Boolean bTriphone );
+
+/* return the leaf of the triphone HMM indexed by $hmm_idx */
+short sbc_phone2terminalidx(ushort hmm_idx, FeaHLRAccType * sa);
+
+/* obtain enhanced feature vector, assuming that it has not yet been calculated
+   @param pSBC pointer to FeaHLRAccType
+   @param org_obs pointer to the original feature vector
+   @param obs_enh pointer to the address of the enhanced feature vector, need to have allocated space by user
+   @param physical_hmm HMM code
+   @param nbr_dim feature vector size
+   @param p_sbc_bias pointer to the address of transformations, need to have an allocated space by user. 
+*/
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_re_enhance( FeaHLRAccType * pSBC,
+                                        short *org_obs,
+                                        short *obs_enh,
+                                        ushort physical_hmm, 
+                                        short nbr_dim, 
+                                        short* p_sbc_bias);
+
+/* obtain enhanced feature vector by sbc_enhance_all_trans.
+   @param pSBC pointer to FeaHLRAccType
+   @param obs observation feature vector
+   @param physical_hmm hmm index
+   @param nbr_dim feature vector size
+   @param p_sbc_bias if the pointer is not NULL, set the bias to the address by the pointer
+   return address of the enhanced feature vector, NULL if failed. 
+*/
+TIESRENGINECOREAPI_API short* sbc_enhance(
+                 FeaHLRAccType * pSBC, 
+                 short *obs,
+                 ushort physical_hmm, 
+                 short nbr_dim, 
+                 short* p_sbc_bias);
+
+
+/* feature bias removal of the current mfcc feature vector. 
+   Save the enhanced features to all used transformation indices. Use sbc_enhance
+   to obtain the enhanced feature vector.
+   @param pSBC pointer to FeaHLRAccType
+   @param obs input feature vector
+   @param nbr_dim feature vector size of the input feature vector
+*/
+TIESRENGINECOREAPI_API TIesrEngineHLRStatusType sbc_enhance_all_trans( FeaHLRAccType * pSBC,
+                                               short *obs,
+                                               short nbr_dim);
+
+
+/* accumulate sufficient statistics for SBC estimates.
+   @param hmm_code HMM code
+   @param cep_dim feature vector size
+   @param seglength length of the current segment
+   @param pSBC pointer to FeaHLRAccType
+   @param fgtrho forgetting factor for SBC sufficient statistics accumulation
+                 dif2 = dif2*fgtrho + newdif2* (1- fgtrho)
+   return TRUE if sucess, otherwise return FALSE
+*/
+TIESRENGINECOREAPI_API Boolean sbc_acc_SBC(ushort hmm_code, ushort cep_dim,
+                ushort seglength, FeaHLRAccType * pSBC ,
+                ushort fgtrho );
+
+
+/* update SBC parameters 
+   @param gv pointer to gmhmm_type
+*/
+TIESRENGINECOREAPI_API void sbc_update_SBC(gmhmm_type* gv );
+
+
+/* accumulate statistics 
+   @param nbr_dim dimension of cepstral vector
+   @param T number of frames of the current segment
+   @param p_mean pointer to mean vector, Q11
+   @param p_invvar pointer to inverse variance vector, Q9
+   @param mfcc MFCC cepstral, Q11
+   @param gamma posterior probabilty, Q15
+   @param p_bias pointer to the bias of SBC method for the current model, Q11
+   @param pSBC pointer to FeaHLRAccType. 
+
+ */
+TIESRENGINECOREAPI_API void sbc_acc_cep_bias(ushort nbr_dim, ushort T, short * p_mean, short *p_invvar,
+                     const short * mfcc, ushort gamma, short * p_bias, FeaHLRAccType* pSBC );
+
+
+TIESRENGINECOREAPI_API void sbc_observation_likelihood(ushort seg_stt, short T, ushort hmm_code,
+                               HmmType *hmm, 
+                               short pdf[], short n_mfcc, gmhmm_type *gv );
+
+
+/*---------------------------------------------------------------- 
+  sbc_set_default_params
+
+  Set default SBC dynamic parameter settings in the global recognizer
+  instance structure.  This is part of the capability provided so that
+  the application designer can make changes to some SBC parameters
+  advanced settings to improve recognition performance in some
+  situations.  Setting parameters to other than the defaults should be
+  done cautiously.
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API void sbc_set_default_params( gmhmm_type *gv );
+
+/* return pointer to the HMM2phone */
+TIESRENGINECOREAPI_API short * sbc_rtn_hmm2phone(FeaHLRAccType *sa);
+
+/*---------------------------------------------------------------- 
+  sbc_free
+
+  This function frees any memory allocated during use of SBC.  This
+  function must be called after using SBC if sbc_init_tree is called
+  and has returned successfully, since that may have allocated
+  memory. 
+  ----------------------------------------------------------------*/
+TIESRENGINECOREAPI_API void sbc_free( FeaHLRAccType* pSBC );
+
+/* for confidence driven adaptation */
+void sbc_backup(FeaHLRAccType * sa);
+void sbc_restore(FeaHLRAccType * sa);
+
+#endif
diff --git a/TIesrEngine/src/search.cpp b/TIesrEngine/src/search.cpp
new file mode 100755 (executable)
index 0000000..7040dd5
--- /dev/null
@@ -0,0 +1,2547 @@
+/*=======================================================================
+ search.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Viterbi HMM search functions.
+
+======================================================================*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "tiesr_config.h"
+#include "search_user.h"
+#include "dist_user.h"
+#include "gmhmm.h"
+#include "sbc_user.h"
+#include "load_user.h"
+#include "pmc_f_user.h"
+#include "uttdet_user.h"
+#ifdef USE_NBEST
+#include "nbest_user.h"
+#endif
+#ifdef USE_CONFIDENCE
+#include "confidence_user.h"
+#endif
+#if defined(USE_RAPID_SEARCH) || defined(RAPID_JAC) || defined(USE_AVL_TREE)
+#include "rapidsearch_user.h"
+#endif
+
+//#define DBG_SEARCH
+//#define SHOW_NBEST
+
+//#define DEBUGP
+
+#ifdef SHOW_DIAGONISIS
+//testing and statistical
+long int global_count; 
+long int global_count2;
+long int global_frame;
+int sttnode=0;
+
+#endif
+
+#ifdef DBG_SEARCH
+short global_active_sym=0;
+short max_glb_active_sym = 0;
+#endif
+/*
+**   (beam_z * 3 + 2 * sym_z * 2 + state_z * 3 + 2 * time_z)
+*/
+
+TIESRENGINECOREAPI_API void set_search_space
+(short *search_space, ushort beam_z, ushort sym_z, ushort state_z, ushort time_z, gmhmm_type *gv)
+{
+  unsigned int c = 0;
+  short k; 
+
+  gv->max_state_cell = state_z;
+  //gv->max_sym_cell2 = (sym_z>>1) ;
+  gv->max_sym_cell2 = (sym_z>>1); 
+  gv->max_beam_cell  = beam_z;
+  gv->max_time_cell  = time_z;
+
+//first beam cell
+  gv->beam_base = (BeamType*) (search_space + c);
+  
+  c += gv->max_beam_cell * BEAM_SZ;  
+
+//second sym cell (in two parts).
+  gv->symcell_base = (SymCell*) (search_space + c);
+
+  /*sym cell has size of 2.  2 genders(or even/odd hmms), t,t+1 (or even odd frame)  */
+  //c += 2 * gv->max_sym_cell2 * 2/* ! make it to max_sym_cell */  * 2;
+  c += SYMB_SZ * gv->max_sym_cell2 * 2; /* ! make it to max_sym_cell */   
+
+
+//third state cell
+  gv->statecell_base = (StateCell *) (search_space + c);
+  c += gv->max_state_cell * STATE_SZ;
+
+//last time cell
+  gv->time_base = (TimeType *) (search_space + c);
+  c += TIME_SZ * gv->max_time_cell;
+
+//  printf("NOw C= %d - and %d ==\n", c,  SEARCH_SIZE(beam_z, sym_z, state_z, time_z));
+#ifdef USE_NBEST
+  if (gv->bUseNBest){
+    gv->max_nb_beam_cell  =  NBESTELEMS; 
+    tmem = (short*) malloc(sizeof(short)*gv->max_nb_beam_cell * 3);
+    gv->nb_beam_base = (BeamType*) tmem; 
+    tmem = (short*) malloc(sizeof(short)*gv->max_time_cell);
+    gv->nb_time_base = (TimeType*) tmem; 
+  }else{
+    gv->nb_beam_base = NULL;
+    gv->nb_time_base = NULL;
+  }
+#endif
+
+#ifdef _MONOPHONE_NET
+  if (rs_get_monophone_search_space(gv)){
+    tmem = (short*) malloc(sizeof(short)*gv->max_beam_cell * 3);
+    rs_get_monophone_search_space(gv)->nb_beam_base = (BeamType*) tmem; 
+    tmem = (short*) malloc(sizeof(short)*gv->max_time_cell);
+    rs_get_monophone_search_space(gv)->nb_time_base = (TimeType*) tmem; 
+  }
+#endif
+
+  gv->sym2pos_map.nbr_syms = 0;
+  gv->sym2pos_map.max_nbr_syms = gv->trans->n_sym * NSYM + 1; 
+  for (k=gv->sym2pos_map.max_nbr_syms-1;k>=0;k--)
+    gv->sym2pos_map.sym2pos[k] = -1; 
+
+}
+
+static void init_last_time_table(gmhmm_type *gv)
+{
+  unsigned short i;
+  for (i=0; i<NN; i++){
+    gv->time_table_idx[i] = UNDEFINEDTIME;
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   this is the watermark statistics, used to compute the peak usage of
+   a batch of recognition test files
+   called per file
+   ---------------------------------------------------------------------- */
+
+static void init_high_pos(gmhmm_type *gv)
+{
+  short i;
+  gv->evalstat.state.high_pos = 0;
+  for (i=0; i< NSYM; i++){
+    gv->evalstat.sym[i].high_pos = 0;
+  }
+  gv->evalstat.beam.high_pos = 0;
+  gv->evalstat.time.high_pos = 0;
+#ifdef USE_NBEST
+  gv->evalstat.nb_beam.high_pos = 0;
+  gv->evalstat.nb_time.high_pos = 0;
+#endif
+
+}
+
+/* ---------------------------------------------------------------------------
+   called per frame
+   ---------------------------------------------------------------------- */
+
+static void init_cur_pos( short idx, gmhmm_type *gv)
+{
+  short i, k;
+
+  gv->eval[ idx ].cur_state = 0;
+  for (i=0; i< NSYM; i++) {
+    gv->eval[ idx ].cur_sym[i] = 0; 
+  }
+
+  for (k=0;k<gv->sym2pos_map.nbr_syms;k++){
+    i = gv->sym2pos_map.syms[k];
+    gv->sym2pos_map.sym2pos[i] = -1; 
+  }
+  gv->sym2pos_map.nbr_syms = 0; 
+}
+
+/* ---------------------------------------------------------------------------
+   clear Gaussian mixture score storage
+   ---------------------------------------------------------------------- */
+
+static void clear_obs_scr(gmhmm_type *gv)
+{
+  short i = gv->n_pdf;
+  for (i=0; i< gv->n_mu; i++)
+    gv->gauss_scr[i]= LZERO; 
+
+}
+
+/* ---------------------------------------------------------------------------
+   update eval cell peak usage estimate watermark,
+   check overflow for SYM and STATE cells.
+   ---------------------------------------------------------------------- */
+
+static short
+eval_cell_overflow( short n_state, short h_code, gmhmm_type *gv )
+{
+  /* need 1 sym cell and n_state state cells */
+  PosType *pos = gv->evalstat.sym + h_code;
+  
+   if (n_state == 32767) {
+     PRT_ERR(printf("code large\n"));
+     return eTIesrEngineEvalCellOverflow;
+  }
+  pos->cur_pos = gv->eval[ 0 ].cur_sym[h_code] + gv->eval[ 1 ].cur_sym[h_code] + 1;
+  
+  gv->evalstat.state.cur_pos = gv->eval[ 0 ].cur_state + gv->eval[ 1 ].cur_state + n_state;
+  
+  /* update watermark */
+
+  if ( pos->cur_pos > pos->high_pos ) pos->high_pos = pos->cur_pos;
+  if ( gv->evalstat.state.cur_pos > gv->evalstat.state.high_pos )
+    gv->evalstat.state.high_pos =  gv->evalstat.state.cur_pos;
+
+  /* check overflow */
+
+  if ( pos->high_pos > gv->max_sym_cell2 ) {
+    PRT_ERR(fprintf(stderr, "Error: Sym eval cell overflow, %d > %d\n", 
+                   pos->high_pos, gv->max_sym_cell2));
+    return eTIesrEngineEvalCellOverflow;
+  }
+  
+  if ( gv->evalstat.state.high_pos > gv->max_state_cell ) {
+    PRT_ERR(fprintf(stderr, "Error: State eval cell overflow\n"));
+    PRT_ERR(printf(" short n_state, short h_code = %d =%d  max_state_cell = %d\n",  n_state,  h_code, gv->max_state_cell ));
+    return eTIesrEngineEvalCellOverflow;
+  }
+
+  return eTIesrEngineSuccess;        /* no overflow */
+}
+    
+/* ---------------------------------------------------------------------------
+   allocate eval cells (one sym cell and its corresponding state cell"s")
+   ---------------------------------------------------------------------- */
+/* @param eval_idx : evaluation cell of the current time, $cur_idx 
+ */
+static StateCell *
+allocate_eval_cell(EvalIdx *eval_idx, unsigned short sym, short n_state, short cur_idx,
+                  gmhmm_type *gv, int depth)
+{
+  StateCell *pstate, *psco;     /* ptr to state cell */
+  SymCell   *psym;       /* ptr to sym cell */
+  short h_code = HCODE(sym); /* male/female? */
+  short mapidx; 
+
+  /* cell overflow? */
+
+  if ( eval_cell_overflow( n_state, h_code, gv ) != eTIesrEngineSuccess ) 
+    return NULL;
+  
+  /* allocate sym cell */
+  psym = h_code? gv->symcell_base + gv->max_sym_cell2: gv->symcell_base;
+  
+  /*get pointer of current sym*/
+  psym = SYM_CELL(psym, eval_idx->cur_sym[h_code], cur_idx, gv->max_sym_cell2); 
+  
+  /* have the symbol lists */
+  /* get the sym2pos mapping */
+  mapidx = gv->sym2pos_map.nbr_syms;
+  if ((mapidx < gv->sym2pos_map.max_nbr_syms) && (mapidx >= 0) && (sym < gv->sym2pos_map.max_nbr_syms) && (mapidx < MAX_NUM_SYMS) && (sym < MAX_NUM_SYMS)){
+    gv->sym2pos_map.syms[mapidx] = sym; 
+    gv->sym2pos_map.nbr_syms++;
+    gv->sym2pos_map.sym2pos[sym] = eval_idx->cur_state; 
+  }
+  else 
+    return NULL;
+
+  eval_idx->cur_sym[h_code]++;            /* increment to next available cell */
+
+  /* corresponding start state cell */
+  psym->start_cell = eval_idx->cur_state;
+  psym->sym_code = sym;
+  psym->depth=depth;
+  
+  /* allocate state cell */
+  pstate = STATE_CELL(gv->statecell_base, eval_idx->cur_state, n_state, cur_idx, gv->max_state_cell);
+
+  eval_idx->cur_state += n_state;   /* increment to next available cell */
+
+
+  psco = pstate;
+  while ( n_state-- ){
+    psco->scr = BAD_SCR; 
+    psco->frm = (ushort) UNDEFINEDTIME; 
+    psco++;
+  }
+
+  return pstate;
+}
+
+/*
+** get time information of a given beam cell
+*/
+static unsigned short get_frame_time(unsigned short bm, gmhmm_type *gv)
+{
+  int i;
+  unsigned short q;
+  
+  for (i=0; i < gv->evalstat.time.high_pos; i++) {
+    if (gv->time_base[i].beam_idx != USHRT_MAX) {
+      for (q = gv->time_base[i].beam_idx; NOT_END_IX_CELL(q, gv->max_beam_cell); q = gv->beam_base[q].next)  {
+       if (q == bm) return gv->time_base[i].frm;
+      }
+    }
+  }
+  return 0; /* impossible to reach here */
+}
+
+/* ---------------------------------------------------------------------------
+   find existing start state cell for a sym
+   a state cell cache can improve efficiency and reduce costs.
+   @param idx : odd frame index ? 
+   ---------------------------------------------------------------------- */
+static StateCell *
+find_state_cell(EvalIdx *eval_idx, unsigned short idx, unsigned short sym, unsigned n_state, gmhmm_type *gv)
+{
+  short i_pos = -1; 
+  StateCell *pstate = NULL; 
+
+  if (sym < gv->sym2pos_map.max_nbr_syms && sym < MAX_NUM_SYMS)
+    i_pos = gv->sym2pos_map.sym2pos[sym]; 
+  if (i_pos >= 0 )
+    pstate = STATE_CELL(gv->statecell_base, i_pos, n_state, idx, gv->max_state_cell);
+
+  return pstate;
+}
+
+/* ---------------------------------------------------------------------------
+   mark backtrace cell as being used (not available)
+   ---------------------------------------------------------------------- */
+
+static void mark_cells_state(unsigned short stop_frm, unsigned short best_sym, gmhmm_type *gv,
+                     unsigned short last_frm)
+{
+   BeamType *bm, *beam = gv->beam_base;
+   short time;
+   unsigned short frm_diff, b_index, cont;   
+   TimeType *time_base = gv->time_base;
+   
+   /*get the correct "time" from time_base, or using the quick access list, so that the stop_frame== time_cell.frm*/
+   if ((frm_diff = last_frm - stop_frm ) < NN) {
+     time = gv->time_table_idx[frm_diff];
+     if (time ==  UNDEFINEDTIME) { // not stored yet, locate time: 
+       MATCH_TIME(time, time_base, stop_frm);
+       gv->time_table_idx[frm_diff] = time; // store it 
+     }
+   }
+   else MATCH_TIME(time, time_base, stop_frm);
+   
+   
+   
+   /* follow the chain to locate the symbol: seach from the beam_index+beam_base for best_sym, store in bm */
+  //  MATCH_SYMB(bm,time_base[time].beam_idx, beam, best_sym);
+  //// #define MATCH_SYMB(bm, bm0, beam0, best_sym) 
+   for (bm = beam + time_base[time].beam_idx; bm->sym != best_sym; )
+   {
+       bm = beam + bm->next;
+   }
+
+   
+   /* backward marking , everying in the past of the beam starting at bm, set cell's idxflag to |8000*/
+   BACKWARD_MARKING(bm,b_index,cont, beam,gv->max_beam_cell);
+}
+
+/* ---------------------------------------------------------------------------
+   mark active beam cells for completed sym
+   ---------------------------------------------------------------------- */
+static void coloring_beam(unsigned short cur_time_index, gmhmm_type *gv)
+{
+  BeamType *beam_base = gv->beam_base, *bm, *beam = beam_base;
+  unsigned short q, b_index, cont, c_bm_cnt = 0; 
+  short depth; 
+
+  if (cur_time_index == USHRT_MAX) return ; /* no beam cell has this time (no sym was collected at this time) */
+  for (q =  gv->time_base[cur_time_index].beam_idx; NOT_END_IX_CELL(q,gv->max_beam_cell); q = beam_base[q].next) { 
+    bm = beam_base + q;
+    depth=0;
+    BACKWARD_MARKING(bm,b_index,cont, beam, gv->max_beam_cell);
+    c_bm_cnt ++; 
+  }
+  gv->beam_count=c_bm_cnt;
+  gv->cur_beam_count = c_bm_cnt; 
+
+#ifdef DEBUGP
+  PRT_ERR(printf ("frame %d, number of beam: %d. symcell pos 0/1 : %d, %d \n", gv->frm_cnt, c_bm_count, gv->evalstat.sym[0].cur_pos,gv->evalstat.sym[1].cur_pos));
+#endif
+
+}
+
+/*
+** update beamcell cache
+*/
+static void update_time_table(short p[], unsigned short n, gmhmm_type *gv)
+{
+  unsigned short i;
+  TimeType *time_base = gv->time_base;
+  for (i = n - 1; i > 0; i--) {
+    if ((p[i-1] != UNDEFINEDTIME) && (time_base[p[i-1]].beam_idx != USHRT_MAX)) p[i] = p[i-1];
+    else p[i] =  UNDEFINEDTIME;
+  }
+  p[0] = UNDEFINEDTIME;
+}
+  
+/* ---------------------------------------------------------------------------
+   garbage collect the backtrace cells
+   ---------------------------------------------------------------------- */
+
+static void 
+compact_beam_cells( BeamType *beam_base, TimeType *time_base,gmhmm_type *gv )
+{
+  short i, t;
+  unsigned short beam_idx, s_next, count=0;
+  BeamType *bm = beam_base, *p, *head;
+
+  /*label the end of list, should be put out */
+  //if (gv->last_beam_cell != UNDEF_CELL) beam_base[gv->last_beam_cell].next =  gv->max_beam_cell;
+  
+  /* mark completed symbol (in time cell )*/
+  coloring_beam(gv->next_time,gv);
+
+  /* at this point, all active beam cells are marked */
+  /* set available(un-marked) to 0x7fff, and un-mark the occupied (marked) */
+
+  for (i = gv->evalstat.beam.high_pos - 1, p = bm + i; i >= 0; p--, i--) { 
+    if ( p->idx_flag & 0x8000 ) p->idx_flag &= 0x7fff;   /* marked -- unmark it*/
+    else {                                      /* not marked, available */
+      p->idx_flag = 0x7fff;                     /* empty */
+      gv->evalstat.beam.cur_pos = i;                /* move to lowest empty */
+      count++;
+    }
+  }
+    #ifdef DEBUGP
+      printf("COMPACT!  beam cell are cut by %d. at frame %d \n", count , gv->frm_cnt);
+    #endif
+  
+  
+  /*
+  ** update time table (head of symbol list)
+  */
+  
+  for (t = gv->evalstat.time.high_pos - 1; t>=0;  t--) {   //pos means the next available, so pos-1 is the current
+   
+   
+    beam_idx = time_base[t].beam_idx;
+    if (beam_idx != USHRT_MAX) { /* there is a list of symbols that follows */
+      /* follow the list until the first non empty cell located: (it will become new head of the time table*/
+      for (; NOT_END_IX_CELL(bm[beam_idx].next,gv->max_beam_cell); beam_idx = bm[beam_idx].next) 
+       if (!CELLEMPTY(bm[beam_idx].idx_flag)) break;
+
+  
+      if (CELLEMPTY(bm[beam_idx].idx_flag)) { /* the list contains only empty cells */
+       beam_idx = USHRT_MAX;                 /* set the list to NULL */
+       gv->evalstat.time.cur_pos = t;            /* lower the curt position for compactness of lower portion */
+      }
+      else { /* head found, and the list contains at least one cell, update symbol chain: */
+       for (head = bm + beam_idx; NOT_END_IX_CELL(head->next, gv->max_beam_cell); head = bm + head->next) {
+         // find the first active one, or the end 
+         for (s_next = head->next, p = bm + s_next; CELLEMPTY(p->idx_flag) && NOT_END_IX_CELL(p->next,gv->max_beam_cell); s_next = p->next, p = bm + s_next) ;
+         
+         if (CELLEMPTY(p->idx_flag)) { // stopped because of empty cell, that the end of the list 
+           head->next = gv->max_beam_cell;   break;
+         }
+         else head->next = s_next;
+       }
+       
+      }
+  
+
+      time_base[t].beam_idx = beam_idx; 
+    }
+    else gv->evalstat.time.cur_pos = t;
+  }
+  
+}
+
+/* ---------------------------------------------------------------------------
+   init the backtrace cells
+   ---------------------------------------------------------------------- */
+
+static void 
+init_beam_list(gmhmm_type *gv)
+{
+  gv->evalstat.beam.cur_pos = 0;
+  gv->evalstat.time.cur_pos = 0;
+
+#ifdef USE_NBEST
+  gv->evalstat.nb_beam.cur_pos = 0;
+  gv->evalstat.nb_time.cur_pos = 0;
+#endif  
+}
+
+/* 
+ * locate an empty backtrace cell
+ * get next available cell, curt is the last used +1 
+ * update top position, if necessary.  -- and gv-> last _beam_cell and the curbeat.next are all updated
+ */
+static unsigned short next_beam_cell(gmhmm_type *gv)
+{
+  unsigned short i, N = gv->evalstat.beam.high_pos;
+  short found = 0;
+  BeamType *beam, *beam_base = gv->beam_base;
+//printf("========frame %d beam cell %d  %d \n", gv->frm_cnt,  gv->evalstat.beam.cur_pos,  gv->evalstat.beam.high_pos);
+
+  for (i = gv->evalstat.beam.cur_pos, beam = beam_base + i; i < N; i++, beam++) /*from current to high limit, look for empty one*/
+    if (CELLEMPTY(beam->idx_flag)) { found = TRUE;  break; }  //check a flag to see cell empty, or get a new one later
+
+  GET_NEW_CELL(found,i, gv->evalstat.beam, gv->max_beam_cell);
+  if (gv->last_beam_cell != UNDEF_CELL) beam_base[gv->last_beam_cell].next = i; /*the link of the current is initialized here*/
+  gv->last_beam_cell = i;
+  return i;  
+}
+
+/*
+** return next available time cell
+*/
+
+static unsigned short next_time_cell(gmhmm_type *gv)
+{
+  unsigned short i;
+  short found = FALSE;
+  TimeType *time = gv->time_base;
+
+  for (i = gv->evalstat.time.cur_pos; i < gv->evalstat.time.high_pos; i++)
+    if (time[i].beam_idx == USHRT_MAX) { found = TRUE; break; }
+  GET_NEW_CELL(found,i, gv->evalstat.time, gv->max_time_cell);
+  return i;  
+}
+
+/* ---------------------------------------------------------------------------
+   find the beam cell with the specified sym and time
+   ---------------------------------------------------------------------- */
+
+/*
+** use chained symbol list.
+*/
+static unsigned short find_beam_index(unsigned short sym, unsigned short frm, gmhmm_type *gv,
+                              unsigned short last_frm)
+{
+  BeamType *bm, *beam = gv->beam_base;
+  TimeType *time_base = gv->time_base;
+  short time;
+  unsigned short  idx; //frm_diff = last_frm - frm,
+  
+//only if last frame has done mark_cell_state, the cache can be used. removed it from the old code. 
+//  if (frm_diff < NN) time = gv->time_table_idx[frm_diff]; /* it must be in, bcs it's back trace */
+//  else 
+  MATCH_TIME(time, time_base, frm);
+
+  /*from the beam at the old time (before the start of this sym, search for the beam differ from this sym*/
+  for (idx = time_base[time].beam_idx, bm = beam + idx; bm->sym != sym; idx = bm->next, bm = beam + idx);
+  return idx;
+}
+
+/* ---------------------------------------------------------------------------
+   grow the backtrace tree by one backtrace cell
+ ---------------------------------------------------------------------------*/
+
+static short
+grow_beam_cell(unsigned short sym, StateCell *p_cell, short first_time, unsigned short frm_cnt, 
+              gmhmm_type *gv, unsigned short last_frm)
+{
+  unsigned short idx;
+
+  idx = next_beam_cell(gv); /*get a new beam cell*/
+//if (gv->frm_cnt>0 )printf("===================now,word %d \n", sym);
+  if ( idx == USHRT_MAX ) 
+    return eTIesrEngineBeamCellOverflow;
+
+  gv->beam_base[idx].sym = sym; /* symcode of this cell */
+
+  /* previous frame sym, starting frame, last frame*/
+  
+  gv->beam_base[idx].idx_flag = (p_cell->sym == USHRT_MAX)?  gv->max_beam_cell  //zlook
+          : find_beam_index(p_cell->sym, p_cell->frm, gv, last_frm);  //previous stats' symble and starting frame.
+
+
+#ifdef _MONOPHONE_NET
+  PRT_ERR
+    (printf("grow beam: idx %d, sym %d, time %d, trace %d\n", idx, 
+        sym, frm_cnt, gv->beam_base[idx].idx_flag));
+#endif
+
+  if (first_time) {
+       
+    gv->beam_count=0;
+    gv->next_time = next_time_cell(gv);
+    if (gv->next_time == USHRT_MAX) 
+      return eTIesrEngineTimeCellOverflow;
+    gv->time_base[gv->next_time].frm = frm_cnt;
+    gv->time_base[gv->next_time].beam_idx = idx; /* this was changed from address to index */
+  }
+
+  return eTIesrEngineSuccess;
+}
+
+/* ---------------------------------------------------------------------------
+   compute Gaussian mixture score
+   ---------------------------------------------------------------------- */
+
+/* experimental methods */
+
+//short logcorrect(short logdiff)
+//{   short   correcttable[7]={44, 30, 20, 13, 8, 5, 3}; /* 0.69 0.47 0.32 0.2 0.13 0.08 0.05.. for 0 , 0.5, 1, 1.5, 2, 2.5.. -log(b/a) vis log(1+b/a) curve */
+//    //    short   correcttable[7]={37, 26, 16, 11, 6, 3, 1}; /* 0.58 0.4 0.25 0.17 0.1 0.05.. for 0 , 0.5, 1, 1.5, 2, 2.5.. -log(b/a) vis log(1+b/a) curve */
+//     logdiff>>=5;  logdiff=logdiff>6?6:logdiff; /*Q1*/
+//     return correcttable[logdiff];
+//}
+
+
+
+TIESRENGINECOREAPI_API short
+gauss_obs_score_f(short *feature, int pdf_idx, gmhmm_type *gv)
+{
+  short i, k;
+  long  scr;
+  short total_scr, nbr_dim = gv->nbr_dim;
+  short n_mix;
+  short *p2wgt;
+  short *mixture;
+#ifndef BIT8MEAN
+  short j;
+  long  diff;
+  short *mu, *invvar, gconst, *feat;
+  short diff_s;
+#endif
+
+  total_scr = BAD_SCR;
+
+  mixture = GET_MIX(gv,pdf_idx);
+  
+  n_mix = MIX_SIZE(mixture);
+  p2wgt = mixture + 1;
+
+  for (i = 0; i < n_mix; i++) {      /* n mixtures */
+    k = mixture[i*3 + 2]; 
+    if (gv->gauss_scr[ k ] == LZERO )
+      {
+   
+#ifndef BIT8MEAN
+       mu = get_mean(gv->base_mu, mixture, nbr_dim, i);   
+       invvar = get_var(gv->base_var, mixture, nbr_dim, i);
+       gconst = gv->base_gconst[ mixture[ i * 3 + 3 ] ];
+       feat = feature;
+            
+       GAUSSIAN_DIST(gv, scr, feat, j, nbr_dim, diff, diff_s, gconst, mu, invvar);
+#else
+       GAUSSIAN_DIST(gv, scr, nbr_dim, mixture, i, feature);
+#endif
+
+       gv->gauss_scr[ k ] = LONG2SHORT(scr); 
+
+      }
+    else
+      {
+       scr=(long) gv->gauss_scr[ k ] ;
+      }         
+
+    scr += p2wgt[ i * 3 ];         /* mixture weight */
+   
+    if ( scr > (long) total_scr ) total_scr = LONG2SHORT(scr);
+    
+  }
+
+  return total_scr;
+}
+
+static Boolean search_if_comes_to_the_end_of_net(short t_sym, gmhmm_type *gv)
+{
+  Boolean bFound = gv->sr_is_end_of_grammar;
+
+  if ((t_sym <= gv->sr_MAX_END_SYM )&& (t_sym >= gv->sr_MIN_END_SYM) 
+      && gv->frm_cnt >= TH_END_GRAMMAR_MIN_END_FRM )
+    {
+      bFound = TRUE; 
+      gv->sr_is_end_of_grammar = bFound; 
+    }
+
+  return bFound; 
+}
+
+static void init_search_last_syms( gmhmm_type * gv)
+{
+  short i, t_symcode; 
+  SymType * endsym;
+  /* expand all fanout after start node (of the top level grammar) */
+  endsym = (SymType *) ( gv->base_net + gv->trans->stop );
+  gv->sr_MAX_END_SYM = 0;
+  gv->sr_MIN_END_SYM = 32767; 
+  gv->sr_is_end_of_grammar = FALSE; 
+  for (i = 0, t_symcode = endsym->next[ i ]; 
+        i < GET_N_NEXT(endsym->n_next); 
+        i++, t_symcode = endsym->next[ i ]) {  
+    gv->sr_MAX_END_SYM = MAX(gv->sr_MAX_END_SYM, t_symcode);
+    gv->sr_MIN_END_SYM = MIN(gv->sr_MIN_END_SYM, t_symcode);
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   search expansion within HMM
+   ---------------------------------------------------------------------- */
+
+static void
+within_model_path(HmmType *hmm,  StateCell *p_prev,  StateCell *p_cur, gmhmm_type *gv, short prune)
+{
+  long       cur_prob;
+  short      *trnprob;
+  short      i, j;
+  StateCell  *state_cell, *pprev;
+  short      n_state, n1;
+
+  n_state = NBR_STATES(hmm,gv->base_tran);
+  trnprob = gv->base_tran + hmm->tran + n_state;
+  n1 = n_state - 1;
+  pprev = p_prev;
+  for (i = 0; i < n1; i++, trnprob += n_state, pprev++) {  /*for all states in the HMM*/
+
+    if ( pprev->scr > prune ) {  /*if a possible start -- within model prune*/
+      
+      for (j = 0; j < n1; j++) {   /*for all target states within model*/
+
+       if ( trnprob[j] > BAD_SCR ) {          /* there exist i to j jump. note transprob is updated above with i */
+
+         state_cell = p_cur + j;
+         cur_prob = (long) pprev->scr + (long) trnprob[j];
+         
+         if ( cur_prob > (long) state_cell->scr ) {  //viterbi on transition prob.
+           state_cell->scr = (short) cur_prob; 
+           state_cell->sym = pprev->sym;   /* propogate prev sym & frm */
+           state_cell->frm = pprev->frm;  /*starting time, B*/
+         }
+       }
+      }
+    }
+  }
+} 
+
+/* ---------------------------------------------------------------------------
+   do the within and cross model transition
+   ---------------------------------------------------------------------- */
+
+#define SET_NEXT_SYM(sym_cell,ps,direction, nbr) {sym_cell = ps; if ( --(nbr) ) ps += direction; else ps = NULL; }
+
+#define SET_SYM_CELL(ps0,ps1,sym_cell,nbr0,nbr1,direction, expr) \
+    if (!ps0) SET_NEXT_SYM(sym_cell,ps1,direction, nbr1) \
+      else if (!ps1) SET_NEXT_SYM(sym_cell,ps0,direction, nbr0) \
+           else if (expr) SET_NEXT_SYM(sym_cell,ps0,direction, nbr0) \
+                else SET_NEXT_SYM(sym_cell,ps1,direction, nbr1)
+/*update path from t to t+1*/
+
+static short 
+cross_model_path(short exit_scr, unsigned short v_sym, unsigned short t_sym, 
+                unsigned short hmm_dlt, unsigned short sym_dlt, short cur_idx, 
+                unsigned short frm_cnt, gmhmm_type *gv, short depth, 
+                unsigned short starttime )
+{
+  unsigned short i, symcode, hmmcode, n_state, nbr_next;
+  SymType        *prev_sym, *psym;
+  HmmType        *hmm;
+  StateCell      *start_cell;
+  long           start_scr;
+  short          *startprob, *endprob;
+  EvalIdx *eval_idx = gv->eval + cur_idx;
+  prev_sym = (SymType *) ( gv->base_net + gv->trans->symlist[ t_sym ] );
+#ifdef USE_NBEST
+  ushort uBeamIdx, cSym; 
+  bIsWord = is_word_sym(prev_sym);
+#endif
+  
+  
+  /*number for next possible symbols*/
+  nbr_next = GET_N_NEXT(prev_sym->n_next);
+//printf("000 sym: %d , n next %d\n", t_sym, nbr_next);  
+  
+  for (i = 0; i < nbr_next; i++) {  /*for all posible next symbols*/
+    symcode = prev_sym->next[ i ];  /*pick one on the next-list*/
+    
+    // get next symble
+       
+    psym = (SymType *) ( gv->base_net + gv->trans->symlist[ symcode ] );
+    hmmcode = psym->hmm_code;
+    hmm = GET_HMM(gv->base_hmms, hmmcode, hmm_dlt);   //using hmm_dlt to ensure the same gender
+
+    n_state = NBR_STATES(hmm,gv->base_tran);
+    /* start state cell may already exist, bcs it may have two predecessors and one already allocated: */
+    start_cell = find_state_cell(eval_idx, cur_idx, VTL_SYM(symcode, sym_dlt), n_state, gv);
+
+    /*alocate sym and state cells for this new sym -- using sym_dlt to ensure sym of the same gender */
+    if ( ! start_cell ) 
+    {
+      start_cell = allocate_eval_cell(eval_idx, VTL_SYM(symcode, sym_dlt), n_state, cur_idx,gv,depth+1);  //last 1: grow
+
+    }
+    if ( ! start_cell ) 
+      return eTIesrEngineEvalCellOverflow;
+
+
+    startprob = GET_PI(hmm, gv->base_tran);
+    endprob = startprob + n_state - 1;
+
+#ifdef USE_NBEST
+    uBeamIdx = UNDEF_CELL;
+#endif
+    for (; startprob < endprob; startprob++, start_cell++) { /* itr through initial probs */
+
+      if ( *startprob > BAD_SCR ) {  //if it can be a initial state
+
+       start_scr = (long) exit_scr + (long) *startprob;
+#ifdef USE_NBEST
+       if (bIsWord && gv->bUseNBest ){
+         /* obtain the nbest index for the current symbol at the time */
+         cSym =  VTL_SYM(symcode, sym_dlt);
+         if (uBeamIdx == UNDEF_CELL || 
+             uBeamIdx == gv->max_nb_beam_cell) 
+           uBeamIdx = nb_find_nbest_index(cSym, frm_cnt - 1, gv); 
+         
+         nb_update_nbest(gv->ptr_nbest_tmp->pNBestCells, uBeamIdx, start_cell, v_sym, cSym,  
+                         frm_cnt - 1, start_scr, 
+                         start_scr >= (long) start_cell->scr, gv); 
+       }
+#endif
+       if ( start_scr >= (long) start_cell->scr ) { 
+         /* Viterbi, for the winner,
+            remember the frame index and the symbol where we are from */
+         start_cell->scr = (short) start_scr;
+         start_cell->frm = starttime; //frm_cnt - 1;  // this is true for HMM backtrace. not word based backtrace.
+         start_cell->sym = v_sym;  // word sym
+
+
+       }
+#ifdef USE_NBEST
+       if (gv->bUseNBest) nb_uniq_nbest(gv->ptr_nbest_tmp->pNBestCells, uBeamIdx, start_cell, gv); 
+#endif
+      }
+    }
+  }
+
+    
+  return eTIesrEngineSuccess;
+}
+
+static short
+path_propagation(short cur_idx, short prev_idx, unsigned short frm_cnt, gmhmm_type *gv, short prune)
+{
+   unsigned short v_sym, t_sym, hmmcode, sym_dlt, hmm_dlt;
+   SymCell        *sym_prev, *ps0 = NULL, *ps1 = NULL;
+   HmmType        *hmm;
+   short          exit_prob,    status, n_state;
+   StateCell      *p_prev, *p_cur;
+   SymType        *psym;
+   unsigned short *nbr_sym =  gv->eval[ prev_idx ].cur_sym;   /*set current sym.. and call it nbr_sym*/
+   EvalIdx *eval_idx = gv->eval + cur_idx;
+   /* loop through all previous sym cells in the list*/
+   short direction = cur_idx ? 1 : -1;
+  
+   /*pointers from top or bottom of the sym space, */
+   if (nbr_sym[0]) ps0 = SYM_CELL(gv->symcell_base, nbr_sym[0] - 1, prev_idx, gv->max_sym_cell2);
+   if (nbr_sym[1]) ps1 = SYM_CELL(gv->symcell_base + gv->max_sym_cell2, nbr_sym[1] - 1, prev_idx,gv->max_sym_cell2 );
+#ifdef DBG_SEARCH
+   printf("sym number %d===========\n" ,nbr_sym[0]+nbr_sym[1]);
+   global_active_sym=0;
+#endif
+   
+   if ((!ps0) && (!ps1)) {
+     return eTIesrEngineAlignmentFail; 
+   }
+
+
+   while (ps0 || ps1) { 
+
+     /*
+       --------- search through all symbol cells --------
+       give value to sym_prev = ps0 or ps1, and [move] one of ps0 and ps1 by 1 or -1, based on the direction 
+       NOTE, but the gv->eval[ prev_idx ].cur_sym, and the PS? will be changed: -1 and next*/
+     SET_SYM_CELL(ps0,ps1,sym_prev,nbr_sym[0],nbr_sym[1],direction, ps0->start_cell > ps1->start_cell); 
+     /*for the chosen direction: give the ps? to sym_prev, and move the ps*/
+     if ( !( sym_prev->sym_code & 0x8000 ) ) {   /* active */
+#ifdef DBG_SEARCH
+       global_active_sym++;
+#endif
+       v_sym = sym_prev->sym_code;  
+
+      /* lope only max 2 times. Move pointers (t_sym stuff)  relative to 'lower gender', 
+      a  translater from gender dependent symcode to gender indep symtype code in GRAMAR NETWORK*/
+       for (hmm_dlt = 0, sym_dlt = 0, t_sym = v_sym; t_sym >= gv->trans->n_sym;
+           t_sym  -= gv->trans->n_sym,  hmm_dlt  += gv->trans->n_hmm_set, sym_dlt  += gv->trans->n_sym) ;
+           
+
+       psym = (SymType *) ( gv->base_net + gv->trans->symlist[ t_sym ] );
+       hmmcode = psym->hmm_code;
+       hmm = GET_HMM(gv->base_hmms, hmmcode, hmm_dlt);
+       
+       
+
+       n_state = NBR_STATES(hmm,gv->base_tran);
+       /* ------- ABOVE: it find hmm from gender-dependant symble, to gender indep sym in network and find the HMM.. and number of state. a lot of work! */
+
+
+       /*space from top or bottom, n_state is only used in higher memory part.*/
+       p_prev = STATE_CELL(gv->statecell_base, sym_prev->start_cell, n_state, prev_idx, gv->max_state_cell);
+   
+       /*find state cell of v_sym from space upto eval_idx->current_sym. (it may exist in previous idx,but not cur idx). */
+       //Note: p_prev is from the old space, and p_cur is for th new space -- it may be there or not. If not, make new.
+       //can be made faster: at first, all the search will sure fail.
+       p_cur = find_state_cell(eval_idx, cur_idx, v_sym, n_state, gv); 
+
+//p_cur=NULL;
+       
+       /*now we get the start state_cell for this frame and last frame */
+       
+       /*      if now entering a new sym, alocate mem for sym and state cells*/
+       if ( ! p_cur ) {
+               /*these syms are just from last frame*/
+               
+        
+               p_cur = allocate_eval_cell(eval_idx, v_sym, n_state, cur_idx, gv,sym_prev->depth);
+       }
+        
+
+       if ( p_cur == NULL ){
+        return eTIesrEngineEvalCellOverflow;
+       }
+
+       /*label all the within model path, if score is OK, prune is OK, */
+       within_model_path(hmm, p_prev, p_cur, gv, prune); /*hmm, last state cell, new allocated state cell, ...*/
+        
+       exit_prob = p_prev[ n_state - 1 ].scr;
+
+#ifdef  DYNAMIC_PRUNE
+       if ( exit_prob > prune + SYMEND_PRUNE_DELTA +WORDEND_PRUNE_DELTA ) { //cross symbol prune , +400 (check word end)
+#else
+       if ( exit_prob > prune ) {
+#endif  
+        /* exit of current HMM, connecting to next HMM */
+
+        // if also word transition, gives the new ending word  to v_sym, otherwise, uses the old one 
+// old:          status = cross_model_path(exit_prob + gv->tranwgt, v_sym, t_sym, hmm_dlt, sym_dlt, cur_idx, frm_cnt,gv, sym_prev->depth);
+       
+        unsigned short starttime;
+
+       if (gv->word_backtrace==WORDBT){ 
+
+        if (psym->n_next & 0x8000)  
+        {
+
+         // unsigned short word_sym = gv->trans->symlist[ t_sym ]; //psym = (SymType *) ( gv->base_net + gv->trans->symlist[ t_sym ] );psym->next[GET_N_NEXT(psym->n_next)];//zx
+           starttime= frm_cnt - 1;  //time of start of new word. 
+         //status = cross_model_path(exit_prob + gv->tranwgt, word_sym, t_sym, hmm_dlt, sym_dlt, cur_idx, frm_cnt,gv, sym_prev->depth, starttime);
+         status = cross_model_path  (exit_prob + gv->tranwgt, v_sym,    t_sym, hmm_dlt, sym_dlt, cur_idx, frm_cnt,gv, sym_prev->depth, starttime);
+
+        }
+        else     // p_prev->sym will be the word info of last sym
+        { starttime = p_prev[ n_state - 1 ].frm;
+          status = cross_model_path(exit_prob + gv->tranwgt, p_prev[n_state -1].sym, t_sym, hmm_dlt, sym_dlt, cur_idx, frm_cnt,gv, sym_prev->depth,starttime);
+        
+         if ( status != eTIesrEngineSuccess )  
+           return status;
+        }
+        
+       }
+       else //hmm based BT
+       {
+          status = cross_model_path(exit_prob + gv->tranwgt, v_sym, t_sym, hmm_dlt, sym_dlt, cur_idx, frm_cnt,gv, sym_prev->depth, frm_cnt-1);
+       }
+        
+        
+        if ( status != eTIesrEngineSuccess )  
+          return status;
+
+        search_if_comes_to_the_end_of_net(t_sym, gv);
+
+       }
+       
+     }//end of active loop
+     gv->eval[ prev_idx ].cur_state = sym_prev->start_cell;   /* (keep curt lower level). change the state_indx for a new sym in the loop */
+
+   }  //end of while loop
+
+#ifdef DBG_SEARCH
+     printf("active syms = %d\n", global_active_sym);
+#endif
+
+   if ( gv->eval[ prev_idx ].cur_state != 0 ) {  // needed?
+     return eTIesrEngineAlignmentFail;
+   }
+   
+#ifdef DBG_HMM
+   printf("--------active sym %d , total HMM: %d  , %d \n", global_active_sym,  gv->trans->n_hmm, gv->trans->stop);
+#endif
+
+   return eTIesrEngineSuccess;
+}
+
+/* ---------------------------------------------------------------------------
+   add obs score 
+   ---------------------------------------------------------------------- */
+static short
+  update_obs_prob(short mfcc_feature[], short cur_idx, unsigned short frm_cnt, gmhmm_type *gv, unsigned short last_frm)
+{
+  unsigned short t_symcode, v_symcode, hmmcode, j, pdf_idx, hmm_dlt, n1;
+  unsigned short nbr0, nbr1;  
+  SymCell        *sym_cell;
+  SymType *psym;
+  SymCell *ps0 = NULL, *ps1 = NULL;  
+  HmmType        *hmm;
+
+  short          gs,  sym_active, direction, status, n_state, *trnprob, max_exit_scr, first_time_call = TRUE, *sObs = NULL;
+
+#ifdef USE_GAUSS_SELECT
+  short iargmix;
+#endif
+
+  long           scr;
+  StateCell      *max_exit_state = NULL, *state_cell, *start_cell;
+  unsigned short last_SYM = USHRT_MAX, last_FRM = USHRT_MAX;
+  unsigned short bestdepth = 0, n_actsym=0,sumdepth=0, maxdepth=0;
+  
+#ifdef SHOW_DIAGONISIS
+  if (sttnode!=3) sttnode=0;
+#endif
+
+#ifdef USE_CONFIDENCE
+  short *p_scr_anti, *pScrAnti = cm_antiscr((ConfType*)gv->pConf, frm_cnt); 
+  short     /* for cache */
+    cm_prev_scr = LZERO; 
+  if (((ConfType*)gv->pConf)->bNeedUpdate == FALSE) 
+    pScrAnti = NULL; 
+#endif
+
+  direction = cur_idx ? 1 : -1;
+  
+  gv->next_time = USHRT_MAX;
+
+  nbr0 = gv->eval[ cur_idx ].cur_sym[0];
+  nbr1 = gv->eval[ cur_idx ].cur_sym[1];
+
+  gv->ending_sym_count =0;
+
+  
+  if (nbr0) ps0 = SYM_CELL(gv->symcell_base, 0, cur_idx, gv->max_sym_cell2);
+  if (nbr1) ps1 = SYM_CELL(gv->symcell_base+ gv->max_sym_cell2, 0, cur_idx, gv->max_sym_cell2);
+  
+  
+
+  while ( ps0 || ps1 ) {  /*loop through all previous (later check active) syms   --- Loop1*/
+      SET_SYM_CELL(ps0,ps1,sym_cell,nbr0,nbr1,direction,ps0->start_cell < ps1->start_cell); 
+      v_symcode = sym_cell->sym_code; 
+      
+      for ( hmm_dlt = 0, t_symcode = v_symcode; t_symcode  >= gv->trans->n_sym; 
+           t_symcode -=  gv->trans->n_sym, hmm_dlt +=  gv->trans->n_hmm_set); 
+      psym = (SymType *) ( gv->base_net + gv->trans->symlist[ t_symcode ] );
+      
+
+      hmmcode = psym->hmm_code;
+
+#ifdef SHOW_DIAGONISIS
+      if (sttnode!=3)
+       if ( hmmcode==0 && sym_cell->depth <2 ) sttnode=1; 
+#endif
+
+      hmm = GET_HMM(gv->base_hmms, hmmcode, hmm_dlt);
+      
+#ifdef USE_SBC
+      if (gv->comp_type & SBC) 
+       /* notice that only true symbol therefore the smaller hmmcode is used */
+       sObs = sbc_enhance( gv->sbcState, mfcc_feature, 
+                           hmmcode, gv->nbr_dim, NULL );
+#endif 
+      n_state = NBR_STATES(hmm,gv->base_tran);
+      
+      start_cell = STATE_CELL(gv->statecell_base, sym_cell->start_cell, n_state, cur_idx, gv->max_state_cell);
+
+      sym_active = 0;
+    
+      max_exit_scr = BAD_SCR;
+    
+      n1 =  n_state - 1;
+      trnprob = gv->base_tran + hmm->tran + n_state + n1;      
+
+      for (state_cell = start_cell, j = 0; j < n1; state_cell++, j++, trnprob += n_state) {  /* for all emit state */
+      
+#ifdef DYNAMIC_PRUNE_DEPTH
+// #ifdef DYNAMIC_PRUNE
+       if ( state_cell->scr > BAD_SCR  && 
+            ( frm_cnt < 6 || ( sym_cell->depth + (sym_cell->depth >> 1) < frm_cnt ) ) )          
+#else
+       if ( state_cell->scr > BAD_SCR )
+#endif
+       {
+         /* a sym is active if any of the state is active */
+         sym_active = 1;
+       
+         pdf_idx = hmm->pdf_idx[ j ];
+#ifdef USE_GAUSS_SELECT
+         if (gv->word_backtrace==HMMFA)  //somehow the G_selection has error on the second pass
+         gs = 
+           gauss_obs_score_f(sObs?sObs:mfcc_feature, pdf_idx, gv); 
+        else
+         gs = 
+           rj_gauss_obs_score_f(sObs?sObs:mfcc_feature, pdf_idx, gv, NULL, &iargmix);
+           
+//printf("=== gs %d, code: %d, pdf %d feat: %d %d %d\n", gs, v_symcode, pdf_idx, sObs[0], sObs[1], sObs[18]);     
+#else
+         gs = 
+           gauss_obs_score_f(sObs?sObs:mfcc_feature, pdf_idx, gv); 
+#endif   
+        
+
+#ifdef USE_CONFIDENCE
+         if ((gs > cm_prev_scr) && (pScrAnti != NULL)){
+           p_scr_anti =  pScrAnti; 
+
+           if (p_scr_anti){
+             *p_scr_anti = gs; 
+           }
+           
+           cm_prev_scr = gs; 
+         }
+#endif
+
+        scr = (long) state_cell->scr + (long) gs; //gauss_obs_score_f(sObs?sObs:mfcc_feature, pdf_idx, gv); 
+
+          
+       //if (sym_cell->depth *1.5  - gv->frm_cnt>0) scr-= 500;  // soft prune
+       //if ( sym_cell->depth > (gv->bestdepth +9) || sym_cell->depth < (gv->bestdepth -10)  ) scr-=500;
+         scr -= (long) gv->best_prev_scr;
+
+         if ( scr < BAD_SCR ) state_cell->scr = BAD_SCR;
+         else {
+           state_cell->scr = (short) scr;
+           /* coloring pending states (including exit states):
+            * mark active beam cells for active pending states
+            */
+           if (state_cell->frm != USHRT_MAX) 
+             if ((state_cell->frm != last_FRM) || (state_cell->sym != last_SYM)) {  //if it is from a new search node (frame/sym pair)
+               /*pass best frame/sym to this state so far*/
+               if (gv->need_compact==TRUE ) //|| gv->word_backtrace==FALSE) //if (gv->evalstat.beam.cur_pos > 1000)   //if (gv->frm_cnt==14)
+                 {   
+                       mark_cells_state(state_cell->frm, state_cell->sym, gv, last_frm);   
+                 }   
+               last_FRM = state_cell->frm; last_SYM = state_cell->sym; 
+             }
+         }
+
+         if ( scr > (long) gv->best_cur_scr ) 
+           {
+             gv->best_cur_scr = (short) scr;
+//if (frm_cnt<9) printf ("=========curbest %d\n",gv->best_cur_scr);
+             bestdepth= sym_cell->depth  ;
+           }
+
+#ifdef MODEL_LEVEL_PRUNE
+         mlp_update(gv, hmmcode , scr);
+#endif
+       
+         if ( *trnprob > BAD_SCR ) {  /* exit? */
+
+           scr = (long) state_cell->scr  +  (long) *trnprob;
+         
+           if ( scr > (long) max_exit_scr) { 
+             max_exit_scr = (short) scr;
+             max_exit_state = state_cell;
+           }   
+         }
+       }
+      }  /* end for all emit states */
+
+      if ( ! sym_active )      sym_cell->sym_code |= 0x8000;      /* inactive, prune the sym */
+      else { /* exit state */
+       sumdepth+=sym_cell->depth;  n_actsym++;      
+        maxdepth=sym_cell->depth> maxdepth?sym_cell->depth: maxdepth;
+            
+       if ( max_exit_scr > BAD_SCR ) {
+         state_cell->scr = max_exit_scr;
+         state_cell->sym = max_exit_state->sym;
+         state_cell->frm = max_exit_state->frm;
+       
+         /*if end of sym, put it in the beam cell list*/
+         // word end label, grow beam cell
+         gv->ending_sym_count ++;
+         if (psym->n_next & 0x8000 || gv->word_backtrace!=WORDBT )
+         {
+           status = grow_beam_cell( v_symcode, state_cell, first_time_call, frm_cnt, gv, last_frm);
+           
+           if ( status != eTIesrEngineSuccess ) 
+             return status;
+           first_time_call = FALSE;
+          }
+         
+
+         
+         if ( (long) state_cell->scr > gv->best_sym_scr ) {    /*best_sym_scr update for the last frame*/
+           gv->best_sym_scr = (long) state_cell->scr; 
+           gv->best_sym = v_symcode; 
+         }
+       } else  state_cell->scr = BAD_SCR;       /* active sym, but not complete yet */
+      }
+  }
+
+#ifdef SHOW_DIAGONISIS
+    if (sttnode==0 && frm_cnt>1) 
+      {/*printf("  %d frame, sttnode exist\n", frm_cnt);*/ sttnode=3;
+      }
+#endif
+
+    //gv->avedepth=sumdepth/n_actsym; 
+    gv->bestdepth=bestdepth;
+    
+    //lable the end (was in compact beam)
+    if (gv->last_beam_cell != UNDEF_CELL) gv->beam_base[gv->last_beam_cell].next =  gv->max_beam_cell;
+    
+#ifdef DEBUGP
+    printf("total sym: %d, active %d , BEST DEPTH: %d, ave depth: %f , max depth %d\n ", ccc, n_actsym, gv->bestdepth, sumdepth*1.0/n_actsym , maxdepth);
+#endif
+
+
+  return eTIesrEngineSuccess;
+}
+
+/* ---------------------------------------------------------------------------
+   init search
+   ---------------------------------------------------------------------- */
+
+static short
+init_search(short mfcc_feature[], short cur_idx, gmhmm_type *gv, unsigned short last_frm)
+{
+  unsigned short t_symcode, hmmcode, exit_state, sym_dlt, hmm_dlt;
+  HmmType        *hmm;
+  short          i, j;
+  StateCell      *state_cell;  
+  short          gs, max_exit_scr, *p_enh = NULL;
+  long           scr;
+  SymType        *psym, *startsym;
+  short          status, n_state, pdf_idx, *startprob, *trnprob, first_time_call = TRUE;
+  EvalIdx  *eval_idx = gv->eval+cur_idx;
+
+  
+#ifdef SHOW_DIAGONISIS
+  sttnode=0;
+  global_count=0;
+#endif
+
+#ifdef DBG_SEARCH
+  max_glb_active_sym= 0;
+#endif
+
+  gv->ending_sym_count =0;
+  gv->bestdepth=0;
+
+  /* expand all fanout after start node (of the top level grammar) */
+  startsym = (SymType *) ( gv->base_net + gv->trans->start );
+
+  gv->beam_count=0;//useless
+  for (hmm_dlt = 0, sym_dlt = 0; hmm_dlt < gv->trans->n_hmm; hmm_dlt += gv->trans->n_hmm_set, sym_dlt+= gv->trans->n_sym)   { /*e.g.: for two genders. */
+  //printf("init===gender %d... nhmm %d   hmset %d \n", hmm_dlt, gv->trans->n_hmm, gv->trans->n_hmm_set );
+    
+    //skip gender for FA. 
+    if (gv->word_backtrace==HMMFA &&  hmm_dlt!= gv->best_word_gender  ){ continue; }
+     
+    for (i = 0, t_symcode = startsym->next[ i ]; 
+        i < GET_N_NEXT(startsym->n_next); 
+        i++, t_symcode = startsym->next[ i ]) {  /*for all the current active hypothesis (symbols) */
+
+      max_exit_scr = BAD_SCR;
+
+      psym = (SymType *) ( gv->base_net + gv->trans->symlist[ t_symcode ] ); /*take one posible symbol*/
+      hmmcode = psym->hmm_code;
+      hmm = GET_HMM(gv->base_hmms, hmmcode, hmm_dlt); /*using hmm name, gender info, and the base to get the offset for the HMM. */
+
+#ifdef USE_SBC
+      if (gv->comp_type & SBC) 
+       p_enh = sbc_enhance( gv->sbcState, mfcc_feature, 
+                            hmmcode, gv->nbr_dim, NULL);
+#endif
+
+
+      n_state = NBR_STATES(hmm, gv->base_tran);
+      exit_state = n_state - 1;
+      startprob = GET_PI(hmm,gv->base_tran);
+      trnprob = gv->base_tran + hmm->tran + n_state;
+
+      state_cell = allocate_eval_cell(eval_idx, VTL_SYM(t_symcode,sym_dlt), n_state, cur_idx, gv,0);
+    
+      if ( state_cell == NULL ) {
+       return eTIesrEngineEvalCellOverflow;
+      }
+
+      for (j = 0; j < n_state - 1; j++) {          /* for all emit states . */
+
+       if ( startprob[ j ] > BAD_SCR ) {          /* locate inititial stateS */
+
+         pdf_idx = hmm->pdf_idx[ j ];
+
+       /*  if (gv->obs_scr[ pdf_idx ] == 0 )  // a cache in computing. 
+           gv->obs_scr[ pdf_idx ] = 
+             gauss_obs_score_f(p_enh?p_enh:mfcc_feature, pdf_idx, gv);
+
+         scr = (long) startprob[ j ] + (long) gv->obs_scr[ pdf_idx ];
+       */
+         gs=gauss_obs_score_f(p_enh?p_enh:mfcc_feature, pdf_idx, gv);
+
+         scr = (long) startprob[ j ] + (long) gs; //gauss_obs_score_f(p_enh?p_enh:mfcc_feature, pdf_idx, gv);
+
+         if ( scr < BAD_SCR ) state_cell[ j ].scr = BAD_SCR;
+         else state_cell[ j ].scr = (short) scr;
+
+         if ( scr > (long) gv->best_cur_scr ) 
+           {
+           gv->best_cur_scr = (short) scr;  /*first frame only*/
+           
+           }
+
+#ifdef MODEL_LEVEL_PRUNE
+         mlp_update(gv, hmmcode , scr);
+#endif
+
+         if ( trnprob[ j * n_state + exit_state ] > BAD_SCR ) {
+           scr = (long) state_cell[ j ].scr + 
+             (long) trnprob[ j * n_state + exit_state ];
+
+           if ( scr > (long) max_exit_scr )
+             max_exit_scr = (short) scr;   /*track the best score to exit the sym*/
+         }
+       }
+       state_cell[ j ].frm = USHRT_MAX;     /*the 4 lines below say : there is no prior sym and frame*/
+       state_cell[ j ].sym = USHRT_MAX;
+      } /* end of all emiting states */
+
+      state_cell[ exit_state ].frm = USHRT_MAX; 
+      state_cell[ exit_state ].sym = USHRT_MAX;
+
+      /* HMM (sym) completed, create a backtrace cell */
+
+      if ( max_exit_scr > BAD_SCR ) {   /* if can be end of symbol, but sure not for first frame. so why here ? */
+       state_cell[ exit_state ].scr = max_exit_scr;
+       
+       
+       
+       //status = grow_beam_cell(VTL_SYM(t_symcode, sym_dlt), state_cell + exit_state, first_time_call, 0, 
+       //                      gv, last_frm);
+       gv->ending_sym_count ++;
+       if (psym->n_next & 0x8000 || gv->word_backtrace!=WORDBT)  //never should happen in word bt
+         {
+                  status = grow_beam_cell(VTL_SYM(t_symcode, sym_dlt), state_cell + exit_state, first_time_call, 0, 
+                               gv, last_frm);
+                  first_time_call = FALSE;   //first time to call beam cell stuff -- for this frame!
+            gv->beam_count++;
+            if ( status != eTIesrEngineSuccess ) 
+              return status;     
+          }
+       
+       
+       
+       
+      }
+    }
+  }
+
+
+  if (gv->last_beam_cell != UNDEF_CELL) gv->beam_base[gv->last_beam_cell].next = gv->max_beam_cell;   
+#ifdef USE_NBEST
+  if (gv->bUseNBest && gv->last_nbest_cell != UNDEF_CELL) 
+    gv->nb_beam_base[gv->last_nbest_cell].next = gv->max_nb_beam_cell;   
+#endif
+
+#ifdef DEBUGP
+  PRT_ERR(printf("at first, number of beam %d \n", gv->beam_count ));
+#endif
+
+  init_search_last_syms(gv);
+  
+  return eTIesrEngineSuccess;
+
+  
+}
+
+/* ---------------------------------------------------------------------------
+   find the best score sym and its score
+   called at the end of utterance to report result
+   ---------------------------------------------------------------------- */
+/* 
+** this may be redundent, will test further when I work on PMC
+*/
+static void
+find_best_sym(short idx, gmhmm_type *gv)
+{
+  unsigned short hmmcode, symcode, hmm_dlt, sym_dlt; 
+  unsigned short i;
+  long           scr;
+  StateCell      *state_cell;
+  HmmType        *hmm;
+  SymType        *stopsym, *psym;
+  short          n_state, bsymc;
+
+  if (gv->word_backtrace==WORDBT){       
+    gv->best_word = USHRT_MAX;
+    gv->best_word_frm = USHRT_MAX; 
+    gv->best_sym = USHRT_MAX; 
+  }
+
+  stopsym = (SymType *) ( gv->base_net + gv->trans->stop );
+  for (i = 0, symcode = stopsym->next[ i ]; 
+       i < GET_N_NEXT(stopsym->n_next); 
+       i++, symcode = stopsym->next[ i ]) {      /* for all stop nodes */
+    for (hmm_dlt = 0,sym_dlt = 0; hmm_dlt <gv-> trans->n_hmm;  hmm_dlt += gv->trans->n_hmm_set, sym_dlt += gv->trans->n_sym)  
+    {
+      psym = (SymType *) ( gv->base_net + gv->trans->symlist[ symcode ] );  //get the basic HMM
+      hmmcode = psym->hmm_code;
+      hmm = GET_HMM(gv->base_hmms, hmmcode, hmm_dlt);
+
+      n_state = NBR_STATES(hmm,gv->base_tran);
+      
+      state_cell = find_state_cell(gv->eval+idx, idx, VTL_SYM(symcode, sym_dlt), n_state, gv);
+
+      if ( state_cell && state_cell[ n_state - 1 ].scr > BAD_SCR ) {
+       /* start state cell */
+
+       scr = (long) state_cell[ n_state - 1 ].scr  + (long) gv->tranwgt;
+
+       if ( gv->best_sym_scr < scr ) {  
+         gv->best_sym_scr = scr;  
+         gv->best_sym = VTL_SYM(symcode,sym_dlt);
+          
+          if (gv->word_backtrace==WORDBT){       
+           bsymc=symcode;
+           if (psym->n_next & 0x8000)   // sym is a word end   //just added sym in growbeam
+           {
+             gv->best_word= VTL_SYM(symcode, sym_dlt);   //t_sym to word       
+             gv->best_word_frm=gv->frm_cnt-1;
+           }
+           else
+           {
+            gv->best_word=state_cell[ n_state - 1 ].sym;   //1
+            gv->best_word_frm=state_cell[ n_state - 1 ].frm;      //2
+           }
+           gv->best_word_gender=hmm_dlt;
+          }
+
+       }
+      }
+    }
+  }
+  
+  if (gv->nbest.n_bests == 0) 
+    gv->nbest.n_bests = 1; 
+#ifdef DBG_HMM  
+  printf("---------best word: %d, best word starging frame: %d, bestsym%d\n", gv->best_word, gv->best_word_frm, gv->best_sym );  
+#endif
+}
+
+/* return TRUE if the input is the different from the elm
+          if FALSE, the score is kept with their maximum. */
+static Boolean nb_uniq_each(ushort *answers, short n_ans, short scr, NB_element * elm)
+{
+  short i; 
+
+  if (elm->n_ans != n_ans)
+    return TRUE; 
+  else{
+    for (i=0;i<n_ans; i++)
+      if (elm->answers[i] != answers[i]) return TRUE; 
+    elm->scr = MAX(scr, elm->scr); 
+    return FALSE; 
+  }
+}
+
+static TIesrEngineStatusType nb_uniq(ushort * answers, short n_ans, short scr, 
+                                    NB_words* nbest)
+{
+  short i; 
+  short iFound = 0; 
+  
+  for (i=0;i<nbest->n_bests;i++){
+    iFound += nb_uniq_each(answers, n_ans, scr, &nbest->elem[i]);
+  }
+
+  if (iFound == nbest->n_bests){
+    /* need to save the new hypothesis */
+    if (nbest->n_bests >= MAX_N_BESTS)
+      return eTIesrEngineNBestMem; 
+
+    nbest->elem[nbest->n_bests].scr = scr; 
+    nbest->elem[nbest->n_bests].n_ans = n_ans; 
+    for (i=0;i<n_ans; i++)
+      nbest->elem[nbest->n_bests].answers[i] = answers[i]; 
+    nbest->n_bests++; 
+  }
+  return eTIesrEngineSuccess;
+}
+
+/* use bubble sorting, assuming that each element is unique from others */
+static void nb_sort(NB_words* nbest)
+{
+  NB_element *m, *n;
+  short i, j, l, a;
+  short* best_idx = nbest->best_idx; 
+
+  j = nbest->n_bests;
+  for (i=0;i<j;i++)
+    best_idx[i] = i; 
+
+  for (j=nbest->n_bests;j>0;j--){
+    for (i=1;i<j;i++){
+      l = best_idx[i-1];
+      m = &nbest->elem[l];
+      
+      l = best_idx[i]; 
+      n = &nbest->elem[l]; 
+      if (n->scr > m->scr){
+       /* switch */
+       a = best_idx[i];
+       best_idx[i] = best_idx[i-1];
+       best_idx[i-1] = a; 
+      }
+    }
+  }
+
+}
+
+#ifdef SHOW_NBEST
+static short nb_nbr_nbests(NB_words * nbest)
+{
+  return nbest->n_bests; 
+}
+
+static ushort * nb_nbests(NB_words *nbest, short idx, short * nbr_ans)
+{
+  short i; 
+
+  if (idx >= 0 && idx < nbest->n_bests)
+    {
+      i = nbest->best_idx[idx]; 
+      *nbr_ans = nbest->elem[i].n_ans; 
+      return nbest->elem[i].answers;
+    }
+  return NULL; 
+}
+#endif
+
+/* find symbols with good scores that are close to the best symbol. 
+   the good symbols include the best symbols, from which the top best path is located.
+   if assuming tree-structured grammar, backtracing the paths of these good 
+   symbols can loate good paths, from which N-best paths can be obtained
+*/
+static TIesrEngineStatusType
+find_good_syms(short idx, gmhmm_type *gv)
+{
+  unsigned short hmmcode, symcode, hmm_dlt, sym_dlt; 
+  unsigned short i, bword, bword_frm;
+  long           scr;
+  StateCell      *state_cell;
+  HmmType        *hmm;
+  SymType        *stopsym, *psym;
+  short          n_state, bsymc;
+
+  if (gv->word_backtrace==WORDBT){       
+
+    stopsym = (SymType *) ( gv->base_net + gv->trans->stop );
+    for (i = 0, symcode = stopsym->next[ i ]; 
+        i < GET_N_NEXT(stopsym->n_next); 
+        i++, symcode = stopsym->next[ i ]) {      /* for all stop nodes */
+      for (hmm_dlt = 0,sym_dlt = 0; hmm_dlt <gv-> trans->n_hmm;  hmm_dlt += gv->trans->n_hmm_set, sym_dlt += gv->trans->n_sym)  
+       {
+         psym = (SymType *) ( gv->base_net + gv->trans->symlist[ symcode ] );  //get the basic HMM
+         hmmcode = psym->hmm_code;
+         hmm = GET_HMM(gv->base_hmms, hmmcode, hmm_dlt);
+         
+         n_state = NBR_STATES(hmm,gv->base_tran);
+         
+         state_cell = find_state_cell(gv->eval+idx, idx, VTL_SYM(symcode, sym_dlt), n_state, gv);
+         
+         if ( state_cell && state_cell[ n_state - 1 ].scr > BAD_SCR ) {
+           /* start state cell */
+           
+           scr = (long) state_cell[ n_state - 1 ].scr  + (long) gv->tranwgt;
+           
+           bsymc=symcode;
+
+           if (psym->n_next & 0x8000)   // sym is a word end   //just added sym in growbeam
+             {
+               bword = VTL_SYM(symcode, sym_dlt);   //t_sym to word    
+               bword_frm=gv->frm_cnt-1;
+             }
+           else
+             {
+               bword = state_cell[ n_state - 1 ].sym;  //1
+               bword_frm=state_cell[ n_state - 1 ].frm;      //2
+             }
+
+           back_trace_beam(bword, bword_frm, 
+                           gv->hmm_code,  gv->stt,  gv->stp, 
+                           &(gv->nbr_seg), &(gv->hmm_dlt), gv);
+           
+           nb_uniq(gv->answer, gv->nbr_ans, scr, &gv->nbest);
+         }
+       }
+    }
+
+    nb_sort(&gv->nbest);
+
+#ifdef SHOW_NBEST
+    printf("N-bests : \n");
+    for (n_state=0;n_state<nb_nbr_nbests(&gv->nbest);n_state++){
+      answers = nb_nbests(&gv->nbest, n_state, &bsymc);
+      for (k=0;k<bsymc;k++)
+       printf("%s ", gv->vocabulary[ answers[ bsymc - 1 - k ]]);
+      printf("\n");
+    }
+#endif
+  
+  }
+  
+
+  return eTIesrEngineSuccess;
+}
+
+/* ---------------------------------------------------------------------------
+   search main entry 
+   ---------------------------------------------------------------------- */
+
+TIESRENGINECOREAPI_API short
+search_a_frame(short mfcc_feature[], short not_end, 
+              unsigned short  frm_cnt,  /* input speech frame index, start from 0 */
+              gmhmm_type *gv)
+
+{ 
+  short cur_idx, prev_idx;     /* eval rotates between 0 and 1 */
+  short status, prune;
+  unsigned short last_frm = 0;
+  long  tmp;
+
+  /* ------------------------------------------------------------------
+     first frame, init search, frm_cnt is global, must start from 0
+     ------------------------------------------------------------- */
+  gv->last_beam_cell = UNDEF_CELL;
+#ifdef USE_NBEST
+  gv->nb_next_time = USHRT_MAX;
+  gv->nb_first_time_call = TRUE; 
+  gv->last_nbest_cell = UNDEF_CELL;
+#endif
+  
+#ifdef USE_SBC
+  if (gv->comp_type & SBC) 
+    sbc_enhance_all_trans( gv->sbcState,
+                          mfcc_feature,
+                          gv->nbr_dim);
+#endif
+
+  if ( frm_cnt == 0 ) {
+    if (gv->max_beam_cell == 0) {
+      PRT_ERR(printf("search space not set\n"));
+      return eTIesrEngineSearchSpace;
+    }
+    
+    /*reset real time guard*/
+    gv->prev_FramesQueued=0;
+    gv->guard=0;
+    
+    //    max_sym_cell2 = (max_sym_cell>>1) ;
+    init_last_time_table(gv);  /* init direct time table access table*/
+    init_high_pos(gv);           /* init peak usage statistics watermark */
+
+    gv->best_cur_scr = BAD_SCR;
+    gv->cum_best_prev_scr = 0;
+    gv->cur_beam_count = 0;
+
+    init_beam_list(gv); /* set cur pos of the beam and time table to 0*/
+
+    init_cur_pos( 0, gv ); /*set the Eval Indx , the current sym an state to 0*/
+    init_cur_pos( 1, gv );
+    clear_obs_scr(gv);  /* clear cache of gaussian*/
+
+#ifdef MODEL_LEVEL_PRUNE 
+    mlp_reset(gv);
+#endif
+
+    /* init search */
+
+    status = init_search(mfcc_feature, 0, gv, last_frm);
+
+    gv->best_prev_scr = gv->best_cur_scr;
+    
+    gv->need_compact=FALSE;
+    
+
+#ifdef USE_NBEST
+    if (gv->bUseNBest) nb_init_nbest(gv); 
+#endif
+
+    return status;
+
+  /* --------------------------------------------------
+     evaluate a frame
+     --------------------------------------------- */
+
+  } else if ( not_end ) {
+
+    cur_idx = frm_cnt & 1;        /*even or odd*/
+    prev_idx = ( frm_cnt - 1 ) & 1;
+
+    gv->best_cur_scr = BAD_SCR;
+    gv->best_sym = USHRT_MAX;
+    gv->best_sym_scr = BAD_SCR;
+    
+    init_cur_pos( cur_idx, gv ); /*set cur_sym in eval to zero*/
+    clear_obs_scr(gv);  /*clear cache*/
+
+    tmp = gv->best_prev_scr + gv->prune * gv->nbr_dim;
+#ifdef MODEL_LEVEL_PRUNE
+    tmp = mlp_threshold(gv ,tmp, gv->prune * gv->nbr_dim); 
+#endif
+
+#ifdef DYNAMIC_PRUNE
+    /*--------------added dynamic purning stuff---------
+    Note that this kind of prunig is specific to the underlyingt task-- parallel names. A leading 'call/dial' may or may not 
+    be a problem, not tested yet.
+    
+    Note, it may also related to feature dimensions -- now it is tuned to 9MFCC+delta
+    
+    It is related to vacab size -- but this part is handled in the code, so that pruning changes with the vocab size.
+    --------------------------*/
+    
+    
+    #ifdef DEBUGP
+    printf("== PRUNE, S=%d , P=%d , %d  beam: %d or =+=%d\n", gv->best_prev_scr, gv->prune , gv->nbr_dim, gv->beam_count, gv->ending_sym_count);
+    #endif
+    
+    
+    
+       //SymType * startsym = (SymType *) ( gv->base_net + gv->trans->start );
+       //int n_fanout= startsym->n_next & 0x7fff; 
+       //printf("=== fanout == %d", n_fanout);
+
+#ifdef DYNAMIC_PRUNE_RAMP
+    //------1. time constrainted pruning ADJUSTMENT : to deal with score variance issue
+    if (frm_cnt<PRUNE_FRAME_TH  && frm_cnt>1 )  //note frm_cnt start from 1 in this part. 20  30 40
+    {
+     // thresholdd 6000 is the pruning at 20 frame. Note that 1280 is about equivalant to PRUNE=1 before (with 10 mfcc), so 6000 is about PRUNE=5
+       tmp+= (PRUNE_FRAME_TH -frm_cnt)* PRUNE_TIME_FACTOR; // 300; // *6000/20.0;  //6000 tuned with 3000 4000 ....  110000, 10000 seems best for dim10  9000 for 9dim.  1000 is for clean 
+    }
+    else  // The program set prune, which is PRUNE=7, is applied here. 
+     tmp = gv->best_prev_scr + gv->prune * gv->nbr_dim; //no need. Set above already. 
+#endif         
+     
+
+#ifdef DYNAMIC_PRUNE_BEAM
+      //2 -----active beam based prune.. this might be number of utt dependendent. Now tuened with 90 names.
+      int zt;
+      int th_n;
+      //----this is a rough estimation on the relation between the number of words and the max number of beams
+      // reason: n_words *2  contains both gender, beam_count happends at the end of HMM. (.. problem if we use word based BTrace)
+      //maybe later should be changed to active hyps????
+      th_n=gv->trans->n_word  * PRUNE_BEAM_WORD_RATIO ;   //620; //800 11  800 is used if no netoptimizer to cut the 25% / 8.0  9.0 ... 12.0   12: 11below  best for dim10
+      
+      if (gv->beam_count > th_n  + PRUNE_BEAM_WORD_DELTA)  // PRUNE_BEAM_WORD_RATIO 3.  900 for optimized net, 1000 for not optimized. tuned with 1000 not tuned    1000
+       {
+         zt=(gv->beam_count-th_n)*PRUNE_BEAM_WORD_PNT1; //800(or 620) *11 
+         tmp=tmp+ zt;
+       }
+      else if (gv->beam_count > th_n)  // not tuned  800 without netoptimizer
+       {
+         zt=(gv->beam_count-th_n)*PRUNE_BEAM_WORD_PNT2; // *10
+         tmp=tmp+ zt;
+       }
+#endif
+
+
+#ifdef DYNAMIC_PRUNE_SUBLINEAR
+
+      //----3 prevent linear increase of active beam (especially at begining)
+      
+      //float powt[22]={ 1.0000, 0.9000, 0.8100, 0.7290, 0.6561, 0.5905, 0.5314, 0.4783, 0.4305, 0.3874, 0.3487, 0.3138, 0.2824, 0.2542, 0.2288, 0.2059, 0.1853, 0.1668, 0.1501, 0.1351, 0.1216};
+      //0.9^n * 2^14 is used to convert the above line into fixed point.
+      short powt[22]={ 16384 , 14746 , 13271, 11944, 10750, 9675, 8706,7836, 7053, 6347, 5713, 5141, 4627,4165,3749,3373 , 3036,2733,2459,2213,1992};
+      
+      
+      if (frm_cnt > 1 && frm_cnt<PRUNE_FRAME_TH ) {
+       short tmp_s=(gv->trans->n_word<<1 )* frm_cnt;
+       long tmp_l =(tmp_s * powt[frm_cnt])>>14;  //14 is from powt, which is 0.9^n * 2^14
+       tmp_s= (short) tmp_l;
+       
+       if ( gv->beam_count > tmp_s )  
+         {
+           tmp+=PRUNE_GROW_PENALTY; 
+         }
+      }  
+#endif
+
+
+      //----4 set minimal prune 
+      
+      //minimal prunie is about PRUNE=2: 2*64*20=2560, or 2*64*18= 2304
+      //zt=zt <   -2560 - gv->prune * gv->nbr_dim ? zt: -2560 - gv->prune * gv->nbr_dim; 
+      
+      tmp=tmp > gv->best_prev_scr -PRUNE_MINIMUM ? gv->best_prev_scr -PRUNE_MINIMUM: tmp; //PRUNE_MINIMUM  2560
+   
+    tmp+=500; 
+    //---------end of dynamic pruning 
+#endif      // for dynamic pruning
+
+     
+#ifdef REALTIMEGUARD
+   /*50 frames is 1 second, the minimal time for realtime guard to activate. 
+     if the queue is larg and increasing, apply penalty increasingly.
+     If the queue is large but decreasing, apply less penalty. 
+     real th can be 100: 2second , REALT_GUARD= 800, about 0.7 in prunne  */
+    if ( /* frm_cnt> gv->realtime_th && */ gv->FramesQueued> (ushort) gv->realtime_th 
+        && ((gv->FramesQueued - gv->prev_FramesQueued) > 0) )  
+   {  
+       gv->guard +=gv->realt_guard; /*keep increasing*/
+       tmp+= gv->guard;
+   }
+    else if ( /*frm_cnt> gv->realtime_th && */ gv->FramesQueued> (ushort)gv->realtime_th )  /* already decreasing, but still high queue*/
+   { 
+     gv->guard -= gv->realt_guard * ( gv->prev_FramesQueued - gv->FramesQueued )/(gv->FramesQueued - gv->realtime_th) ;
+     gv->guard= gv->guard>0 ? gv->guard : 0 ;
+     tmp+= gv->guard;
+   }
+   else
+   {
+     gv->guard=0;
+   }
+   gv->prev_FramesQueued = gv->FramesQueued ;
+#endif
+
+    tmp=tmp > gv->best_prev_scr -PRUNE_MINIMUM ? gv->best_prev_scr -PRUNE_MINIMUM: tmp; //PRUNE_MINIMUM  2560 
+
+   /*for FA*/     
+    if (gv->word_backtrace == HMMFA) tmp = gv->best_prev_scr - 150 * gv->nbr_dim;
+   
+    prune = MAX(tmp, -32768);  
+//printf("prune is %d\n", prune);    
+    last_frm = frm_cnt - 1; /* used in mark_cells, etc. -- should move to 3 lines below. */
+    /* HMM transition , and determine best path from Gaussians compution of LAST FRAME*/
+
+    status = path_propagation( cur_idx, prev_idx, frm_cnt, gv, prune);
+
+    if ( status != eTIesrEngineSuccess ) 
+      return status;
+
+#ifdef MODEL_LEVEL_PRUNE 
+    mlp_reset(gv);
+#endif 
+    /* accumulate acoustic score */
+    
+     //needed for second FA pass, if FA pass uses Gaussian selection
+     //alternatively, this can be put in process_file_1 in FA in jac-estim.cpp
+    //if (gv->word_backtrace == HMMFA )  
+    // rj_clear_obs_scr(gv, mfcc_feature);
+     
+    status = update_obs_prob(mfcc_feature, cur_idx, frm_cnt, gv, last_frm );
+    if ( status != eTIesrEngineSuccess ) 
+      return status;
+
+    /* do the backtrace (memory manage) stuff */
+    #ifdef DEBUGP
+    printf("beam cell size: %d at frame %d\n", gv->evalstat.beam.high_pos,  frm_cnt );
+    #endif
+  
+
+    /* do the backtrace stuff */
+#ifdef USE_NBEST
+    if (gv->bUseNBest) 
+      nb_compact_beam_cells( cur_idx, gv->beam_base, gv->time_base, gv , 
+                            gv->ptr_nbest_tmp->pNBestCells);
+    else
+      compact_beam_cells( gv->beam_base, gv->time_base, gv );
+#else
+
+    if (gv->need_compact==TRUE )            // || gv->word_backtrace==FALSE ) 
+     {
+       compact_beam_cells(  gv->beam_base, gv->time_base, gv );  
+        gv->need_compact=FALSE;
+        //printf("compact beam==%d==frm %d ===",gv->evalstat.beam.cur_pos,  frm_cnt);
+     }
+    else if (gv->evalstat.beam.cur_pos > BEAM_CELL_LIMIT)
+     { gv->need_compact=TRUE;
+     }
+    
+    /*shift the quick time access cache*/
+
+#endif
+
+    update_time_table(gv->time_table_idx, NN, gv); 
+    
+    gv->cum_best_prev_scr += (long) gv->best_prev_scr;
+
+    gv->best_prev_scr = gv->best_cur_scr;
+
+#ifdef DBG_HMM
+    find_best_sym( frm_cnt & 1, gv); 
+#endif
+
+    return status;
+
+  /* --------------------------------------------------
+     end, report result
+     --------------------------------------------- */
+
+  } else { 
+#ifdef SHOW_DIAGONISIS
+    global_count2+=    global_count; global_frame+=frm_cnt;
+    //#ifdef DEBUGP
+    //printf("gc=%d, frame=%d. Gaussian per frame %d. \n GlobalGPF: Gas: %d, GFRM: %d ,Ave GPF %d\n. ", global_count, frm_cnt, global_count/frm_cnt, global_count2,global_frame, global_count2/global_frame);
+    //#endif
+#endif
+    
+    gv->best_sym = USHRT_MAX;
+    gv->best_sym_scr = BAD_SCR;
+
+    cur_idx = frm_cnt & 1;
+
+    if (gv->bUseNBest){
+      if( find_good_syms( cur_idx, gv) != eTIesrEngineSuccess)
+       return  eTIesrEngineNBestMem; 
+    }
+
+    find_best_sym( cur_idx, gv );
+
+    gv->best_sym_scr += gv->cum_best_prev_scr;
+
+    return eTIesrEngineSuccess;
+  }
+}
+
+
+
+/* 
+** backtrace beam cells
+** if hmm_codes != NULL, then back track also phone boundaries (in reversed order)
+** "answer" contains the word code of the recognized utterance.
+** return the number of recognized words in "answer"
+*/
+// need change.
+
+TIESRENGINECOREAPI_API TIesrEngineStatusType
+back_trace_beam(short symcode, short frm, ushort *hmm_codes, ushort *stt, ushort *stp, ushort *nbr_seg, ushort *hmm_delta, gmhmm_type *gv)
+{
+   BeamType *b = gv->beam_base;
+   SymType  *sym, *psym, *zsym;
+   short    cont, ii , jj, fano;
+   short    time;
+   unsigned short t_sym, hmm_dlt, b_index, word_code, l_frm = frm, p;
+   TimeType *time_base = gv->time_base;
+   BeamType *beam_base = gv->beam_base;
+   
+   gv->nbr_ans = 0; //keep this during change
+   
+   #ifdef USE_CONFIDENCE
+   ConfType* pConf = (ConfType*) gv->pConf;
+   #endif
+   
+   
+   if (gv->word_backtrace==WORDBT)
+   {
+      //printf("=============word backtrace\n");
+      
+      if ( frm >= 0 )
+      {
+         // Index of hmm_codes in backtrace
+         p = 0;
+         
+         // hmm_code of 0 is not necessarily silence with non-TIesrFlex grammars
+         // Now all hmm's are tied to words so this is not necessary.
+         //if (frm != gv->frm_cnt-1)
+         //{//-printf("add hmmcode 0 at end\n");
+         //    hmm_codes[p++]=0;
+         //}
+         
+         /* return the beam cell */
+         //find the time of the last word before frm (when a beam/time cell generated)
+         MATCH_TIME(time, time_base, frm);
+         
+         
+         //use the best sym to do backtrace
+         //MATCH_SYMB(b, time_base[time].beam_idx, beam_base, gv->best_sym);
+         //#define MATCH_SYMB(bm, bm0, beam0, best_sym) for (bm = beam0 + bm0; bm->sym != best_sym; bm = beam0 + bm->next)
+         for (b = beam_base + time_base[time].beam_idx; b->sym != symcode; b = beam_base + b->next)
+         {
+            ; //printf("bt: %d \n", b->next);
+         }
+         
+         gv->nbr_ans = 0;
+
+         // Loop over all best path words in the beam
+         do
+         {
+            
+            /* hmm_d are not used, but it will be when you do phone-level decoding */
+            // Find the base path symbol representing the path of the best beam symbol 
+            unsigned t_sym;
+            for ( t_sym = b->sym; t_sym >= gv->trans->n_sym;  t_sym  -= gv->trans->n_sym) ;
+            
+            // Pointer to base grammar symbol information for path symbol
+            //psym = (SymType *) ( gv->base_net + b->sym );
+            psym = (SymType *) ( gv->base_net + gv->trans->symlist[ t_sym ] );
+            
+            //Initialize search for the symbol that has transition into path symbol
+            unsigned short gotit=0;
+            unsigned short wordend=0;
+            unsigned short t_sym2=t_sym;
+            
+            // Add word path symbol hmm code to the hmm_codes along the path
+            //printf ("hmm: %d symnode: %d  %d\n", psym->hmm_code,t_sym, p);
+            hmm_codes[p++]=psym->hmm_code;
+            
+            // Loop to add all symbols of the path corresponding to the present word
+            do
+            {
+                // Find a grammar symbol with transition into path symbol
+               
+               // Loop over all grammar symbols
+               for ( ii=0; ii< gv->trans->n_sym; ii++)//for all the node
+               {
+                  zsym = (SymType *) ( gv->base_net + gv->trans->symlist[ ii ] );
+                  
+                  // Loop over all transitions out of the grammar symbol
+                  fano=zsym->n_next & 0x7fff;
+                  for (jj=0; jj< fano ; jj++)
+                  {
+                     // for all the fanout of node ii
+                     
+                     // Check if symbol has transition that goes into path symbol
+                     //printf(" %d fanout %d\n", ii, zsym-> n_next & 0x7fff);
+                     if ( zsym->next[jj]==t_sym2)
+                     {
+                        t_sym2=ii;
+                        gotit=1;
+                        
+                        //if ii is a word end, or sil, or start node (note: Sil must be HMM=0!!
+                        //if  (zsym->n_next & 0x8000 ||zsym->hmm_code==0 || ii==0 )
+                        
+                        // This check has been changed. Now, by convention, all grammar symbols 
+                        // are connected to words, hence each symbol is either marked as word 
+                        // ending, or is a symbol corresponding to an earlier hmm in the word. 
+                        // There is no requirement that the hmm_code 0 is silence.  This is just
+                        // done by convention in TIesrFlex.  The first grammar symbol (ii=0) does
+                        // not necessarily correspond to the beginning of the grammar.
+                        // Check if symbol transitioning to path symbol is word ending symbol
+                        if(zsym->n_next & 0x8000)
+                           wordend=1;  //get word end or hmmcode=0 (sil) ...or get node 0 starting node
+                        else
+                        { 
+                           
+                           //printf ("bt: hmm: %d , node %d\n", zsym->hmm_code, ii);
+
+                           // If not a word ending symbol, it must be a symbol corresponding
+                           // to an hmm of the word along the path so add it to the hmm_codes.
+                           hmm_codes[p++]=zsym->hmm_code;
+                        }
+                        
+                        // Found symbol transitioning to path symbol, break out of transition loop
+                        break;
+                     }
+                  }
+                  
+                  // If symbol transitioning to path symbol found, break out of symbol loop
+                  if (gotit)
+                  {break;}
+               }
+               
+               if (gotit==1)
+               {
+                  // If the symbol transitioning to path symbol was found, reset the flag,
+                  // and go look for next symbol of word if not at first symbol of word
+                  gotit=0;
+               }
+               else
+               {
+                  // There is no symbol with a transition to path symbol.  Must be at
+                  // the start of the grammar, and hence have found all symbols for a whole
+                  // word.
+                  
+                  wordend = 1;
+               }
+              
+               // Loop until all symbols for a word have been added to the hmm_codes array
+            }while (wordend==0);     //t_sym2 is not a end of  word or sil
+            
+            // Not necessary any longer to add a "sil" model code between words.
+            // Now the silence model is represented by a "_SIL" word, so will be
+            // output by the above word processing loop.
+            //printf (" add a hmmcode 0 here sil\n");
+            //hmm_codes[p++]=0;
+            
+            gv->answer[ (gv->nbr_ans)++ ] = psym->next[GET_N_NEXT(psym->n_next)]; //b->sym;  //zx
+            if (gv->nbr_ans == MAX_WORD_UTT) return  eTIesrEngineAnswerMemoryOut;
+            
+            /*move to the next beam cell*/
+            b_index =  b->idx_flag & 0x7fff;
+            
+            if ((cont = NOT_END_IX_CELL(b_index, gv->max_beam_cell)) == TRUE)
+            {
+               
+               b = beam_base + b_index;
+               
+            }
+            else
+            {
+               ;
+            }
+            
+         } while ( cont );
+         
+         // hack, it is not used, but for passing some check
+         //*nbr_seg = gv->nbr_ans;  *hmm_delta = gv->best_word_gender;  // I am not sure if these two are useful
+         /* assigned to the last one */
+         if (stt)
+         {
+            *nbr_seg = p;  *hmm_delta = gv->best_word_gender; /*printf("GENDER: %d\n", *hmm_delta);*/
+         }
+      }
+   }
+   
+   else
+   {//hmm backtrace
+      //printf("=============hmm backtrace\n");
+      if ( frm >= 0 )
+      {
+         /* return the beam cell */
+         MATCH_TIME(time, time_base, frm);
+         MATCH_SYMB(b, time_base[time].beam_idx, beam_base, gv->best_sym);
+         gv->nbr_ans = 0;
+         p = 0;
+         do
+         {
+            /* hmm_d are not used, but it will be when you do phone-level decoding */
+            for (hmm_dlt = 0, t_sym = symcode; t_sym >= gv->trans->n_sym; t_sym  -= gv->trans->n_sym, hmm_dlt += gv->trans->n_hmm_set);
+            sym = (SymType *) ( gv->base_net + gv->trans->symlist[ t_sym ] );
+            
+            if ( sym->n_next & 0x8000 )
+            {    /* recognized words, backward order */
+               word_code = sym->next[GET_N_NEXT(sym->n_next)];
+               
+               #ifdef USE_CONFIDENCE
+               pConf->answers[gv->nbr_ans] = word_code ;
+               pConf->uStp[gv->nbr_ans] = frm + 1;
+               pConf->nWords = gv->nbr_ans + 1;
+               #endif
+               
+               gv->answer[ (gv->nbr_ans)++ ] = word_code;
+               if (gv->nbr_ans == MAX_WORD_UTT)
+                  return  eTIesrEngineAnswerMemoryOut;
+            }
+            
+            b_index =  b->idx_flag & 0x7fff;
+            if ((cont = NOT_END_IX_CELL(b_index, gv->max_beam_cell)) == TRUE)
+            {
+               frm = get_frame_time(b_index, gv);
+               b = beam_base + b_index;
+               symcode = b->sym;
+            }
+            else
+            {
+               symcode = USHRT_MAX;
+               frm = USHRT_MAX;
+            }
+            /* this means phone back track requested */
+            if (hmm_codes)
+            {hmm_codes[p] = sym->hmm_code;
+             //       printf("hmmcode: %d, node %d\n" , hmm_codes[p], t_sym ); //-1352
+            }
+            if (stp) stp[p] = l_frm + 1;
+            if (stt) stt[p] = frm   + 1; /* this is the AT LEAST MUST HAVE for hmm tracing */
+            //      printf("  %d,  start %d, stop %d\n", p, stt[p], stp[p]);
+            p++;
+            l_frm = frm;
+         } while ( cont );
+         
+         /* assigned to the last one */
+         if (stt)
+         {  *nbr_seg = p;  *hmm_delta = hmm_dlt;
+            gv->best_word_gender=hmm_dlt; /*printf("GENDER: %d\n", *hmm_delta);*/
+         }
+      }  //end of hmm or word
+      
+   }
+   return eTIesrEngineSuccess;
+}
+
+
+/*
+  
+** This file contains function for claculating EM forward/back ward variables.
+** - The functions uses per-frame log-likelihood normalization to keep values
+**   in the short integer range. 
+** - All entry and output variables are in short.
+** - Forward variables are calculated on-demand, frame by frame, while backward variables
+**   are calculated by block (e.g. for all available frames)
+** 
+*/
+
+/* 
+** compute alpha variable and return likelihood of the given sequence 
+** work for multi-entry state models.
+*/
+static void EM_alpha_0(short pd[], short alpha[], int T, HmmType *hmm, short c_t_beta, gmhmm_type *gv)
+{
+  ushort i;
+  short trans;
+  long tmp;
+  /* START: t = 0, for all states */
+  FOR_EMS_STATES(i,hmm,gv->base_tran) {   /* initial A2: */ 
+    trans = GET_PI(hmm,gv->base_tran)[i];
+    tmp = (HAS_TRANSITION(trans)? (trans + (long)pd[i * T]): BAD_SCR) - c_t_beta;
+    alpha[i] = LONG2SHORT(tmp);
+  }
+}
+
+/*
+**  general case t in [1,T)
+*/
+
+static void EM_alpha_gnl(short pd[], short alpha[],  short alfa[], int T, HmmType *hmm, ushort t, short c_t_beta, gmhmm_type *gv)
+{
+  ushort i,j;
+  short *a_i, *a_j, trans;
+  long tmp;
+
+  a_j = alpha;
+  FOR_EMS_STATES(j,hmm,gv->base_tran) {
+    tmp = BAD_SCR;
+    a_i = alfa;
+    FOR_EMS_STATES(i,hmm,gv->base_tran) {
+      trans = GET_AIJ(hmm,i,j,gv->base_tran);
+      if (HAS_TRANSITION(trans)) {
+       tmp = hlr_logsum(LONG2SHORT(tmp), LONG2SHORT(a_i[i] + (long)trans));
+      }
+    }
+    tmp += pd[j * T + t] - c_t_beta;
+    a_j[j]  = LONG2SHORT( tmp );
+  }
+}
+
+/*
+** for exit states:  TERMINATION: t = T-1, emission states 
+*/
+
+static void EM_alpha_e(short alpha[],  HmmType *hmm, short c_t_beta, gmhmm_type *gv )
+{
+  ushort i, nbr_states = NBR_STATES(hmm,gv->base_tran) - 1;
+  long tmp; 
+  short *a_i, trans;
+
+  tmp = BAD_SCR ; 
+  a_i = alpha;
+  FOR_EMS_STATES(i,hmm,gv->base_tran) {  /* final, no emission prob A3: */
+    trans = GET_AIJ(hmm,i, nbr_states,gv->base_tran);
+    if (HAS_TRANSITION( trans )) 
+      tmp = hlr_logsum((short)tmp, LONG2SHORT(a_i[i] + (long) trans));
+  }
+  /* EXIT STATE: t = T-1, exit state */
+  a_i = alpha;
+  tmp -= c_t_beta;
+  a_i[ nbr_states ] = LONG2SHORT( tmp );
+}
+
+
+/*
+** compute the alpha (forward) variable used in EM algorithm.
+** alpha is calculated for the frame t.
+** the function returns a pointor to the memory holding the alpha_t.
+*/
+
+TIESRENGINECOREAPI_API short * /* return the starting address of alpha variable for frame t */
+EM_alpha_t (short lld[],       /* log likelihood of the segment, lld[j * T + t] for state j frame t */
+           short alpha[],    /* forward variable, size must be 2 * NBR_STATES(hmm) */
+           ushort t,         /* current frame index */
+           ushort T,         /* total number of frames */
+           HmmType *hmm,     /* GTM structure hmm  */
+           short c_t_beta[], /* normalization factor, size T+1, c_t_beta[t] for frame t output */
+           gmhmm_type *gv)
+{
+    short *a_t = GET_ALPHA(alpha,t,NBR_STATES(hmm,gv->base_tran));
+    short *a_t1;
+    
+    if (t==0) EM_alpha_0(lld, a_t, T, hmm, c_t_beta[T],gv);
+    else {
+      a_t1 = GET_ALPHA(alpha,t-1,NBR_STATES(hmm, gv->base_tran));
+      EM_alpha_gnl(lld, a_t, a_t1, T, hmm, t, c_t_beta[t-1],gv);
+    }
+    if (t == T-1) EM_alpha_e(a_t, hmm, c_t_beta[t],gv);
+    return a_t;
+}
+
+
+/*  
+** compute beta (backward) variable used in EM algorithm.
+** beta is calculated for all the segment t=[0, T-1].
+*/
+
+TIESRENGINECOREAPI_API long  /* return the total log likelihood over the T frames */
+EM_beta(short lld[],     /* log likelihood of the segment, lld[j * T + t] for state j frame t */
+        short beta[],    /* backward variable, beta[j * T + t] for state j frame t */
+       ushort T,        /* total number of frames */
+        HmmType *hmm,    /* GTM structure hmm  */
+        short c_t_beta[],/* normalization factor, size T+1, c_t_beta[t] for frame t output */
+       gmhmm_type *gv)
+{
+   ushort i,j, nbr_ems_states = NBR_STATES(hmm, gv->base_tran)-1; 
+   short trans, *b_i, *b_j, t, c_t; 
+   long tmp, log_sum_b = 0;
+   
+   beta[nbr_ems_states * T + T-1] = 0; /* B3 */
+   c_t = BAD_SCR; 
+
+   FOR_E_STATES(i,b_i,nbr_ems_states,beta,T) { /* beta[T-1] from exit state  B2 */
+     trans = GET_AIJ(hmm,i,nbr_ems_states, gv->base_tran);
+     if (HAS_TRANSITION(trans)) b_i[T-1] = trans;
+     else b_i[T-1] = BAD_SCR;
+     c_t = hlr_logsum(c_t,b_i[T-1]);
+   }
+   c_t_beta[T-1] = c_t;
+
+   FOR_E_STATES(i,b_i,nbr_ems_states,beta,T) b_i[T-1] = LONG2SHORT((long)b_i[T-1] - c_t_beta[T-1]);
+   
+   b_i = beta;
+   log_sum_b += c_t_beta[T-1];  
+
+   for (t = T-2; t>=0; t--) { /* beta[t] from beta[t+1]  B1 */
+     c_t = BAD_SCR; 
+     FOR_E_STATES(i,b_i,nbr_ems_states,beta,T) {
+       tmp = BAD_SCR;
+       FOR_E_STATES(j,b_j,nbr_ems_states,beta,T) { /* remove trans will make diff btw FWD and BWD var */
+        trans = GET_AIJ(hmm,i,j, gv->base_tran);
+        if (HAS_TRANSITION(trans)) {
+          tmp = hlr_logsum((short)(tmp), LONG2SHORT(trans +(long) lld[j * T + t+1] + b_j[t+1]));
+        }
+       }
+       b_i[t] = (short)(tmp);
+       c_t = hlr_logsum(c_t, b_i[t]);
+     }
+     c_t_beta[t] = c_t;
+     FOR_E_STATES(i,b_i,nbr_ems_states,beta,T) b_i[t] = LONG2SHORT((long)b_i[t] - c_t_beta[t]);
+     log_sum_b += c_t_beta[t];
+   }
+   tmp = BAD_SCR;    /* just check: not necessary for computing other parameters */
+   c_t = BAD_SCR;
+   FOR_E_STATES(i,b_i,nbr_ems_states,beta,T) {
+     trans = GET_PI(hmm, gv->base_tran)[i];
+     if (HAS_TRANSITION( trans ))
+       tmp = hlr_logsum((short)(tmp), LONG2SHORT((long)trans + lld[i * T + 0] + b_i[0]));
+   }
+   c_t_beta[T] = hlr_logsum(c_t, (short)(tmp));
+   log_sum_b += c_t_beta[T];
+   return log_sum_b;
+}
+
+/* get the pointer to the log-likelihood score of the model $s_seg */
+void EM_get_lld( short s_seg,
+                const short *p_lld, 
+                const short * p_beta, 
+                short T, 
+                SearchMemType * smem, 
+                gmhmm_type * gv)
+{
+  ushort nbr_ems_states ;
+  short s, *b_j, *l_j;
+  HmmType * hmm; 
+
+  b_j = (short*) p_lld; l_j = (short*) p_beta; 
+  for (s=0;s<s_seg;s++){
+    /* for each HMM */
+    hmm = GET_HMM(gv->base_hmms, gv->hmm_code[s], gv->hmm_dlt);
+    nbr_ems_states = NBR_STATES(hmm, gv->base_tran) - 1; 
+    if (b_j) b_j += nbr_ems_states * T; 
+    l_j += (nbr_ems_states + 2) * T;
+  }
+  smem->p_lld_hmm = b_j; 
+  smem->p_beta_hmm = l_j; 
+}
+
+#ifdef DEV_EM
+long EM_beta_word(const short lld[],     /* log likelihood of the segment, lld[j * T + t] for state j frame t */
+                 short beta[],
+                 /* backward variable, beta[j * T + t] for state j frame t */
+                 short sz_bkwd, /* size of the memory for beta */
+                 ushort T,        /* total number of frames */
+                 short c_t_beta[],
+                 /* normalization factor, size T+1, c_t_beta[t] for frame t output */
+                 gmhmm_type *gv)
+{
+  ushort i,j, nbr_ems_states ;
+  short trans, *b_i, *b_j, t, c_t, s, *beta_hmm, 
+    *lld_hmm, Nq, *beta_em, Nqt; 
+  long tmp, log_sum_b = 0, b_ip1_tp1 = 0/* beta(1, q+1, t+1) */;
+  HmmType * hmm; 
+  SearchMemType smem; 
+
+  for (t=T-1;t>=0;t--){ /* for each time */
+    
+    c_t = BAD_SCR; 
+    for (s=gv->nbr_seg -1;s>=0;s--){
+      /* for each HMM */
+      hmm = GET_HMM(gv->base_hmms, gv->hmm_code[s], gv->hmm_dlt);
+      nbr_ems_states = NBR_STATES(hmm, gv->base_tran) - 1; 
+      EM_get_lld( s, lld, beta, T, &smem, gv); 
+      beta_hmm = smem.p_beta_hmm; 
+      lld_hmm = smem.p_lld_hmm; 
+      Nq = nbr_ems_states + 1; 
+      beta_em = beta_hmm + T; /* starting pointer to the first emitting states */
+      /* the starting point of beta for the current HMM */
+
+      Nqt = Nq * T + t; 
+      if (t==T-1){
+       beta_hmm[Nqt] = (s==gv->nbr_seg-1)? 0 : BAD_SCR ; 
+       
+       FOR_E_STATES(i,b_i,nbr_ems_states,beta_em,T) { /* beta[T-1] from exit state  B2 */
+         trans = GET_AIJ(hmm,i,nbr_ems_states, gv->base_tran);
+         if (HAS_TRANSITION(trans)) 
+             b_i[t] = LONG2SHORT(trans + (long)beta_hmm[Nqt]);
+         else b_i[t] = BAD_SCR;
+         c_t = MAX(c_t, b_i[t]); 
+       }
+      }else{
+       beta_hmm[Nqt] = (s==gv->nbr_seg-1)? BAD_SCR : b_ip1_tp1; 
+       
+       FOR_E_STATES(i,b_i,nbr_ems_states,beta_em,T) {
+         tmp = BAD_SCR;
+         FOR_E_STATES(j,b_j,nbr_ems_states,beta_em,T) { 
+           trans = GET_AIJ(hmm,i,j, gv->base_tran);
+           if (HAS_TRANSITION(trans)) {
+             tmp = 
+               hlr_logsum((short)(tmp), 
+                          LONG2SHORT(trans +(long) lld_hmm[j * T + t+1] + (long) b_j[t+1]));
+           }
+         }
+         trans = GET_AIJ(hmm, i, nbr_ems_states, gv->base_tran);
+         if (HAS_TRANSITION(trans))
+           tmp = hlr_logsum((short)(tmp), 
+                            LONG2SHORT(trans + (long) beta_hmm[Nqt]));
+         b_i[t] = (short)(tmp);
+         c_t = MAX(c_t, b_i[t]);
+       }
+      }
+
+      tmp = BAD_SCR; 
+      FOR_E_STATES(i,b_i,nbr_ems_states,beta_em,T) {
+       trans = GET_PI(hmm, gv->base_tran)[i];
+       if (HAS_TRANSITION( trans ))
+         tmp = hlr_logsum((short)(tmp), 
+                          LONG2SHORT((long)trans + lld_hmm[i * T + t] + b_i[t]));
+      }
+      beta_hmm[t] = tmp; 
+      c_t = MAX(c_t, tmp);
+
+      b_ip1_tp1 = (t==T-1)?BAD_SCR:beta_hmm[t+1];
+    }
+
+    c_t_beta[t] = c_t; 
+
+    /* normalize score */
+    for (s=t;s<sz_bkwd;s+=T)
+      beta[s] = LONG2SHORT((long)beta[s] - (long)c_t); 
+  }
+
+  log_sum_b = beta_hmm[0]; 
+  return log_sum_b;
+}
+
+long EM_alpha_word(short tfrm, 
+                  const short lld[],     
+                  /* log likelihood of the segment, lld[j * T + t] for state j frame t */
+                  short alpha[],    /* backward variable, beta[j * T + t] for state j frame t */
+                  ushort T,        /* total number of frames */
+                  ushort sz_frwd,  /* size of alpha */
+                  short c_t_beta[],
+                  /* normalization factor, size T+1, c_t_beta[t] for frame t output */
+                  gmhmm_type *gv)
+{
+  ushort i,j, nbr_ems_states ;
+  short trans, *a_i, *a_j, t, s, *alpha_hmm, *alpha_hmm_tm1,
+    *p_alpha, *p_alpha_tm1, *alpha_em_tm1,
+    *lld_hmm, Nq, *alpha_em;
+  long tmp, tmp2, a_im1_tm1 = 0/* beta(1, q+1, t+1) */, log_sum_b;
+  HmmType * hmm; 
+
+  t = tfrm; 
+  {
+    p_alpha = (t&0x0001)?alpha +  (sz_frwd >> 1): alpha; /* alpha(t) */
+    p_alpha_tm1 = (t&0x0001)?alpha:alpha +  (sz_frwd >> 1); /* alpha(t-1)*/
+    alpha_hmm = p_alpha; 
+    alpha_hmm_tm1 = p_alpha_tm1; 
+    lld_hmm = (short*) lld; 
+
+    for (s=0;s<gv->nbr_seg;s++){
+      /* for each HMM */
+      hmm = GET_HMM(gv->base_hmms, gv->hmm_code[s], gv->hmm_dlt);
+      nbr_ems_states = NBR_STATES(hmm, gv->base_tran) - 1; 
+
+      alpha_em = alpha_hmm + 1; /* starting pointer to the first emitting states */
+      alpha_em_tm1 = alpha_hmm_tm1 + 1; 
+      /* the starting point of alpha for the current HMM */
+      Nq = nbr_ems_states + 1; 
+
+      if (t==0){
+       alpha_hmm[0] = (s==0)?0:BAD_SCR; 
+       
+       FOR_EMS_STATES(i,hmm,gv->base_tran) {   /* initial A2: */ 
+         trans = GET_PI(hmm,gv->base_tran)[i];
+         tmp = HAS_TRANSITION(trans)? 
+           (trans + (long)lld_hmm[ i * T + t ] + (long)alpha_hmm[0]) : BAD_SCR ;
+         alpha_em[i] = LONG2SHORT(tmp);
+       }
+      }else{
+       alpha_hmm[0] = (s==0)?BAD_SCR:a_im1_tm1; 
+       
+       a_j = alpha_em;
+       FOR_EMS_STATES(j,hmm,gv->base_tran) {
+         tmp = BAD_SCR;
+         a_i = alpha_em_tm1;
+         FOR_EMS_STATES(i,hmm,gv->base_tran) {
+           trans = GET_AIJ(hmm,i,j,gv->base_tran);
+           if (HAS_TRANSITION(trans)) {
+             tmp = hlr_logsum(LONG2SHORT(tmp), LONG2SHORT(a_i[i] + (long)trans));
+           }
+         }
+         trans = GET_PI(hmm,gv->base_tran)[j];
+         if (HAS_TRANSITION(trans)){
+           tmp2 = trans + (long)alpha_hmm[0];
+           tmp = hlr_logsum(LONG2SHORT(tmp), LONG2SHORT(tmp2)); 
+         }
+         tmp += (long)lld_hmm[j * T + t];
+         a_j[j]  = LONG2SHORT( tmp );
+       }
+      }
+
+      tmp = BAD_SCR ; 
+      a_i = alpha_em;
+      FOR_EMS_STATES(i,hmm,gv->base_tran) {  /* final, no emission prob A3: */
+       trans = GET_AIJ(hmm,i, nbr_ems_states,gv->base_tran);
+       if (HAS_TRANSITION( trans )) 
+         tmp = hlr_logsum((short)tmp, LONG2SHORT(a_i[i] + (long) trans));
+      }
+      alpha_hmm[Nq] = LONG2SHORT(tmp);
+      
+      a_im1_tm1 = (t==0)?BAD_SCR:alpha_hmm_tm1[Nq];
+      alpha_hmm += nbr_ems_states + 2;
+      alpha_hmm_tm1 += nbr_ems_states + 2; 
+      lld_hmm += nbr_ems_states * T; 
+
+    }
+
+    i = sz_frwd >> 1; 
+    for (s=0;s<i;s++)
+      p_alpha[s] = LONG2SHORT((long)p_alpha[s] - c_t_beta[t]);
+
+    log_sum_b = p_alpha[i-1]; 
+  }
+
+  return log_sum_b;
+}
+
+#endif
diff --git a/TIesrEngine/src/search_user.h b/TIesrEngine/src/search_user.h
new file mode 100644 (file)
index 0000000..afbc4fa
--- /dev/null
@@ -0,0 +1,209 @@
+/*=======================================================================
+ search_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file defines the interface to search functions of the
+ TIESR gmhmm search engine.
+
+======================================================================*/
+
+#ifndef SEARCH_USER_H
+#define SEARCH_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+
+#include "tiesrcommonmacros.h"
+#include "status.h"
+#include "gmhmm_type.h"
+
+//---------------------PRUNING PARAMETERS
+
+// most pruning constraints are for the first 20 frames
+#define  PRUNE_FRAME_TH 20   
+
+// time dependant pruning. Note: 20*300 should be smaller to the overall  pruning max, which is,e.g. 7*64*18=8000, 
+//This is number is subtracted from the overall pruning max.
+#define PRUNE_TIME_FACTOR  300  
+
+// the penalty when #of active beam increase too fast
+#define PRUNE_GROW_PENALTY 2000  
+
+//in case the pruning constraints add up, here is a minimal 
+#define  PRUNE_MINIMUM  2560
+
+// This is the maximal ratio between the number of words and the number of beams. If above, penalty will be applied on pruning.
+#define PRUNE_BEAM_WORD_RATIO 7 //3
+// The delta applied for the above threshold, as the second line to tell there is really too many active beam. MOre penalty will be used.
+#define PRUNE_BEAM_WORD_DELTA  250
+
+//the two penalty factors for too much active beam
+#define  PRUNE_BEAM_WORD_PNT1 4  //11
+#define  PRUNE_BEAM_WORD_PNT2 3   //10
+
+//hmm end prune, with 400 more prune
+#define SYMEND_PRUNE_DELTA  400
+#define WORDEND_PRUNE_DELTA  0
+//-----------------------------------------
+
+//word based BT and dymanic memory management
+typedef enum DecMode
+{
+   WORDBT,
+   HMMBT,
+   HMMFA
+} DecMode;
+
+
+#define BEAM_CELL_LIMIT 3000
+
+
+/* gaussian observation likelihood type evaluation */
+typedef enum ObsType 
+{
+   VITERBI,
+   FULL,
+   COMPONENT
+} ObsType;
+
+
+/*--------------------------------*/
+/* SymType */
+typedef struct {
+  unsigned short hmm_code; /* HMM code, not context-expanded */
+  unsigned short n_next;   /* the number of symbols in next[]. if bit15 == 1 then the last element in
+                              "next[]" is the word code  */
+  unsigned short next[1];  /* the list of following symbols, 
+                             cannot use short *, more than 1 */
+} SymType;
+
+
+/*--------------------------------*/
+/* HmmType */
+typedef struct {
+
+  short          tran;    /* offset pointing into the transition matrix pool,
+                             NOT converted into real addr in initialization
+                          */
+  unsigned short pdf_idx[1]; /* each entry is an offset pointing into
+                               base_pdf[],
+                               it is the observation distribution for each
+                               emission state,
+                               pdf_idx[ n_state - 1 ]
+                            */
+} HmmType;
+
+
+typedef struct _SEARCH_MEM{
+  short * p_lld_hmm; /* pointer to the log-likelhood score of the HMM */
+  short * p_beta_hmm; /* pointer to the backward score of the HMM */
+} SearchMemType; 
+
+/*--------------------------------*/
+/* Functional interface to search engine */
+
+TIESRENGINECOREAPI_API void set_search_space(short *search_space, ushort beam_z, ushort sym_z,
+                     ushort state_z, ushort time_z, gmhmm_type *gv);
+
+
+TIESRENGINECOREAPI_API short gauss_obs_score_f(short *feature, int pdf_idx, gmhmm_type *gv);
+
+
+TIESRENGINECOREAPI_API short search_a_frame(short mfcc_feature[], short not_end,
+                    unsigned short  frm_cnt, gmhmm_type *gv);
+
+
+TIESRENGINECOREAPI_API TIesrEngineStatusType back_trace_beam(short symcode, short frm,
+                                     ushort *hmm_codes, ushort *stt, 
+                                     ushort *stp, ushort *nbr_seg, 
+                                     ushort *hmm_delta, gmhmm_type *gv);
+
+/* return the starting address of alpha variable for frame t */
+TIESRENGINECOREAPI_API short * EM_alpha_t (short lld[],  /* log likelihood of the segment, lld[j * T + t] for state j frame t */
+                   short alpha[],    /* forward variable, size must be 2 * NBR_STATES(hmm) */
+                   ushort t,         /* current frame index */
+                   ushort T,         /* total number of frames */
+                   HmmType *hmm,     /* GTM structure hmm  */
+                   short c_t_beta[], /* normalization factor, size T+1, c_t_beta[t] for frame t output */
+                   gmhmm_type *gv);
+
+
+/* return the total log likelihood over the T frames */
+TIESRENGINECOREAPI_API long EM_beta(short lld[],     /* log likelihood of the segment, lld[j * T + t] for state j frame t */
+            short beta[],    /* backward variable, beta[j * T + t] for state j frame t */
+            ushort T,        /* total number of frames */
+            HmmType *hmm,    /* GTM structure hmm  */
+            short c_t_beta[],/* normalization factor, size T+1, c_t_beta[t] for frame t output */
+            gmhmm_type *gv);
+
+/* get the address of beta and log-likelihood score */
+void EM_get_lld( short s_seg,
+                const short *p_lld, 
+                const short * p_beta, 
+                short T, 
+                SearchMemType * smem, 
+                gmhmm_type * gv);
+
+/* -------------------- utterance-level forward-backward algorithm ----------------------- */
+#ifdef DEV_EM
+
+long EM_beta_word(const short lld[],     /* log likelihood of the segment, lld[j * T + t] for state j frame t */
+                 short beta[],
+                 /* backward variable, beta[j * T + t] for state j frame t */
+                 short sz_bkwd, 
+                 ushort T,        /* total number of frames */
+                 short c_t_beta[],
+                 /* normalization factor, size T+1, c_t_beta[t] for frame t output */
+                 short * lo_hi_idx , /* start and end points */
+                 gmhmm_type *gv); 
+
+/* Forward alpha updating without HMM boundaries */
+long EM_alpha_word(short tfrm, 
+                  const short lld[],     
+                  /* log likelihood of the segment, lld[j * T + t] for state j frame t */
+                  short alpha[],    
+                  /* backward variable, beta[j * T + t] for state j frame t */
+                  ushort T,        /* total number of frames */
+                  ushort sz_frwd,  /* size of alpha */
+                  short c_t_beta[],
+                  /* normalization factor, size T+1, c_t_beta[t] for frame t output */
+                  short * lo_hi_idx, /* start and end points */
+                  gmhmm_type *gv);
+
+#endif
+
+#endif
diff --git a/TIesrEngine/src/siinit.cpp b/TIesrEngine/src/siinit.cpp
new file mode 100755 (executable)
index 0000000..4fb2ea6
--- /dev/null
@@ -0,0 +1,502 @@
+/*=======================================================================
+ siinit.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This source provides for opening and closing the TIesr SI ASR, and
+ some functions for handling memory.
+
+======================================================================*/
+
+/* Windows OS specific includes */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+
+#include "tiesr_config.h"
+#include "tiesrcommonmacros.h"
+
+#include "siinit.h"
+
+#include "gmhmm_type.h"
+#include "search_user.h"
+#include "uttdet_user.h"
+#include "load_user.h"
+#include "volume_user.h"
+#include "gmhmm_si_api.h"
+#include "jac-estm_user.h"
+#include "noise_sub_user.h"
+
+//#ifdef USE_SBC
+#include "sbc_user.h"
+//#endif
+
+#ifdef USE_NBEST
+#include "nbest_user.h"
+#endif
+#if defined(USE_RAPID_SEARCH) || defined(RAPID_JAC)
+#include "rapidsearch_user.h"
+#endif
+#ifdef USE_CONFIDENCE
+#include "confidence_user.h"
+#endif
+
+/*
+** shared by on-line and offline SI (JAC). (jac-main.c, main.c)
+*/
+
+// static short mem_mfcc_C [ MAX_FRM * MAX_NBR_MFCC ];   /* mfcc */
+
+/* 
+** search space split:
+** used name 200 statistics: BEAM 4.3900000e-01, SYMB  1.3500000e-01, STATE  4.9300000e-01
+** normalized, ./ by [3 4 3] and scaled to Q16: 
+*/
+
+// ratio = [.46 .13 .43]; 
+
+#ifdef _MONOPHONE_NET
+void output_network(FILE*, short *base_net);
+#endif
+
+/* 
+#define BEAM_Z   32766 // MAX. (idx_flag limits to 2^15)  ( for SI name dilaing) // 10000 
+#define SYMB_Z   6000  // 4000 
+#define STATE_Z  30000  // 20000
+#define TIME_Z   2000 
+*/
+
+const short K_mean[ MAX_DIM_MFCC16 ] = /* {11668, 506, 957, -1425, -472, -668, -2806, 1911};   */
+  { 14149,  -4777,  -746,  287,  -2014,  -749,  -773,  -171 , 0,0, 
+    0,0,0,0,0,0};
+
+/*
+** If we assume: 1. 100MIPS --> 2mil cyc / frame.   2. 20K cyc / vector for JAC
+** then we should be able to do 100 vector/frame.
+*/
+
+
+/*--------------------------------*/
+unsigned short GetMaxFrames(gmhmm_type *gvv )
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+  return gv->max_frame_nbr;
+}
+
+
+/*--------------------------------*/
+/*
+** three blocks of memory: type, speech, search
+*/
+
+/* init search space 
+*/
+static void Init_Search(gmhmm_type * gv, const short * p_K_mean)
+{
+  ushort i; 
+  Boolean bUseNBest = TRUE; 
+  short compType = JAC | SBC | SVA ; 
+
+  gv->comp_type = compType;
+  gv->scale_feat = gv->scale_mu;
+  gv->nbr_dim = gv->n_mfcc * 2; /*  static + delta   */
+  //  const_init(); 
+  //  dim_init(gv->n_mfcc, &(gv->mu_scale_p2)); 
+  dim_p2_init(gv->n_mfcc, gv);
+
+  for (i = 0; i < gv->n_mfcc; i++) {
+    gv->mfcc_mean[ i ] = p_K_mean[ i ]; /* this should be on permenent memory */
+  }
+  gv->last_sig = 0; 
+
+  gv->low_vol_limit  = LOW_VOL_LIMIT;
+  gv->high_vol_limit = HIGH_VOL_LIMIT;
+  
+  gv->prune = PRUNE_COEFF * (1<<6);    
+  gv->tranwgt = (WIP)*(1<<6); /* word insertion balance */
+
+#ifdef REALTIMEGUARD
+  gv->realtime_th = REALTIME_TH;  // frames that trigger more pruning as realtime guard, 50 is one second.
+  gv->realt_guard = REALT_GUARD;
+#endif
+
+  gv->bUseNBest = bUseNBest; 
+#ifdef USE_NBEST
+  gv->ptr_nbest_tmp = NULL;
+#endif
+
+#ifdef _MONOPHONE_NET
+  gv->pAux = NULL;
+  gv->ptr_nbest_tmp = NULL;
+#endif
+
+}
+
+static void SetDefault(gmhmm_type * gv)
+{
+  /* Initialize JAC default parameters */
+  JAC_set_default_params( gv );
+
+  sbc_set_default_params( gv );
+
+  /* Initialize SAD default thresholds */
+  set_default_uttdet(gv);
+
+#if defined(USE_CONFIDENCE) && defined(USE_CONF_DRV_ADP)
+  cm_set_param(CM_ADP_THRE, CM_NBR_NBEST_LOW_CONF, gv); 
+#endif
+
+#ifdef  USE_ONLINE_REF
+  rj_set_ORM( GBG_num_ids, 
+             GBG_HNOISE,  GBG_VAD_VERIFY_TH_LNOISE,  GBG_VAD_VERIFY_TH_HNOISE, 
+             GBG_END_SPEECH_CNT_TH, GBG_END_SPEECH_TH_PERC, 
+             GBG_END_SPEECH_START, GBG_NUM_AFTER_PEAK_TO_TRIGGER_END_SPEECH,
+             gv);
+#endif
+  
+}
+
+/* GMHMM_SI_API */ 
+static TIesrEngineStatusType AllocateTIesrMemory( short* memoryPool, 
+                                                 unsigned short max_frm,
+                                                 char * ptr_model_file_path )
+{
+  gmhmm_type *gv;
+  ushort BEAM_Z, SYMB_Z, STATE_Z;
+  unsigned int total_BSS, a_size;
+  int total_words; /* in short */
+  int mfcc_memory_size; /* storage of mfcc of the utterance for JAC */
+  short *search_mem;
+  int curt_mem;     /* size of used memory, in short */
+  int stt_mem = 0;  /* index of first available memory space */
+
+  /* basic gmhmm_type space */
+  gv = (gmhmm_type *)( memoryPool + stt_mem );
+  curt_mem = (sizeof(gmhmm_type) + 1) >> 1; /* in short */
+  stt_mem += curt_mem;
+  display_size("gmhmm_type memory (scratch)",curt_mem, stt_mem,  gv->total_words);
+
+  /* Save model directory */
+  if( ptr_model_file_path )
+  { 
+     gv->chpr_Model_Dir = (char*)(memoryPool + stt_mem);
+     curt_mem =  (strlen( ptr_model_file_path ) + 1) >> 1;
+     curt_mem++;
+     /* Ensure next allocation is on int boundary */
+     if( curt_mem & 0x1 )
+       curt_mem++;
+
+     strcpy( gv->chpr_Model_Dir, ptr_model_file_path );
+
+     stt_mem += curt_mem;
+  }
+  else
+  {
+     gv->chpr_Model_Dir = NULL;
+  }
+
+  /* phone-level pruning */
+  gv->pPhoneLevelPrune = NULL; 
+#ifdef MODEL_LEVEL_PRUNE
+
+  gv->pPhoneLevelPrune = memoryPool + stt_mem ;
+  /* size of cluster-dependent JAC structure and data */
+  curt_mem = ( sizeof( MODEL_PRUNE_type ) + 1 ) >> 1 ; 
+  mlp_open( gv ) ; 
+  stt_mem += curt_mem;
+  display_size("Phone-level pruning data structure memory", curt_mem, stt_mem,  gv->total_words);
+#endif
+
+  /* SBC compensation structure, if used */
+  gv->sbcState = NULL;
+#ifdef USE_SBC
+
+  gv->sbcState = (FeaHLRAccType *)( memoryPool + stt_mem );
+
+  /* size of SBC state structure */
+  curt_mem = ( sizeof( FeaHLRAccType ) + 1 ) >>1;
+  stt_mem += curt_mem;
+  display_size("SBC structure memory", curt_mem, stt_mem,  gv->total_words);
+
+  /* Construction initialization */
+  sbc_open( gv->sbcState );
+
+#endif
+
+  gv->pConf = NULL;
+#ifdef USE_CONFIDENCE
+  gv->pConf = memoryPool + stt_mem; 
+  /* size for the confidence measures */
+  curt_mem = ( sizeof ( ConfType ) + 1) >> 1; 
+  if (cm_open( (ConfType*)gv->pConf, gv) == eTIesrEngineCMMemorySize) 
+    return eTIesrEngineCMMemorySize; 
+
+  stt_mem += curt_mem; 
+  display_size("Confidence measure data structure memory", curt_mem, stt_mem,  gv->total_words);
+#endif
+
+  /* noise supression structure, if used */
+  gv->pNss = NULL;
+#ifdef USE_SNR_SS
+
+  gv->pNss = memoryPool + stt_mem ;
+
+  /* size of SBC state structure */
+  curt_mem = ( sizeof( NssType ) + 1 ) >> 1;
+  stt_mem += curt_mem;
+  display_size("Noise supression structure memory", curt_mem, stt_mem,  gv->total_words);
+
+  /* Construction initialization */
+  ss_open( (NssType*) gv->pNss , gv); 
+
+#endif
+
+  /* cluster-dependent JAC structure, if used */
+  gv->offline_vq = NULL; 
+
+#ifdef RAPID_JAC
+  gv->offline_vq = memoryPool + stt_mem ;
+  /* size of cluster-dependent JAC structure and data */
+  curt_mem = ( sizeof( OFFLINE_VQ_HMM_type ) + 10 ) >> 1 ; 
+  if (rj_open( u_rj_perc_core,  u_rj_perc_inte , gv) == eTIesrEngineVQHMMMemorySize)
+    return eTIesrEngineVQHMMMemorySize;
+  stt_mem += curt_mem;
+  display_size("Cluster-dependent JAC data structure memory", curt_mem, stt_mem,  gv->total_words);
+#endif
+
+  /* check space is enough for sym2pos mapping */
+  if (gv->trans->n_sym * NSYM >= MAX_NUM_SYMS)
+    return eTIesrEngineSym2PosMapSize;
+
+  /* variable size, so SI, SA, and SD can all use: */
+  gv->hmm_code = (ushort *)( memoryPool + stt_mem );
+  curt_mem = MAX_NBR_SEGS * 3;
+  stt_mem += curt_mem;
+  display_size("segmental information",curt_mem, stt_mem, gv->total_words);
+
+  gv->stt =  gv->hmm_code +  MAX_NBR_SEGS;
+  gv->stp =  gv->hmm_code +  MAX_NBR_SEGS * 2;
+
+  /* answer list size */
+  gv->answer = (ushort *)( memoryPool + stt_mem );
+  curt_mem = MAX_WORD_UTT;
+  stt_mem += curt_mem;
+  display_size("answer word list memory",curt_mem, stt_mem, gv->total_words);
+
+  gv->max_frame_nbr = max_frm; /* modifier */
+
+
+/* Allocate memory to hold incoming feature vectors.
+   TODO: change code to accommodate static, delta, acc ... */
+#ifdef BIT8FEAT
+  mfcc_memory_size = gv->max_frame_nbr * gv->n_mfcc;  
+#else
+  mfcc_memory_size = gv->max_frame_nbr * gv->n_mfcc*2; 
+#endif
+  
+  /* feature vector memory for JAC: */
+  gv->mem_feature = (ushort *)( memoryPool + stt_mem );
+  curt_mem = mfcc_memory_size;
+  stt_mem += curt_mem;
+  display_size("MFCC memory",curt_mem, stt_mem, gv->total_words);
+
+  total_words = gv->total_words - stt_mem;  /* the rest:  total memory for search */
+  if (total_words < 0) return eTIesrEngineSearchMemorySize;
+
+  /* search space */
+  search_mem = (short *) memoryPool + stt_mem;
+  curt_mem = total_words;
+  stt_mem += curt_mem;
+  display_size("search memory",curt_mem, stt_mem, gv->total_words);
+  
+
+  total_BSS = total_words - TIME_SZ *TIME_Z;
+  
+  
+  
+#ifdef WORDBACKTRACE
+  //-
+  a_size = BEAM_CELL_LIMIT * 2 ; //+ (BEAM_CELL_LIMIT>>1) ; // and beam may go beyond limit, so add 50% more 
+  //a_size =(BEAM_R * total_BSS) >> 16; /* must < 32766 */
+  //if (a_size >= 32766) return eTIesrEngineSearchMemoryLimit;
+
+  BEAM_Z = a_size;
+  
+  STATE_Z  = (total_BSS-a_size)*17/20/STATE_SZ;     //90% of the rest.. 1:10 ratio to SYM CeLL   (STATE_R * total_BSS) >> 16;
+  //  STATE_Z  = (total_BSS-a_size)*9/10/STATE_SZ;     //90% of the rest.. 1:10 ratio to SYM CeLL   (STATE_R * total_BSS) >> 16;
+  //STATE_Z  = (STATE_R * total_BSS) >> 16;
+  
+  SYMB_Z = (total_BSS - BEAM_SZ * BEAM_Z - STATE_SZ * STATE_Z) /SYMB_SZ ;//>> 2; /* e.g. div by SYMB_SZ */
+//printf("BEAM %d, STATE %d, SYM %d ===\n", BEAM_SZ * BEAM_Z, STATE_SZ * STATE_Z, SYMB_Z*3 );
+
+#else
+  
+  a_size = (BEAM_R * total_BSS) >> 16; /* must < 32766 */
+  if (a_size >= 32766) return eTIesrEngineSearchMemoryLimit;
+
+  BEAM_Z = a_size;
+  STATE_Z  = (STATE_R * total_BSS) >> 16;
+  SYMB_Z = (total_BSS - BEAM_SZ * BEAM_Z - STATE_SZ * STATE_Z) /SYMB_SZ; /* e.g. div by SYMB_SZ */
+
+#endif
+
+
+/*  
+  a_size = (BEAM_R * total_BSS) >> 16; // must < 32766 
+  if (a_size >= 32766) return eTIesrEngineSearchMemoryLimit;
+
+  BEAM_Z = a_size;
+  STATE_Z  = (STATE_R * total_BSS) >> 16;
+  SYMB_Z = (total_BSS - BEAM_SZ * BEAM_Z - STATE_SZ * STATE_Z) >> 2; // e.g. div by SYMB_SZ 
+*/
+
+
+  PRT_ERR(printf("Total search memory: %d (words)\n",SEARCH_SIZE(BEAM_Z, SYMB_Z, STATE_Z, TIME_Z)));
+  set_search_space(search_mem, BEAM_Z, SYMB_Z, STATE_Z, TIME_Z, gv);
+
+  return eTIesrEngineSuccess;
+}
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIesrEngineStatusType OpenASR(char model_file_name[], int total_words, 
+                             gmhmm_type* memoryPool )
+{
+   gmhmm_type *gv;
+   TIesrEngineStatusType status;
+   int gvSize;
+
+#ifdef _MONOPHONE_NET
+   FILE* fp; 
+#endif
+
+  gvSize = (sizeof(gmhmm_type) + 1) >> 1;
+  if( total_words < gvSize )
+     return eTIesrEngineMemorySizeFail;
+
+  gv = (gmhmm_type*)memoryPool;
+  gv->vocabulary = NULL;
+  status = load_models(model_file_name, gv, FALSE, NULL, NULL); 
+  if (status != eTIesrEngineSuccess) return status;
+  
+  gv->total_words = total_words; 
+  /* total memory for gmhmm_type, search and mfcc storage */
+
+  Init_Search(gv, K_mean); 
+
+#ifdef _MONOPHONE_NET
+  fp = fopen("test.xvcg", "wt");
+  output_network(fp, (short*)((gmhmm_type*)gv->pAux)->trans);
+  fclose(fp);
+  status = AllocateTIesrMemory( (short*) rs_get_decoder(gv), MAX_FRM_NBR, model_file_name);
+  if (status != eTIesrEngineSuccess) return status;
+#endif
+
+  status = AllocateTIesrMemory( (short*)memoryPool, MAX_FRM_NBR, model_file_name );
+
+  if (status != eTIesrEngineSuccess) 
+    return status; 
+
+  SetDefault(gv);
+
+  return status;
+}
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+void CloseASR(gmhmm_type *gvv)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+/*  void free_models(gmhmm_type *);*/
+  free_models(gv);  
+
+#ifdef USE_SBC
+  sbc_free( gv->sbcState );
+#endif
+
+#ifdef USE_NBEST
+  if (gv->bUseNBest) nb_close(gv); 
+#endif
+
+#if defined(RAPID_JAC)
+  rj_close(gv); 
+#endif
+
+#ifdef USE_SNR_SS
+  ss_close(gv);
+#endif
+
+#ifdef USE_CONFIDENCE
+  cm_close(gv);
+#endif
+
+#ifdef MODEL_LEVEL_PRUNE
+  mlp_close(gv);
+#endif
+
+}
+
+#ifdef _MONOPHONE_NET
+
+void print_next_list(FILE* fp, ushort s, ushort *l_next, ushort nbr_next, char color[], short revert)
+{
+  ushort p, from_node, to_node, n_next;
+
+  n_next = GET_N_NEXT(nbr_next); 
+
+  for (p=0; p<n_next; p++) {
+    if (revert) {
+      from_node = l_next[p];
+      to_node = s; 
+    }
+    else {
+      from_node = s;
+      to_node = l_next[p];
+    }
+    fprintf(fp,"edge: {thickness: 1 sourcename: \"%d\" targetname: \"%d\" color: %s}\n", 
+          from_node, to_node, color);
+  }
+}
+
+/*
+ * show a network of grammar
+ */
+void output_network(FILE *fp, short *base_net)
+{
+  ushort s;
+  TransType *trans = (TransType *) base_net;
+  SymType *p;
+  char str[ MAX_STR ];
+  
+  fprintf(fp,"graph: {\nsplines: yes\ndisplay_edge_labels: yes\n");
+  fprintf(fp,"/* list of nodes: */\n");
+
+  /* list of nodes: */
+  for (s = 0; s < trans->n_sym; s++) {
+    p = (SymType *)(base_net + trans->symlist[s]);
+    sprintf(str,"NODE: %2d PDF: %2d", s, p->hmm_code);
+    fprintf(fp,"node: { title: \"%d\" label: \"%s\" }\n", s, str);
+  } 
+  fprintf(fp,"node: { title: \"%d\" label: \"START NODE\" color: red }\n", s++);
+  fprintf(fp,"node: { title: \"%d\" label: \"STOP NODE\"  color: red }\n", s++);
+
+  fprintf(fp,"/* list of edges: */\n");
+  for (s=0; s< trans->n_sym; s++) {
+    p = (SymType *)(base_net + trans->symlist[s]);
+    fprintf(fp,"/* hmm code = %d:  */\n", p->hmm_code);
+    print_next_list(fp, s,p->next,p->n_next, "black", FALSE);
+  }
+  fprintf(fp,"/* list of entry-exit nodes: */\n");
+  p = (SymType *)(base_net + trans->start);
+  print_next_list(fp, s++,p->next,p->n_next, "green", FALSE);
+  p = (SymType *)(base_net + trans->stop);
+  print_next_list(fp, s++,p->next,p->n_next, "green", FALSE);
+  fprintf(fp,"}\n");
+}
+
+#endif
diff --git a/TIesrEngine/src/siinit.h b/TIesrEngine/src/siinit.h
new file mode 100644 (file)
index 0000000..2c11c0e
--- /dev/null
@@ -0,0 +1,23 @@
+/*=======================================================================
+ siinit.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file contains macros that are used in specifying
+ parameters for speaker-independent recognition.  Specifically,
+ the parameters define the memory sizes used during search.
+
+======================================================================*/
+
+#ifndef SIINIT_H
+#define SIINIT_H
+
+
+/* macros for search space */
+#define BEAM_R   9851
+#define STATE_R  9209
+#define TIME_Z   200 /* words, MIN 118 */
+
+#endif
diff --git a/TIesrEngine/src/siproc.cpp b/TIesrEngine/src/siproc.cpp
new file mode 100755 (executable)
index 0000000..5f36996
--- /dev/null
@@ -0,0 +1,330 @@
+/*=======================================================================
+ siproc.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This source defines a few functions used for TIesr SI recognition.
+
+======================================================================*/
+
+/*
+#include "mfcc_f.h"
+#include "gmhmm.h"
+#include "gmhmm_type.h"
+#include "uttdet.h"
+#include "gmhmm_si_api.h"
+*/
+
+/* Windows OS specific includes */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+
+#include "tiesr_config.h"
+
+#include "tiesrcommonmacros.h"
+#include "status.h"
+#include "search_user.h"
+#include "gmhmm_si_api.h"
+#include "sbc_user.h"
+#ifdef USE_NBEST
+#include <nbest_user.h>
+#endif
+
+#ifdef USE_AUDIO
+#include "volume_user.h"
+#endif
+
+/* #define WORK_ON_SEARCH */
+/*
+** works for offline tests. Has no effect if audio device is used.
+*/
+#ifdef WORK_ON_SEARCH 
+static void GetSearchInfo(void *gvv)
+{
+  gmhmm_type *gv = (gmhmm_type *)gvv;
+  PRT(printf("DR: peak count, beam = %d, sym = %d, state = %d, time = %d\n", 
+        gv->evalstat.beam.high_pos,
+        NSYM * MAX(gv->evalstat.sym[0].high_pos,gv->evalstat.sym[1].high_pos),
+        gv->evalstat.state.high_pos, gv->evalstat.time.high_pos));  
+  printf("Search size = %d words, score = %f (%d frames)\n", SEARCH_SPACE(gv->evalstat),
+        (float) gv->best_sym_scr /  gv->frm_cnt / 64,  gv->frm_cnt);
+}
+#endif
+
+/* GMHMM_SI_API */ 
+/*
+short SpeechDetected(void *gvv)
+{
+  gmhmm_type *g = (gmhmm_type *) gvv;
+
+  return ( g->speech_detected);
+}
+*/
+
+/* GMHMM_SI_API */ 
+/*
+short SpeechEnded(void *gvv)
+{
+  gmhmm_type *g = (gmhmm_type *) gvv;
+  
+  return ( g->speech_detected && ( g->uttdet_state == NON_SPEECH ));
+}
+*/
+
+/*
+** per utterance initialization
+*/
+
+#ifdef _MONOPHONE_NET
+
+static int find_hmm_idx(int c, int l, int r, int hmm_idx, Hmmtbl* hmm)
+{
+   int   i;
+   
+   for ( i = 1; i < hmm_idx; i++ )
+   {
+      if ( hmm[i].c == c && hmm[i].l == l && hmm[i].r == r ) return i;
+   }
+   
+   return 0;
+}
+
+static TIesrEngineStatusType  rs_CopyAlignFrom( gmhmm_type * src_eng, 
+                                               gmhmm_type * tgt_eng)
+{
+  short i, si; 
+  int c, l, r, ui, n_triphone; 
+  short sDoTriphone = FALSE; 
+  FILE * fp; 
+  Hmmtbl *triphonehmms = NULL; 
+  Hmmtbl tmpmem; 
+
+  fp = fopen(HMM_TRIPHONE_INDEX_FILE, "rb");
+  if (fp){
+    /* exist triphone HMM index file */
+    i = 0; 
+    fread(&n_triphone, sizeof(int), 1, fp);
+    fread(&ui, sizeof(int), 1, fp);
+    triphonehmms = (Hmmtbl*) malloc(sizeof(Hmmtbl)*ui);
+    do{
+      fread(&triphonehmms[i], sizeof(Hmmtbl), 1, fp); 
+      i++;
+    }while(i < ui); 
+    fclose(fp);
+    sDoTriphone = TRUE; 
+  }
+
+  tgt_eng->nbr_ans = src_eng->nbr_ans; 
+  for (i=0;i<tgt_eng->nbr_ans;i++) tgt_eng->answer[i] = src_eng->answer[i]; 
+  tgt_eng->nbr_seg = src_eng->nbr_seg;
+  for (i=0;i<tgt_eng->nbr_seg;i++) {
+    if (sDoTriphone){
+      if (i==0) r = n_triphone; 
+      else if (IS_WORD_END_TIME( src_eng->stp[i] )) r = n_triphone; /* word-level transcription */
+      else if (src_eng->stp[i] >= src_eng->stp[i-1]) /* sentence-level transcription */
+       r = n_triphone; 
+      else 
+       r = src_eng->hmm_code[i-1]; 
+
+      c = src_eng->hmm_code[i]; 
+
+      if (i==tgt_eng->nbr_seg - 1) l = n_triphone; 
+      else if (IS_WORD_END_TIME(src_eng->stp[i+1])) l = n_triphone; 
+      else if (src_eng->stp[i] <= src_eng->stp[i+1])
+       l = n_triphone; 
+      else
+       l = src_eng->hmm_code[i+1]; 
+      
+      si = (short) find_hmm_idx(c, l, r, ui, triphonehmms); 
+    }else
+      si = src_eng->hmm_code[i]; 
+    tgt_eng->hmm_code[i] = si; 
+    tgt_eng->stp[i] = CLR_MARK_WORD_END_TIME(src_eng->stp[i]);
+    tgt_eng->stt[i] = CLR_MARK_WORD_END_TIME(src_eng->stt[i]);
+  }
+
+  tgt_eng->hmm_dlt = 0; /* assume male model */
+  
+  if (triphonehmms) free(triphonehmms);
+  return eTIesrEngineSuccess;
+}
+#endif
+
+/*--------------------------------*/
+/*
+** back tracking search space, set error messsages:
+*/
+
+/* GMHMM_SI_API */ TIesrEngineStatusType CloseSearchEngine(TIesrEngineStatusType status, gmhmm_type *gvv)
+{
+  gmhmm_type *global_var = (gmhmm_type *) gvv;
+#ifdef _MONOPHONE_NET
+  global_var = (gmhmm_type*) global_var->pAux; 
+#endif
+
+  global_var->nbr_seg = 0;
+  global_var->nbr_ans = 0;
+  if ( status == eTIesrEngineSuccess ) search_a_frame(NULL, 0, global_var->frm_cnt - 1, global_var );
+  if ( status == eTIesrEngineSuccess ) {
+    if (global_var->best_sym != USHRT_MAX ) /* backtrace and print result */
+#ifdef USE_NBEST
+      {
+       if (global_var->bUseNBest)
+         status = nb_back_trace_beam(global_var->best_sym, global_var->frm_cnt - 1,  
+                                     global_var->hmm_code,  global_var->stt,  global_var->stp, 
+                                     &(global_var->nbr_seg), &(global_var->hmm_dlt), global_var);
+       else
+         status = back_trace_beam(global_var->best_sym, global_var->frm_cnt - 1,  
+                                  global_var->hmm_code,  global_var->stt,  global_var->stp, 
+                                  &(global_var->nbr_seg), &(global_var->hmm_dlt), global_var);
+      }
+#else
+     {
+#ifdef _MONOPHONE_NET
+      status = nb_back_trace_beam(global_var->best_sym, global_var->frm_cnt - 1,  
+                               global_var->hmm_code,  global_var->stt,  global_var->stp, 
+                               &(global_var->nbr_seg), &(global_var->hmm_dlt), global_var);
+#else   //this is the regular deco
+      //printf("===========regular==========\n");
+      if (gvv->word_backtrace==WORDBT)
+      status = back_trace_beam(global_var->best_word,  global_var->best_word_frm,
+                               global_var->hmm_code,  global_var->stt,  global_var->stp, 
+                               &(global_var->nbr_seg), &(global_var->hmm_dlt), global_var);
+      else                                     
+      status = back_trace_beam(global_var->best_sym, global_var->frm_cnt - 1,  
+                               global_var->hmm_code,  global_var->stt,  global_var->stp, 
+                               &(global_var->nbr_seg), &(global_var->hmm_dlt), global_var);
+      
+                               
+                               
+#endif
+     }
+#endif
+    else status = eTIesrEngineAlignmentFail;
+  }
+  if (global_var->nbr_seg > MAX_NBR_SEGS)  status = eTIesrEngineSegmentMemoryOut;
+  //  fprintf(stderr,"maximum (MAX_NBR_SEGS = %d) capacity exceeded\n", MAX_NBR_SEGS);
+#ifdef USE_AUDIO
+  global_var->vol = set_volume_flag(global_var);
+#endif
+#ifdef WORK_ON_SEARCH 
+  GetSearchInfo(global_var); 
+#endif
+
+#ifdef _MONOPHONE_NET
+  rs_CopyAlignFrom( global_var , gvv ); 
+#endif
+
+#ifdef USE_NBEST
+  nb_clear_time_mark(global_var);
+#endif
+
+  return status;
+}
+
+/* GMHMM_SI_API */ 
+/* 
+short GetFrameCount(void *g)
+{
+  return   ((gmhmm_type *)g)->frm_cnt;
+}
+*/
+
+/*
+** best cumulated score
+*/
+
+/* GMHMM_SI_API */ 
+/*
+long GetTotalScore(void *g)
+{
+  return   ((gmhmm_type *)g)->best_sym_scr;
+}
+*/
+
+/* GMHMM_SI_API */
+/*
+ ushort  GetCycleCount(void *g)
+{
+  return ((gmhmm_type *)g)->nbr_cpy;
+}
+*/
+
+/* GMHMM_SI_API */ 
+/*
+ushort GetAnswerCount(void const *gv) 
+{
+  return ((gmhmm_type *)gv)->nbr_ans;
+}
+*/
+
+
+/* GMHMM_SI_API */ 
+/*
+short GetVolumeStatus(void *gv)
+{
+  return ((gmhmm_type *)gv)->vol;
+}
+*/
+
+
+/* GMHMM_SI_API */ 
+/* 
+unsigned short *GetAnswerIndex(void *gv)
+{
+  return ((gmhmm_type *)gv)->answer;
+}
+*/
+
+
+/* GMHMM_SI_API */ 
+/*
+const char *GetAnswerWord(unsigned short i, void *gvv)
+{
+  gmhmm_type *gv = (gmhmm_type *)gvv;
+  return gv->vocabulary[ gv->answer[ gv->nbr_ans - 1 - i ] ];
+}
+*/
+
+/*
+** return water mark search space size
+*/
+
+unsigned short GetSearchMemorySize(gmhmm_type *gvv)
+{
+  gmhmm_type *gv = (gmhmm_type *)gvv;
+  return SEARCH_SPACE(gv->evalstat);
+}
+
+/*
+void SetTIesrPrune(void *gv, short value)
+{
+  ((gmhmm_type *)gv)->prune = value * (1<<6);
+}
+*/
+
+/*
+void GetTIesrPrune(void *gv, short *value)
+{
+  *value = (((gmhmm_type *)gv)->prune) >> 6;  
+}
+*/
+
+
+/*
+void SetTIesrTransiWeight(void *gv, short value)
+{
+  ((gmhmm_type *)gv)->tranwgt = (value)*(1<<6);
+}
+*/
+
+/*
+void GetTIesrTransiWeight(void *gv, short *value)
+{
+  *value = (((gmhmm_type *)gv)->tranwgt) >> 6; 
+}
+*/
diff --git a/TIesrEngine/src/status.h b/TIesrEngine/src/status.h
new file mode 100644 (file)
index 0000000..b799aba
--- /dev/null
@@ -0,0 +1,135 @@
+/*=======================================================================
+ status.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header defines the typedefs and enums that make up the status
+ that is reported by the TIesr Engine APIs.
+
+======================================================================*/
+
+#ifndef  _STATUS_H
+#define  _STATUS_H
+
+/*
+** returned value from recognizer's search engine         
+*/
+
+typedef enum {
+  /*
+  ** common for SI and SD
+  */
+       eTIesrEngineSuccess = 100,            
+       eTIesrEngineEvalCellOverflow,
+       eTIesrEngineBeamCellOverflow,       
+       eTIesrEngineTimeCellOverflow,       
+
+       eTIesrEngineSearchSpace = 200,     /* max_beam_cell set to zero */
+       eTIesrEngineSearchMemoryLimit,     /* search memory specified too large for engine (limit for shorts) */
+       eTIesrEngineSearchMemorySize,      /* search memory specified too small for engine */
+       eTIesrEngineVQHMMMemorySize,      
+       /* memory for VQ-HMM is too small, need to adjust VQHMM_SIZE in rapidsearch.h */
+       eTIesrEngineVQHMMGarbage,          
+       /* requested number of begining frames are too large  */ 
+       eTIesrEngineVQHMMSave, 
+       /* save VQHMM failed */
+       eTIesrEngineVQHMMLoad, 
+       /* load VQHMM failed */
+
+       /* TIesr JAC compensation failed */
+       eTIesrEngineCompFail,
+
+       eTIesrEngineFeatureMemoryOut = 300,/* feature speech vector count out of MAX_FRM */
+       eTIesrEngineSegmentMemoryOut,      /* max nbr of segments overflow */
+       eTIesrEngineMuSpaceMemoryOut,      /* search memory specified smaller than mem_block space */
+       eTIesrEngineFeatureFrameOut,       /* mfcc memory specified too small */
+       eTIesrEngineAnswerMemoryOut,       /* MAX_WORD_UTT too small */
+       eTIesrEngineTimeOut,               /* recognition time out */
+       eTIesrEngineNBestMem,              /* Not enough space to hold N-best information */
+
+       eTIesrEngineModelLoadFail = 400,   /* fail to load recognition models */
+       eTIesrEngineAlignmentFail,
+       eTIesrEngineMemorySizeFail,
+
+       eTIesrEngineFailedJAC = 425,
+
+       
+/*
+**  specific to SDSR:
+*/
+       eTIesrEngineFeatureDimensionFail = 450, /* gtm model size mismatch */
+       eTIesrEngineSegmentSizeCheckFail,       /* SEG cap_in_check failure */
+       eTIesrEngineModelFileFail,              /* model file open fail (nbr mfcc file) */
+       eTIesrEngineSaveFail,                   /* fail to save model on disk */
+       eTIesrEngineEnrollLoadFail,             /* problem in loading utterances in enrollment */
+       eTIesrEngineBackgoundCreationFail,      /* failure to calculate background clustered model */     
+
+       eTIesrEngineStateMemoryOut = 500,       /* max size for states reached */
+       eTIesrEngineSearchMemoryOut,            /* max size for search space reached */
+
+       eTIesrEngineModelMemorySize = 600,      /* gtm memory size */
+       eTIesrEngineFeatureMemorySize,          /* observation memory */
+       eTIesrEngineNetworkMemorySize,          /* total network memory */
+       eTIesrEngineModelSize,                  /* model size in SD reco */
+       eTIesrEngineBackTrackMemorySize,        /* back-tracking in SD ENRO */
+       eTIesrEngineCMMemorySize, /* memory for confidence measure is too small */
+       eTIesrEngineVALTreeMemorySize, /* memory for VAL BST is too small */
+       eTIesrEngineSym2PosMapSize,   /* memory for mapping symbol to start state index is too small */
+
+       eTIesrEngineShortUtterance = 700,       /* utterance (excluding silence) contains too few frames */
+
+       eTIesrTTSLoadHMM2Phone = 800,           /* HMM2phone mapping can not be loaded */
+       eTIesrTTSNoSilencePhone = 801,          /* no silence phone is found in the recognition network */
+       eTIesrTTSLoadPhone2Voicing = 802,       /* can not load phone 2 voicing */
+       eTIesrTTSLoadPhoneDuration = 803,       /* can not load phone durationo */
+       eTIesrTTSPhoneMismatch = 804,           /* mismatch of phone indices */
+       eTIesrTTSPhoneMissWord = 805,           /* can not locate a proper word */
+       eTIesrTTSPhoneDuration = 806,           /* no phone duration information */
+       eTIesrTTSPhoneWord = 807,               /* can not find word information */
+       eTIesrTTSSaveTTSMean = 808,             /* can not save TTS MFCC mean vectors */
+       eTIesrTTSSaveVoicing = 809,             /* can not save TTS voicing */
+       eTIesrTTSSaveDuration = 810,            /* can not save duration */
+       eTIesrTTSTTS = 811,                     /* TTS data structure does not exist */
+       eTIesrTTSPhoneList = 812,               /* phone list data is not in TTS data structure */
+       eTIesrTTSNumPhones = 813,               /* mismatch of number of phones in phone list and 
+                                                pPhone2Voicing */
+       eTIesrTTSNumWords = 814,                /* mismatch of number of words in nNumWords and 
+                                                 the autual none NULL list in pWords */
+       eTIesrTTSOutputFile = 815,              /* can not open output binary file to save synthesized voice */
+       eTIesrTTSInputMFCC = 816,               /* can not read MFCC mean vectors */
+       eTIesrTTSInputDuration = 817,           /* can not read duration information */
+       eTIesrTTSInputVoicing = 818,            /* can not read voicing information */
+       
+       eTIesrTTSNotFound = 819,                /* word sequence is not found in the recognition network */
+       eTIesrTTSOutputMeanSize = 820,          /* output mean vector size is too large, check whether the space for the mean expansion is sufficient */
+       eTIesrTTSOutput = 821              /* can not allocate space for output voice signals */
+} TIesrEngineStatusType;
+
+/*
+** status for JAC
+*/
+typedef enum {
+       eTIesrEngineJACSuccess,            
+       eTIesrEngineJACMemoryFail,         /* lack of memory */
+       eTIesrEngineJACLoadFail,
+       eTIesrEngineJACReset,              /* reset JAC and other parameters because JAC_load is failed */
+       eTIesrEngineJACSaveFail,
+       eTIesrEngineJACSBCInitFail,
+       eTIesrEngineJACSBCLoadFail,
+       eTIesrEngineJACSVAFail,
+       eTIesrEngineJACFail,
+       eTIesrEngineJACNoAlignment,
+       eTIesrEngineJACRJLoadFail
+} TIesrEngineJACStatusType;
+
+
+/*
+** volume indication: 
+*/
+
+enum {TIesrEngineVolumeLow, TIesrEngineVolumeHigh, TIesrEngineVolumeOK };
+
+
+#endif /* _STATUS_H */
diff --git a/TIesrEngine/src/tiesr_config.h b/TIesrEngine/src/tiesr_config.h
new file mode 100644 (file)
index 0000000..ee5ada4
--- /dev/null
@@ -0,0 +1,229 @@
+/*=======================================================================
+ tiesr_config.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file is used to define global flags that describe the
+ configuration used when a version of the TIesr APIs is built.  This
+ is a central repository for all flags that affect the compilation of
+ the TIesr APIs and thus makes it easy to change the configuration
+ without having to hunt down exactly where each configuration flag is
+ defined.  This header should be included as the first item in any
+ source file.
+
+======================================================================*/
+
+#ifndef TIESR_CONFIG_H
+#define TIESR_CONFIG_H
+
+/* Live mode feature and JAC processing is desired.  To imitate
+   file mode processing, comment out the line below*/
+#define LIVEMODE
+
+/* In file mode, FILEMODEWAIT determines how many frames are used
+   to compute the JAC noise estimate. */
+#define FILEMODEWAIT 10
+
+
+/*--------------------------------*/
+/* Use of live audio devices or file-mode processing */
+/* Also allows printing errors if not using audio */
+#define USE_AUDIO
+
+#ifndef USE_AUDIO 
+#define PRT_ERR(any_) any_
+#else
+#define PRT_ERR(any_)  
+#endif
+
+
+/*--------------------------------*/
+/* If PRT allows "command" to occur, then printing of HLR 
+   intermediate result information is allowed */
+#define PRT(command) /* command */
+
+
+
+/*--------------------------------*/
+/* Size of model vectors */
+
+/* TIesr Engine will store and use byte mean vectors */
+#define BIT8MEAN
+
+/* TIesr Engine will store and use byte inverse variance vectors */
+// #define BIT8VAR
+
+/* TIesr Engine will utilize 8 bit feature vectors for doing
+   adaptation.  At this time this is the only method supported.  Work
+   needs to be done on TIesr in order to use short feature vectors,
+   since at this time it means that static buffers need to be
+   allocated. */
+#define BIT8FEAT
+
+/* Compact (using 8bits) representation of mean and variance is in the
+   model binary files that the TIesr Engine will load.  This
+   configuration parameter is now defunct.  It is replaced with a
+   config.bin file that specifies the format of the mean and inverse
+   variance parameters in the input mu.bin and var.bin files. */
+//#define COMPACT
+
+
+/*--------------------------------*/
+/* Utilize SVA for variance adaptation of models */
+
+#define USE_SVA
+
+/* Qifeng's improved ISVA */
+/* Presently the SVA START_DIMENSION is 1, but further improvements in ISVA
+   may result in changing it back to 0. This research is not conclusive yet. */
+// #define ISVA 
+
+/* Qifeng's Gaussian cache */
+#define USE_GAUSSIAN_CACHE
+
+/*--------------------------------*/
+/* Defining the following macro enables IJAC for noisy speech
+   recognition */
+
+#define USE_IJAC
+
+/*--------------------------------*/
+/* Defining the following macro enables weighted SVA */
+#define USE_WSVA
+
+/*--------------------------------*/
+/* Defining the following macro to enables SBC for noisy speech 
+   recognition */
+
+#define USE_SBC
+
+/*--------------------------------*/
+/* Smooth the SBC estimate (also eliminates overflow problem) */
+
+#define SBC_PRIOR
+
+/*--------------------------------*/
+/* Not sure of the use of REC.  Not used for live TIESR. */
+
+/* #define REC */
+
+/*--------------------------------*/
+/* fast DCT */
+//#define USE_FAST_DCT
+
+/*--------------------------------*/
+/* Dynamic Prunning 
+enable the dynamic pruning (the hmm end pruning is always enabled)
+*/
+#define DYNAMIC_PRUNE
+
+// Turn on each part of dynamic pruning individually by its flag
+#define DYNAMIC_PRUNE_RAMP
+#define DYNAMIC_PRUNE_BEAM
+#define DYNAMIC_PRUNE_SUBLINEAR
+#define DYNAMIC_PRUNE_DEPTH
+
+
+/* ----- Spectral Subtraction Support ------------------
+   Berouti-style noise supression (ETSI VAD is used inside)
+   ----------------------------------------------------- */
+#define USE_SNR_SS 
+
+/*---------- Cluster-dependent JAC --------------------- 
+ Rapid JAC via offline vector-quantiziation of HMM mean vectors 
+  ------------------------------------------------------*/
+#define RAPID_JAC
+
+/*-------------------------------------------------------
+    Offline vector-quantiziation of HMM mean vectors 
+
+ -------------------- NOTICE -----------------------------
+ |   Need to load ROM2cls.bin and cls_centr.bin          |
+ |   ROM2cls.bin : ROM mean index to cluster mapping     |
+ |   cls_center.bin : 20-dimenional centroid             |
+ --------------------------------------------------------
+*/
+#define OFFLINE_CLS
+
+/* ---------------------------------------------- 
+   Decoder uses 16-bit operation
+   Packing/unpacking is not used 
+   ---------------------------------------------*/
+#define USE_16BITMEAN_DECOD
+#if defined(USE_16BITMEAN_DECOD)
+#undef BIT8MEAN
+#endif
+
+/* ----------------------------------------------
+   Enable Gaussian selection. 
+   ----------------------------------------------*/
+#define USE_GAUSS_SELECT  
+
+/* ------------------------------------------------------- 
+   Enables prunning with phone-level score. The phone-level score is the maximum
+   triphone score for a given center phone. Prunning threshold is selected
+   relative to a good phone-level score, which in the current setup,
+   is the 50% quantile of all phone-level scores. 
+   -------------------------------------------------------*/
+//#define MODEL_LEVEL_PRUNE
+#if defined(MODEL_LEVEL_PRUNE)
+#undef DYNAMIC_PRUNE
+#endif
+
+/* --------------------------------------------------------
+   Enable confidence measure output 
+   -------------------------------------------------------*/
+#define USE_CONFIDENCE
+
+/* --------------------------------------------------------------------------
+   The On-line Reference Modeling Method
+   used for two purposes:
+   1) GMM-based VAD 
+   2) Rescoring of silence model to deal with very non-stationary noise
+        such as competing speech.
+   ---------------------------------------------------------------------------*/
+#if defined(OFFLINE_CLS)&&defined(USE_SNR_SS)
+#define USE_ONLINE_REF 
+// on-line reference modeling (ORM)
+#define USE_ORM_VAD
+// method for voice activity detection and robust speech recognition
+// End-of-speech detection using the ORM method
+
+#define USE_ORM_PU // update cluster lists of ORM using background statistics
+// of the current utterance and the previous utterances. 
+
+#endif
+
+
+//#define DEV_CLS2PHONE
+
+/* --------------- Confidence-driven unsupervised adaptation -----------------
+   Update of adaptation parameters is done only if confidence score (in gmhmm_type->cm_score)
+   is above a certain threshold. The threshold is by default set at CM_ADP_THRE (-200)
+   --------------------------------------------------------------------------- */
+#if defined(USE_CONFIDENCE)
+#define USE_CONF_DRV_ADP
+#endif
+
+#define REALTIMEGUARD
+
+/* Word-level Backtrace 
+   the word-level backtrace is used in the first pass. the normal HMM-level back
+   trace is used in the second pass to align utterances to phone levels. 
+*/
+#define WORDBACKTRACE  // if commented out, HMM based BT will be used.
+
+
+// The setup below will remove all Gaussian selection and clustering processing
+
+//#undef OFFLINE_CLS
+//#undef RAPID_JAC
+//#undef USE_GAUSS_SELECT
+//#undef USE_ORIG_MEAN
+//#undef USE_ONLINE_REF
+//#undef USE_ORM_VAD
+//#undef USE_ORM_PU
+
+#endif
diff --git a/TIesrEngine/src/tiesr_engine_api_sireco.h b/TIesrEngine/src/tiesr_engine_api_sireco.h
new file mode 100644 (file)
index 0000000..2aad562
--- /dev/null
@@ -0,0 +1,245 @@
+/*=======================================================================
+ tiesr_engine_api_sireco.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header defines the interface of the TIesr SI recognizer.
+
+======================================================================*/
+
+#ifndef _TIESR_ENGINE_API_SIRECO_H
+#define _TIESR_ENGINE_API_SIRECO_H
+
+/* Needed if Windows in order to export DLL functions */
+#if defined (WIN32) || defined (WINCE)
+
+#ifndef TIESRENGINESIAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINESIAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINESIAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINESIAPI_EXPORTS
+#define TIESRENGINESIAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINESIAPI_API __declspec(dllimport)
+#endif
+
+#endif
+
+#else
+
+#ifndef TIESRENGINESIAPI_API
+#define TIESRENGINESIAPI_API
+#endif
+
+#endif
+
+
+/* 
+** Data structure specifying TIESR SI algorithms.
+*/
+
+/*
+#include "status.h"
+#include "winlen.h"
+#include "use_audio.h"
+*/
+
+#include "tiesr_config.h"
+#include "status.h"
+
+/* This is only included here, since the user must know how many
+   samples per frame to supply to the recognizer. */
+#include "winlen.h"
+
+/*--------------------------------*/
+/*  
+    The TIesrEngineSIRECOType structure defines an instance of the
+    TIesr SI recognizer.  The user must instantiate and delete an
+    instance by opening or closing the instance.
+*/
+
+/*
+** scope limitation: API function visible only within variable
+*/
+
+typedef struct gmhmm_type* TIesr_t;
+//typedef const struct  gmhmm_struct* cTIesr_t;
+typedef struct gmhmm_type const* cTIesr_t;
+
+
+typedef struct TIesrEngineSIRECO {
+
+      //
+      // Doers (functions)
+      //
+      TIesrEngineStatusType (*OpenASR)(char [], int, TIesr_t );
+      void (*CloseASR)(TIesr_t);
+      TIesrEngineStatusType (*OpenSearchEngine)(TIesr_t); 
+      TIesrEngineStatusType (*CallSearchEngine)(short [], TIesr_t, unsigned int);
+      TIesrEngineStatusType (*CloseSearchEngine)(TIesrEngineStatusType, TIesr_t );
+
+      short (*SpeechDetected)( TIesr_t);
+      short (*SpeechEnded)( TIesr_t);
+
+      TIesrEngineJACStatusType (*JAC_load)(const char *bias_file, 
+                                          TIesr_t, 
+                                          const char* pNetDir,
+                                          const char* pPhoneticClusterTree);
+
+      TIesrEngineJACStatusType (*JAC_save)(const char *bias_file, TIesr_t);
+
+      TIesrEngineJACStatusType (*JAC_clear)(TIesr_t, 
+                                           const char* aModelDir, 
+                                           const char* aTreeFile); 
+
+      TIesrEngineJACStatusType (*JAC_update)(TIesr_t);
+
+
+      //
+      // Getters (queries)
+      //
+      short (*GetFrameCount)( cTIesr_t);  
+      long (*GetTotalScore)(cTIesr_t);
+      unsigned short  (*GetCycleCount)( cTIesr_t); 
+      const unsigned short  *(*GetAnswerIndex)(cTIesr_t, short);
+      const char *(*GetAnswerWord)(unsigned short, cTIesr_t, short);
+      unsigned short (*GetAnswerCount)(cTIesr_t, short); 
+  /* setup N-best */
+  void (*SetTIesrNBest)(TIesr_t, short); 
+  void (*GetTIesrNBest)(TIesr_t , short*);
+  unsigned short  (*GetNumNbests)(cTIesr_t); 
+
+//#ifdef USE_CONFIDENCE
+      short (*GetConfidenceScore)(cTIesr_t);
+//#ifdef USE_CONF_DRV_ADP
+/* 
+   1) setup paramters for confidence-driven adaptation 
+confidence score of an utterance has to be larger than a threshold to have adaptation 
+     default adaptation_cm_threshold = -200 
+   2) set the threshold of nbest to declare low confidence score 
+   default is 20
+*/     
+  void (*SetTIesrConfidenceAdaptation)(short, short, TIesr_t); 
+  void (*GetTIesrConfidenceAdaptation)(short*, short*, TIesr_t);
+//#endif
+//#endif
+
+// Defines should not change the compatibility
+// of TIesr processing that is optional      
+//#ifdef USE_GAUSS_SELECT
+  /* setup parameters for Gaussian selection 
+     default percentage_of_core = 16384, 
+     percentage_of_inter = 0 */
+  void (*SetTIesrGaussSelection)(TIesr_t, unsigned short , unsigned short );
+  void (*GetTIesrGaussSelection)(cTIesr_t , unsigned short * , unsigned short *); 
+//#endif
+
+//#if defined(USE_ORM_VAD)||defined(USE_ONLINE_REF)
+  /* setup parameters for on-line reference modeling method
+     default setup 
+     number_of_frame_to_generate_ORM = 9
+     threshold_noise_level = 12000
+     th_llr_low_noise = 150,
+     th_llr_high_noise = 80,
+     number_of_frame_with_LLR_below_threshold = 80
+     percentage_of_the_maximum_LLR_to_get_threshold = 3277
+     starting_frame = 30 ) 
+     th_nbr_frm_after_llr_peak = 150 
+  */
+  void (*SetTIesrOnlineReferenceModel)(short, short ,
+                                      short, short , 
+                                      short, unsigned short , short, short, TIesr_t);
+  void (*GetTIesrOnlineReferenceModel)(short*, short*, short*, short*, 
+                                      short*, unsigned short*, short*, short *, TIesr_t);
+//#endif
+
+// Options should not redfine the user interface
+//#ifdef USE_SNR_SS
+  /* setup parameters for noise subtraction 
+     default setup
+     alpha = 29491
+     beta = 3 */
+  void (*SetTIesrNoiseSubtraction)(unsigned short, short, TIesr_t);
+  void (*GetTIesrNoiseSubtraction)(unsigned short*, short*, TIesr_t);
+//#endif
+
+
+#ifdef REALTIMEGUARD
+
+  
+  void (*getRealTimeGuardTh)(short*, TIesr_t); 
+  void (*getGetRealTGuard)(short*, TIesr_t); 
+  
+  void (*setRealTimeGuardTh) (short, TIesr_t);
+  void (*setGetRealTGuard) (short, TIesr_t);
+  
+#endif
+
+      short (*GetVolumeStatus)(cTIesr_t);   
+
+      //  void (*GetSearchInfo)(void *);
+      unsigned short (*GetSearchMemorySize)(TIesr_t);
+      unsigned short (*GetMaxFrames)(TIesr_t);
+
+      //
+      // Setters (modifiers)
+      //
+      void (*SetTIesrPrune)(TIesr_t, short);
+      void (*SetTIesrTransiWeight)(TIesr_t, short);
+      void (*SetTIesrSAD)(TIesr_t, short, short, short, short, short);
+      void (*SetTIesrJacRate)( TIesr_t, short);
+      void (*SetTIesrJAC)( TIesr_t, short, short, short, short, short,
+                          short, short );
+      void (*SetTIesrSBC)( TIesr_t, short );
+
+
+#ifdef USE_AUDIO
+      void (*SetTIesrVolRange)(TIesr_t, unsigned short, unsigned short);
+#endif
+
+
+      //
+      // Getters for the previous block of Setters 
+      //
+
+      void (*GetTIesrPrune)(cTIesr_t, short*);
+      void (*GetTIesrTransiWeight)(cTIesr_t, short*);
+      void (*GetTIesrSAD)(cTIesr_t, short*, short*, short*, short*, short*);
+      void (*GetTIesrJacRate)(TIesr_t, short*);
+      void (*GetTIesrJAC)( cTIesr_t, short*, short*, short*, short*, short*,
+                          short*, short* );
+      void (*GetTIesrSBC)( cTIesr_t, short* );
+
+#ifdef USE_AUDIO
+      void (*GetTIesrVolRange)(TIesr_t, unsigned short *, unsigned short *);
+#endif
+
+} TIesrEngineSIRECOType;
+
+
+/*--------------------------------*/
+/* 
+   This code defines the two functions that instantiate and close
+   an instance of the TIesrEngineSIRECOType structure which 
+   implements the TIesr SI recognizer engine.
+*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+TIESRENGINESIAPI_API void TIesrEngineOpen (TIesrEngineSIRECOType *);
+TIESRENGINESIAPI_API void TIesrEngineClose(TIesrEngineSIRECOType *);
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _TIESR_ENGINE_API_SIRECO_H */
diff --git a/TIesrEngine/src/tiesrcommonmacros.h b/TIesrEngine/src/tiesrcommonmacros.h
new file mode 100644 (file)
index 0000000..9f70012
--- /dev/null
@@ -0,0 +1,125 @@
+/*=======================================================================
+ tiesrcommonmacros.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file contains macros that may be used in several APIs.
+
+======================================================================*/
+
+#ifndef TIESRCOMMONMACROS_H
+#define TIESRCOMMONMACROS_H
+
+
+/*--------------------------------*/
+/* Types */
+
+/* The Codesourcery gnu ARM toolchain typedefs ushort in <stdlib>, causing
+ the #define to generate an error, so convert #define to typedef 
+ for consistency. */
+
+/*#define ushort unsigned short */
+typedef unsigned short ushort;
+
+#define uchar  unsigned char
+#define Boolean short
+
+/*--------------------------------*/
+/* Macros that are commonly used constants */
+#ifndef TRUE
+#define TRUE  1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+/* log10(2) = 0.30103 in Q 15 */
+#define   LOG2TOLOG10  9864               
+/* comment: in order to use LOG2TOLOG10, use q15_x(LOG2TOLOG10, value) so that the returned 
+   value has the same Q number as that of value */
+
+/* log2(10) = 3.3219 in Q 13 */
+#define   LOG10TOLOG2  27213              
+
+#define LZERO -32767
+
+/*  log2(10)/ln(10) in Q13 */
+#define LC   11818  
+
+/* ln 10 in Q13 */
+#define LN10 18863 
+
+/* 1/log2(exp(1)) in Q9 */
+#define LOG2Q9 355
+
+/* 1.0 in Q15 */
+#define ONE_Q15  32768
+
+/* 1.0 in Q9 */
+#define ONE_Q9   512
+
+/*--------------------------------*/
+/* Macros that act as functions */
+
+/*
+** un scaled: W_B in Q 15
+*/
+#define SMOOTHING(A, W_B, B) ((long) ( 32767 - W_B ) * A + (long) W_B * B)
+
+#ifndef MAX
+#define   MAX(a,b)  ((a) > (b) ? (a): (b))
+#endif
+#ifndef MIN
+#define   MIN(a,b)  ((a) < (b) ? (a): (b))
+#endif
+
+/* right shift with rounding: */
+#define LONG_RIGHT_SHIFT_N(_val_,_n_) (((_val_) + ((long)1<<((_n_)-1))) >>(_n_))
+
+/* clip */
+#define LONG2SHORT(x) (short)(MIN(MAX(x, -32768),32767))
+
+/* macros for search space */
+/* These are now in headers specific to the particular recognition task */
+//#define BEAM_R   9851
+//#define STATE_R  9209
+//#define TIME_Z   200 /* words, MIN 118 */
+
+// specific code value used in grammar parsing
+#define MCODE 65534
+
+#define IS_WORD_END_TIME( time_at ) (time_at & 0x8000)
+#define MARK_WORD_END_TIME( time_at) (time_at | 0x8000)
+#define CLR_MARK_WORD_END_TIME( time_at ) (time_at & 0x7fff)
+
+/* log(2) in Q12 */
+#define LOG2Q12 2839
+
+/* log(2*pi) in Q21 */
+#define LOG_2_PI 3854306
+
+
+/* Alignment for memory management */
+#define SHORTALIGN 0
+#define LONGALIGN 1
+#define INTALIGN 2
+
+
+/* Architecture's sizes for shorts and longs.  This assumes char, short,
+ int, long, all have sizes that are a power of 2 bytes. */
+
+#define SHORTLEN  ( sizeof(short) )
+
+/* Number of >> shifts to turn byte size to short size, assuming
+ number of bytes is multiple of number of shorts. */
+#define SHORTSHIFT ( SHORTLEN >> 1 )
+
+#define SHORTSPERLONG ( sizeof(long) >> SHORTSHIFT )
+
+/* Number of << shifts to turn long size to short size, assuming
+longs are multiple of shorts. */
+#define LONGSHIFT ( SHORTSPERLONG >> 1 )
+#endif
diff --git a/TIesrEngine/src/uttdet.cpp b/TIesrEngine/src/uttdet.cpp
new file mode 100755 (executable)
index 0000000..1b3113a
--- /dev/null
@@ -0,0 +1,450 @@
+/*=======================================================================
+ uttdet.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Utterance detector functions.
+
+======================================================================*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+#include "tiesr_config.h"
+#include "tiesrcommonmacros.h"
+#include "mfcc_f_user.h"
+#include "noise_sub_user.h"
+#include "dist_user.h"
+
+#include "uttdet_user.h"
+#include "uttdet.h"
+
+/*
+#include "mfcc_f.h"
+#include "gmhmm.h"
+#include "gmhmm_type.h"
+#include "uttdet.h"
+*/
+
+/*
+** reset sad control parameters
+*/
+
+/*
+void SetTIesrSAD(void *gvv, short a, short b, short c, short d, short e)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+
+  gv->th_speech_delta = a;
+  gv->th_min_speech_db = b; 
+  gv->th_min_beg_frm = c;
+  gv->th_min_end_frm = d;
+  gv->th_noise_flr = e ;
+}
+*/
+
+/*
+void GetTIesrSAD(void *gvv, short  *a, short  *b, short  *c, short  *d, short  *e)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+
+  *a = gv->th_speech_delta;
+  *b = gv->th_min_speech_db;
+  *c = gv->th_min_beg_frm;
+  *d = gv->th_min_end_frm;
+  *e = gv->th_noise_flr;
+}
+
+*/
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short SpeechDetected(gmhmm_type *gvv)
+{
+/*  gmhmm_type *g = (gmhmm_type *)gvv;*/
+
+  return ( gvv->speech_detected );
+}
+
+
+/*--------------------------------*/
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short SpeechEnded(gmhmm_type *gvv)
+{
+  //  return ( gvv->speech_detected && ( gvv->uttdet_state == NON_SPEECH ) );
+
+#ifdef USE_ORM_VAD
+  /* the modification corrected 401 error, no alignment,
+     also works if there is sniff before the speech signal*/
+  /* the new modification to end speech 
+     printf(" %d %d %d %d \n", gvv->speech_detected ,
+     gvv->uttdet_state == NON_SPEECH , 
+     gvv->sr_is_end_of_grammar, 
+     gvv->gbg_end_of_speech); 
+  */
+  return ( gvv->sr_is_end_of_grammar && gvv->gbg_end_of_speech);
+
+  /*
+  return ( gvv->sr_is_end_of_grammar && 
+          ((gvv->speech_detected && gvv->uttdet_state == NON_SPEECH ) 
+           || gvv->gbg_end_of_speech));
+  */
+  //  return ( (gvv->speech_detected && ( gvv->uttdet_state == NON_SPEECH ) 
+  //    && gvv->sr_is_end_of_grammar ) || gvv->gbg_end_of_speech);
+#else
+  /* the modification corrected 401 error, no alignment */
+  return ( gvv->speech_detected && ( gvv->uttdet_state == NON_SPEECH ) 
+          && gvv->sr_is_end_of_grammar );
+#endif
+}
+
+/* ---------------------------------------------------------------------------
+   extern
+   ---------------------------------------------------------------------- */
+
+/* Now defined in mfcc_f_user.h
+extern void fft(short *real, short *imag);
+*/
+/* ---------------------------------------------------------------------------
+   attenuate low and high frequency components
+   ---------------------------------------------------------------------- */
+
+static void frequency_shaping( short *ps )
+{
+  short i, alpha, win2 = WINDOW_LEN >>1;
+  long  tmp;
+
+  /* attenuate low freq */
+
+  for (i = L_CUT, alpha = 32767; i >= 0; i--) {
+    
+    tmp = (long) ps[ i ] * alpha;
+    tmp >>= 15;
+    ps[ i ] = (short) tmp;
+
+    tmp = (long) alpha * L_RATE;
+    tmp >>= 15;
+    alpha = (short) tmp;
+  }
+
+  /* attenuate high freq */
+
+  for (i = H_CUT, alpha = 32767; i < win2; i++) {
+    
+    tmp = (long) ps[ i ] * alpha;
+    tmp >>= 15;
+    ps[ i ] = (short) tmp;
+
+    tmp = (long) alpha * H_RATE;
+    tmp >>= 15;
+    alpha = (short) tmp;
+  }
+
+  /* power spectrum is symmetric */
+
+  ps[ win2 ] = 0;
+  for (i = 0; i < win2; i++)
+    ps[ win2 + i ] = ps[ win2 - i ];
+
+}
+
+/* ---------------------------------------------------------------------------
+   normalize
+   ---------------------------------------------------------------------- */
+
+static void
+normalize(short *sig, short len, short *norm)
+{
+  short i, tmp, max;
+
+  max = 0;
+
+  /* find max */
+
+  for (i = 0; i < len; i++) {
+    tmp = sig[ i ] > 0 ? sig[ i ] : (- sig[ i ]);
+    if ( tmp > max ) max = tmp;
+  }
+
+  /* normalize to most precision */
+
+  if ( max > 0 ) {
+
+    for (*norm = 0; max < 0x4000; (*norm) ++)
+      max <<= 1;
+    
+    *norm = *norm > 0 ? *norm - 1 : *norm;
+
+  } else {
+
+    *norm = 0;
+  }
+
+  /* normalize */
+
+  for (i = 0; i < len; i++) {
+
+    sig[ i ] <<= *norm;
+  }
+}
+
+
+/* ---------------------------------------------------------------------------
+   update speech level and noise level
+   ---------------------------------------------------------------------- */
+
+TIESRENGINECOREAPI_API short
+update_level(short new_val, short old, short uptc, short dntc)
+{
+  long  tmp;
+  short tc;
+
+  tc = new_val > old ? uptc : dntc;
+  tmp =  SMOOTHING(new_val, tc, old);
+  return (short) LONG_RIGHT_SHIFT_N(tmp, 15);
+
+
+  // tmp = (long) ( 32767 - tc ) * new_val;
+  // tmp += (long) tc * old;
+  // tmp += ( 1 << 14 );
+  // tmp >>= 15;
+}
+
+/*
+**(per utterance) init utterance detection parameters
+*/
+
+TIESRENGINECOREAPI_API void
+init_uttdet(gmhmm_type *gv)
+{
+  gv->sm_autoc = INI_NOISE * AC_SCALE;
+  gv->noise_level = INI_NOISE * AC_SCALE;
+  gv->speech_level = INI_SPEECH * AC_SCALE;
+  gv->uttdet_state = NON_SPEECH;
+  gv->speech_detected = 0; 
+  gv->sr_is_end_of_grammar = FALSE; 
+
+  gv->uttdet_end_frm = -1; 
+  gv->uttdet_beg_frm = -1; 
+  
+  init_spect_sub(&(gv->noise_smooth));
+
+}
+
+
+
+/*--------------------------------
+  set_default_uttdet
+
+  Set utterance detector default parameters.  This should 
+  be called when opening the asr.
+  --------------------------------*/
+TIESRENGINECOREAPI_API void set_default_uttdet(gmhmm_type *gv)
+{
+  /*
+  ** set default thresholds
+  */
+  gv->th_noise_flr = TH_NOISE_FLR_DEFAULT;
+  gv->th_speech_delta = TH_SPEECH_DELTA_DEFAULT;
+  /* min dB level to be considered as speech */
+  gv->th_min_speech_db = TH_MIN_SPEECH_DB_DEFAULT;
+  /* larger (e.g. 5)  -> more robust to  noise pulses */
+  gv->th_min_beg_frm = TH_MIN_BEG_FRM_DEFAULT;
+  /* smaller (.e.g. 30) --> quicker latency  time */
+  gv->th_min_end_frm = TH_MIN_END_FRM_DEFAULT;
+
+}
+
+//void set_uttdet(short min_speech_db, gmhmm_type *gv)
+//{
+//  /* min dB level to be considered as speech */
+//  gv->th_min_speech_db = min_speech_db;
+//}
+
+/* ---------------------------------------------------------------------------
+   utterance detection state machine, 
+   input: uttdet_isspeech, uttdet_state; 
+   output: uttdet_state
+   ---------------------------------------------------------------------- */
+static void
+uttdet_state_machine(short frm_cnt, gmhmm_type *gv)
+{
+  switch ( gv->uttdet_state ) {
+
+  case NON_SPEECH:
+    
+    if (  gv->uttdet_isspeech ) {
+
+      gv->uttdet_cnt = 1;
+      gv->uttdet_beg_frm = frm_cnt - 1;
+      gv->delta_sum_accum = (long) ( gv->sm_autoc -  gv->noise_level);
+      gv->uttdet_state = PRE_SPEECH;
+    }
+
+    break;
+
+  case PRE_SPEECH:
+
+    if ( gv->uttdet_isspeech ) {
+      short go_to_speech;
+      gv->uttdet_cnt++;
+      gv->delta_sum_accum += gv->sm_autoc - gv->noise_level;
+
+      //      if ( uttdet_cnt < MIN_BEG_FRM ) {
+       /* SPEECH_DELTA * 1.25: */
+      go_to_speech = (gv->uttdet_cnt == gv->th_min_beg_frm) ||
+                    ((gv->delta_sum_accum > ((gv->th_speech_delta + (gv->th_speech_delta >> 2)) * gv->uttdet_cnt)) &&
+                     (gv->uttdet_cnt >= gv->th_min_beg_frm - 2));
+      if  (!go_to_speech) 
+
+       gv->uttdet_state = PRE_SPEECH;
+
+      else {
+
+       gv->uttdet_state = IN_SPEECH;
+      }
+    } else {
+
+      gv->uttdet_state = NON_SPEECH;
+    }
+
+    break;
+
+  case IN_SPEECH:
+
+    if ( gv->uttdet_isspeech ) {
+
+      gv->uttdet_state = IN_SPEECH;
+
+    } else {
+
+      gv->uttdet_end_frm = frm_cnt;
+      gv->uttdet_cnt = 1;
+      gv->uttdet_state = PRE_NONSPEECH;
+    }
+      
+    break;
+
+  case PRE_NONSPEECH:
+
+    if ( gv->uttdet_isspeech ) {
+
+      gv->uttdet_state = IN_SPEECH;
+
+    } else {
+
+      if ( gv->uttdet_cnt < gv->th_min_end_frm ) {
+
+       gv->uttdet_cnt++;
+       gv->uttdet_state = PRE_NONSPEECH;
+
+      } else {
+
+       gv->uttdet_state = NON_SPEECH;
+      }
+    }
+
+    break;
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   compute autocorrelation
+   ---------------------------------------------------------------------- */
+
+#ifndef USE_AUDIO
+FILE *pf = NULL; /* for debug use */
+#endif
+
+
+void
+compute_uttdet(short *power_spectrum, short cnt, short frm_cnt, short *mfcc, 
+              gmhmm_type *gv, NormType *var_norm)
+{
+  short imag[ WINDOW_LEN ];
+  short i;
+  unsigned long  tmp_l;
+  short tmp_s, max_pow;
+  short norm3, norm4;
+  short autoc;               /* autocorrelation */
+  short arg_max;
+
+  /* fixed-point MFCC front end power spectrum need this much compensation */
+  norm3 = ( var_norm->norm0 + var_norm->norm1 - 8 ) * 2 + ( var_norm->norm2 - 2 ) - 15;
+
+  /* in-place spectral subtraction */
+  noise_subs(power_spectrum, norm3, gv->ps_noisy_smoothed, gv->noise_floor, 
+            gv->signal_cnt, &(gv->noise_smooth)); 
+
+  /* attenuate lower and higher frequency bins */
+  frequency_shaping( power_spectrum );
+
+  //n=WINDOW_LEN>>1; energy=0;for (i = 0; i < n; i++) energy+=power_spectrum[i]; energy=energy
+  for (i = 0; i < WINDOW_LEN; i++) imag[ i ] = 0;
+
+  /* normalize to the most precision */
+  normalize( power_spectrum, WINDOW_LEN, &norm4 );
+
+  norm3 += norm4;
+
+  /* back to time-domain, get AC */
+  fft( power_spectrum, imag );    /* IFFT, input symmectric, by FFT , */
+
+  /* search for the fundamental frequency */
+  tmp_s = power_spectrum[ LEND ];
+  for (i = LEND, arg_max = LEND; i < HEND; i++)
+    if ( power_spectrum[ i ] > tmp_s ) {
+      tmp_s = power_spectrum[ i ];
+      arg_max = i;
+    }
+  
+  max_pow = tmp_s;
+
+  tmp_l = tmp_s;
+  tmp_s = log_polyfit( tmp_l, norm3);   /* Q 9 */
+
+  tmp_l = (long) tmp_s * LOG2TOLOG10;/* Q 9 * Q 15 */
+  tmp_l *= 10;
+  autoc = tmp_l >> 18;               /* 15 + 9 - 18, Q 6 */
+  
+  /* smoothed autoc */
+
+  tmp_l = SMOOTHING(gv->sm_autoc, SMOOTH,  autoc);
+  gv->sm_autoc = LONG_RIGHT_SHIFT_N(tmp_l,15);
+
+  /* track peak and dip */
+
+  gv->speech_level = update_level( gv->sm_autoc, gv->speech_level, SLUPTC, SLDNTC );// 0.36 0.998 if arg1 big, use fast update, if arg1 small, use slow keep
+  gv->noise_level  = update_level(gv-> sm_autoc, gv->noise_level,  NLUPTC, NLDNTC );//
+  
+  tmp_s=gv->sm_autoc;
+  tmp_s+=tmp_s>>4 ;  
+  tmp_s+=tmp_s>>5;
+  
+  // tmp_s-=100;  //2.5dB *64 
+  /*noise floor default =0,  th speech delta=10 db, speech level=50*/
+  if ( tmp_s > ( MAX((gv->th_noise_flr *  AC_SCALE), gv->noise_level) + gv->th_speech_delta * AC_SCALE ) &&
+       ( tmp_s > gv->th_min_speech_db * AC_SCALE ) )
+    gv->uttdet_isspeech = 1; 
+  else
+    gv-> uttdet_isspeech = 0;
+
+  /* state */
+  
+  uttdet_state_machine(frm_cnt, gv);
+  
+#ifndef USE_AUDIO
+  if (pf) fprintf(pf,"[%3d] %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d\n",frm_cnt,
+                 gv->sm_autoc, gv->speech_level, gv->noise_level, gv->uttdet_isspeech, gv->uttdet_state, 
+                 mfcc[0],gv->noise_level+ gv->th_speech_delta * AC_SCALE, log_pow, arg_max,
+                 gv->th_noise_flr * AC_SCALE ,gv->th_speech_delta,gv->th_min_speech_db
+                 ); 
+#endif
+
+}
diff --git a/TIesrEngine/src/uttdet.h b/TIesrEngine/src/uttdet.h
new file mode 100644 (file)
index 0000000..71e6a3b
--- /dev/null
@@ -0,0 +1,101 @@
+/*=======================================================================
+ uttdet.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file contains the utterance detector parameters.
+======================================================================*/
+
+#ifndef _UTTDET_H
+#define _UTTDET_H
+
+/*--------------------------------
+  Utterance detector default parameters
+  --------------------------------*/
+static const int TH_NOISE_FLR_DEFAULT = 0;
+
+static const int TH_SPEECH_DELTA_DEFAULT = 10;
+
+/* min dB level to be considered as speech */
+static const int TH_MIN_SPEECH_DB_DEFAULT = 50;
+
+/* larger (e.g. 5)  -> more robust to  noise pulses */
+static const int TH_MIN_BEG_FRM_DEFAULT = 5;
+
+/* smaller (.e.g. 30) --> quicker latency  time, but
+ pauses will be interpreted as end of speech */
+#ifdef USE_AUDIO
+static const int TH_MIN_END_FRM_DEFAULT = 35;
+#else
+static const int TH_MIN_END_FRM_DEFAULT = 70;
+#endif
+
+/*--------------------------------
+  Constants by define
+  --------------------------------*/
+
+// #define  L_CUT          19         /* 256 * 600 / 8000 */
+//#define  H_CUT          58         /* 256 * 1800 / 8000 */
+
+//#define  L_CUT  6     /* 256 * 200/8000 */
+
+#define  L_CUT  13     /* 256 * 400/8000 */
+#define  H_CUT  86    /* 256*2700/8000 */
+
+
+#define  L_RATE         22938      /* 0.70, Q 15 */
+#define  H_RATE         27853      /* 0.85, Q 15 */
+#define  LEND           20         /* 400 Hz */
+#define  HEND           120       /* 75 Hz (66Hz?) */
+
+#define  SMOOTH        16384  /* 13107 (0.4) */      /* 0.5, Q 15 */
+
+#define  AC_SCALE       64         /* auto correlation scale */
+//#define  SPEECH_DELTA   10    
+#define  INI_NOISE      70
+#define  INI_SPEECH    (INI_NOISE /* +SPEECH_DELTA */)
+//#define  MIN_SPEECH_DB  50  /* min dB level to be considered as speech */
+
+//#ifdef USE_AUDIO
+//#define  MIN_END_FRM    35  /* smaller (.e.g. 30) --> quicker latency  time */
+//#else
+//#define  MIN_END_FRM    70  /* file based, handling longer pausses */
+//#endif
+
+#define  SLUPTC         12055      /* exp(-1) = 0.3679, Q 15 */
+#define  SLDNTC         32119     /* exp(-1/50) = .980198 Q 15 */
+#define  NLUPTC         SLDNTC 
+#define  NLDNTC         SLUPTC
+
+//#define  SLDNTC         31693      /* exp(-1/30) = 0.9672, Q 15 */
+//#define  NLUPTC         32440      /* exp(-1/100) = 0.99, Q 15 */
+// #define  NLDNTC         21964      /* exp(-2/5) = 0.6703, Q 15 */
+
+//#define  MIN_BEG_FRM   5  /* larger (e.g. 5)  -> more robust to  noise pulses */
+
+
+/*
+extern void init_uttdet(gmhmm_type *);
+extern void set_default_uttdet(gmhmm_type *);
+
+extern void compute_uttdet(short *power_spectrum, short cnt,short frm_cnt, short *, gmhmm_type *, NormType *);
+
+extern void noise_subs(short *ps_signal, short norm, short *ps_noisy_smoothed, short *noise_floor,
+                      ushort, short *);
+
+extern short update_level(short new_val, short old, short uptc, short dntc);
+extern void init_spect_sub(short *);
+
+*/
+
+/*
+** un scaled: W_B in Q 15
+*/
+/*
+#define SMOOTHING(A, W_B, B) ((long) ( 32767 - W_B ) * A + (long) W_B * B)
+*/
+
+#endif
diff --git a/TIesrEngine/src/uttdet_user.h b/TIesrEngine/src/uttdet_user.h
new file mode 100755 (executable)
index 0000000..d8842cf
--- /dev/null
@@ -0,0 +1,92 @@
+/*=======================================================================
+ uttdet_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file defines the interface with the tiesr utterance extractor.
+
+======================================================================*/
+
+#ifndef UTTDET_USER_H
+#define UTTDET_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+
+#include "gmhmm_type.h"
+#include "mfcc_f_user.h"
+#include "uttdet.h"
+
+/* Utterance detector parameters exposed to the user.  These should
+   not be exposed to the user but for now they are exposed.  The
+   utterance detector state should be in an enum.
+*/
+
+#define  NON_SPEECH     0
+#define  PRE_SPEECH     1
+#define  IN_SPEECH      2
+#define  PRE_NONSPEECH  3
+
+
+/* 30 seconds at 50 frames/second */
+#define TIMEOUT 1500
+
+/* the minimum frame count in decoder to declare end of grammar */
+#define TH_END_GRAMMAR_MIN_END_FRM 40
+
+/*the cushion in number of frames before detected speech for noise estimate*/
+#define NOISECUSHION 8  
+
+/*--------------------------------*/
+/* The uttdet user interface functions */
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short SpeechDetected(gmhmm_type *gvv);
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API short SpeechEnded(gmhmm_type *gvv);
+
+TIESRENGINECOREAPI_API void init_uttdet(gmhmm_type *);
+
+TIESRENGINECOREAPI_API void set_default_uttdet(gmhmm_type *);
+
+TIESRENGINECOREAPI_API void compute_uttdet(short *power_spectrum, short cnt,short frm_cnt, short *, gmhmm_type *, NormType *);
+
+TIESRENGINECOREAPI_API short update_level(short new_val, short old, short uptc, short dntc);
+
+TIESRENGINECOREAPI_API void init_spect_sub(short *);
+
+#endif
diff --git a/TIesrEngine/src/volume.cpp b/TIesrEngine/src/volume.cpp
new file mode 100755 (executable)
index 0000000..05f4426
--- /dev/null
@@ -0,0 +1,80 @@
+/*=======================================================================
+ volume.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Simple volume measure based on maximum signal swing.
+
+======================================================================*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+/*
+#include "mfcc_f.h"
+#include "gmhmm.h"
+#include "gmhmm_type.h"
+#include "volume.h"
+*/
+
+#include "tiesr_config.h"
+
+#ifdef USE_AUDIO
+
+
+#include "status.h"
+#include "gmhmm_type.h"
+#include "volume_user.h"
+
+/*
+** check volume range 
+*/
+
+/* GMHMM_SI_API */
+TIESRENGINECOREAPI_API void SetTIesrVolRange(gmhmm_type *gvv, unsigned short low_v, unsigned short high_v)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+  gv->low_vol_limit = low_v; 
+  gv->high_vol_limit = high_v;
+}
+
+/* GMHMM_SI_API */
+TIESRENGINECOREAPI_API void GetTIesrVolRange(gmhmm_type* gvv, unsigned short *low_v, unsigned short *high_v)
+{
+  gmhmm_type *gv = (gmhmm_type *) gvv;
+  *low_v  = gv->low_vol_limit;
+  *high_v = gv->high_vol_limit;
+}
+
+
+TIESRENGINECOREAPI_API short set_volume_flag(gmhmm_type *gv)
+{
+  short volume_flag;
+  
+  //   short volume = (amplitude_max - amplitude_min) >> 1;
+     unsigned short volume = (unsigned short)(((long)gv->amplitude_max - (long)gv->amplitude_min) >> 1);   
+  
+     if (volume < gv->low_vol_limit) {
+        PRT_ERR(printf("volume too low (%d)!\n", volume));
+        volume_flag = TIesrEngineVolumeLow;
+     }
+     else {
+       if (volume >  gv->high_vol_limit ) { 
+        PRT_ERR(printf("volume too high (%d)!\n", volume));
+        volume_flag = TIesrEngineVolumeHigh;
+       }
+       else {
+        PRT_ERR(printf("volume (%d) OK.\n", volume));
+        volume_flag = TIesrEngineVolumeOK;
+       }
+     }
+     return volume_flag;
+}
+
+
+#endif
+
diff --git a/TIesrEngine/src/volume_user.h b/TIesrEngine/src/volume_user.h
new file mode 100644 (file)
index 0000000..6308cb3
--- /dev/null
@@ -0,0 +1,68 @@
+/*=======================================================================
+ volume_user.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ Encapsulates the user interface to setting volume.
+
+======================================================================*/
+
+#ifndef VOLUME_USER_H
+#define VOLUME_USER_H
+
+
+/*--------------------------------------------------------------
+The Windows method of exporting functions from a DLL.
+---------------------------------------------------------------*/
+#if defined (WIN32) || defined (WINCE)
+
+/* If it is not defined already, define a macro that does
+Windows format export of DLL functions */
+#ifndef TIESRENGINECOREAPI_API
+
+// The following ifdef block is the standard way of creating macros which
+// make exporting from a DLL simpler. All files within this DLL are compiled
+// with the TIESRENGINECOREAPI_EXPORTS symbol defined on the command line.
+// This symbol should not be defined on any project that uses this DLL.
+// This way any other project whose source files include this file see
+// TIESRENGINECOREAPI_API functions as being imported from a DLL,
+// whereas this DLL sees symbols defined with this macro as being exported.
+#ifdef TIESRENGINECOREAPI_EXPORTS
+#define TIESRENGINECOREAPI_API __declspec(dllexport)
+#else
+#define TIESRENGINECOREAPI_API __declspec(dllimport)
+#endif
+#endif
+
+#else
+
+#ifndef TIESRENGINECOREAPI_API
+#define TIESRENGINECOREAPI_API
+#endif
+
+#endif
+/*--------------------------------------------------------------------*/
+
+
+#include "gmhmm_type.h"
+
+#define LOW_VOL_LIMIT 1024
+
+/* Note: 30000 doesn't work well with some PCs */
+#define HIGH_VOL_LIMIT 28000 
+
+
+/* GMHMM_SI_API */
+TIESRENGINECOREAPI_API void SetTIesrVolRange(gmhmm_type *gvv, unsigned short low_v,
+                     unsigned short high_v);
+
+/* GMHMM_SI_API */ 
+TIESRENGINECOREAPI_API void GetTIesrVolRange(gmhmm_type *gvv, unsigned short *low_v,
+                     unsigned short *high_v);
+
+
+TIESRENGINECOREAPI_API short set_volume_flag(gmhmm_type *gv);
+
+#endif
diff --git a/TIesrEngine/src/winlen.h b/TIesrEngine/src/winlen.h
new file mode 100644 (file)
index 0000000..9bb51c8
--- /dev/null
@@ -0,0 +1,22 @@
+/*=======================================================================
+ winlen.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header defines how many audio samples make up a frame that TIesr
+ is expecting.  This file is somewhat misnamed, since it is defining
+ frame length instead of a window length.
+
+======================================================================*/
+
+#ifndef _WINLEN_H
+#define _WINLEN_H
+
+/* 
+**  number of samples in a frame of data that user must copy to buffer
+*/
+#define   FRAME_LEN    160
+
+#endif /* _WINLEN_H */
diff --git a/TIesrFA/ReadMe.txt b/TIesrFA/ReadMe.txt
new file mode 100644 (file)
index 0000000..b1e49ba
--- /dev/null
@@ -0,0 +1,83 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+----------------
+
+
+The TIesrFA API collects audio data and places the data into frames of a defined
+number of samples for use by the TIesr speech recognizer tools.  The API
+interface is completely specified by the TIesrFA_User.h file found in the src
+directory.  The purpose of the creation of this interface is to provide a
+consistent interface for use by all of the other TIesr speech recognizer tools.
+
+Each hardware device and OS will likely have one or more unique APIs for
+collecting audio input.  Since these methods will be OS and hardware dependent,
+the TIesrFA API interface will have to be implemented for each device and OS. 
+This will be the responsibility of the target OS/device application designer.
+
+Using the testtiesrfa Program
+-----------------------------
+
+The testtiesrfa program exercises the TIesrFA API. The command line for the
+program is:
+
+testtiesrfa sample_rate frm_samples num_frames num_circ num_audio read_rate
+            device out_file
+
+sample_rate: Sample rate in samples/second
+frm_samples: Number of samples in a frame
+num_frames:  Number of frames of samples to write to out_file
+num_circ:    Number of frames held in a circular buffer of frames
+num_audio:   Number of input audio buffer frames, see below
+read_rate:   Device specific parameter, see below
+device:      Name of audio device to interact with, see below
+out_file:    Output raw audio file
+
+
+testtiesrfa collects audio data and places it into a circular buffer of frames
+that are then written to an output file. The number of samples in a frame is
+specified by frm_samples, and the number of frames in the frame circular buffer
+is given by num_circ.  The testtiesrfa program will output num_frames of frames
+of audio data to out_file. 
+
+The arguments num_audio, read_rate, and device will take on different meanings
+depending on the platform audio interface, since these parameters specify how to
+set up the driver parameters for the audio. In all cases, if the device argument
+specifies the name of an existing file, then audio data is input from the file
+instead of a real audio device. 
+
+The current release of TIesr contains two implementations of TIesrFA and
+testtiesrfa. The implementation of TIesrFA for Windows uses the Windows Waveform
+Audio API to interface with Windows audio devices. In this case the num_audio
+argument specifies the number of audio buffers that are queued to the audio
+driver to collect data. The number of samples in an audio buffer is a multiple
+of the frm_samples, and the multiple is specified by the read_rate argument.
+Typically read_rate is a small integer. If the device argument is not the name
+of an existing file, then it is ignored and TIesrFA uses the Waveform Audio API
+to locate the audio driver to use.
+
+The implementation of TIesrFA for Linux uses the ALSA library API. In this case,
+the read_rate argument specifies the duration between reads of the audio driver
+ring data buffer in microseconds. The num_audio argument specifies a multiplier
+that sets the size of the ALSA ring buffer as a multiple of the number of
+samples occurring in the read_rate duration. The device argument specifies the
+ALSA pcm device to use, for example "plughw:0,0".
+
+An example of running the testtiesrfa program from the top-level distribution
+directory on a Linux OS is shown below. In this example, data is collected at
+8000 samples/second, with a circular buffer frame size of 160 samples (20 msec).
+200 frames, or four seconds of audio is recorded. The circular frame buffer can
+hold 50 frames. The ALSA ring buffer will hold 10 times the read rate in
+samples.  Since the read rate is 20000 microseconds (20msec), the ALSA ring
+buffer will hold 200 msec of data. The ALSA plughw:0,0 device is used, and the
+four seconds of speech is output to the file Data/AudioDir/test.raw.
+
+Dist/LinuxReleaseGnu/bin/testtiesrfa \
+      8000 \
+      160 \
+      200 \
+      50 \
+      10 \
+      20000 \
+      plughw:0,0 \
+      Data/AudioDir/test.raw
\ No newline at end of file
diff --git a/TIesrFA/TIesrFAWinso/.dep.inc b/TIesrFA/TIesrFAWinso/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrFA/TIesrFAWinso/Makefile b/TIesrFA/TIesrFAWinso/Makefile
new file mode 100755 (executable)
index 0000000..524ba36
--- /dev/null
@@ -0,0 +1,111 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrFA/TIesrFAWinso/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrFA/TIesrFAWinso/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100755 (executable)
index 0000000..88f3d8a
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc.exe
+CCC=g++.exe
+CXX=g++.exe
+FC=
+AS=as.exe
+
+# Macros
+CND_PLATFORM=Cygwin-Windows
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_WM5.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lwinmm
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/libTIesrFAWin.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrFAWin.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -v -mno-cygwin -shared -o ../../Dist/${CND_CONF}/libTIesrFAWin.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_WM5.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFA_WM5.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRFA_EXPORTS -DWIN32 -DCYGWIN -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_WM5.o ../src/TIesrFA_WM5.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/libTIesrFAWin.dll
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TIesrFAWinso/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrFA/TIesrFAWinso/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100755 (executable)
index 0000000..e663b23
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc.exe
+CCC=g++.exe
+CXX=g++.exe
+FC=
+AS=as.exe
+
+# Macros
+CND_PLATFORM=Cygwin-Windows
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_WM5.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lwinmm
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/libTIesrFAWin.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrFAWin.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -v -mno-cygwin -shared -o ../../Dist/${CND_CONF}/libTIesrFAWin.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_WM5.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFA_WM5.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRFA_EXPORTS -DWIN32 -DCYGWIN -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_WM5.o ../src/TIesrFA_WM5.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/libTIesrFAWin.dll
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TIesrFAWinso/nbproject/Makefile-impl.mk b/TIesrFA/TIesrFAWinso/nbproject/Makefile-impl.mk
new file mode 100755 (executable)
index 0000000..bab302e
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TIesrFAWinso
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrFA/TIesrFAWinso/nbproject/Makefile-variables.mk b/TIesrFA/TIesrFAWinso/nbproject/Makefile-variables.mk
new file mode 100755 (executable)
index 0000000..e611497
--- /dev/null
@@ -0,0 +1,24 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Windows
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=libTIesrFAWin.dll
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/libTIesrFAWin.dll
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Windows/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=libTIesrFAWinso.dll.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Windows/package/libTIesrFAWinso.dll.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Windows
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=libTIesrFAWin.dll
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/libTIesrFAWin.dll
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Windows/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=libTIesrFAWinso.dll.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Windows/package/libTIesrFAWinso.dll.tar
diff --git a/TIesrFA/TIesrFAWinso/nbproject/Package-WindowsDebugMinGW.bash b/TIesrFA/TIesrFAWinso/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100755 (executable)
index 0000000..4b74200
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Windows
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrFAWin.dll
+OUTPUT_BASENAME=libTIesrFAWin.dll
+PACKAGE_TOP_DIR=libTIesrFAWinso.dll/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFAWinso.dll/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAWinso.dll.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAWinso.dll.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TIesrFAWinso/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrFA/TIesrFAWinso/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100755 (executable)
index 0000000..ac61cc7
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Windows
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrFAWin.dll
+OUTPUT_BASENAME=libTIesrFAWin.dll
+PACKAGE_TOP_DIR=libTIesrFAWinso.dll/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFAWinso.dll/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAWinso.dll.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAWinso.dll.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TIesrFAWinso/nbproject/configurations.xml b/TIesrFA/TIesrFAWinso/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..ab54deb
--- /dev/null
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<configurationDescriptor version="62">\r
+  <logicalFolder name="root" displayName="root" projectFiles="true">\r
+    <logicalFolder name="HeaderFiles"\r
+                   displayName="Header Files"\r
+                   projectFiles="true">\r
+      <itemPath>../src/TIesrFA_User.h</itemPath>\r
+      <itemPath>../src/TIesrFA_WM5.h</itemPath>\r
+    </logicalFolder>\r
+    <logicalFolder name="ResourceFiles"\r
+                   displayName="Resource Files"\r
+                   projectFiles="true">\r
+    </logicalFolder>\r
+    <logicalFolder name="SourceFiles"\r
+                   displayName="Source Files"\r
+                   projectFiles="true">\r
+      <itemPath>../src/TIesrFA_WM5.cpp</itemPath>\r
+    </logicalFolder>\r
+    <logicalFolder name="ExternalFiles"\r
+                   displayName="Important Files"\r
+                   projectFiles="false">\r
+      <itemPath>Makefile</itemPath>\r
+    </logicalFolder>\r
+  </logicalFolder>\r
+  <projectmakefile>Makefile</projectmakefile>\r
+  <confs>\r
+    <conf name="WindowsDebugMinGW" type="2">\r
+      <toolsSet>\r
+        <developmentServer>localhost</developmentServer>\r
+        <compilerSet>Cygwin|Cygwin</compilerSet>\r
+        <platform>3</platform>\r
+      </toolsSet>\r
+      <compileType>\r
+        <cTool>\r
+          <commandLine>-v -mno-cygwin</commandLine>\r
+          <preprocessorList>\r
+            <Elem>TIESRFA_IMPORTS</Elem>\r
+            <Elem>WIN32</Elem>\r
+            <Elem>CYGWIN</Elem>\r
+          </preprocessorList>\r
+          <warningLevel>2</warningLevel>\r
+        </cTool>\r
+        <ccTool>\r
+          <commandLine>-v -mno-cygwin</commandLine>\r
+          <preprocessorList>\r
+            <Elem>TIESRFA_EXPORTS</Elem>\r
+            <Elem>WIN32</Elem>\r
+            <Elem>CYGWIN</Elem>\r
+          </preprocessorList>\r
+          <warningLevel>2</warningLevel>\r
+        </ccTool>\r
+        <linkerTool>\r
+          <output>../../Dist/${CND_CONF}/libTIesrFAWin.dll</output>\r
+          <linkerLibItems>\r
+            <linkerLibLibItem>winmm</linkerLibLibItem>\r
+          </linkerLibItems>\r
+          <commandLine>-v</commandLine>\r
+        </linkerTool>\r
+      </compileType>\r
+    </conf>\r
+    <conf name="WindowsReleaseMinGW" type="2">\r
+      <toolsSet>\r
+        <developmentServer>localhost</developmentServer>\r
+        <compilerSet>Cygwin|Cygwin</compilerSet>\r
+        <platform>3</platform>\r
+      </toolsSet>\r
+      <compileType>\r
+        <cTool>\r
+          <developmentMode>5</developmentMode>\r
+          <commandLine>-v -mno-cygwin</commandLine>\r
+          <preprocessorList>\r
+            <Elem>TIESRFA_IMPORTS</Elem>\r
+            <Elem>WIN32</Elem>\r
+            <Elem>CYGWIN</Elem>\r
+          </preprocessorList>\r
+          <warningLevel>2</warningLevel>\r
+        </cTool>\r
+        <ccTool>\r
+          <developmentMode>5</developmentMode>\r
+          <commandLine>-v -mno-cygwin</commandLine>\r
+          <preprocessorList>\r
+            <Elem>TIESRFA_EXPORTS</Elem>\r
+            <Elem>WIN32</Elem>\r
+            <Elem>CYGWIN</Elem>\r
+          </preprocessorList>\r
+          <warningLevel>2</warningLevel>\r
+        </ccTool>\r
+        <fortranCompilerTool>\r
+          <developmentMode>5</developmentMode>\r
+        </fortranCompilerTool>\r
+        <linkerTool>\r
+          <output>../../Dist/${CND_CONF}/libTIesrFAWin.dll</output>\r
+          <linkerLibItems>\r
+            <linkerLibLibItem>winmm</linkerLibLibItem>\r
+          </linkerLibItems>\r
+          <commandLine>-v</commandLine>\r
+        </linkerTool>\r
+      </compileType>\r
+    </conf>\r
+  </confs>\r
+</configurationDescriptor>\r
diff --git a/TIesrFA/TIesrFAWinso/nbproject/private/configurations.xml b/TIesrFA/TIesrFAWinso/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..d8f7022
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<configurationDescriptor version="62">\r
+  <projectmakefile>Makefile</projectmakefile>\r
+  <defaultConf>0</defaultConf>\r
+  <confs>\r
+    <conf name="WindowsDebugMinGW" type="2">\r
+      <gdbdebugger version="2">\r
+        <gdb_command>gdb</gdb_command>\r
+        <array_repeat_threshold>10</array_repeat_threshold>\r
+      </gdbdebugger>\r
+      <gizmo_options version="1">\r
+      </gizmo_options>\r
+      <runprofile version="5">\r
+        <args></args>\r
+        <rundir></rundir>\r
+        <buildfirst>true</buildfirst>\r
+        <console-type>0</console-type>\r
+        <terminal-type>0</terminal-type>\r
+        <environment>\r
+        </environment>\r
+      </runprofile>\r
+    </conf>\r
+    <conf name="WindowsReleaseMinGW" type="2">\r
+      <gdbdebugger version="2">\r
+        <gdb_command>gdb</gdb_command>\r
+        <array_repeat_threshold>10</array_repeat_threshold>\r
+      </gdbdebugger>\r
+      <gizmo_options version="1">\r
+      </gizmo_options>\r
+      <runprofile version="5">\r
+        <args></args>\r
+        <rundir></rundir>\r
+        <buildfirst>true</buildfirst>\r
+        <console-type>0</console-type>\r
+        <terminal-type>0</terminal-type>\r
+        <environment>\r
+        </environment>\r
+      </runprofile>\r
+    </conf>\r
+  </confs>\r
+</configurationDescriptor>\r
diff --git a/TIesrFA/TIesrFAWinso/nbproject/private/private.properties b/TIesrFA/TIesrFAWinso/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrFA/TIesrFAWinso/nbproject/private/private.xml b/TIesrFA/TIesrFAWinso/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..cc2c0e5
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">\r
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>\r
+</project-private>\r
diff --git a/TIesrFA/TIesrFAWinso/nbproject/project.properties b/TIesrFA/TIesrFAWinso/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrFA/TIesrFAWinso/nbproject/project.xml b/TIesrFA/TIesrFAWinso/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..f5f4386
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://www.netbeans.org/ns/project/1">\r
+    <type>org.netbeans.modules.cnd.makeproject</type>\r
+    <configuration>\r
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">\r
+            <name>TIesrFAWinso</name>\r
+            <make-project-type>0</make-project-type>\r
+            <c-extensions/>\r
+            <cpp-extensions>cpp</cpp-extensions>\r
+            <header-extensions>h</header-extensions>\r
+            <sourceEncoding>UTF-8</sourceEncoding>\r
+            <make-dep-projects/>\r
+        </data>\r
+    </configuration>\r
+</project>\r
diff --git a/TIesrFA/TIesrFA_ALSAso/.dep.inc b/TIesrFA/TIesrFA_ALSAso/.dep.inc
new file mode 100644 (file)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrFA/TIesrFA_ALSAso/Makefile b/TIesrFA/TIesrFA_ALSAso/Makefile
new file mode 100644 (file)
index 0000000..0f284f8
--- /dev/null
@@ -0,0 +1,119 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+       if [ ${CONF} == LinuxDebugGnu -o \
+       ${CONF} == LinuxReleaseGnu -o \
+       ${CONF} == ArmLinuxDebugGnueabi -o \
+       ${CONF} == ArmLinuxReleaseGnueabi ]; \
+       then cd ../../Dist/${CONF}/lib; \
+       rm -f libTIesrFA_ALSA.so; \
+       ln -s libTIesrFA_ALSA.so.1 libTIesrFA_ALSA.so; \
+       fi
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..1a52cae
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o
+
+# C Compiler Flags
+CFLAGS=-v -idirafter ../../Tools/ARM/include
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Tools/ARM/lib -Wl,-rpath ${CND_BASEDIR}/../../Tools/ARM/lib -lpthread -lasound
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFA_ALSA.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFA_ALSA.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrFA_ALSA.so.1 -Wl,--version-script=../resource/TIesrFAso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFA_ALSA.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o ../src/TIesrFA_ALSA.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFA_ALSA.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..ca93483
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o
+
+# C Compiler Flags
+CFLAGS=-v -idirafter ../../Tools/ARM/include
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Tools/ARM/lib -Wl,-rpath ${CND_BASEDIR}/../../Tools/ARM/lib -lpthread -lasound
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFA_ALSA.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFA_ALSA.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrFA_ALSA.so.1 -Wl,--version-script=../resource/TIesrFAso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFA_ALSA.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o ../src/TIesrFA_ALSA.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFA_ALSA.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..38f6a1f
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lpthread -lasound
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/lib/libTIesrFA_ALSA.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrFA_ALSA.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrFA_ALSA.so.1 -Wl,--version-script=../resource/TIesrFAso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFA_ALSA.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o ../src/TIesrFA_ALSA.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/lib/libTIesrFA_ALSA.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..4b818df
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lpthread -lasound
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/lib/libTIesrFA_ALSA.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrFA_ALSA.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrFA_ALSA.so.1 -Wl,--version-script=../resource/TIesrFAso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFA_ALSA.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFA_ALSA.o ../src/TIesrFA_ALSA.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/lib/libTIesrFA_ALSA.so.1
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-impl.mk b/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..da3fc42
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TIesrFA_ALSAso
+
+# Active Configuration
+DEFAULTCONF=LinuxDebugGnu
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-variables.mk b/TIesrFA/TIesrFA_ALSAso/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..ed0c305
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib
+CND_ARTIFACT_NAME_LinuxDebugGnu=libTIesrFA_ALSA.so.1
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib/libTIesrFA_ALSA.so.1
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=libTIesrFAALSAso.so.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/libTIesrFAALSAso.so.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib
+CND_ARTIFACT_NAME_LinuxReleaseGnu=libTIesrFA_ALSA.so.1
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib/libTIesrFA_ALSA.so.1
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=libTIesrFAALSAso.so.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/libTIesrFAALSAso.so.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=libTIesrFA_ALSA.so.1
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFA_ALSA.so.1
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=libTIesrFAALSAso.so.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrFAALSAso.so.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=libTIesrFA_ALSA.so.1
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFA_ALSA.so.1
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=libTIesrFAALSAso.so.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrFAALSAso.so.tar
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrFA/TIesrFA_ALSAso/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..1a99d65
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1
+OUTPUT_BASENAME=libTIesrFA_ALSA.so.1
+PACKAGE_TOP_DIR=libTIesrFAALSAso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFAALSAso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAALSAso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAALSAso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrFA/TIesrFA_ALSAso/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..98177c7
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1
+OUTPUT_BASENAME=libTIesrFA_ALSA.so.1
+PACKAGE_TOP_DIR=libTIesrFAALSAso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFAALSAso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAALSAso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAALSAso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Package-LinuxDebugGnu.bash b/TIesrFA/TIesrFA_ALSAso/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..98a5840
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1
+OUTPUT_BASENAME=libTIesrFA_ALSA.so.1
+PACKAGE_TOP_DIR=libTIesrFAALSAso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFAALSAso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAALSAso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAALSAso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/Package-LinuxReleaseGnu.bash b/TIesrFA/TIesrFA_ALSAso/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..c3c375a
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1
+OUTPUT_BASENAME=libTIesrFA_ALSA.so.1
+PACKAGE_TOP_DIR=libTIesrFAALSAso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFAALSAso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAALSAso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFAALSAso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/configurations.xml b/TIesrFA/TIesrFA_ALSAso/nbproject/configurations.xml
new file mode 100644 (file)
index 0000000..1f3e195
--- /dev/null
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrFA_ALSA.h</itemPath>
+      <itemPath>../src/TIesrFA_User.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+      <itemPath>/data/speech/release/OpenSource/TIesr/trunk/TIesrFA/resource/TIesrFAso.ver</itemPath>
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrFA_ALSA.c</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="LinuxDebugGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1</output>
+          <linkerLibItems>
+            <linkerLibStdlibItem>PosixThreads</linkerLibStdlibItem>
+            <linkerLibLibItem>asound</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrFA_ALSA.so.1 -Wl,--version-script=../resource/TIesrFAso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1</output>
+          <linkerLibItems>
+            <linkerLibStdlibItem>PosixThreads</linkerLibStdlibItem>
+            <linkerLibLibItem>asound</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrFA_ALSA.so.1 -Wl,--version-script=../resource/TIesrFAso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <commandLine>-v -idirafter ../../Tools/ARM/include</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Tools/ARM/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Tools/ARM/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibStdlibItem>PosixThreads</linkerLibStdlibItem>
+            <linkerLibLibItem>asound</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrFA_ALSA.so.1 -Wl,--version-script=../resource/TIesrFAso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v -idirafter ../../Tools/ARM/include</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrFA_ALSA.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Tools/ARM/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Tools/ARM/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibStdlibItem>PosixThreads</linkerLibStdlibItem>
+            <linkerLibLibItem>asound</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrFA_ALSA.so.1 -Wl,--version-script=../resource/TIesrFAso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/private/configurations.xml b/TIesrFA/TIesrFA_ALSAso/nbproject/private/configurations.xml
new file mode 100644 (file)
index 0000000..3a6f126
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>0</defaultConf>
+  <confs>
+    <conf name="LinuxDebugGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/private/private.properties b/TIesrFA/TIesrFA_ALSAso/nbproject/private/private.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/private/private.xml b/TIesrFA/TIesrFA_ALSAso/nbproject/private/private.xml
new file mode 100644 (file)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/project.properties b/TIesrFA/TIesrFA_ALSAso/nbproject/project.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/TIesrFA/TIesrFA_ALSAso/nbproject/project.xml b/TIesrFA/TIesrFA_ALSAso/nbproject/project.xml
new file mode 100644 (file)
index 0000000..29bfde3
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TIesrFA_ALSAso</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions>c</c-extensions>
+            <cpp-extensions/>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrFA/TestTIesrFA/.dep.inc b/TIesrFA/TestTIesrFA/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrFA/TestTIesrFA/Makefile b/TIesrFA/TestTIesrFA/Makefile
new file mode 100755 (executable)
index 0000000..524ba36
--- /dev/null
@@ -0,0 +1,111 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrFA/TestTIesrFA/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrFA/TestTIesrFA/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..9ca7931
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Tools/ARM/lib -lTIesrFA_ALSA
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrfa
+
+../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrfa: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrfa ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFA.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DLINUX -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o ../src/TestTIesrFA.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrfa
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TestTIesrFA/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrFA/TestTIesrFA/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..b567f5b
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Tools/ARM/lib -lTIesrFA_ALSA
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrfa
+
+../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrfa: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrfa ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFA.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DLINUX -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o ../src/TestTIesrFA.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrfa
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TestTIesrFA/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrFA/TestTIesrFA/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..638bb61
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrFA_ALSA
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/bin/testtiesrfa
+
+../../Dist/LinuxDebugGnu/bin/testtiesrfa: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrfa ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFA.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DLINUX -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o ../src/TestTIesrFA.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/bin/testtiesrfa
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TestTIesrFA/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrFA/TestTIesrFA/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..37a0f79
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrFA_ALSA
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/bin/testtiesrfa
+
+../../Dist/LinuxReleaseGnu/bin/testtiesrfa: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrfa ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFA.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DLINUX -I../src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o ../src/TestTIesrFA.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/bin/testtiesrfa
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TestTIesrFA/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrFA/TestTIesrFA/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..6c2cbbe
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF} -lTIesrFAWin
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/testtiesrfa.exe
+
+../../Dist/WindowsDebugMinGW/testtiesrfa.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrfa.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFA.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DWIN32 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o ../src/TestTIesrFA.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/testtiesrfa.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TestTIesrFA/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrFA/TestTIesrFA/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..269bdc5
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF} -lTIesrFAWin
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/testtiesrfa.exe
+
+../../Dist/WindowsReleaseMinGW/testtiesrfa.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrfa.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFA.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DWIN32 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFA.o ../src/TestTIesrFA.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/testtiesrfa.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFA/TestTIesrFA/nbproject/Makefile-impl.mk b/TIesrFA/TestTIesrFA/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..7769401
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TestTIesrFA
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrFA/TestTIesrFA/nbproject/Makefile-variables.mk b/TIesrFA/TestTIesrFA/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..8c642e5
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=testtiesrfa.exe
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/testtiesrfa.exe
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=testtiesrfa.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/testtiesrfa.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=testtiesrfa.exe
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/testtiesrfa.exe
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=testtiesrfa.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/testtiesrfa.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin
+CND_ARTIFACT_NAME_LinuxDebugGnu=testtiesrfa
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin/testtiesrfa
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=testtiesrfa.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/testtiesrfa.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin
+CND_ARTIFACT_NAME_LinuxReleaseGnu=testtiesrfa
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin/testtiesrfa
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=testtiesrfa.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/testtiesrfa.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=testtiesrfa
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrfa
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=testtiesrfa.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrfa.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=testtiesrfa
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrfa
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=testtiesrfa.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrfa.tar
diff --git a/TIesrFA/TestTIesrFA/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrFA/TestTIesrFA/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..9b6b7c2
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrfa
+OUTPUT_BASENAME=testtiesrfa
+PACKAGE_TOP_DIR=testtiesrfa/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrfa/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TestTIesrFA/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrFA/TestTIesrFA/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..815700c
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrfa
+OUTPUT_BASENAME=testtiesrfa
+PACKAGE_TOP_DIR=testtiesrfa/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrfa/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TestTIesrFA/nbproject/Package-LinuxDebugGnu.bash b/TIesrFA/TestTIesrFA/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..b7dee82
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrfa
+OUTPUT_BASENAME=testtiesrfa
+PACKAGE_TOP_DIR=testtiesrfa/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrfa/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TestTIesrFA/nbproject/Package-LinuxReleaseGnu.bash b/TIesrFA/TestTIesrFA/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..49250f5
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrfa
+OUTPUT_BASENAME=testtiesrfa
+PACKAGE_TOP_DIR=testtiesrfa/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrfa/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TestTIesrFA/nbproject/Package-WindowsDebugMinGW.bash b/TIesrFA/TestTIesrFA/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..403ddc6
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrfa.exe
+OUTPUT_BASENAME=testtiesrfa.exe
+PACKAGE_TOP_DIR=testtiesrfa/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrfa/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TestTIesrFA/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrFA/TestTIesrFA/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..ec810dd
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrfa.exe
+OUTPUT_BASENAME=testtiesrfa.exe
+PACKAGE_TOP_DIR=testtiesrfa/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrfa/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrfa.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFA/TestTIesrFA/nbproject/configurations.xml b/TIesrFA/TestTIesrFA/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..3ee3201
--- /dev/null
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TestTIesrFA.cpp</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrfa.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFAWin</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrfa.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFAWin</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrfa</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFA_ALSA</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrfa</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFA_ALSA</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrfa</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+            <pElem>${CND_BASEDIR}/../../Tools/ARM/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFA_ALSA</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrfa</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+            <pElem>${CND_BASEDIR}/../../Tools/ARM/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFA_ALSA</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrFA/TestTIesrFA/nbproject/private/configurations.xml b/TIesrFA/TestTIesrFA/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..dd87d46
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>8000  160 200  100  40  2  WMAUDIO  ../../Data/AudioDir/test.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>8000  160 200  100  40  2  WMAUDIO  ../../Data/AudioDir/test.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>8000 160 250 50 10 20000 plughw:0,0  ../../Data/AudioDir/test.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>8000 160 250 50 10 20000 plughw:0,0  ../../Data/AudioDir/test.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>8000 160 250 50 10 20000 plughw:0,0  ../../Data/AudioDir/test.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>8000 160 250 50 10 20000 plughw:0,0  ../../Data/AudioDir/test.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrFA/TestTIesrFA/nbproject/private/private.properties b/TIesrFA/TestTIesrFA/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrFA/TestTIesrFA/nbproject/private/private.xml b/TIesrFA/TestTIesrFA/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrFA/TestTIesrFA/nbproject/project.properties b/TIesrFA/TestTIesrFA/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrFA/TestTIesrFA/nbproject/project.xml b/TIesrFA/TestTIesrFA/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..8423b98
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TestTIesrFA</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions/>
+            <cpp-extensions>cpp</cpp-extensions>
+            <header-extensions/>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrFA/resource/TIesrFAso.map b/TIesrFA/resource/TIesrFAso.map
new file mode 100644 (file)
index 0000000..92c27e5
--- /dev/null
@@ -0,0 +1,14 @@
+TXN_1.1 {  
+       global:
+                # TIesrFA.o
+                TIesrFA_init;
+                TIESRFA_open;
+                TIesrFA_start;
+                TIesrFA_getframe;
+                TIesrFA_stop;
+                TIesrFA_close;
+                TIesrFA_destroy;
+               
+        local: 
+                * ;
+};
\ No newline at end of file
diff --git a/TIesrFA/resource/TIesrFAso.ver b/TIesrFA/resource/TIesrFAso.ver
new file mode 100644 (file)
index 0000000..92503dd
--- /dev/null
@@ -0,0 +1,15 @@
+TXN_1.1 {
+       global:
+               # TIesrFA_ALSA.o
+               TIesrFA_close;
+               TIesrFA_destroy;
+               TIesrFA_getframe;
+               TIesrFA_init;
+               TIesrFA_open;
+               TIesrFA_start;
+               TIesrFA_stop;
+
+
+        local:
+                * ;
+};
\ No newline at end of file
diff --git a/TIesrFA/src/TIesrFA_ALSA.c b/TIesrFA/src/TIesrFA_ALSA.c
new file mode 100644 (file)
index 0000000..e067ba7
--- /dev/null
@@ -0,0 +1,1055 @@
+/*=======================================================================
+ TIesrFA_ALSA.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This file contains an implementation of a TIesrFA API interface
+ that is for use on a Linux OS platform with ALSA support.
+
+======================================================================*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+//#include <time.h>
+#include <sched.h>
+#include <limits.h>
+
+#include "TIesrFA_User.h"
+
+#include "TIesrFA_ALSA.h"
+
+/*----------------------------------------------------------------
+ TIesrFA_init
+
+ Implmentation of the TIesrFA_init function.  Initializes the implementation
+ object.
+  --------------------------------*/
+TIesrFA_Error_t TIesrFA_init( TIesrFA_t * const aTIesrFAInstance,
+        const unsigned int sample_rate,
+        const TIesrFA_Encoding_t encoding,
+        const unsigned int samples_per_frame,
+        const unsigned int num_circular_buffer_frames,
+        const unsigned int num_audio_buffer_frames,
+        const unsigned long audio_read_rate,
+        const char* channel_name,
+        const int priority )
+{
+    int error;
+    TIesrFA_ALSA_t* ALSAData;
+
+    /* The implementation data is initially not defined */
+    aTIesrFAInstance->impl_data = NULL;
+
+    /* Should check for valid parameters here */
+    aTIesrFAInstance->sample_rate = sample_rate;
+
+    if( encoding != TIesrFALinear )
+        return TIesrFAErrFail;
+    aTIesrFAInstance->encoding = encoding;
+
+    aTIesrFAInstance->samples_per_frame = samples_per_frame;
+
+    aTIesrFAInstance->num_circular_buffer_frames = num_circular_buffer_frames;
+
+    /* Number of audio interrupt durations in ALSA ring buffer.  This is an
+     indirect way of sizing the ALSA ring buffer.
+     */
+    aTIesrFAInstance->num_audio_buffer_frames = num_audio_buffer_frames;
+
+    /* Used to calculate ALSA interrupt duration.  This is converted into
+     the number of samples that should be collected prior to the ALSA PCM
+     interrupting TIesrFA to report data available. */
+    aTIesrFAInstance->audio_read_rate = audio_read_rate;
+
+    /* For ALSA, this is the PCM name to open */
+    aTIesrFAInstance->channel_name = strdup( channel_name );
+
+    aTIesrFAInstance->priority = priority;
+
+    if( aTIesrFAInstance->channel_name == NULL )
+    {
+        return TIesrFAErrFail;
+    }
+
+    /* Create the implementation specific structure, save it and initialize it */
+    ALSAData = (TIesrFA_ALSA_t*) malloc( sizeof( TIesrFA_ALSA_t ) );
+    if( ALSAData == NULL )
+    {
+        return TIesrFAErrFail;
+    }
+    aTIesrFAInstance->impl_data = (void *) ALSAData;
+
+    ALSAData->state = TIesrFA_ALSAStateUninit;
+
+
+    /* File mode input parameter initialization */
+    ALSAData->file_pointer = NULL;
+    ALSAData->frame_data = NULL;
+
+
+    /* Buffers and data processing initialization */
+    ALSAData->circ_buffer = NULL;
+    ALSAData->frame_bytes = NULL;
+    ALSAData->read_buffer = NULL;
+
+
+
+    /* initialize the circular and read buffers */
+    error = TIesrFA_ALSA_initbuf( aTIesrFAInstance );
+    if( error != TIesrFA_ALSAErrNone )
+    {
+        free( aTIesrFAInstance->channel_name );
+        free( ALSAData );
+        aTIesrFAInstance->impl_data = NULL;
+        return TIesrFAErrFail;
+    }
+
+
+    /* check if channel_name is a file name, which indicates that
+       audio data will be read from a file, rather than collected
+       from a live hardware audio channel */
+    ALSAData->file_pointer = fopen( channel_name, "rb" );
+    if( ALSAData->file_pointer == NULL )
+    {
+        ALSAData->file_mode = FALSE;
+    }
+    else
+    {
+        ALSAData->file_mode = TRUE;
+        fclose( ALSAData->file_pointer );
+        ALSAData->file_pointer = NULL;
+    }
+
+
+    /* Initialization completed successfully */
+    ALSAData->state = TIesrFA_ALSAStateInit;
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_ALSA_initbuf
+
+ Initialize the circular buffer frames and input buffer, allocating space to
+ hold the information.
+ --------------------------------*/
+TIesrFA_ALSA_Error_t TIesrFA_ALSA_initbuf( TIesrFA_t * const aTIesrFAInstance )
+{
+    unsigned int sampleBytes;
+    unsigned int bufSize;
+
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+
+    /* Determine number of bytes per sample */
+    switch( aTIesrFAInstance->encoding )
+    {
+        case TIesrFALinear:
+            sampleBytes = 2;
+            break;
+
+        case TIesrFAUlaw:
+        case TIesrFAAlaw:
+            sampleBytes = 1;
+            break;
+
+        default:
+            return TIesrFA_ALSAErrFail;
+    }
+
+
+    /* Allocate the circular buffer of TIesr frames.  The frame size in TIesr
+     is not the same as a "frame" in ALSA. TIesr frames are made up of samples
+     of mono audio data. Hence an ALSA "frame" is a TIesr "sample". */
+    ALSAData->sample_size = sampleBytes;
+    ALSAData->frame_size = aTIesrFAInstance->samples_per_frame * sampleBytes;
+
+    bufSize = ALSAData->frame_size * aTIesrFAInstance->num_circular_buffer_frames;
+    ALSAData->circ_buffer = (unsigned char*) malloc( bufSize * sizeof(unsigned char) );
+    if( ALSAData->circ_buffer == NULL )
+    {
+        return TIesrFA_ALSAErrFail;
+    }
+
+    /* An array to hold how many bytes have been loaded into a circular buffer frame.
+     This allows for an audio interface that returns a non-constant number of bytes */
+    ALSAData->frame_bytes =
+            (unsigned int *) malloc( aTIesrFAInstance->num_circular_buffer_frames * sizeof(unsigned int) );
+    if( ALSAData->frame_bytes == NULL )
+    {
+        free( ALSAData->circ_buffer );
+        ALSAData->circ_buffer = NULL;
+        return TIesrFA_ALSAErrFail;
+    }
+
+    /* The buffer to hold samples read from ALSA, a power of 2*/
+    bufSize = aTIesrFAInstance->sample_rate * aTIesrFAInstance->audio_read_rate / 1000000;
+    ALSAData->read_samples = bufSize;
+    /*
+        ALSAData->read_samples = 1;
+        while( bufSize > ALSAData->read_samples )
+        {
+            ALSAData->read_samples <<= 1;
+        }
+     */
+    ALSAData->read_buffer = (unsigned char*) malloc( ALSAData->read_samples * sampleBytes );
+    if( ALSAData->read_buffer == NULL )
+    {
+        free( ALSAData->circ_buffer );
+        ALSAData->circ_buffer = NULL;
+
+        free( ALSAData->frame_bytes );
+        ALSAData->frame_bytes = NULL;
+        return TIesrFA_ALSAErrFail;
+    }
+
+
+    return TIesrFA_ALSAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_open
+
+ Implementation of the function that opens a channel and prepares for
+ reading samples of audio data.  Normally this will open the audio
+ channel.  However, if the channel name is a file name, input will
+ come from a file.
+ ----------------------------------------------------------------*/
+TIesrFA_Error_t TIesrFA_open( TIesrFA_t * const aTIesrFAInstance )
+{
+    TIesrFA_ALSA_Error_t error;
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+    if( ALSAData->state != TIesrFA_ALSAStateInit )
+    {
+        return TIesrFAErrState;
+    }
+
+    /* If audio data is from a file, then open the file */
+    if( ALSAData->file_mode )
+    {
+        ALSAData->file_pointer = fopen( aTIesrFAInstance->channel_name, "rb" );
+        if( ALSAData->file_pointer == NULL )
+        {
+            return TIesrFAErrFail;
+        }
+
+        /* Make space to hold the frame of data from the file */
+        ALSAData->frame_data =
+                (unsigned char*) malloc( ALSAData->frame_size * sizeof(unsigned char) );
+
+        if( ALSAData->frame_data == NULL )
+        {
+            fclose( ALSAData->file_pointer );
+            return TIesrFAErrFail;
+        }
+    }
+
+        /* If audio data from an audio channel, then open the channel */
+    else
+    {
+        /* Open an actual ALSA PCM channel. */
+        error = TIesrFA_ALSA_open( aTIesrFAInstance );
+        if( error != TIesrFA_ALSAErrNone )
+        {
+            return TIesrFAErrFail;
+        }
+    }
+
+
+    /* Opened the audio source successfully.  Ready to read audio samples */
+    ALSAData->state = TIesrFA_ALSAStateOpen;
+
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_ALSA_open
+
+ Try to open an ALSA audio PCM channel.
+  ----------------------------------------------------------------*/
+TIesrFA_ALSA_Error_t TIesrFA_ALSA_open( TIesrFA_t * const aTIesrFAInstance )
+{
+    int rtnStatus;
+    int openSuccess = 0;
+    snd_pcm_uframes_t numSamples;
+    snd_pcm_hw_params_t *hw_params = 0;
+    snd_pcm_sw_params_t *sw_params = 0;
+
+
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+    /* Try to open a handle to the ALSA pcm in blocking mode. */
+    rtnStatus = snd_pcm_open( &ALSAData->alsa_handle,
+            aTIesrFAInstance->channel_name,
+            SND_PCM_STREAM_CAPTURE,
+            0 );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    /* Set up the information for recording from the audio channelport.  This
+     will include data specified by the user, such as data in
+     aTIesrFAInstance->encoding, etc.   If setup fails, then the audio channel
+     should be shut down and failure reported. */
+
+    /* Setup hardware parameters of the ALSA pcm */
+    rtnStatus = snd_pcm_hw_params_malloc( &hw_params );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    rtnStatus = snd_pcm_hw_params_any( ALSAData->alsa_handle, hw_params );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    /* There will only be a single channel */
+    rtnStatus = snd_pcm_hw_params_set_channels( ALSAData->alsa_handle,
+            hw_params, 1 );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    /* Even though only one channel, must specify type of read. */
+    rtnStatus = snd_pcm_hw_params_set_access( ALSAData->alsa_handle,
+            hw_params,
+            SND_PCM_ACCESS_RW_INTERLEAVED );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+
+    /* Format type - only 16 bit linear for now */
+    rtnStatus = snd_pcm_hw_params_set_format( ALSAData->alsa_handle,
+            hw_params,
+            SND_PCM_FORMAT_S16 );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    /* Set sample rate, it must be exactly supported */
+    rtnStatus = snd_pcm_hw_params_set_rate( ALSAData->alsa_handle,
+            hw_params,
+            aTIesrFAInstance->sample_rate, 0 );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+
+    /* Size of ALSA PCM ring buffer is set to approximately the desired 
+     number of multiples of read_samples in the buffer */
+    numSamples = aTIesrFAInstance->num_audio_buffer_frames *
+            ALSAData->read_samples;
+    rtnStatus = snd_pcm_hw_params_set_buffer_size_near( ALSAData->alsa_handle,
+            hw_params, &numSamples );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+
+    /* Set the hardware parameters in the PCM*/
+    rtnStatus = snd_pcm_hw_params( ALSAData->alsa_handle, hw_params );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+
+
+    /* Set software parameters to interrupt at the end of an audio buffer 
+     number of samples and to start-up manually */
+    rtnStatus = snd_pcm_sw_params_malloc( &sw_params );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    rtnStatus = snd_pcm_sw_params_current( ALSAData->alsa_handle, sw_params );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    /* Number of samples needed in PCM buffer prior to interrupt */
+    rtnStatus = snd_pcm_sw_params_set_avail_min( ALSAData->alsa_handle,
+            sw_params, ALSAData->read_samples );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    /* Set start threshold so startup is done manually */
+    rtnStatus = snd_pcm_sw_params_set_start_threshold( ALSAData->alsa_handle,
+            sw_params, ULONG_MAX );
+    if( rtnStatus < 0 )
+        goto openExit;
+
+    /* Channel opened successfully */
+    openSuccess = 1;
+
+
+openExit:
+
+    if( hw_params != NULL )
+        snd_pcm_hw_params_free( hw_params );
+
+    if( sw_params != NULL )
+        snd_pcm_sw_params_free( sw_params );
+
+
+    if( openSuccess )
+        return TIesrFA_ALSAErrNone;
+
+    return TIesrFA_ALSAErrFail;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_start
+
+ This function starts data collection on an opened channel.  If an
+ audio channel is opened, then data collection starts in a new thread.
+ If audio data is from a file, then this function just indicates the
+ collection started successfully if the file pointer is valid.
+  ----------------------------------------------------------------*/
+TIesrFA_Error_t TIesrFA_start( TIesrFA_t * const aTIesrFAInstance )
+{
+    int frame;
+    int result;
+    int threadresult;
+    TIesrFA_ALSA_Error_t error;
+
+    /* Thread synchronization startup variables. */
+    pthread_attr_t attr;
+    struct sched_param sparam;
+
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+
+    /* The audio source must have opened successfully to be started */
+    if( ALSAData->state != TIesrFA_ALSAStateOpen )
+    {
+        return TIesrFAErrState;
+    }
+
+    /* If audio data is from a file, just return if file is opened */
+    if( ALSAData->file_mode )
+    {
+        if( ALSAData->file_pointer == NULL )
+        {
+            return TIesrFAErrFail;
+        }
+        else
+        {
+            ALSAData->state = TIesrFA_ALSAStateRunning;
+            return TIesrFAErrNone;
+        }
+    }
+
+
+    /* Initialize the thread synchronization parameters */
+    error = TIesrFA_ALSA_initsync( ALSAData );
+    if( error != TIesrFA_ALSAErrNone )
+    {
+        return TIesrFAErrFail;
+    }
+
+
+    /* Prepare all of the variables for data collection */
+    ALSAData->input_buffer_frame = 0;
+    ALSAData->output_buffer_frame = 0;
+    ALSAData->buffer_frames_full = 0;
+    ALSAData->read_data = TRUE;
+    ALSAData->buffer_overflow = FALSE;
+
+    /* Initialize all buffers to holding no bytes of data */
+    for( frame = 0; frame < aTIesrFAInstance->num_circular_buffer_frames; frame++ )
+    {
+        ALSAData->frame_bytes[frame] = 0;
+    }
+
+
+    /* Set thread attributes and priority */
+    result = pthread_attr_init( &attr );
+    result = pthread_attr_getschedparam( &attr, &sparam );
+    sparam.sched_priority = aTIesrFAInstance->priority;
+    result = pthread_attr_setschedparam( &attr, &sparam );
+
+
+    /* Start the audio channel read data thread */
+    threadresult = pthread_create( &( ALSAData->thread_id ), &attr,
+            TIesrFA_ALSA_thread, (void *) aTIesrFAInstance );
+
+    result = pthread_attr_destroy( &attr );
+
+    if( threadresult != 0 )
+    {
+        ALSAData->read_data = FALSE;
+        return TIesrFAErrThread;
+    }
+
+
+    /* Wait for the thread to indicate it has started */
+    sem_wait( &( ALSAData->start_semaphore ) );
+    /* printf( "Thread started\n" );*/
+
+    /* Check if thread started PCM ok.  If not, it will return zero in
+     read_buffer flag, and the thread will be terminated.  Wait for thread
+     to complete.*/
+    if( !ALSAData->read_data )
+    {
+        /* Wait for thread to complete */
+        void * status;
+        pthread_join( ALSAData->thread_id, &status );
+
+        return TIesrFAErrThread;
+    }
+
+    ALSAData->state = TIesrFA_ALSAStateRunning;
+
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_ALSA_initsync
+
+ Initialize the synchronization objects for the circular buffer.
+ ----------------------------------------------------------------*/
+TIesrFA_ALSA_Error_t TIesrFA_ALSA_initsync( TIesrFA_ALSA_t * const aALSAData )
+{
+    int status;
+
+    status = pthread_mutex_init( &( aALSAData->buffer_mutex ), NULL );
+    if( status != 0 )
+    {
+        return TIesrFA_ALSAErrFail;
+    }
+
+
+    status = sem_init( &( aALSAData->buffer_semaphore ), 0, 0 );
+    if( status != 0 )
+    {
+        return TIesrFA_ALSAErrFail;
+    }
+
+    status = sem_init( &( aALSAData->start_semaphore ), 0, 0 );
+    if( status != 0 )
+    {
+        return TIesrFA_ALSAErrFail;
+    }
+
+    return TIesrFA_ALSAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_getframe
+
+ The user is requesting a frame of data from the audio channel.
+ Check if any frames of data are available.  If blocking is
+ requested, and no frame data is available, block for next frame.
+ Otherwise if blocking is not requested and no frame data is
+ available, just return error information that a frame of data is not
+ available yet.
+
+ If audio is coming from a file, then just read the data from the
+ file.
+ ----------------------------------------------------------------*/
+TIesrFA_Error_t TIesrFA_getframe( TIesrFA_t * const aTIesrFAInstance,
+        unsigned char* const aFrame,
+        const int aBlock,
+        unsigned int* aFramesQueued )
+{
+    int waitresult;
+    unsigned char* bufFrame;
+    int bufferOverflow;
+    unsigned int numBytesRead;
+
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+
+    /* The audio source must be reading audio */
+    if( ALSAData->state != TIesrFA_ALSAStateRunning )
+    {
+        return TIesrFAErrState;
+    }
+
+
+    /* If audio is coming from the file, just read the samples.
+     If at the end of the file, just continue to output the last frame,
+     but notify calling function by setting EOF return status. */
+    if( ALSAData->file_mode )
+    {
+        /* No backlogged frames */
+        *aFramesQueued = 0;
+
+        if( !feof( ALSAData->file_pointer ) )
+        {
+            numBytesRead = fread( aFrame, sizeof(unsigned char),
+                    ALSAData->frame_size,
+                    ALSAData->file_pointer );
+
+            if( numBytesRead == ALSAData->frame_size )
+            {
+                /* Save copy of the latest full frame */
+                memcpy( ALSAData->frame_data, aFrame, ALSAData->frame_size );
+            }
+            else
+            {
+                /* Output the copy of the last full frame */
+                memcpy( aFrame, ALSAData->frame_data, ALSAData->frame_size );
+                return(TIesrFAErrEOF );
+
+            }
+        }
+        else
+        {
+            /* Output a copy of the last full frame if no more data. */
+            memcpy( aFrame, ALSAData->frame_data, ALSAData->frame_size );
+            return(TIesrFAErrEOF );
+        }
+
+        return TIesrFAErrNone;
+    }
+
+
+    /* Not reading from a file, so reading from live channel.
+     Check to see if a frame of data is available.  The thread may also
+     be implemented to return some read failure status. It is assumed here
+     the thread continues working until requested to stop. */
+    if( aBlock )
+    {
+        /* Block waiting for a circular buffer frame to become available */
+        waitresult = sem_wait( &( ALSAData->buffer_semaphore ) );
+        if( waitresult != 0 )
+        {
+            return TIesrFAErrFail;
+        }
+    }
+    else
+    {
+        /* Check for frame available right now, if not notify user */
+        waitresult = sem_trywait( &( ALSAData->buffer_semaphore ) );
+        if( waitresult != 0 )
+        {
+            if( errno == EAGAIN )
+                return TIesrFAErrNoFrame;
+            else
+                return TIesrFAErrFail;
+        }
+    }
+
+    /* A frame is available, so transfer it to the user's memory */
+    bufFrame = ALSAData->circ_buffer + ALSAData->output_buffer_frame * ALSAData->frame_size;
+    memcpy( aFrame, bufFrame, ALSAData->frame_size );
+
+    /* Update the circular buffer samples and pointer to indicate we
+       are finished with the frame.  This is mutex protected, to
+       protect the circular buffer frame access by both threads */
+    pthread_mutex_lock( &( ALSAData->buffer_mutex ) );
+
+    ALSAData->frame_bytes[ ALSAData->output_buffer_frame ] = 0;
+
+    ALSAData->buffer_frames_full--;
+
+    *aFramesQueued = ALSAData->buffer_frames_full;
+
+    bufferOverflow = ALSAData->buffer_overflow;
+
+    pthread_mutex_unlock( &( ALSAData->buffer_mutex ) );
+
+    /* Go to the next output circular buffer frame, which the read
+       thread will fill or has already filled. */
+    ALSAData->output_buffer_frame++;
+    if( ALSAData->output_buffer_frame >= aTIesrFAInstance->num_circular_buffer_frames )
+    {
+        ALSAData->output_buffer_frame = 0;
+    }
+
+
+    /* Successfully transferred a frame */
+    return( bufferOverflow ) ? TIesrFAErrOverflow : TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_ALSA_thread
+
+ This function is the thread function that reads audio sample data
+ from the audio channel and puts the data into the circular buffers.
+ --------------------------------*/
+void* TIesrFA_ALSA_thread( void* aArg )
+{
+    int rtnval;
+    int pcmStarted = FALSE;
+
+    /* The argument to the thread is the TIesrFA instance */
+    TIesrFA_t * const aTIesrFAInstance = (TIesrFA_t * const) aArg;
+
+    /* TIesrFA_ALSA specific data */
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+
+    /* Start the capture of audio data by the audio channel.  If it failed to
+     start, then set the read_data flag to zero, indicating failure, and 
+     the thread will terminate. */
+    rtnval = snd_pcm_start( ALSAData->alsa_handle );
+    if( rtnval < 0 )
+        ALSAData->read_data = FALSE;
+    else
+        pcmStarted = TRUE;
+
+
+    /* Notify main thread that TIesrFA thread has attempted to start the PCM.
+     Success or failure is set in the read_data value. If failed, then the
+     thread will terminate immediately. */
+    sem_post( &( ALSAData->start_semaphore ) );
+
+    /* Loop reading sample data until requested to stop */
+    while( ALSAData->read_data == TRUE )
+    {
+        snd_pcm_sframes_t numSamples;
+
+        /* Wait for audio data to become available.  If no data in one second,
+         then something bad has happened. */
+        rtnval = snd_pcm_wait( ALSAData->alsa_handle, 1000 );
+        if( rtnval == 0 )
+        {
+            /* Timeout indicating some bad failure. */
+            continue;
+        }
+
+        /* PCM has indicated data is available. Get amount of data available */
+        numSamples = snd_pcm_avail_update( ALSAData->alsa_handle );
+        if( numSamples < 0 )
+        {
+            /* Assume buffer overflow condition */
+            ALSAData->buffer_overflow = 1;
+
+            /* Try to recover */
+            snd_pcm_prepare( ALSAData->alsa_handle );
+
+            continue;
+        }
+
+
+        /* Determine number of samples to read.  Must not exceed buffer size. */
+        numSamples = numSamples > ALSAData->read_samples ?
+                ALSAData->read_samples : numSamples;
+
+        /* Read the samples from the PCM */
+        numSamples = snd_pcm_readi( ALSAData->alsa_handle,
+                ALSAData->read_buffer, numSamples );
+
+        /* Transfer samples to circular frame buffers, or handle error on read. */
+        if( ALSAData->read_data == TRUE )
+        {
+            if( numSamples > 0 )
+            {
+                int numBytesRead = numSamples * ALSAData->sample_size;
+                TIesrFA_ALSA_fillframes( aTIesrFAInstance, numBytesRead );
+            }
+
+            else if( numSamples == -EPIPE )
+            {
+                ALSAData->buffer_overflow = 1;
+                snd_pcm_prepare( ALSAData->alsa_handle );
+                continue;
+            }
+            else
+            {
+                /* Some other failure */
+                continue;
+            }
+        }
+
+    }
+
+    /* The flag has been set to stop processing audio data, so terminate the thread */
+
+    if( pcmStarted )
+        snd_pcm_drop( ALSAData->alsa_handle );
+
+    return(void*) TIesrFA_ALSAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_ALSA_fillframes
+
+ The audio channel has returned some data.  Put it in one or more
+ circular buffer frames, and if circular buffer frames are filled, then
+ update the circular buffer frame pointer and semaphore accordingly.
+ --------------------------------*/
+TIesrFA_ALSA_Error_t TIesrFA_ALSA_fillframes( TIesrFA_t * const aTIesrFAInstance, const int aBytesRead )
+{
+    unsigned int framesFull;
+    unsigned char* bufFrame;
+    unsigned int frameBytesRemaining;
+    unsigned int frameOffset;
+
+    /* Initialize read buffer tracking variables. */
+    int bufBytesRemaining = aBytesRead;
+    int bufOffset = 0;
+
+    /* FILE specific data */
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+    /* printf( "BytesRead %d\n", aBytesRead ); */
+
+    while( bufBytesRemaining > 0 )
+    {
+        /* Determine if all buffer frames are full.  If so, there is an overflow condition, so
+         abort putting data in frames.  Mutex protect the fetch of the count of number of
+         frames full and status setting. */
+        pthread_mutex_lock( &( ALSAData->buffer_mutex ) );
+
+        framesFull = ALSAData->buffer_frames_full;
+
+        /* printf( "Frames full: %d\n", framesFull ); */
+
+        if( framesFull == aTIesrFAInstance->num_circular_buffer_frames )
+        {
+            /* log that a buffer overflow occurred */
+            ALSAData->buffer_overflow = TRUE;
+            pthread_mutex_unlock( &( ALSAData->buffer_mutex ) );
+            return TIesrFA_ALSAErrOverflow;
+        }
+
+        pthread_mutex_unlock( &( ALSAData->buffer_mutex ) );
+
+
+        /* The input buffer frame is not full, so put data into it */
+        bufFrame = ALSAData->circ_buffer + ALSAData->input_buffer_frame * ALSAData->frame_size;
+
+        /* This should be ok unprotected by a mutex, since if the frame is not full, the main thread will
+         not be clearing the frame_bytes variable for this frame */
+        frameBytesRemaining = ALSAData->frame_size -
+                ALSAData->frame_bytes[ ALSAData->input_buffer_frame ];
+
+        frameOffset = ALSAData->frame_size - frameBytesRemaining;
+
+        /* Check if there are enough read buffer bytes to completely fill the present input
+         circular buffer frame */
+        if( bufBytesRemaining >= frameBytesRemaining )
+        {
+            memcpy( bufFrame + frameOffset, ALSAData->read_buffer + bufOffset, frameBytesRemaining );
+            ALSAData->frame_bytes[ ALSAData->input_buffer_frame ] += frameBytesRemaining;
+            bufBytesRemaining -= frameBytesRemaining;
+            bufOffset += frameBytesRemaining;
+
+            /* printf( "Fill %d with %d\n", ALSAData->input_buffer_frame, frameBytesRemaining ); */
+
+            /* Indicate to the main thread that a new frame is available.  This is mutex protected. */
+            pthread_mutex_lock( &( ALSAData->buffer_mutex ) );
+
+            ALSAData->buffer_frames_full++;
+
+            /* Another frame is available for processing indicated by the semaphore */
+            sem_post( &( ALSAData->buffer_semaphore ) );
+
+            pthread_mutex_unlock( &( ALSAData->buffer_mutex ) );
+
+
+            /* Go to the next input buffer frame, since the present one is now full */
+            ALSAData->input_buffer_frame++;
+            if( ALSAData->input_buffer_frame >= aTIesrFAInstance->num_circular_buffer_frames )
+            {
+                ALSAData->input_buffer_frame = 0;
+            }
+        }
+
+
+            /* There are not enough buffer bytes to fill the present input circular buffer frame.  Put
+             all remaining buffer bytes into the circular buffer frame, but it is not full yet so we
+             do not need to update any inter-thread buffer status.  This will exit the while loop,
+             since no more read_buffer bytes remain to be processed. */
+        else
+        {
+            memcpy( bufFrame + frameOffset, ALSAData->read_buffer + bufOffset, bufBytesRemaining );
+            ALSAData->frame_bytes[ ALSAData->input_buffer_frame ] += bufBytesRemaining;
+
+            /* printf( "Add to %d with %d\n", ALSAData->input_buffer_frame, bufBytesRemaining ); */
+
+            bufBytesRemaining = 0;
+        }
+    }
+
+
+    /* Done successfully filling the circular buffer from the read buffer */
+    return TIesrFA_ALSAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_stop
+
+ This function call stops data collection.  If the data is from 
+ a file, then the state is just changed.  Normally for an audio channel,
+ the data reading thread is terminated and then the channel data collection
+ is stopped. This function does not close the audio channel, which is still
+ available for doing another recording by calling TIesrFA_start.
+  ----------------------------------------------------------------*/
+TIesrFA_Error_t TIesrFA_stop( TIesrFA_t * const aTIesrFAInstance )
+{
+    void *status;
+    TIesrFA_ALSA_Error_t error;
+
+
+    /* FILE specific data */
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+    if( ALSAData->state != TIesrFA_ALSAStateRunning )
+    {
+        return TIesrFAErrState;
+    }
+
+
+    /* If audio is coming from a file, just rewind it */
+    if( ALSAData->file_mode )
+    {
+        rewind( ALSAData->file_pointer );
+
+        ALSAData->state = TIesrFA_ALSAStateOpen;
+
+        return TIesrFAErrNone;
+    }
+
+
+    /* Set variable to stop reading data and shut down thread */
+    ALSAData->read_data = FALSE;
+
+    /* Wait for thread to complete */
+    pthread_join( ALSAData->thread_id, &status );
+
+    /* printf( "Thread ended\n"); o*/
+
+    /* Reset sync objects */
+    error = TIesrFA_ALSA_resetsync( ALSAData );
+
+    ALSAData->state = TIesrFA_ALSAStateOpen;
+
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_ALSA_resetsync
+
+ Reset all of the synchronization objects.  They must be reinitialized
+ to use them again.
+ --------------------------------*/
+TIesrFA_ALSA_Error_t TIesrFA_ALSA_resetsync( TIesrFA_ALSA_t * const aALSAData )
+{
+    int status;
+
+    status = pthread_mutex_destroy( &( aALSAData->buffer_mutex ) );
+
+    status = sem_destroy( &( aALSAData->start_semaphore ) );
+
+    status = sem_destroy( &( aALSAData->buffer_semaphore ) );
+
+    return TIesrFA_ALSAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_close
+
+ Close an audio channel.  This will just close the file in file mode. For
+ normal audio channels, this would close the audio channel.
+  ----------------------------------------------------------------*/
+TIesrFA_Error_t TIesrFA_close( TIesrFA_t * const aTIesrFAInstance )
+{
+
+    int rtnStatus;
+
+    /* FILE specific data */
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+    if( ALSAData->state != TIesrFA_ALSAStateOpen )
+    {
+        return TIesrFAErrState;
+    }
+
+
+    /* If data is coming from a file, close the file, and free frame data memory */
+    if( ALSAData->file_mode )
+    {
+        fclose( ALSAData->file_pointer );
+        ALSAData->file_pointer = NULL;
+
+        free( ALSAData->frame_data );
+        ALSAData->frame_data = NULL;
+
+        ALSAData->state = TIesrFA_ALSAStateInit;
+        return TIesrFAErrNone;
+    }
+
+
+    /* Close the audio channel here, and check for failure */
+    rtnStatus = snd_pcm_close( ALSAData->alsa_handle );
+    if( rtnStatus < 0 )
+        return TIesrFAErrFail;
+
+
+    /* The audio channel closed successfully */
+    ALSAData->state = TIesrFA_ALSAStateInit;
+
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+ TIesrFA_destroy
+  
+ This function is supplied to free all memory allocated to an
+ instance of the audio channel.  It does not destroy the instance
+ object itself.
+ --------------------------------*/
+TIesrFA_Error_t TIesrFA_destroy( TIesrFA_t * const aTIesrFAInstance )
+{
+    /* FILE specific data */
+    TIesrFA_ALSA_t * const ALSAData = (TIesrFA_ALSA_t * const) aTIesrFAInstance->impl_data;
+
+    if( aTIesrFAInstance->channel_name != NULL )
+    {
+        free( aTIesrFAInstance->channel_name );
+        aTIesrFAInstance->channel_name = NULL;
+    }
+
+
+    /* Check for already in an uninitialized state */
+    if( ALSAData == NULL )
+    {
+        return TIesrFAErrNone;
+    }
+
+
+    /* Check if the FILE channel is not closed */
+    if( ALSAData->state != TIesrFA_ALSAStateInit )
+    {
+        return TIesrFAErrState;
+    }
+
+
+    /* Close file if open.  Should not happen */
+    if( ALSAData->file_mode )
+    {
+        if( ALSAData->file_pointer != NULL )
+        {
+            fclose( ALSAData->file_pointer );
+            ALSAData->file_pointer = NULL;
+        }
+    }
+
+
+    /* Free all allocated memory */
+    if( ALSAData->circ_buffer != NULL )
+    {
+        free( ALSAData->circ_buffer );
+        ALSAData->circ_buffer = NULL;
+    }
+
+    if( ALSAData->read_buffer != NULL )
+    {
+        free( ALSAData->read_buffer );
+        ALSAData->read_buffer = NULL;
+    }
+
+    if( ALSAData->frame_bytes != NULL )
+    {
+        free( ALSAData->frame_bytes );
+        ALSAData->frame_bytes = NULL;
+    }
+
+
+    /* Free the FILE impl_data object itself.  This removes any FILE
+       implementation state information */
+    free( ALSAData );
+    aTIesrFAInstance->impl_data = NULL;
+
+
+
+    return TIesrFAErrNone;
+}
diff --git a/TIesrFA/src/TIesrFA_ALSA.h b/TIesrFA/src/TIesrFA_ALSA.h
new file mode 100644 (file)
index 0000000..73e2a5d
--- /dev/null
@@ -0,0 +1,122 @@
+/*=======================================================================
+ TIesrFA_ALSA.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header is designed to be used with TIesrFA_ALSA.c, which implements
+ the TIesrFA API for Linux platforms supporting the ALSA library API.
+
+======================================================================*/
+
+#ifndef _TIesrFA_ALSA_H
+#define        _TIesrFA_ALSA_H
+
+/* Needed for thread operation? */
+#define _REENTRANT
+
+#include <stdio.h>
+#include <pthread.h>
+#include <semaphore.h>
+
+/* The ALSA library API */
+#include <alsa/asoundlib.h>
+
+/* Constants that are part of the API */
+#define THREAD_PRIORITY 20
+
+#define FALSE 0
+#define TRUE 1
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /* State of the instance of FILE data collection */
+    typedef enum TIesrFA_ALSA_States
+    {
+        TIesrFA_ALSAStateUninit,
+        TIesrFA_ALSAStateInit,
+        TIesrFA_ALSAStateOpen,
+        TIesrFA_ALSAStateRunning
+    } TIesrFA_ALSA_State_t;
+
+    /* Errors that can be returned */
+    typedef enum TIesrFA_ALSA_Errors
+    {
+        TIesrFA_ALSAErrNone,
+        TIesrFA_ALSAErrFail,
+        TIesrFA_ALSAErrNoMemory,
+        TIesrFA_ALSAErrOverflow
+    } TIesrFA_ALSA_Error_t;
+
+    /* TIesrFA_ALSA_t defines the implementation specific implementation data used */
+
+    typedef struct TIesrFA_ALSA_Struct
+    {
+        /* State of the channel */
+        TIesrFA_ALSA_State_t state;
+
+        /* File-mode control.Boolean flag indicating if audio channel is a file,
+         file pointer, and buffer pointer to hold file data when read */
+        int file_mode;
+        FILE *file_pointer;
+        unsigned char* frame_data;
+
+
+        /* The ALSA PCM channel */
+        snd_pcm_t *alsa_handle;
+
+
+        /* TIesr frame circular buffer and parameters for managing the TIesr frame
+         circular buffer. */
+        unsigned char *circ_buffer;
+        unsigned int *frame_bytes;
+        unsigned int input_buffer_frame;
+        unsigned int output_buffer_frame;
+        unsigned int sample_size;
+        unsigned int frame_size;
+
+
+        /* Input read buffer, for reading samples from ALSA */
+        unsigned char *read_buffer;
+        unsigned int  read_samples;
+
+
+        /* circular buffer and thread synchronization */
+        unsigned int buffer_frames_full;
+        pthread_t thread_id;
+        sem_t start_semaphore;
+        pthread_mutex_t buffer_mutex;
+        sem_t buffer_semaphore;
+        pthread_mutex_t read_mutex;
+        int read_data;
+        int buffer_overflow;
+
+    } TIesrFA_ALSA_t;
+
+
+
+    /* static functions - hidden from user */
+    static TIesrFA_ALSA_Error_t TIesrFA_ALSA_initbuf( TIesrFA_t * const aTIesrFAInstance );
+
+    static TIesrFA_ALSA_Error_t TIesrFA_ALSA_initsync( TIesrFA_ALSA_t * const aFILEData );
+
+    static TIesrFA_ALSA_Error_t TIesrFA_ALSA_open( TIesrFA_t * const aTIesrFAIntance );
+
+    static TIesrFA_ALSA_Error_t TIesrFA_ALSA_fillframes( TIesrFA_t * const aTIesrInstance, int aSamplesRead );
+
+    static TIesrFA_ALSA_Error_t TIesrFA_ALSA_resetsync( TIesrFA_ALSA_t * const aFILEData );
+
+    /* The thread function for loading frames of audio */
+    static void* TIesrFA_ALSA_thread( void* aArg );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TIesrFA_ALSA_H */
diff --git a/TIesrFA/src/TIesrFA_User.h b/TIesrFA/src/TIesrFA_User.h
new file mode 100644 (file)
index 0000000..75e7507
--- /dev/null
@@ -0,0 +1,272 @@
+/*=======================================================================
+ TIesrFA_User.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This is the header file for using the TIesrFA frame audio API.  The TIesrFA
+ API provides the means of obtaining frames of audio data for use by the
+ TIesr recognizer.  This header file defines the interface with the API.  The
+ API provides a means of creating an instance of a single monaural audio channel.
+ Note that an audio channel may be a live hardware audio channel, or a
+ file containing binary audio data.
+
+ This interface provides the basis for designing the TIesrFA API for a large
+ number of OS platforms.
+
+======================================================================*/
+
+#ifndef _TIESRFA_USER_H
+#define _TIESRFA_USER_H
+
+/* Windows OS DLL function export method */
+#if defined( WIN32 ) || defined( WINCE )
+
+/*------------------------------------------------------------------
+ The following ifdef block is the standard way of creating macros which make exporting
+ from a DLL simpler. All files within this DLL are compiled with the TIESRFA_EXPORTS
+ symbol defined on the command line. This symbol should not be defined on any project
+ that uses this DLL. This way any other project whose source files include this file see
+ TIESRFA_API functions as being imported from a DLL, whereas this DLL sees symbols
+ defined with this macro as being exported.
+ ---------------------------------------------------------------------*/
+#ifdef TIESRFA_EXPORTS
+#define TIESRFA_API __declspec(dllexport)
+#else
+#define TIESRFA_API __declspec(dllimport)
+#endif
+
+#else
+#define TIESRFA_API 
+#endif 
+
+#if defined( __cplusplus )
+extern "C"
+{
+#endif
+/*----------------------------------------------------------------------
+ TIesrFA_error defines all returned status reporting of the API.  These
+ may be used in any way a particular implementation desires.  However,
+ general definitions are as follows:
+
+ TIesrFAErrNone = No error from function's request
+
+ TIesrFAErrFail = The request failed, and the instance is in a condition
+ as if the function call had not been made.
+
+ TIesrFAErrArg = Invalid argument
+
+ TIesrFAErrState = State error. For example, trying to open an already
+ running  audio data channel collection.
+
+ TIesrFAErrThread = Thread start-up error, for those cases in which the
+ data collection occurs in a separate thread.  Use of a thread is normally
+ the case, so that data can be collected while the recognizer is processing.
+
+ TIesrFAErrNoFrame = A non-blocking request for a frame was made and no
+ frame is available.
+
+ TIesrFAErrOverflow = A frame of data was returned.  However, it has been detected
+ that an overflow condition occurred at some frame, and some data is lost at some
+ frame.
+ ---------------------------------------------------------------------------------*/
+typedef enum TIesrFA_Errors
+{
+  TIesrFAErrNone,
+  TIesrFAErrFail,
+  TIesrFAErrArg,
+  TIesrFAErrState,
+  TIesrFAErrThread,
+  TIesrFAErrNoFrame,
+  TIesrFAErrOverflow,
+  TIesrFAErrEOF
+} TIesrFA_Error_t;
+
+
+/*--------------------------------------------------------------
+ TIesrFA_encoding defines the type of data returned.  At this time
+ TIesr is expecting TIesrFALinear only as 16 bit PCM samples.
+ --------------------------------------------------------------*/
+typedef enum TIesrFA_Encodings
+{
+  TIesrFALinear,
+  TIesrFAUlaw,
+  TIesrFAAlaw
+} TIesrFA_Encoding_t;
+
+/*---------------------------------------------------------------------------
+ TIesrFA_t defines the structure that encapsulates an instance of an audio
+ channel. The user must create an object of this structure in order to
+ obtain a connection to an audio channel.  The definition of this structure
+ is given here so that it can be allocated on the stack or in heap.  The
+ user must never directly modify any of the parameters in the structure, but
+ should only rely on the interface functions to do so.  The structure consists
+ of a few basic parameters that most audio sampling implementations will define,
+ along with the capability for each hardware device to expand the definitions.
+ ---------------------------------------------------------------------------*/
+typedef struct TIesrFA_Struct
+{
+      /* The A/D sampling rate in samples per second */
+      unsigned int sample_rate;
+      
+      /* The type of encoding desired */
+      TIesrFA_Encoding_t encoding;
+
+      /* The number of samples per frame returned to user */
+      unsigned int samples_per_frame;
+
+      /* The number of circular buffer frames that will be used to
+       store data as a buffer to maintain real time */
+      unsigned int num_circular_buffer_frames;
+
+      /* The number of audio input buffer frames.  Some audio APIs may
+       require that one or more input buffers be created.  This
+       parameter defines the size of the buffer in terms of number
+       of frames of samples.  This parameter may not be used by all
+       audio APIs, in which case it can be used as an additional
+       API parameter. */
+      unsigned int num_audio_buffer_frames;
+
+      /* The rate to attempt reading audio data.  Some audio APIs may
+       require that the audio input be read at some periodic rate.
+       This parameter defines the rate in microseconds at which the
+       reading should take place.  This parameter may not be used
+       with all audio APIs, in which case it can be used as an additional
+       API parameter.  */
+      unsigned long audio_read_rate;
+
+      /* A character string that identifies which audio channel to
+       open.  Each implementation and platform will handle this
+       string differently.  If the channel_name parameter is the
+       name of a file, then the file will be opened and used as a
+       source of audio data. */
+      char* channel_name;
+     
+      /* An integer which defines the priority at which the audio
+       channel will run, if in a separate thread.  Each
+       implementation and platform will handle this integer
+       according to the particular OS and device */
+      int priority;
+
+      /* A pointer to implementation dependent data.  This data will
+       depend on the particular interface with the hardware audio
+       driver supplied on a particular platform and OS. */
+      void* impl_data;
+
+} TIesrFA_t;
+
+
+/*-------------------------------------------------------------------
+ TIesrFA_init initializes the TIesrFA_t object for an instance of a
+ TIesrFA audio channel.  It must be called prior to using the
+ TIesrFA_t object for audio collection. It provides the opportunity
+ for an implementation to initialize itself prior to opening an
+ audio channel connection.  This will usually include establishing
+ OS-dependent parameters within the impl_data object in the
+ TIesrFA_t structure.  It also allows for parameter checking to
+ ensure that the type of channel parameters requested can be
+ supported.  The user passes a pointer to the object in this
+ function call.  Thus the TIesrFA_t object may be allocated on the
+ stack or in heap.  However, it must not go out of scope until all
+ data collection is finished and all memory allocated within the
+ object is destroyed by a call to TIesrFA_destroy.
+-----------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_init( TIesrFA_t* const  aTIesrFAInstance,
+                             const unsigned int sample_rate, 
+                             const TIesrFA_Encoding_t encoding,
+                             const unsigned int samples_per_frame,
+                             const unsigned int num_circular_buffer_frames,
+                             const unsigned int num_audio_buffer_frames,
+                             const unsigned long audio_read_rate,
+                             const char* channel_name,
+                             const int priority );
+
+
+/*--------------------------------------------------------------------
+ TIesrFA_open opens an audio channel.  Opening an audio channel does
+ not start collection of audio data.  It establishes a connection
+ with an audio device. No frames of audio data can be received until
+ an instance has been initialized and opened.
+----------------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_open( TIesrFA_t* const aTIesrFAInstance );
+
+
+/*------------------------------------------------------------------
+ TIesrFA_start starts data collection.  Upon return the audio
+ collection should be running. Audio collection may be started in a
+ separate thread.
+--------------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_start( TIesrFA_t* const aTIesrFAInstance );
+
+
+/*-------------------------------------------------------------------
+ TIesrFA_getframe requests a frame of data from a running audio
+ channel.  This function examines the circular frame buffer to see
+ if a frame of data is available. If a frame is available, it
+ transfers the data to the aFrame location specified in the function
+ call.  If a frame of data is not available, then the aBlock boolean
+ variable will determine if the function blocks waiting for a frame,
+ or if the function returns indicating no frame is yet
+ available. The parameter aFramesQueued returns the number of frames
+ in the circular buffer remaining to be processed, not including the
+ frame returned.
+ ----------------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_getframe( TIesrFA_t* const aTIesrFAInstance, 
+                                 unsigned char * const aFrame, 
+                                 const int aBlock,
+                                 unsigned int *aFramesQueued );
+
+
+/*-------------------------------------------------------------------
+ TIesrFA_stop stops data collection.  Upon return the audio
+ collection has stopped, and if a separate thread has been used for
+ collection, that thread of execution has terminated.  Audio
+ collection may be started again by another call to TIesrFA_start.
+ Audio channel resources remain connected.
+ ---------------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_stop( TIesrFA_t* const aTIesrFAInstance );
+
+
+/*---------------------------------------------------------------------
+ TIesrFA_close closes the connection with the audio channel. In
+ order to start collection again, the user must call TIesrFA_open to
+ re-establish an audio channel connection.
+ ----------------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_close( TIesrFA_t* const aTIesrFAInstance );
+
+
+/*----------------------------------------------------------------------
+ TIesrFA_destroy allows the particular implementation to destroy any
+ objects it may have created upon initialization.  This function must
+ be called after initialization has successfully completed in order
+ to ensure that no memory leaks occur.  It can not be called
+ successfully when the audio channel is opened.  Calling this
+ function does not destroy the TIesrFA_t object itself.
+ ----------------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_destroy( TIesrFA_t* const aTIesrFAInstance );
+
+/*----------------------------------------------------------------------
+ TIesrFA_status returns a single unsigned integer of information
+ regarding the operation of the TIesrFA API.  The contents of this
+ variable will be dependent upon the particular implementation of the API,
+ and must be documented by the API implementer. This function will only
+ return valid information after TIesrFA_init is successfully called,
+ and prior to calling TIesrFA_destroy.  This function is optional and not
+ required for operation of the TIesr recognizer.  It provides a mechanism
+ to report status of the data collection for diagnostic purposes.
+ -----------------------------------------------------------------------*/
+TIESRFA_API
+unsigned int TIesrFA_status( TIesrFA_t* const aTIesrFAInstance );
+
+#if defined( __cplusplus )
+}
+#endif
+#endif
diff --git a/TIesrFA/src/TIesrFA_WM5.cpp b/TIesrFA/src/TIesrFA_WM5.cpp
new file mode 100755 (executable)
index 0000000..1783802
--- /dev/null
@@ -0,0 +1,1713 @@
+/*=======================================================================
+ TIesrFA_WM5.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This file contains an implementation of a TIesrFA API interface
+ that uses the Windows Audio interface.
+
+======================================================================*/
+
+/* Windows header */
+#include <windows.h>
+
+
+/* TIesrFA headers */
+#include "TIesrFA_User.h"
+#include "TIesrFA_WM5.h"
+
+/*-----------------------------------------------------------------
+DLL Entry point for TIesrFA
+--------------------------------------------------------------*/
+BOOL APIENTRY DllMain(HANDLE hModule,
+        DWORD ul_reason_for_call,
+        LPVOID lpReserved
+        ) {
+    switch (ul_reason_for_call) {
+        case DLL_PROCESS_ATTACH:
+        case DLL_THREAD_ATTACH:
+        case DLL_THREAD_DETACH:
+        case DLL_PROCESS_DETACH:
+            break;
+    }
+    return TRUE;
+}
+
+/*----------------------------------------------------------------
+TIesrFA_init
+
+Implmentation of the TIesrFA_init function.  Initializes the implementation
+object.  Allocates memory to hold buffer data and run the data collection.
+------------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_init(TIesrFA_t * const aTIesrFAInstance,
+        const unsigned int sample_rate,
+        const TIesrFA_Encoding_t encoding,
+        const unsigned int samples_per_frame,
+        const unsigned int num_circular_buffer_frames,
+        const unsigned int num_audio_buffer_frames,
+        const unsigned long audio_read_rate,
+        const char* channel_name,
+        const int priority) {
+    TIesrFAWM5_Error_t wm5Error;
+    TIesrFAWM5_t* WM5Data;
+
+    /* The implementation data is initially not defined */
+    aTIesrFAInstance->impl_data = NULL;
+
+    /* Should check for valid parameters here */
+    aTIesrFAInstance->sample_rate = sample_rate;
+    aTIesrFAInstance->encoding = encoding;
+    aTIesrFAInstance->samples_per_frame = samples_per_frame;
+    aTIesrFAInstance->num_circular_buffer_frames = num_circular_buffer_frames;
+    aTIesrFAInstance->num_audio_buffer_frames = num_audio_buffer_frames;
+    aTIesrFAInstance->audio_read_rate = audio_read_rate;
+
+#ifdef CYGWIN
+    // cygwin uses strdup
+    aTIesrFAInstance->channel_name = strdup(channel_name);
+#else
+    // Windows uses _strdup
+    aTIesrFAInstance->channel_name = _strdup( channel_name );
+#endif
+
+
+    aTIesrFAInstance->priority = priority;
+
+    if (aTIesrFAInstance->channel_name == NULL) {
+        return TIesrFAErrArg;
+    }
+
+    if (aTIesrFAInstance->audio_read_rate == 0 ||
+            aTIesrFAInstance->num_circular_buffer_frames < 2 ||
+            aTIesrFAInstance->num_audio_buffer_frames < 2 ||
+            aTIesrFAInstance->sample_rate != WM5_MIN_SAMPLE_RATE ||
+            aTIesrFAInstance->samples_per_frame < WM5_MIN_SAMPLES_PER_FRAME) {
+        return TIesrFAErrArg;
+    }
+
+    /* Create the implementation specific structure, save it and initialize it */
+    WM5Data = (TIesrFAWM5_t*) malloc(sizeof ( TIesrFAWM5_t));
+    if (WM5Data == NULL) {
+        return TIesrFAErrFail;
+    }
+    aTIesrFAInstance->impl_data = (void *) WM5Data;
+
+
+#ifdef WM5_DEBUG_LOG
+    WM5Data->threadFile = NULL;
+
+    WM5Data->logFile = fopen(LOGFILE, "w");
+    if (WM5Data->logFile == NULL) {
+        free(WM5Data);
+        aTIesrFAInstance->impl_data = NULL;
+        return TIesrFAErrFail;
+    }
+
+    fprintf(WM5Data->logFile, "FAinit\n");
+    fflush(WM5Data->logFile);
+#endif
+
+
+    /* Initial state and status */
+    WM5Data->state = TIesrFAWM5StateUninit;
+    WM5Data->status = 0;
+
+
+    /* File mode input parameter initialization */
+    WM5Data->filePointer = NULL;
+    WM5Data->frameData = NULL;
+
+
+    /* WM5 waveform audio input channel handle */
+    WM5Data->wiHandle = NULL;
+
+    /* WM5 audio channel read frame buffer, headers, processing queue, and
+    synchronization objects */
+    WM5Data->readHeaders = NULL;
+    WM5Data->readBuffer = NULL;
+    WM5Data->readHeadersReturnQueue = NULL;
+    WM5Data->readReturnEvent = NULL;
+    WM5Data->readCSInitialized = FALSE;
+
+    /* Output frame circular buffer and frame buffer byte counts */
+    WM5Data->circBuffer = NULL;
+    WM5Data->bytesInFrame = NULL;
+
+    /* Output frame circular buffer synchronization objects */
+    WM5Data->circularSemaphore = NULL;
+    WM5Data->circCSInitialized = FALSE;
+
+    /* Initialize collection thread and synchronization objects */
+    WM5Data->threadHandle = NULL;
+    WM5Data->startEvent = NULL;
+    WM5Data->stopEvent = NULL;
+
+    /* Wait objects for the thread are stopEvent and readSemaphore */
+    WM5Data->waitObjects[0] = NULL;
+    WM5Data->waitObjects[1] = NULL;
+
+
+    /* initialize the read and circular buffers and associated structures */
+    wm5Error = TIesrFAWM5_initbuf(aTIesrFAInstance);
+    if (wm5Error != TIesrFAWM5ErrNone) {
+        free(aTIesrFAInstance->channel_name);
+        free(WM5Data);
+        aTIesrFAInstance->impl_data = NULL;
+        return TIesrFAErrFail;
+    }
+
+
+    /* check if channel_name is a file name, which indicates that
+    audio data will be read from a file, rather than collected
+    from a live hardware audio channel */
+    WM5Data->filePointer = fopen(channel_name, "rb");
+    if (WM5Data->filePointer == NULL) {
+        WM5Data->fileMode = FALSE;
+    } else {
+        WM5Data->fileMode = TRUE;
+        fclose(WM5Data->filePointer);
+        WM5Data->filePointer = NULL;
+    }
+
+
+    /* Initialization completed successfully */
+    WM5Data->state = TIesrFAWM5StateInit;
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAInit success\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFAWM5_initbuf
+
+Initialize the read buffer, the WM5 read buffer frame headers,
+the read buffer frame queue, the circular buffer and circular buffer frame byte counters.
+------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_initbuf(TIesrFA_t * const aTIesrFAInstance) {
+    unsigned int sampleBytes;
+    unsigned int bufSize;
+    TIesrFAWM5_Error_t wm5Error;
+
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+
+    /* Determine number of bytes per sample */
+    switch (aTIesrFAInstance->encoding) {
+        case TIesrFALinear:
+            sampleBytes = 2;
+            WM5Data->formatTag = WAVE_FORMAT_PCM;
+            break;
+
+#ifndef CYGWIN
+        case TIesrFAUlaw:
+            WM5Data->formatTag = WAVE_FORMAT_MULAW;
+            sampleBytes = 1;
+            break;
+
+        case TIesrFAAlaw:
+            WM5Data->formatTag = WAVE_FORMAT_ALAW;
+            sampleBytes = 1;
+            break;
+#endif
+
+        default:
+            return TIesrFAWM5ErrFail;
+    }
+
+    /* Size of a sample and size of a frame in bytes */
+    WM5Data->sampleSize = sampleBytes;
+    WM5Data->frameSize = aTIesrFAInstance->samples_per_frame * sampleBytes;
+
+    /* Size of a waveform audio header read buffer. */
+    WM5Data->readBufSize = WM5Data->frameSize * aTIesrFAInstance->audio_read_rate;
+
+
+    /* Allocate the WM5 wave headers */
+    WM5Data->readHeaders = (PWAVEHDR) malloc(aTIesrFAInstance->num_audio_buffer_frames *
+            sizeof ( WAVEHDR));
+    if (WM5Data->readHeaders == NULL)
+        goto FailedInit;
+
+    /* Allocate the read frame buffer which holds frames of input data */
+    bufSize = WM5Data->readBufSize * aTIesrFAInstance->num_audio_buffer_frames;
+    WM5Data->readBuffer = (unsigned char*) malloc(bufSize * sizeof (unsigned char));
+    if (WM5Data->readBuffer == NULL)
+        goto FailedInit;
+
+    /* Allocate the read frame queue which tells which read headers have been 
+    filled and returned by the WM5 audio device and are ready to have data transferred 
+    to the circular buffer. */
+    WM5Data->readHeadersReturnQueue =
+            (unsigned int*) malloc(aTIesrFAInstance->num_audio_buffer_frames *
+            sizeof ( unsigned int));
+    if (WM5Data->readHeadersReturnQueue == NULL)
+        goto FailedInit;
+
+
+
+    /* Allocate the circular frame buffer, which is the buffer that holds frames of
+    data that can be transferred to the application. */
+    bufSize = WM5Data->frameSize * aTIesrFAInstance->num_circular_buffer_frames;
+    WM5Data->circBuffer = (unsigned char*) malloc(bufSize * sizeof (unsigned char));
+    if (WM5Data->circBuffer == NULL)
+        goto FailedInit;
+
+    /* Allocate array of counters containing number of active bytes in each circular
+    buffer frame.  This way an audio channel can return partially full read frame buffers
+    and this will be handled correctly. Data will be put in a circular buffer frame 
+    until full, then that frame will be released to the application when requested. */
+    WM5Data->bytesInFrame =
+            (unsigned int *) malloc(aTIesrFAInstance->num_circular_buffer_frames * sizeof (unsigned int));
+    if (WM5Data->bytesInFrame == NULL)
+        goto FailedInit;
+
+    return TIesrFAWM5ErrNone;
+
+
+FailedInit:
+
+    wm5Error = TIesrFAWM5_destroybuf(WM5Data);
+
+    return TIesrFAWM5ErrFail;
+}
+
+/*----------------------------------------------------------------------
+    TIesrFAWM5_destroybuf
+
+    This function deallocates any of the buffers allocated by 
+    TIesrFAWM5_initbuf.  This makes it easy to clean up the TIesrFAWM5_t
+    structure of allocated memory.
+    --------------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_destroybuf(TIesrFAWM5_t * const aWM5Data) {
+    if (aWM5Data->readHeaders != NULL) {
+        free(aWM5Data->readHeaders);
+        aWM5Data->readHeaders = NULL;
+    }
+
+    if (aWM5Data->readBuffer != NULL) {
+        free(aWM5Data->readBuffer);
+        aWM5Data->readBuffer = NULL;
+    }
+
+    if (aWM5Data->readHeadersReturnQueue != NULL) {
+        free(aWM5Data->readHeadersReturnQueue);
+        aWM5Data->readHeadersReturnQueue = NULL;
+    }
+
+    if (aWM5Data->circBuffer != NULL) {
+        free(aWM5Data->circBuffer);
+        aWM5Data->circBuffer = NULL;
+    }
+
+    if (aWM5Data->bytesInFrame != NULL) {
+        free(aWM5Data->bytesInFrame);
+        aWM5Data->bytesInFrame = NULL;
+    }
+
+    return TIesrFAWM5ErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFA_open
+
+Implementation of the function that opens a channel and prepares for
+reading samples of audio data.
+----------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_open(TIesrFA_t * const aTIesrFAInstance) {
+    TIesrFAWM5_Error_t wm5Error;
+
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+    if (WM5Data->state != TIesrFAWM5StateInit) {
+        return TIesrFAErrState;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAOpen\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* Initialize the status to no errors when attempting to open */
+    WM5Data->status = 0;
+
+    /* If audio data is from a file, then open the file */
+    if (WM5Data->fileMode) {
+        WM5Data->filePointer = fopen(aTIesrFAInstance->channel_name, "rb");
+        if (WM5Data->filePointer == NULL) {
+            return TIesrFAErrFail;
+        }
+        WM5Data->frameData =
+                (unsigned char*) malloc(WM5Data->frameSize * sizeof (unsigned char));
+
+        if (WM5Data->frameData == NULL) {
+            fclose(WM5Data->filePointer);
+            WM5Data->filePointer = NULL;
+            WM5Data->status |= TIesrFAWM5StatusMemory;
+            return TIesrFAErrFail;
+        }
+    }        /* If audio data from WM5 audio, then open the channel */
+    else {
+        /* Open a WM5 audio channel */
+        wm5Error = TIesrFAWM5_open(aTIesrFAInstance);
+        if (wm5Error != TIesrFAWM5ErrNone) {
+            return TIesrFAErrFail;
+        }
+    }
+
+
+    /* Opened a channel successfully.  Ready to read audio samples */
+    WM5Data->state = TIesrFAWM5StateOpen;
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAOpen success\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFAWM5_open
+
+Try to open a WM5 audio port for reading audio data.
+----------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_open(TIesrFA_t * const aTIesrFAInstance) {
+    HWAVEIN wiHandle;
+    WAVEFORMATEX wvFormat;
+    MMRESULT mmResult;
+
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+    /* Define the WM5 format structure to find an audio channel */
+    wvFormat.wFormatTag = WM5Data->formatTag;
+    wvFormat.nChannels = 1;
+    wvFormat.nSamplesPerSec = aTIesrFAInstance->sample_rate;
+    wvFormat.nBlockAlign = WM5Data->sampleSize;
+    wvFormat.nAvgBytesPerSec = aTIesrFAInstance->sample_rate * WM5Data->sampleSize;
+    wvFormat.wBitsPerSample = WM5Data->sampleSize * 8;
+    wvFormat.cbSize = 0;
+
+    /* Try to open a WM5 channel with these characteristics */
+    mmResult = waveInOpen(&wiHandle, WAVE_MAPPER, &wvFormat,
+            (DWORD_PTR) TIesrFAWM5_waveinproc, (DWORD_PTR) aTIesrFAInstance,
+            CALLBACK_FUNCTION);
+
+    if (mmResult != MMSYSERR_NOERROR) {
+        return TIesrFAWM5ErrFail;
+    }
+
+    /* WM5 audio device opened successfully */
+    WM5Data->wiHandle = wiHandle;
+
+    return TIesrFAWM5ErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFA_start
+
+This function starts data collection on an opened channel.  The
+data collection starts in a new high priority thread in order to 
+maintain real time processing. After the thread is running, or
+fails to start this function will return.
+----------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_start(TIesrFA_t * const aTIesrFAInstance) {
+    unsigned int frame;
+    TIesrFAWM5_Error_t wm5Error;
+    MMRESULT mmResult;
+    DWORD threadStatus;
+
+
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+
+    /* The WM5 channel must be open */
+    if (WM5Data->state != TIesrFAWM5StateOpen) {
+        return TIesrFAErrState;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStart\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* Reset all status except memory errors prior to startup attempt */
+    WM5Data->status &= TIesrFAWM5StatusMemory;
+
+
+    /* If audio data is from a file, just return if file is opened */
+    if (WM5Data->fileMode) {
+        if (WM5Data->filePointer == NULL) {
+            return TIesrFAErrFail;
+        } else {
+            WM5Data->state = TIesrFAWM5StateRunning;
+
+#ifdef WM5_DEBUG_LOG
+            fprintf(WM5Data->logFile, "FAStart success\n");
+            fflush(WM5Data->logFile);
+#endif
+
+            return TIesrFAErrNone;
+        }
+    }
+
+#ifdef WM5_DEBUG_LOG
+    WM5Data->threadFile = fopen(THREADFILE, "w");
+    if (WM5Data->threadFile == NULL)
+        return TIesrFAErrFail;
+#endif
+
+
+    /* DEBUGGING */
+    WM5Data->totalReadHeadersReturned = 0;
+    WM5Data->totalCircFramesTransferred = 0;
+
+    /* Initialize flags indicating no buffer real-time status failures. */
+    WM5Data->circularOverflow = FALSE;
+    WM5Data->readUnderflow = FALSE;
+
+    /* Initialize number of valid bytes in each circular buffer frame */
+    for (frame = 0; frame < aTIesrFAInstance->num_circular_buffer_frames; frame++) {
+        WM5Data->bytesInFrame[frame] = 0;
+    }
+
+    /* Initialize variables for managing the WM5 read buffer frames and headers. 
+    These will be synchronized. */
+    WM5Data->readHeadersinReturnQueue = 0;
+    WM5Data->readHeadersActive = 0;
+    WM5Data->readHeadersInputIndex = 0;
+    WM5Data->readHeadersOutputIndex = 0;
+    WM5Data->readHeadersinAudioQueue = 0;
+
+    /* Initialize variables for managing the circular frame buffer */
+    WM5Data->circularFrameInputIndex = 0;
+    WM5Data->circularFrameOutputIndex = 0;
+    WM5Data->circularFramesFull = 0;
+
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStart initing sync\n");
+    fflush(WM5Data->logFile);
+#endif
+    /* Initialize the thread synchronization objects */
+    wm5Error = TIesrFAWM5_initsync(WM5Data,
+            aTIesrFAInstance->num_audio_buffer_frames,
+            aTIesrFAInstance->num_circular_buffer_frames);
+    if (wm5Error != TIesrFAWM5ErrNone) {
+        return TIesrFAErrFail;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStart prep headers\n");
+    fflush(WM5Data->logFile);
+#endif
+    /* Prepare all WM5 wave headers for read buffer frames  */
+    wm5Error = TIesrFAWM5_prepallheaders(aTIesrFAInstance);
+    if (wm5Error != TIesrFAWM5ErrNone) {
+        return TIesrFAErrFail;
+    }
+
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStart add headers\n");
+    fflush(WM5Data->logFile);
+#endif
+    /* Add all wave headers to the WM5 waveform audio driver queue.  It
+    now takes control of the read frame buffers.  It will return them 
+    when they are full, or when requested by a waveInReset. If this function
+    fails, all headers are unprepared. */
+    wm5Error = TIesrFAWM5_addallheaders(aTIesrFAInstance);
+    if (wm5Error != TIesrFAWM5ErrNone) {
+        return TIesrFAErrFail;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStart create thread\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* Create a thread that will start the audio device running and handle 
+    input in a separate high priority thread. The thread is created in a
+    suspended state. */
+    WM5Data->threadHandle = CreateThread(NULL, 0,
+            (LPTHREAD_START_ROUTINE) TIesrFAWM5_thread,
+            (LPVOID) aTIesrFAInstance, CREATE_SUSPENDED, NULL);
+    if (WM5Data->threadHandle == NULL) {
+        WM5Data->status |= TIesrFAWM5StatusCreateThread;
+
+        /* If the thread failed to be created then request return of
+        all wave headers, and clean up.  Since the thread has not
+        disturbed the header counters, this can be done synchronously. */
+        waveInReset(WM5Data->wiHandle);
+        TIesrFAWM5_unprepallheaders(aTIesrFAInstance, TRUE);
+
+        return TIesrFAErrFail;
+    }
+    SetThreadPriority(WM5Data->threadHandle, aTIesrFAInstance->priority);
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStart run thread\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* Start running the thread */
+    ResumeThread(WM5Data->threadHandle);
+
+
+    /* Wait for thread to report WM5 audio device start up, 
+    and check if it started ok */
+    threadStatus = WaitForSingleObject(WM5Data->startEvent, WM5_THREAD_WAIT);
+    if (threadStatus == WAIT_TIMEOUT) {
+        WM5Data->status |= TIesrFAWM5StatusStartThread;
+
+        /* The thread never responded that it started. Something is very wrong. 
+        This is a drastic step, to terminate the thread itself and free all resources. */
+        TerminateThread(WM5Data->threadHandle, TIesrFAWM5ErrFail);
+
+        /* Try to recover from the failed thread start-up */
+        CloseHandle(WM5Data->threadHandle);
+        WM5Data->threadHandle = NULL;
+
+        /* Request that the WM5 audio device return queued wave headers */
+        mmResult = waveInReset(WM5Data->wiHandle);
+
+        /* Unprepare the headers.  We can do this synchronously because
+        the WM5 audio driver started ok, and the thread has not disturbed
+        the buffer counters. */
+        wm5Error = TIesrFAWM5_unprepallheaders(aTIesrFAInstance, TRUE);
+
+        /* Clean up sync objects */
+        wm5Error = TIesrFAWM5_destroysync(WM5Data);
+
+        return TIesrFAErrFail;
+    } else if (WM5Data->threadError != TIesrFAWM5ErrNone) {
+        /* Thread had a failure on startup, indicating that
+        the WM5 audio device driver did not start correctly. Wait
+        for the thread to complete and remove it. */
+        WaitForSingleObject(WM5Data->threadHandle, INFINITE);
+        CloseHandle(WM5Data->threadHandle);
+        WM5Data->threadHandle = NULL;
+
+        /* Request that the WM5 audio device driver return queued
+        wave headers */
+        mmResult = waveInReset(WM5Data->wiHandle);
+
+        /* Since the WM5 audio device driver did not start ok, it is
+        best to assume that it may have problems returning headers,
+        so just unprep them after waiting a while. */
+        Sleep(WM5_WAVEINRESET_WAIT);
+        wm5Error = TIesrFAWM5_unprepallheaders(aTIesrFAInstance, FALSE);
+
+        /* Clean up sync objects */
+        wm5Error = TIesrFAWM5_destroysync(WM5Data);
+
+        return TIesrFAErrFail;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStart success\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* Thread started ok */
+    WM5Data->state = TIesrFAWM5StateRunning;
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFAWM5_initsync
+
+Initialize the synchronization objects for the circular buffer.
+
+--------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_initsync(TIesrFAWM5_t * const aWM5Data,
+        int aReadFrames, int aCircularFrames) {
+    /* Read frame buffer interface synchronization critical section. 
+    Synchronizes between audio driver callback and collection thread. */
+
+    try {
+        InitializeCriticalSection(&aWM5Data->readCriticalSection);
+    } catch (...) {
+        goto InitSyncFail;
+    }
+    aWM5Data->readCSInitialized = TRUE;
+
+
+    /* Event signaled when WM5 driver returns a read frame wave header. 
+    Stays signalled until there are no unprocessed read frames/headers in the 
+    read frame return queue. */
+    aWM5Data->readReturnEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+    if (aWM5Data->readReturnEvent == NULL)
+        goto InitSyncFail;
+
+    /* Event signaled when the thread process has initialized. */
+    aWM5Data->startEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    if (aWM5Data->startEvent == NULL)
+        goto InitSyncFail;
+
+    /* Event signaled when the applications wants to stop data collection */
+    aWM5Data->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+    if (aWM5Data->stopEvent == NULL)
+        goto InitSyncFail;
+
+    /* Critical section to interface with circular frame buffer.  
+    Synchronizes between collection thread and user request for a
+    frame of data. */
+    try {
+        InitializeCriticalSection(&aWM5Data->circularCriticalSection);
+    } catch (...) {
+        goto InitSyncFail;
+    }
+    aWM5Data->circCSInitialized = TRUE;
+
+
+    /* Semaphore incremented when a frame of data placed in circular buffer. */
+    aWM5Data->circularSemaphore = CreateSemaphore(NULL, 0, aCircularFrames, NULL);
+    if (aWM5Data->circularSemaphore == NULL)
+        goto InitSyncFail;
+
+    /* Object array that is used for waiting in thread */
+    aWM5Data->waitObjects[0] = aWM5Data->stopEvent;
+    aWM5Data->waitObjects[1] = aWM5Data->readReturnEvent;
+
+    return TIesrFAWM5ErrNone;
+
+InitSyncFail:
+    aWM5Data->status |= TIesrFAWM5StatusSync;
+
+    TIesrFAWM5_destroysync(aWM5Data);
+
+    return TIesrFAWM5ErrFail;
+}
+
+/*--------------------------------------------------------------------
+TIesrFAWM5_destroysync
+
+This function removes the sync objects when TIesrFAWM5 is done using them.
+----------------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_destroysync(TIesrFAWM5_t *aWM5Data) {
+
+    /* Check if critical section created ok before delete */
+    if (aWM5Data->readCSInitialized) {
+        DeleteCriticalSection(&aWM5Data->readCriticalSection);
+        aWM5Data->readCSInitialized = FALSE;
+    }
+
+    if (aWM5Data->readReturnEvent != NULL) {
+        CloseHandle(aWM5Data->readReturnEvent);
+        aWM5Data->readReturnEvent = NULL;
+    }
+
+    /* Check if critical section created ok before delete */
+    if (aWM5Data->circCSInitialized) {
+        DeleteCriticalSection(&aWM5Data->circularCriticalSection);
+        aWM5Data->circCSInitialized = FALSE;
+    }
+
+    if (aWM5Data->circularSemaphore != NULL) {
+        CloseHandle(aWM5Data->circularSemaphore);
+        aWM5Data->circularSemaphore = NULL;
+    }
+
+    if (aWM5Data->startEvent != NULL) {
+        CloseHandle(aWM5Data->startEvent);
+        aWM5Data->startEvent = NULL;
+    }
+
+    if (aWM5Data->stopEvent != NULL) {
+        CloseHandle(aWM5Data->stopEvent);
+        aWM5Data->stopEvent = NULL;
+    }
+
+    aWM5Data->waitObjects[0] = NULL;
+    aWM5Data->waitObjects[1] = NULL;
+
+    return TIesrFAWM5ErrNone;
+}
+
+/*-------------------------------------------------------------------
+TIesrFAWM5_prepallheaders
+
+This function prepares all of the WM5 waveform audio read buffer frame headers
+for all frames for use by the WM5 waveform audio input driver.
+----------------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_prepallheaders(TIesrFA_t *aTIesrFAInstance) {
+    TIesrFAWM5_Error_t wm5Error;
+    unsigned int frame;
+    unsigned int unframe;
+    PWAVEHDR wHeaders;
+    MMRESULT mmResult;
+
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+    /* Pointer to the array of WAVEHDR headers */
+    wHeaders = WM5Data->readHeaders;
+
+    /* Clear all flags, so they can be used to determine which read frame buffer
+    headers have been prepared */
+    for (frame = 0; frame < aTIesrFAInstance->num_audio_buffer_frames; frame++) {
+        wHeaders[frame].dwFlags = 0;
+    }
+
+    /* Prepare each header.  The user data for each header is its frame index. */
+    for (frame = 0; frame < aTIesrFAInstance->num_audio_buffer_frames; frame++) {
+        wm5Error = TIesrFAWM5_prepheader(WM5Data, &wHeaders[frame], frame);
+
+        /* If any prepare fails, unprepare all prepared headers and return error */
+        if (wm5Error != TIesrFAWM5ErrNone) {
+            for (unframe = 0; unframe < frame; unframe++) {
+                mmResult = waveInUnprepareHeader(WM5Data->wiHandle,
+                        &wHeaders[unframe], sizeof (WAVEHDR));
+
+                if (mmResult != MMSYSERR_NOERROR)
+                    WM5Data->status |= TIesrFAWM5StatusUnprep;
+            }
+            return TIesrFAWM5ErrFail;
+        }
+    }
+
+    return TIesrFAWM5ErrNone;
+}
+
+/*--------------------------------------------------------------------
+TIesrFAWM5_prepheader
+
+This function prepares the WM5 header for the read buffer frame indexed by
+aFrame for use by the WM5 audio input driver.
+------------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_prepheader(TIesrFAWM5_t *aWM5Data,
+        PWAVEHDR aHeader,
+        unsigned int aFrame) {
+    MMRESULT mmResult;
+    unsigned char* bufferLocation;
+
+    bufferLocation = aWM5Data->readBuffer +
+            aFrame * aWM5Data->readBufSize;
+
+    /* Prepare the header for the present frame buffer.  dwUser holds the 
+    frame index number associated with the frame buffer of this header. */
+    aHeader->lpData = (LPSTR) bufferLocation;
+    aHeader->dwBufferLength = aWM5Data->readBufSize;
+    aHeader->dwUser = aFrame;
+    aHeader->dwFlags = 0;
+
+    mmResult = waveInPrepareHeader(aWM5Data->wiHandle, aHeader, sizeof (WAVEHDR));
+    if (mmResult != MMSYSERR_NOERROR) {
+        aWM5Data->status |= TIesrFAWM5StatusPrep;
+
+        return TIesrFAWM5ErrFail;
+    }
+    return TIesrFAWM5ErrNone;
+}
+
+/*---------------------------------------------------------------
+TIesrFAWM5_addallheaders
+
+This function adds all of the read frame buffers as specified 
+by their WAVEHDR objects to the WM5 waveform audio device driver queue.  
+If any of them can not be added, then all headers are unprepared
+and failure is returned.  This happens prior to starting of the 
+audio collection thread.  Note that this function must be called after 
+waveInOpen opens the WM5 audio device driver, but before the driver
+is started by waveInStart.
+-----------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_addallheaders(TIesrFA_t* aTIesrFAInstance) {
+    PWAVEHDR wHeaders;
+    bool headersQueued;
+    unsigned int frame;
+    MMRESULT mmResult;
+    TIesrFAWM5_Error_t wm5Error;
+
+    TIesrFAWM5_t* WM5Data = (TIesrFAWM5_t*) aTIesrFAInstance->impl_data;
+
+    /* Track error */
+    wm5Error = TIesrFAWM5ErrNone;
+
+    wHeaders = WM5Data->readHeaders;
+
+    for (frame = 0; frame < aTIesrFAInstance->num_audio_buffer_frames; frame++) {
+        /* Add a buffer to the WM5 audio driver which has not started yet. */
+        mmResult = waveInAddBuffer(WM5Data->wiHandle, &wHeaders[frame], sizeof (WAVEHDR));
+
+        if (mmResult == MMSYSERR_NOERROR) {
+            WM5Data->readHeadersActive++;
+            WM5Data->readHeadersinAudioQueue++;
+        } else {
+            /* waveInReset should return buffers even if audio driver
+            not started yet? */
+            WM5Data->status |= TIesrFAWM5StatusAddHdr;
+            headersQueued = (WM5Data->readHeadersinAudioQueue > 0);
+            waveInReset(WM5Data->wiHandle);
+            wm5Error = TIesrFAWM5_unprepallheaders(aTIesrFAInstance, headersQueued);
+
+            return (wm5Error == TIesrFAWM5ErrNone) ? TIesrFAWM5ErrFail : wm5Error;
+        }
+    }
+
+    return TIesrFAWM5ErrNone;
+}
+
+/*-------------------------------------------------------------------
+TIesrFAWM5_unprepallheaders
+
+This function unprepares all of the read buffer frame WAVEHDR headers.
+It is assumed when this function is called that all headers have been
+or are in the process of being released by the WM5 waveform audio driver,
+for example by calling waveInReset.  This function is looping, and 
+continues to loop until no headers remain that are not unprepared.
+So, it is critical that no header remain in the driver queue.  The 
+optional boolean aQueuedFlag specifies that at least some wave headers
+have been queued to the audio buffer.  If this is the case, then this 
+function loops until all of the headers have been returned prior to 
+unpreparing the headers. 
+---------------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_unprepallheaders(TIesrFA_t *aTIesrFAInstance,
+        BOOL aQueuedFlag) {
+    unsigned int frame;
+    PWAVEHDR wHeaders;
+    TIesrFAWM5_Error_t wm5Error;
+    MMRESULT mmResult;
+
+    TIesrFAWM5_t *WM5Data = (TIesrFAWM5_t *) aTIesrFAInstance->impl_data;
+
+    wHeaders = WM5Data->readHeaders;
+
+    /* Track error to return */
+    wm5Error = TIesrFAWM5ErrNone;
+
+    /* If headers are queued, loop until they have all been returned.
+    TIesr has kept a counter in readHeadersinAudioQueue of the read
+    frames/headers that have been sent to the WM5 audio queue but not
+    processed from a return yet.
+    Include a method to exit the loop to just give up if it appears 
+    that the WM5 audio driver never releases the headers.
+    This would be some form of catastrophic failure. */
+    if (aQueuedFlag) {
+        while (WM5Data->readHeadersinAudioQueue > 0) {
+            mmResult = WaitForSingleObject(WM5Data->readReturnEvent, WM5_THREAD_WAIT);
+
+            /* The WM5 Driver did not respond by sending back a remaining 
+            queued frame/header */
+            if (mmResult == WAIT_TIMEOUT) {
+                WM5Data->status |= TIesrFAWM5StatusDequeue;
+                break;
+            }
+
+            /* Count the read frames/headers that are being returned by
+            consuming them immediately. */
+            EnterCriticalSection(&WM5Data->readCriticalSection);
+
+            WM5Data->readHeadersinReturnQueue--;
+            if (WM5Data->readHeadersinReturnQueue == 0)
+                ResetEvent(WM5Data->readReturnEvent);
+
+            LeaveCriticalSection(&WM5Data->readCriticalSection);
+
+            WM5Data->readHeadersinAudioQueue--;
+        }
+    }
+
+
+    /* Try to unprepare all of the headers */
+    for (frame = 0; frame < aTIesrFAInstance->num_audio_buffer_frames; frame++) {
+        /* Check if header was returned from WM5 driver queue. That is,
+        the driver is done with the header.  This should normally be the
+        case. */
+        if (wHeaders[frame].dwFlags & WHDR_DONE) {
+            /* Unprepare the wave header */
+            mmResult = waveInUnprepareHeader(WM5Data->wiHandle,
+                    &wHeaders[frame], sizeof (WAVEHDR));
+
+            if (mmResult != MMSYSERR_NOERROR) {
+                WM5Data->status |= TIesrFAWM5StatusUnprep;
+                wm5Error = TIesrFAWM5ErrFail;
+            }
+        }            /* This is some form of critical failure, since the audio driver
+            did not release the wave header. */
+        else {
+            WM5Data->status |= TIesrFAWM5StatusInQueue;
+            wm5Error = TIesrFAWM5ErrFail;
+        }
+    }
+
+    return wm5Error;
+}
+
+/*----------------------------------------------------------------
+TIesrFA_getframe
+
+The user is requesting a frame of data from the audio channel.
+Check if any frames of data are available.  If blocking is
+requested, and no frame data is available, block for next frame.
+Otherwise if blocking is not requested and no frame data is
+available, just return error information that a frame of data is not
+available yet.
+----------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_getframe(TIesrFA_t * const aTIesrFAInstance,
+        unsigned char* const aFrame,
+        const int aBlock,
+        unsigned int *aFramesQueued) {
+    DWORD waitResult;
+    unsigned char* circFrame;
+    int bufferOverflow;
+    unsigned int numBytesRead;
+
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+
+    /* The channel must be reading audio */
+    if (WM5Data->state != TIesrFAWM5StateRunning) {
+        return TIesrFAErrState;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAGetFrame\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* If audio is coming from the file, just read the samples.
+    If at the end of the file, just continue to output the last frame */
+    if (WM5Data->fileMode) {
+        *aFramesQueued = 0;
+        if (!feof(WM5Data->filePointer)) {
+            numBytesRead = fread(aFrame, sizeof (unsigned char),
+                    WM5Data->frameSize,
+                    WM5Data->filePointer);
+
+            if (numBytesRead == WM5Data->frameSize) {
+                /* Save copy of the latest full frame */
+                memcpy(WM5Data->frameData, aFrame, WM5Data->frameSize);
+            } else {
+                /* Output the copy of the last full frame */
+                memcpy(aFrame, WM5Data->frameData, WM5Data->frameSize);
+                return (TIesrFAErrEOF);
+
+            }
+        } else {
+            /* Output a copy of the last full frame */
+            memcpy(aFrame, WM5Data->frameData, WM5Data->frameSize);
+            return (TIesrFAErrEOF);
+        }
+
+        return TIesrFAErrNone;
+    }
+
+
+
+    /* Not reading from a file, so reading from live WM5 audio channel.
+    Check to see if a frame of data is available */
+    if (aBlock) {
+        /* Block waiting for a frame */
+        waitResult =
+                WaitForSingleObject(WM5Data->circularSemaphore, WM5_THREAD_FRAME_WAIT);
+        if (waitResult == WAIT_TIMEOUT) {
+            WM5Data->status |= TIesrFAWM5StatusWaitThread;
+            return TIesrFAErrThread;
+        }
+    } else {
+        /* Check for frame available right now, if not notify user */
+        waitResult = WaitForSingleObject(WM5Data->circularSemaphore, 0);
+        if (waitResult == WAIT_TIMEOUT)
+            return TIesrFAErrNoFrame;
+    }
+
+    /* A frame is available, so transfer it to the user's memory */
+    circFrame = WM5Data->circBuffer +
+            WM5Data->circularFrameOutputIndex * WM5Data->frameSize;
+
+    memcpy(aFrame, circFrame, WM5Data->frameSize);
+
+    /* Update the circular buffer samples and pointer to indicate we
+    are finished with the frame.  This is mutex protected, to
+    protect the circular buffer frame access by both threads */
+    EnterCriticalSection(&WM5Data->circularCriticalSection);
+
+    WM5Data->bytesInFrame[ WM5Data->circularFrameOutputIndex ] = 0;
+    WM5Data->circularFramesFull--;
+    *aFramesQueued = WM5Data->circularFramesFull;
+
+    bufferOverflow = WM5Data->circularOverflow || WM5Data->readUnderflow;
+
+
+#ifdef MYDEBUG
+    printf("Get: circ frame %d, circ full: %d\n",
+            WM5Data->circularFrameOutputIndex, WM5Data->circularFramesFull);
+#endif
+
+    LeaveCriticalSection(&WM5Data->circularCriticalSection);
+
+    /* Go to the next output circular buffer frame, which the read
+    thread will fill or has already filled. */
+    WM5Data->circularFrameOutputIndex++;
+    if (WM5Data->circularFrameOutputIndex >= aTIesrFAInstance->num_circular_buffer_frames) {
+        WM5Data->circularFrameOutputIndex = 0;
+    }
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAGetframe end %d\n", bufferOverflow);
+    fflush(WM5Data->logFile);
+#endif
+
+    /* Successfully transferred a frame */
+    if (bufferOverflow)
+        return TIesrFAErrOverflow;
+    else
+        return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFAWM5_thread
+
+This function is the thread function that reads audio sample data
+from the WM5 device and puts the data into the circular buffers.
+--------------------------------*/
+static
+DWORD TIesrFAWM5_thread(LPVOID aArg) {
+    TIesrFAWM5_Error_t wm5Error;
+    MMRESULT mmResult;
+    DWORD waitObject;
+
+    TIesrFA_t * const aTIesrFAInstance = (TIesrFA_t * const) aArg;
+
+    /* WM5 specific data */
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->threadFile, "FAThread\n");
+    fflush(WM5Data->threadFile);
+#endif
+
+    /* Initially flag failure to start the audio collection */
+    WM5Data->threadError = TIesrFAWM5ErrFail;
+
+    /* Try to start the WM5 waveform audio device driver */
+    mmResult = waveInStart(WM5Data->wiHandle);
+    if (mmResult != MMSYSERR_NOERROR) {
+        /* On failure signal the start function that thread failed to start
+        the WM5 audio device driver, then terminate the thread by exiting. */
+        SetEvent(WM5Data->startEvent);
+        return TIesrFAWM5ErrFail;
+    }
+
+    /* Signal the start function that audio is now being collected. */
+    WM5Data->threadError = TIesrFAWM5ErrNone;
+    SetEvent(WM5Data->startEvent);
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->threadFile, "FAThread loop start\n");
+    fflush(WM5Data->threadFile);
+#endif
+
+    /* Loop reading sampled data */
+    while (TRUE) {
+        /* Wait either for the user to request that data collection be stopped or
+        for a read frame to become available. */
+        waitObject = WaitForMultipleObjects(2, WM5Data->waitObjects, FALSE, INFINITE);
+
+        /* Check to see if the user signaled to finish data collection.
+        If so, then just exit the thread. */
+        if (waitObject == WAIT_OBJECT_0) {
+            break;
+        }            /* Check to see if the read return event indicates a WM5 wave header
+            is filled and available. */
+        else if (waitObject == WAIT_OBJECT_0 + 1) {
+
+            /* If the read return event is signaled, then fill frames in the
+            circular frame buffer from the read frame buffer in the read frame
+            queue.  This function will also synchronously reset the read 
+            return event if no more read frames are in the read frame buffer */
+            wm5Error = TIesrFAWM5_fillframes(aTIesrFAInstance);
+        }            /* Some other condition occurred in the wait.  This is some kind of
+            failure. */
+        else {
+            // TODO: Handle wait failure.
+        }
+    }
+
+    /* The flag has been set to stop processing WM5 audio data, so we
+    just terminate the thread */
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->threadFile, "FAThread end\n");
+    fflush(WM5Data->threadFile);
+#endif
+
+    return TIesrFAWM5ErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFAWM5_waveinproc
+
+This is the WM5 waveform audio driver callback procedure that is called
+each time the driver releases a wave header.  This function queues the header
+onto the read return queue for processing by the thread, which will 
+copy the data into the circular buffer if space permits.  This function
+also checks to ensure that at least one wave header is still queued.  If
+not, then data is lost.
+---------------------------------------------------------------------*/
+static
+void CALLBACK TIesrFAWM5_waveinproc(HWAVEIN aWIHandle, UINT aMsg,
+        DWORD aInstance, DWORD aParam1,
+        DWORD aParam2) {
+    unsigned int frame;
+    PWAVEHDR pWaveHeader;
+
+    TIesrFA_t * const aTIesrFAInstance = (TIesrFA_t * const) aInstance;
+
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+    /* Only process data callback messages */
+    if (aMsg != WIM_DATA)
+        return;
+
+    /* A read frame wave header has been returned.  Find which 
+    header frame index has been returned. */
+    pWaveHeader = (PWAVEHDR) aParam1;
+    frame = (unsigned int) pWaveHeader->dwUser;
+
+    /* Updating of the read return queue and counters must be synchronized. */
+    EnterCriticalSection(&WM5Data->readCriticalSection);
+
+    /* Put the wave header frame index in the read frame return queue. */
+    WM5Data->readHeadersReturnQueue[ WM5Data->readHeadersInputIndex ] = frame;
+    WM5Data->readHeadersinReturnQueue++;
+
+    /* Signal that another read frame is ready for processing. */
+    SetEvent(WM5Data->readReturnEvent);
+
+    /* DEBUGGING */
+    WM5Data->totalReadHeadersReturned++;
+
+    /* Check to see if the WM5 audio driver has returned all read
+    return frames/headers, and is therefore starved for queued 
+    wave headers.  Normally readHeadersActive should remain a constant
+    during processing, but it can decrease if a waveInAddHeader fails
+    during data collection.  readHeadersActive is not synchronized since 
+    waveInAddHeader can not be synchronized with this callback function,
+    so the underflow may not be set in the very rare condition that
+    a waveInAddHeader fails and the readHeadersActive changes exactly 
+    when this callback function is at this code. */
+    if (WM5Data->readHeadersinReturnQueue >=
+            WM5Data->readHeadersActive) {
+        WM5Data->readUnderflow = TRUE;
+        WM5Data->status |= TIesrFAWM5StatusUnderflow;
+    }
+
+#ifdef MYDEBUG
+    printf("Drv: hdr %d put in read queue at %d,  %d hdrs in queue\n",
+            frame, WM5Data->readHeadersInputIndex, WM5Data->readHeadersinReturnQueue);
+#endif
+
+    LeaveCriticalSection(&WM5Data->readCriticalSection);
+
+
+    /* Update the read frame return queue input index */
+    WM5Data->readHeadersInputIndex++;
+    if (WM5Data->readHeadersInputIndex >= aTIesrFAInstance->num_audio_buffer_frames) {
+        WM5Data->readHeadersInputIndex = 0;
+    }
+
+    return;
+}
+
+/*----------------------------------------------------------------
+TIesrFAWM5_fillframes
+
+This function is called when a read frame wave header data returned by the
+WM5 audio driver is available.  This function is responsible for 
+transferring the data to one or more circular frame buffers, and for
+requeuing the wave header back to the WM5 audio driver queue. The
+function puts the data into one or more circular buffer frames, and
+if circular buffer frames are filled, then it updates the circular
+buffer frame pointer and semaphore accordingly.
+-------------------------------------------------------------------------*/
+static
+TIesrFAWM5_Error_t TIesrFAWM5_fillframes(TIesrFA_t * const aTIesrFAInstance) {
+    unsigned int frame;
+    PWAVEHDR wHeaders;
+    unsigned int framesFull;
+    unsigned char* readFrameData;
+    unsigned int readBytesRemaining;
+    unsigned int circBytesRemaining;
+    unsigned int readFrameOffset;
+    unsigned int circFrameOffset;
+    unsigned char* circFrameData;
+    MMRESULT mmResult;
+
+
+
+    /* WM5 specific data */
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+    /* Simulate circular buffer filling not able to keep up with real-time */
+    //Sleep(50);
+
+    /* Determine next available wave header frame on the read frame return queue. */
+    wHeaders = WM5Data->readHeaders;
+    frame = WM5Data->readHeadersReturnQueue[ WM5Data->readHeadersOutputIndex ];
+
+
+    /* Initialize number of bytes in the read frame and frame location */
+    readBytesRemaining = wHeaders[frame].dwBytesRecorded;
+    readFrameData = WM5Data->readBuffer + frame * WM5Data->readBufSize;
+    readFrameOffset = 0;
+
+    /* printf( "BytesRead %d\n", aBytesRead ); */
+
+    while (readBytesRemaining > 0) {
+        /* Determine if all circular frames are full.  If so, there is an overflow
+        condition, so do not put data from read frame into circular frame buffer.
+        Synchronize the fetch of number of circular frame buffers full. */
+        EnterCriticalSection(&WM5Data->circularCriticalSection);
+        framesFull = WM5Data->circularFramesFull;
+        LeaveCriticalSection(&WM5Data->circularCriticalSection);
+
+        /* printf( "Frames full: %d\n", framesFull ); */
+
+        if (framesFull == aTIesrFAInstance->num_circular_buffer_frames) {
+            /* Log that a buffer overflow occurred, and exit loop without
+            using the data from the read frame buffer since there is no
+            place to put it.  Real-time has been lost. */
+
+            WM5Data->status |= TIesrFAWM5StatusOverflow;
+            WM5Data->circularOverflow = TRUE;
+            break;
+        } else {
+            /* The circular buffer frame is not full, so put data into it */
+            circFrameData = WM5Data->circBuffer +
+                    WM5Data->circularFrameInputIndex * WM5Data->frameSize;
+
+            /* This should be ok unprotected by a mutex, since if the frame is not full, 
+            the main thread will not be clearing the bytesInFrame variable for this frame */
+            circBytesRemaining = WM5Data->frameSize -
+                    WM5Data->bytesInFrame[ WM5Data->circularFrameInputIndex ];
+
+            circFrameOffset = WM5Data->frameSize - circBytesRemaining;
+
+            /* Check if there are enough read buffer bytes to completely fill the present
+            input circular frame buffer */
+            if (readBytesRemaining >= circBytesRemaining) {
+                /* completely fill the circular frame */
+                memcpy(circFrameData + circFrameOffset, readFrameData + readFrameOffset,
+                        circBytesRemaining);
+
+                WM5Data->bytesInFrame[ WM5Data->circularFrameInputIndex ] +=
+                        circBytesRemaining;
+
+                /* Adjust location and amount of next data to use read frame buffer */
+                readBytesRemaining -= circBytesRemaining;
+                readFrameOffset += circBytesRemaining;
+
+
+                /* Indicate to the main thread that a new frame is available. Protected 
+                by synchronization. */
+                EnterCriticalSection(&WM5Data->circularCriticalSection);
+
+                WM5Data->circularFramesFull++;
+
+                /* DEBUGGING */
+                WM5Data->totalCircFramesTransferred++;
+
+                /* Another circular frame is available for processing indicated
+                by the semaphore */
+                ReleaseSemaphore(WM5Data->circularSemaphore, 1, NULL);
+
+                LeaveCriticalSection(&WM5Data->circularCriticalSection);
+
+
+                /* Go to the next circular frame buffer, 
+                since the present one is now full */
+                WM5Data->circularFrameInputIndex++;
+                if (WM5Data->circularFrameInputIndex >=
+                        aTIesrFAInstance->num_circular_buffer_frames) {
+                    WM5Data->circularFrameInputIndex = 0;
+                }
+            }
+                /* There are not enough read frame buffer bytes to fill the present input
+                circular frame buffer.  Put all remaining read frame buffer bytes into
+                the circular frame buffer, but it is not full yet so do not need to update
+                any inter-thread  status. This will exit the while loop, since no more
+                readFrameData bytes remain to be processed. */
+            else {
+                memcpy(circFrameData + circFrameOffset,
+                        readFrameData + readFrameOffset, readBytesRemaining);
+
+                WM5Data->bytesInFrame[ WM5Data->circularFrameInputIndex ] +=
+                        readBytesRemaining;
+
+                /* printf( "Add to %d with %d\n", WM5Data->input_buffer_frame, bufBytesRemaining ); */
+
+                readBytesRemaining = 0;
+            }
+        }
+    }
+
+    /* Done with this wave header and its read frame buffer, so TIesrFA
+    knows that one read frame buffer has been consumed.  This is a local
+    count of frames sent to the audio queue but not yet processed. */
+    WM5Data->readHeadersinAudioQueue--;
+
+    /*Update read return queue output index. */
+    WM5Data->readHeadersOutputIndex++;
+    if (WM5Data->readHeadersOutputIndex >= aTIesrFAInstance->num_audio_buffer_frames)
+        WM5Data->readHeadersOutputIndex = 0;
+
+    /* Gain lock on the WM5 audio driver CS so that the count of read frames
+    in the queue is synchronized. */
+    EnterCriticalSection(&WM5Data->readCriticalSection);
+
+    /*  Check if the waveform audio driver has returned all active headers.  
+    If this is the case, then the driver is starved for headers, 
+    and real-time is lost. */
+    if (WM5Data->readHeadersinReturnQueue == WM5Data->readHeadersActive) {
+        WM5Data->readUnderflow = TRUE;
+        WM5Data->status |= TIesrFAWM5StatusUnderflow;
+    }
+
+    /* Finished with this read frame buffer.  This count is synchronized. */
+    WM5Data->readHeadersinReturnQueue--;
+
+    /* If there are no more read frames in the queue, then reset the event, so that
+    the thread must wait for the WM5 audio driver to signal when more read headers
+    become available. Otherwise, leave the event signaled, since there are more
+    read frames in the read frame return queue to process.  It is required that
+    this event be synchronized.*/
+    if (WM5Data->readHeadersinReturnQueue == 0)
+        ResetEvent(WM5Data->readReturnEvent);
+
+#ifdef MYDEBUG
+    printf("Fill: hdr %d consumed, %d hdrs in read queue\n",
+            frame, WM5Data->readHeadersinReturnQueue);
+#endif
+
+    LeaveCriticalSection(&WM5Data->readCriticalSection);
+
+
+    /* Re-queue the wave header just used back to the WM5 audio device queue.
+    This call cannot be made synchronized with the readCriticalSection or
+    TIesrFA will hang since the WM5 audio driver callback function may be
+    waiting for the CS, and at the same time waveInAddBuffer can not
+    complete since the driver is blocked. */
+    mmResult = waveInAddBuffer(WM5Data->wiHandle, &wHeaders[frame], sizeof (WAVEHDR));
+
+    if (mmResult == MMSYSERR_NOERROR) {
+        /* TIesrFA successfully put back another wave header in the 
+        WM5 audio driver queue */
+        WM5Data->readHeadersinAudioQueue++;
+    } else {
+        /* Just report error in status.  If this continues to happen,
+        eventually the thread will become non-responsive and the user
+        will detect this as a failure to get a frame of data. */
+        WM5Data->status |= TIesrFAWM5StatusReAddHdr;
+        WM5Data->readHeadersActive--;
+
+        /* If only one or less read frame/headers remains active, 
+        then surely real-time will be lost. This would be a fairly
+        catostrophic failure, and is not likely to happen. */
+        if (WM5Data->readHeadersActive <= 1) {
+            WM5Data->readUnderflow = TRUE;
+            WM5Data->status |= TIesrFAWM5StatusUnderflow;
+        }
+
+    }
+
+#ifdef MYDEBUG
+    printf("Fill: finished hdr %d, hdrs to process %d\n",
+            frame, WM5Data->readHeadersinAudioQueue);
+#endif
+
+    /* Done successfully filling the circular buffer from the read buffer */
+    return TIesrFAWM5ErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFA_stop
+
+This function call stops data collection.  This does not close the
+audio channel, which is still available for doing another recording
+by calling TIesrFA_start. This function does stop the audio data
+collection thread.
+----------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_stop(TIesrFA_t * const aTIesrFAInstance) {
+    TIesrFAWM5_Error_t wm5Error;
+    MMRESULT mmResult;
+    DWORD threadResult;
+    TIesrFA_Error_t faError;
+
+
+    /* WM5 specific data */
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+    if (WM5Data->state != TIesrFAWM5StateRunning) {
+        return TIesrFAErrState;
+    }
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStop\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* If audio is coming from a file, just rewind it */
+    if (WM5Data->fileMode) {
+        fseek(WM5Data->filePointer, 0, SEEK_SET);
+        clearerr(WM5Data->filePointer);
+
+        WM5Data->state = TIesrFAWM5StateOpen;
+
+#ifdef WM5_DEBUG_LOG
+        fprintf(WM5Data->logFile, "FAStop success\n");
+        fflush(WM5Data->logFile);
+#endif
+        return TIesrFAErrNone;
+    }
+
+    /* Track output error to return */
+    faError = TIesrFAErrNone;
+
+    /* Set the stop event to stop reading data and shut down thread */
+    /* Should this be synchronized? */
+    SetEvent(WM5Data->stopEvent);
+
+    /* Wait for thread to complete */
+    threadResult = WaitForSingleObject(WM5Data->threadHandle, WM5_THREAD_WAIT);
+    if (threadResult == WAIT_TIMEOUT) {
+        /* The thread is not responding, set error status and terminate it. */
+        WM5Data->status |= TIesrFAWM5StatusEndThread;
+        TerminateThread(WM5Data->threadHandle, TIesrFAWM5ErrThreadTimeout);
+        faError = TIesrFAErrThread;
+    }
+
+    CloseHandle(WM5Data->threadHandle);
+    WM5Data->threadHandle = NULL;
+
+#ifdef WM5_DEBUG_LOG
+    if (WM5Data->threadFile) {
+        fclose(WM5Data->threadFile);
+        WM5Data->threadFile = NULL;
+    }
+
+    fprintf(WM5Data->logFile, "FAStop closed thread\n");
+    fflush(WM5Data->logFile);
+#endif
+    /* printf( "Thread ended\n"); o*/
+
+    /* Stop the WM5 audio driver audio collection, and unprepare headers. */
+    mmResult = waveInReset(WM5Data->wiHandle);
+
+    /* If the thread failed to exit, then some catastrophic failure occurred
+    in the thread, and the thread has been terminated.  Header counters
+    may not be good.  Simply wait for the waveInReset to return headers
+    and then try to unprep them without synchronization. */
+    if (faError == TIesrFAErrThread) {
+        Sleep(WM5_WAVEINRESET_WAIT);
+        wm5Error = TIesrFAWM5_unprepallheaders(aTIesrFAInstance, FALSE);
+    } else {
+        wm5Error = TIesrFAWM5_unprepallheaders(aTIesrFAInstance, TRUE);
+    }
+
+    if (wm5Error != TIesrFAWM5ErrNone) {
+        if (faError == TIesrFAErrNone)
+            faError = TIesrFAErrFail;
+    }
+
+    /* Reset sync objects */
+    wm5Error = TIesrFAWM5_destroysync(WM5Data);
+    if (wm5Error != TIesrFAWM5ErrNone) {
+        if (faError == TIesrFAErrNone)
+            faError = TIesrFAErrFail;
+    }
+
+    WM5Data->state = TIesrFAWM5StateOpen;
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAStop end %d\n", faError);
+    fflush(WM5Data->logFile);
+#endif
+    return faError;
+}
+
+/*----------------------------------------------------------------
+TIesrFA_close
+
+Close an audio channel.  Just closes the audio channel, but does not
+deallocate the TIesrFA resources.  The channel can be reopened.
+----------------------------------------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_close(TIesrFA_t * const aTIesrFAInstance) {
+
+    MMRESULT mmResult;
+
+    /* WM5 specific data */
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+    if (WM5Data->state != TIesrFAWM5StateOpen) {
+        return TIesrFAErrState;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAClose\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* If data is coming from a file, close the file, and free frame data memory */
+    if (WM5Data->fileMode) {
+        fclose(WM5Data->filePointer);
+        WM5Data->filePointer = NULL;
+
+        free(WM5Data->frameData);
+        WM5Data->frameData = NULL;
+
+        WM5Data->state = TIesrFAWM5StateInit;
+
+#ifdef WM5_DEBUG_LOG
+        fprintf(WM5Data->logFile, "FAClose success\n");
+        fflush(WM5Data->logFile);
+#endif
+
+        return TIesrFAErrNone;
+    }
+
+
+    /* Close the WM5 audio port, which stops recording and flushes data */
+    mmResult = waveInClose(WM5Data->wiHandle);
+    if (mmResult != MMSYSERR_NOERROR) {
+        return TIesrFAErrFail;
+    }
+
+    WM5Data->wiHandle = NULL;
+    WM5Data->state = TIesrFAWM5StateInit;
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FAClose success\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    return TIesrFAErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrFA_destroy
+
+This function is supplied to free all memory allocated to an
+instance of the audio channel.  It does not destroy the instance
+object itself.
+--------------------------------*/
+TIESRFA_API
+TIesrFA_Error_t TIesrFA_destroy(TIesrFA_t * const aTIesrFAInstance) {
+    TIesrFAWM5_Error_t wm5Error;
+    TIesrFA_Error_t faError;
+
+    /* WM5 specific data */
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+
+    /* Check for already in an uninitialized state */
+    if (WM5Data == NULL) {
+        return TIesrFAErrNone;
+    }
+
+
+    /* Check if the WM5 channel is not closed */
+    if (WM5Data->state != TIesrFAWM5StateInit) {
+        return TIesrFAErrState;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FADestroy\n");
+    fflush(WM5Data->logFile);
+#endif
+
+    /* Track return error */
+    faError = TIesrFAErrNone;
+
+
+    /* Close file if open.  Should not happen */
+    if (WM5Data->fileMode) {
+        if (WM5Data->filePointer != NULL) {
+            fclose(WM5Data->filePointer);
+            WM5Data->filePointer = NULL;
+        }
+
+        if (WM5Data->frameData != NULL) {
+            free(WM5Data->frameData);
+            WM5Data->frameData = NULL;
+        }
+    }
+
+
+    /* Destroy syncrhonization objects.  They should already be destroyed by a 
+    TIesrFA_stop, or failure to start correctly, but this will make sure. */
+    wm5Error = TIesrFAWM5_destroysync(WM5Data);
+    if (wm5Error != TIesrFAWM5ErrNone) {
+        if (faError == TIesrFAErrNone)
+            faError = TIesrFAErrFail;
+    }
+
+    /* Free all buffer space */
+    wm5Error = TIesrFAWM5_destroybuf(WM5Data);
+    if (wm5Error != TIesrFAWM5ErrNone) {
+        if (faError == TIesrFAErrNone)
+            faError = TIesrFAErrFail;
+    }
+
+#ifdef WM5_DEBUG_LOG
+    fprintf(WM5Data->logFile, "FADestroy end\n");
+    fflush(WM5Data->logFile);
+
+    if (WM5Data->logFile)
+        fclose(WM5Data->logFile);
+
+    if (WM5Data->threadFile)
+        fclose(WM5Data->threadFile);
+#endif
+
+    /* Free the WM5 impl_data object itself.  This removes any WM5
+    implementation state information */
+    free(WM5Data);
+    aTIesrFAInstance->impl_data = NULL;
+
+
+    /* Free channel (or file) name */
+    if (aTIesrFAInstance->channel_name != NULL) {
+        free(aTIesrFAInstance->channel_name);
+        aTIesrFAInstance->channel_name = NULL;
+    }
+
+    return faError;
+}
+
+/*---------------------------------------------------------
+TIesrFA_status
+
+This function returns a status unsigned int that can be used
+during debugging of TIesrFA.  It provides status of failures
+during processing.
+----------------------------------------------------------*/
+TIESRFA_API
+unsigned int TIesrFA_status(TIesrFA_t * const aTIesrFAInstance) {
+    /* WM5 specific data */
+    TIesrFAWM5_t * const WM5Data = (TIesrFAWM5_t * const) aTIesrFAInstance->impl_data;
+
+    if (WM5Data == NULL) {
+        return TIesrFAWM5StatusMemory;
+    } else {
+        return WM5Data->status;
+    }
+}
diff --git a/TIesrFA/src/TIesrFA_WM5.h b/TIesrFA/src/TIesrFA_WM5.h
new file mode 100755 (executable)
index 0000000..da10e9e
--- /dev/null
@@ -0,0 +1,300 @@
+/*=======================================================================
+ TIesrFA_WM5.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header file defines the objects that are internal to this
+ particular implmentation of the TIesrFA API, and do not need to be
+ accessed by the user.
+
+ This implmementation of the API is for use on Windows Mobile 5.0
+ systems, and uses the Windows Waveform Audio API. The API also works
+ on other Windows platforms.
+
+======================================================================*/
+
+#ifndef _TIESRFA_WM5_H
+#define _TIESRFA_WM5_H
+
+/* These are the WM5 headers required for threading and WM5 waveform audio API */
+#include <mmsystem.h>
+#include <Mmreg.h>
+
+/* Used C libraries */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Enable this flag to output a debugging log file.
+   Normally this flag should not be defined. */
+// #define WM5_DEBUG_LOG
+
+#ifdef WM5_DEBUG_LOG
+#define LOGFILE "\\Application Data\\TIesr\\FAlog.txt"
+#define THREADFILE "\\Application Data\\TIesr\\FAthread.txt"
+#endif
+
+/* Constants that are part of the API. */
+
+/* Initialization check parameters */
+#define WM5_MIN_SAMPLE_RATE 8000
+
+#define WM5_MIN_SAMPLES_PER_FRAME 40
+
+
+/* The priority of the thread that transfers data from the WM5 audio driver
+to circular buffer frames. */
+#define WM5_THREAD_PRIORITY   THREAD_PRIORITY_ABOVE_NORMAL
+
+/* Time to wait on the thread to respond to an action, either starting,
+or stopping. For debugging it is better to use an infinite wait.*/
+//#define WM5_THREAD_WAIT  10000
+#define WM5_THREAD_WAIT  INFINITE
+
+/* Time to wait on the thread to return a frame.  This can indicate to the
+application that the thread has for some reason become non-responsive. 
+For debugging it is better to use an infinite wait. */
+//#define WM5_THREAD_FRAME_WAIT  10000
+#define WM5_THREAD_FRAME_WAIT  INFINITE
+
+
+/* Time to wait for waveInReset to return headers.  Only used in 
+catastrophic conditions where the thread fails. */
+#define WM5_WAVEINRESET_WAIT 5000
+
+
+/* State of the instance of WM5 data collection */
+typedef enum TIesrFAWM5_States
+{
+    TIesrFAWM5StateUninit,
+    TIesrFAWM5StateInit,
+    TIesrFAWM5StateOpen,
+    TIesrFAWM5StateRunning
+} TIesrFAWM5_State_t;
+
+
+/* Errors that can be returned */
+typedef enum TIesrFAWM5_Errors
+{
+    TIesrFAWM5ErrNone,
+    TIesrFAWM5ErrFail,
+    TIesrFAWM5ErrNoMemory,
+    TIesrFAWM5ErrOverflow,
+    TIesrFAWM5ErrThreadTimeout,
+    TIesrFAWM5ErrThreadStart
+} TIesrFAWM5_Error_t;
+
+
+enum TIesrFAWM5_Status
+{
+    TIesrFAWM5StatusMemory = 0x1,
+    TIesrFAWM5StatusPrep = 0x2,
+    TIesrFAWM5StatusAddHdr = 0x4,
+    TIesrFAWM5StatusCreateThread = 0x8,
+    TIesrFAWM5StatusStartThread = 0x10,
+    TIesrFAWM5StatusUnprep = 0x020,
+    TIesrFAWM5StatusWaitThread = 0x40,
+    TIesrFAWM5StatusOverflow = 0x80,
+    TIesrFAWM5StatusUnderflow = 0x100,
+    TIesrFAWM5StatusReAddHdr = 0x200,
+    TIesrFAWM5StatusEndThread = 0x400,
+    TIesrFAWM5StatusSync = 0x800,
+    TIesrFAWM5StatusDequeue = 0x1000,
+    TIesrFAWM5StatusInQueue = 0x2000
+};
+
+
+/* TIesrFAWM5_t defines the implementation specific implementation data used */
+
+typedef struct TIesrFAWM5_Struct
+{
+    /* State of the channel */
+    TIesrFAWM5_State_t state;
+
+    /* Boolean flag indicating if audio channel is a file,
+    and file pointer */
+    bool fileMode;
+    FILE *filePointer;
+    unsigned char* frameData;
+
+    /* WM5 Waveform format tag type */
+    WORD formatTag;   
+
+    /* Size of a sample and a circular frame buffer in bytes */
+    unsigned int sampleSize;
+    unsigned int frameSize;
+
+    /* Size of a wave header read buffer in bytes */
+    unsigned int readBufSize;
+   
+    /* WM5 read buffer and headers.*/
+    unsigned char *readBuffer;
+    PWAVEHDR readHeaders;
+    
+    /* Variables to manage read header/buffer processing */
+
+    /* Number of read headers that are being actively used between
+    TIesrFA and the WM5 audio driver. This number should remain constant 
+    unless a waveInAddHeader fails. */
+    unsigned int readHeadersActive;
+
+    /* Number of read headers in WM5 audio driver queue.  This
+    is a counter local to TIesrFA that maintains a count of read headers 
+    that TIesrFA knows it has transferred to the WM5 audio driver, but which
+    TIesrFA has not yet processed by having them returned by the WM5 audio
+    driver. */
+    unsigned int readHeadersinAudioQueue;
+
+    /* Circular queue of returned read header indices specifying 
+    read headers that have been returned by the WM5 audio driver
+    that need to be processed. This queue is synchronized. */
+    unsigned int *readHeadersReturnQueue;
+
+    /* Number of read headers returned by WM5 Audio device to the read headers
+    return queue and not yet processed.  This count is synchronized between
+    TIesrFA and the WM5 audio driver via the driver callback using a critical
+    section. */
+    unsigned int readHeadersinReturnQueue;
+    /* Present read header return queue index for input used by the WM5
+    audio driver callback function to access the read return queue. */
+    unsigned int readHeadersInputIndex;
+    
+    /* Present read header return queue index for output to circular buffer used
+    by TIesrFA to access the read return queue. */
+    unsigned int readHeadersOutputIndex;
+    
+    /* Synchronization object for management of read frame return queue. */
+    CRITICAL_SECTION readCriticalSection;
+    bool readCSInitialized;
+
+    /* readReturnEvent when signalled indicates that there is at least
+    one read header in the read header return queue that has not
+    yet been processed.  If it is not signalled, then the read header return
+    queue has no entries that need to be processed by TIesrFA. This event is
+    synchronized by the critcal section. */ 
+    HANDLE readReturnEvent;
+
+
+    /* Frame output circular buffer */
+    unsigned char *circBuffer;
+
+    /* circular frame buffers full, not yet transferred to user. */
+    unsigned int circularFramesFull;
+
+    /* Array of number of valid bytes loaded from read frame buffers to each 
+    circular buffer frame.  This determines when a circular buffer frame is full
+    and hence available for output. */
+    unsigned int *bytesInFrame;
+
+    /* Variables to manage the circular frame buffer */
+    
+    /* Present circular frame index for input of data returned from the 
+    WM5 audio driver in a read frame. */
+    unsigned int circularFrameInputIndex;
+    
+    /* Present circular frame index for output to user. */
+    unsigned int circularFrameOutputIndex;
+    /* Synchronization object for managing circular buffer. */
+    CRITICAL_SECTION circularCriticalSection;
+    bool circCSInitialized;
+   
+    /* This semaphore contains a count of circular frames available to
+    the user.  This semaphore is used to determine when frames are
+    available to the user. If no frames are available, then the user may
+    choose to block waiting for a frame, or continue processing and try
+    again later. */
+    HANDLE circularSemaphore;
+   
+
+    /* Synchronization objects for starting and stopping data collection thread */
+    HANDLE startEvent;
+    HANDLE stopEvent;
+
+    /* Array of handles for waiting in the thread.  The thread waits for
+    either a read frame wave header to be returned, or for the user to 
+    signal that data collection should terminate. The two wait objects are
+    therefore stopEvent and readReturnEvent */
+    HANDLE waitObjects[2];
+
+
+    /* WM5 Waveform Input Audio Device handle */
+    HWAVEIN wiHandle;
+
+    /* Data collection thread handle */
+    HANDLE threadHandle;
+    TIesrFAWM5_Error_t threadError;
+    
+    /* Flag indicating a circular buffer overflow occurred.  That is, 
+    there is data available in a read frame buffer but no place to
+    put it since the circular frame buffers are all full,
+    therefore the read frame buffer data is just discarded. */
+    BOOL circularOverflow;
+    
+    /* Flag indicating that there was a read frame wave header underflow. 
+    That is, the WM5 audio device has returned the last wave header queued and
+    now has no queued buffers. Note that this naturally happens when the
+    wave headers are flushed at the end of data collection by a waveInReset.
+    However, if this happens during data collection it indicates that TIesrFA
+    could not keep up with the WM5 audio driver returned frames and so real-time
+    has been lost. */
+    BOOL readUnderflow;
+
+    /* The status flag of this instance. */
+    unsigned int status;
+
+
+    /* Debugging parameters */
+    unsigned int totalReadHeadersReturned;
+    unsigned int totalCircFramesTransferred;
+
+#ifdef WM5_DEBUG_LOG
+    FILE* logFile;
+    FILE* threadFile;
+#endif
+
+} TIesrFAWM5_t;
+
+
+
+/* static functions - hidden from user */
+
+static TIesrFAWM5_Error_t TIesrFAWM5_addallheaders( TIesrFA_t* aTIesrFAInstance );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_destroybuf( TIesrFAWM5_t * const aWM5Data );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_destroysync( TIesrFAWM5_t *aWM5Data );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_initbuf( TIesrFA_t* const aTIesrFAInstance );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_fillframes( TIesrFA_t* const aTIesrFAInstance );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_initbuf( TIesrFA_t* const aTIesrFAInstance );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_initsync( TIesrFAWM5_t* const aWM5Data, 
+                                       int aReadFrames, int aCircularFrames );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_open( TIesrFA_t* const aTIesrFAInstance );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_prepallheaders( TIesrFA_t *aTIesrFAInstance );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_prepheader( TIesrFAWM5_t *aWM5Data, 
+                                                PWAVEHDR aHeader, 
+                                                unsigned int aFrame );
+
+static TIesrFAWM5_Error_t TIesrFAWM5_unprepallheaders( TIesrFA_t *aTIesrFAInstance,
+                                               BOOL aQueuedFlag );
+
+/* The thread function for loading frames of audio */
+static DWORD TIesrFAWM5_thread( LPVOID aArg );
+
+/* The waveform audio callback function */
+static void CALLBACK TIesrFAWM5_waveinproc( HWAVEIN aWIHandle, UINT aMsg,
+                                    DWORD aInstance, DWORD aParam1,
+                                    DWORD aParam2 );
+
+#endif
diff --git a/TIesrFA/src/TestTIesrFA.cpp b/TIesrFA/src/TestTIesrFA.cpp
new file mode 100755 (executable)
index 0000000..29cb5b9
--- /dev/null
@@ -0,0 +1,160 @@
+/*=======================================================================
+ TestTIesrFA.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This program tests the TIesrFA API by recording audio input. The command
+ line for the program is:
+
+ TestTIesrFA sampleRate frameSamples numFrames numCircFrames numAudioFrames \
+ readRate device filename
+
+ sampleRate = sample rate in Hz
+
+ frameSamples = number of samples in one audio frame
+
+ numFrames = number of audio frames to record
+
+ numCircFrames = number of audio frames in the circular input buffer
+
+ numAudioFrames = number of buffer frames used by audio device. Buffer frames
+ and audio frames are not necessarily the same size.
+ readRate = Value depends on the TIesrFA API implementation. For TIesrFA_ALSA
+ it is the number of microseconds between successive reads of the audio buffers,
+ typically 40000. For TIesrFA_WM5 (Windows) it is the multiple of audio frame
+ size for each device buffer frame, typically 2.
+
+ device = audio device name, which depends on the OS and TIesrFA implementation.
+ For TIesrFA_ALSA it is set to plughw:0,0 and for TIesrFA_WM5 it is set to
+ any non-file name string such as "WinAudio"
+
+ filename = output file name
+
+======================================================================*/
+
+#if defined( WIN32 )
+#include <windows.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "TIesrFA_User.h"
+
+#if defined(LINUX)
+#define THREAD_PRIORITY 20
+#elif defined( WIN32 )
+#define THREAD_PRIORITY THREAD_PRIORITY_ABOVE_NORMAL
+#endif
+
+int main( int argc, char** argv )
+{
+   int sampleRate;
+   int frameSamples;
+   int numFrames;
+   int numCircularFrames;
+   int numAudioFrames;
+   int readRate;
+   char *device;
+   char *filename;
+   unsigned int framesQueued;
+
+   TIesrFA_t aTIesrFAInstance;
+   TIesrFA_Error_t error;
+   int frameCount;
+   unsigned char* sampleBuf;
+   FILE *fp;
+
+   sampleRate = atoi( argv[1] );
+   frameSamples = atoi( argv[2] );
+   numFrames = atoi( argv[3] );
+   numCircularFrames = atoi( argv[4] );
+   numAudioFrames = atoi( argv[5] );
+   readRate = atoi( argv[6] );
+   device = argv[7];
+   filename = argv[8];
+
+   fp = fopen( filename, "wb");
+   if( fp == NULL )
+   {
+      printf( "File open fail\n" );
+      return -1;
+   }
+
+   sampleBuf = (unsigned char*) malloc( frameSamples*2*sizeof(unsigned char) );
+
+   error = TIesrFA_init( &aTIesrFAInstance, sampleRate, TIesrFALinear, frameSamples, 
+                        numCircularFrames, numAudioFrames, 
+                        readRate, device, THREAD_PRIORITY );
+   if( error != TIesrFAErrNone )
+   {
+      printf( "Init fail %d\n", error );
+      return 1;
+   }
+
+   printf( "Instance initialized\n" );
+
+   error = TIesrFA_open( &aTIesrFAInstance );
+   if( error != TIesrFAErrNone )
+   {
+      printf( "Open fail %d\n", error );
+      return 2;
+   }
+
+   printf( "Instance opened\n" );
+
+
+   error = TIesrFA_start( &aTIesrFAInstance );
+   if( error != TIesrFAErrNone )
+   {
+      printf( "Start fail %d\n", error );
+      return 3;
+   }
+
+   printf( "Speak now...\n" );
+   for( frameCount=0; frameCount<numFrames; frameCount++ )
+   {
+      error = TIesrFA_getframe( &aTIesrFAInstance, sampleBuf, 1, &framesQueued );
+
+      if( error != TIesrFAErrNone )
+      {
+        printf( "Get fail %d\n", error );
+        return 4;
+      }
+
+      fwrite( sampleBuf, sizeof( unsigned char), frameSamples*2, fp );
+
+   }
+
+   printf( "Done Recording\n" );
+   fclose(fp);
+
+   error = TIesrFA_stop( &aTIesrFAInstance );
+   if( error != TIesrFAErrNone )
+   {
+      printf( "Stop fail %d\n", error );
+      return 5;
+   }
+   printf( "Instance stopped\n" );
+
+
+   error = TIesrFA_close( &aTIesrFAInstance );
+   if( error != TIesrFAErrNone )
+   {
+      printf( "Close fail %d\n", error );
+      return 6;
+   }
+   printf( "Instance closed\n" );
+
+
+   error = TIesrFA_destroy( &aTIesrFAInstance );
+   if( error != TIesrFAErrNone )
+   {
+      printf( "Destroy fail %d\n", error );
+      return 7;
+   }
+
+   printf( "Instance destroyed\n" );
+   return 0;
+}
diff --git a/TIesrFlex/ReadMe.txt b/TIesrFlex/ReadMe.txt
new file mode 100644 (file)
index 0000000..998d469
--- /dev/null
@@ -0,0 +1,117 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+----------------
+
+The TIesrFlex API is the top-level API that an application designer uses to
+create a binary grammar network and acoustic model file set given an input
+grammar specification. The output file set is used by the TIesrSI API to perform
+speech recognition. The TIesrFlex API uses the TIesrDict and TIesrDT APIs.
+
+
+Using the testtiesrflex Program
+-------------------------------
+
+The testtiesrflex program exercises the TIesrFlex API. The source of the
+testtiesrflex program provides an illustration of how the TIesrFlex API can be
+used to create a binary grammar and model file set. The detailed description of
+the user API functions supplied by the TIesrFlex API is found in the TIesrFlex.h
+header file. The command line for the program is: 
+
+testtiesrflex grm_string out_dir data_dir language [max_pron inc_rule 
+    auto_sil lit_end byte_mean byte_var
+    
+grm_string: String defining the grammar
+out_dir:    Directory to place binary grammar network and acoustic model files
+data_dir:   Top level directory holding pronunciation and model data
+language:   Name of the language directory just under data_dir
+max_pron:   Maximum pronunciations per word to include in output grammar network
+inc_rule:   Flag indicating to include decision tree rule pronunciation
+auto_sil:   Flag indicating to include optional silence between words
+lit_end:    Flag output files in little endian format
+byte_mean:  Output acoustic probability mean vectors as byte data
+byte_var:   Output acoustic probability variance vectors as byte data
+add_close:  (optional; default enabled) Add closure phones prior to stop
+consonants
+
+grm_string is a string argument that defines the grammar for which a network and
+model set will be created.  The grammar string is in an easy to use text format.
+Documentation of the format is provided in the TIesr documenation. out_dir is
+the directory to hold the binary grammar network and model set output. data_dir
+is the top level of a directory tree containing data that TIesrFlex needs to
+create its output. Directly under this directory should be a sub-directory for a
+language, which is specified by the language argument on the testtiesrflex
+commmand line. The structure of data_dir/language is such that it holds the
+TIesrDT decision trees, TIesrDict dictionary (in a sub-directory usually named
+Dict), and the acoustic model information (in a sub-directory usually named
+Models). There are several optional arguments to the test program. max_pron
+specifies the maximum pronunciations allowed for a word. The number of
+pronunciations actually available is dependent on the number of entries in the
+dictionary. inc_rule is a 0/1 flag that specifies whether to include the
+decision tree rule as a pronunciation.  If inc_rule is set to zero (false), then
+the decision tree rule pronunciation generated by TIesrDT will not be used if
+there is a pronunciation in the dictionary. If there is no entry for a word in
+the dictionary, then the decision tree rule pronunciation must be used. auto-sil
+is a 0/1 flag that specifies if a silence model is automatically inserted
+between each word, and should normally be set to 1 (true). little_endian is a
+0/1 flag that specifies if the output should be written in little or big-endian
+format and depends on the platform architecture. byte_mean is a 0/1 flag
+indicating if acoustic mean information should be compressed to single bytes,
+and byte_var is a 0/1 flag indicating to compress acoustic variance data to
+single bytes.  These last two flags reduce the size of the model information,
+and have been designed such that there is minimal speech recognition performance
+loss. add_close is a 0/1 flag indicating whether flexphone should automatically
+add closure phones prior to the stop consonant phones (b,d,g,k,p,t). The closure
+phones (bcl,dcl,gcl,kcl,pcl,tcl) must exist as valid phone models. This option
+is turned on by default, but is somewhat specific to English.
+
+An example of running the testtiesrflex program from the top-level distribution
+directory on a Linux OS is shown below. This constructs the binary grammar
+network and acoustic model file set for a simple grammar consisting of one of
+the words "yes", "no", or "maybe".
+
+Dist/LinuxReleaseGnu/bin/testtiesrflex \
+      "start(_S). _S ---> yes | no | maybe." \
+      Data/GramDir \
+      Data/OffDT_GenDict_PhbVR_LE_MQ \
+      English \
+      2 0 1 1 1 1
+
+Typical output from running this program is a sequence of messages
+indicating correct operation and output:
+
+Loading language, grammar, and model data
+Parsing input grammar
+Writing out binary grammar network and model files
+Grammar network and model files output successfully
+
+After running the program the directory Data/GramDir should contain the
+following binary files with the sizes in bytes as:
+
+    6  config.bin
+    2  dim.bin
+  336  gconst.bin
+  278  hmm.bin
+   22  hmm2phone.bin
+ 2056  mixture.bin
+ 5882  mu.bin
+  152  net.bin
+  296  o2amidx.bin
+  184  pdf.bin
+   80  scale.bin
+  650  tran.bin
+ 3342  var.bin
+ 5124  vqcentr.bin
+ The directory also contains the word.lis text file which should contain:
+_SIL
+yes
+no
+maybe
+
+
+
+
+
diff --git a/TIesrFlex/TIesrFlexso/.dep.inc b/TIesrFlex/TIesrFlexso/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrFlex/TIesrFlexso/Makefile b/TIesrFlex/TIesrFlexso/Makefile
new file mode 100755 (executable)
index 0000000..704a14d
--- /dev/null
@@ -0,0 +1,119 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+       if [ ${CONF} == LinuxDebugGnu -o \
+       ${CONF} == LinuxReleaseGnu -o \
+       ${CONF} == ArmLinuxDebugGnueabi -o \
+       ${CONF} == ArmLinuxReleaseGnueabi ]; \
+       then cd ../../Dist/${CONF}/lib; \
+       rm -f libTIesrFlex.so; \
+       ln -s libTIesrFlex.so.1 libTIesrFlex.so; \
+       fi
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrFlex/TIesrFlexso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..1db2980
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../../TIesrDict/TIesrDictso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDict.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFlex.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFlex.so.1: ../../TIesrDict/TIesrDictso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDict.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFlex.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrFlex.so.1 -Wl,--version-script=../resource/TIesrFlexso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../../TIesrDict/src -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o ../src/TIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFlex.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrFlex/TIesrFlexso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..3906ccc
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../../TIesrDict/TIesrDictso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDict.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFlex.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFlex.so.1: ../../TIesrDict/TIesrDictso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDict.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFlex.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrFlex.so.1 -Wl,--version-script=../resource/TIesrFlexso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -I../../TIesrDict/src -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o ../src/TIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFlex.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrFlex/TIesrFlexso/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..07869f4
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../../TIesrDict/TIesrDictso/../../Dist/LinuxDebugGnu/lib/libTIesrDict.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/lib/libTIesrFlex.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrFlex.so.1: ../../TIesrDict/TIesrDictso/../../Dist/LinuxDebugGnu/lib/libTIesrDict.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrFlex.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrFlex.so.1 -Wl,--version-script=../resource/TIesrFlexso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../../TIesrDict/src -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o ../src/TIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/lib/libTIesrFlex.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrFlex/TIesrFlexso/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..adbec79
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib ../../TIesrDict/TIesrDictso/../../Dist/LinuxReleaseGnu/lib/libTIesrDict.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/lib/libTIesrFlex.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrFlex.so.1: ../../TIesrDict/TIesrDictso/../../Dist/LinuxReleaseGnu/lib/libTIesrDict.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrFlex.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/lib
+       ${LINK.cc} -Wl,-znow,-zdefs -Wl,-h,libTIesrFlex.so.1 -Wl,--version-script=../resource/TIesrFlexso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -I../../TIesrDict/src -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o ../src/TIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/lib/libTIesrFlex.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrFlex/TIesrFlexso/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..2b5caab
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=../../TIesrDict/TIesrDictso/../../Dist/WindowsDebugMinGW/libTIesrDict.dll
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/libTIesrFlex.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrFlex.dll: ../../TIesrDict/TIesrDictso/../../Dist/WindowsDebugMinGW/libTIesrDict.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrFlex.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -v -shared -o ../../Dist/${CND_CONF}/libTIesrFlex.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DTIESRFLEX_EXPORTS -DWIN32 -I../../TIesrDict/src -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o ../src/TIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/libTIesrFlex.dll
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrFlex/TIesrFlexso/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..c705cc6
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=../../TIesrDict/TIesrDictso/../../Dist/WindowsReleaseMinGW/libTIesrDict.dll
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/libTIesrFlex.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrFlex.dll: ../../TIesrDict/TIesrDictso/../../Dist/WindowsReleaseMinGW/libTIesrDict.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrFlex.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -v -shared -o ../../Dist/${CND_CONF}/libTIesrFlex.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DTIESRFLEX_EXPORTS -DWIN32 -I../../TIesrDict/src -I../../TIesrDT/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrFlex.o ../src/TIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/libTIesrFlex.dll
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrDict/TIesrDictso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Makefile-impl.mk b/TIesrFlex/TIesrFlexso/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..74a17a5
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TIesrFlexso
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Makefile-variables.mk b/TIesrFlex/TIesrFlexso/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..10a64d9
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=libTIesrFlex.dll
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/libTIesrFlex.dll
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=libTIesrFlexso.so.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/libTIesrFlexso.so.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=libTIesrFlex.dll
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/libTIesrFlex.dll
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=libTIesrFlexso.so.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/libTIesrFlexso.so.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib
+CND_ARTIFACT_NAME_LinuxDebugGnu=libTIesrFlex.so.1
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib/libTIesrFlex.so.1
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=libTIesrFlexso.so.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/libTIesrFlexso.so.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib
+CND_ARTIFACT_NAME_LinuxReleaseGnu=libTIesrFlex.so.1
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib/libTIesrFlex.so.1
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=libTIesrFlexso.so.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/libTIesrFlexso.so.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=libTIesrFlex.so.1
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFlex.so.1
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=libTIesrFlexso.so.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrFlexso.so.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=libTIesrFlex.so.1
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFlex.so.1
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=libTIesrFlexso.so.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrFlexso.so.tar
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrFlex/TIesrFlexso/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..d949d98
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1
+OUTPUT_BASENAME=libTIesrFlex.so.1
+PACKAGE_TOP_DIR=libTIesrFlexso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFlexso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrFlex/TIesrFlexso/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..8beb0ae
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1
+OUTPUT_BASENAME=libTIesrFlex.so.1
+PACKAGE_TOP_DIR=libTIesrFlexso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFlexso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Package-LinuxDebugGnu.bash b/TIesrFlex/TIesrFlexso/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..326732d
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1
+OUTPUT_BASENAME=libTIesrFlex.so.1
+PACKAGE_TOP_DIR=libTIesrFlexso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFlexso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Package-LinuxReleaseGnu.bash b/TIesrFlex/TIesrFlexso/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..6c41d43
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1
+OUTPUT_BASENAME=libTIesrFlex.so.1
+PACKAGE_TOP_DIR=libTIesrFlexso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFlexso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Package-WindowsDebugMinGW.bash b/TIesrFlex/TIesrFlexso/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..ef0655a
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrFlex.dll
+OUTPUT_BASENAME=libTIesrFlex.dll
+PACKAGE_TOP_DIR=libTIesrFlexso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFlexso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TIesrFlexso/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrFlex/TIesrFlexso/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..f0a7786
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrFlex.dll
+OUTPUT_BASENAME=libTIesrFlex.dll
+PACKAGE_TOP_DIR=libTIesrFlexso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrFlexso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrFlexso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TIesrFlexso/nbproject/configurations.xml b/TIesrFlex/TIesrFlexso/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..76a227b
--- /dev/null
@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrFlex.h</itemPath>
+      <itemPath>../src/TIesrFlexLocal.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+      <itemPath>../resource/TIesrFlexso.ver</itemPath>
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrFlex.cpp</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRFLEX_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrFlex.dll</output>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDict/TIesrDictso"
+                            CT="2"
+                            CN="WindowsDebugMinGW"
+                            AC="true"
+                            BL="true"
+                            WD="../../TIesrDict/TIesrDictso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean"
+                            OP="../../Dist/WindowsDebugMinGW/libTIesrDict.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRFLEX_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrFlex.dll</output>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDict/TIesrDictso"
+                            CT="2"
+                            CN="WindowsReleaseMinGW"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrDict/TIesrDictso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean"
+                            OP="../../Dist/WindowsReleaseMinGW/libTIesrDict.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDict/TIesrDictso"
+                            CT="2"
+                            CN="LinuxDebugGnu"
+                            AC="true"
+                            BL="true"
+                            WD="../../TIesrDict/TIesrDictso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxDebugGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxDebugGnu clean"
+                            OP="../../Dist/LinuxDebugGnu/lib/libTIesrDict.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrFlex.so.1 -Wl,--version-script=../resource/TIesrFlexso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDict/TIesrDictso"
+                            CT="2"
+                            CN="LinuxReleaseGnu"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrDict/TIesrDictso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean"
+                            OP="../../Dist/LinuxReleaseGnu/lib/libTIesrDict.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrFlex.so.1 -Wl,--version-script=../resource/TIesrFlexso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDict/TIesrDictso"
+                            CT="2"
+                            CN="ArmLinuxDebugGnueabi"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrDict/TIesrDictso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean"
+                            OP="../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrDict.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrFlex.so.1 -Wl,--version-script=../resource/TIesrFlexso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandlineTool>arm-none-linux-gnueabi-g++</commandlineTool>
+          <incDir>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrFlex.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrDict/TIesrDictso"
+                            CT="2"
+                            CN="ArmLinuxReleaseGnueabi"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrDict/TIesrDictso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean"
+                            OP="../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrDict.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrFlex.so.1 -Wl,--version-script=../resource/TIesrFlexso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrFlex/TIesrFlexso/nbproject/private/configurations.xml b/TIesrFlex/TIesrFlexso/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..a1af2a8
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrFlex/TIesrFlexso/nbproject/private/private.properties b/TIesrFlex/TIesrFlexso/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrFlex/TIesrFlexso/nbproject/private/private.xml b/TIesrFlex/TIesrFlexso/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrFlex/TIesrFlexso/nbproject/project.properties b/TIesrFlex/TIesrFlexso/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrFlex/TIesrFlexso/nbproject/project.xml b/TIesrFlex/TIesrFlexso/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..bc3a0ab
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TIesrFlexso</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions/>
+            <cpp-extensions>cpp</cpp-extensions>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects>
+                <make-dep-project>../../TIesrDict/TIesrDictso</make-dep-project>
+            </make-dep-projects>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrFlex/TestTIesrFlex/.dep.inc b/TIesrFlex/TestTIesrFlex/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrFlex/TestTIesrFlex/Makefile b/TIesrFlex/TestTIesrFlex/Makefile
new file mode 100755 (executable)
index 0000000..524ba36
--- /dev/null
@@ -0,0 +1,111 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrFlex/TestTIesrFlex/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..5a8d065
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrFlex
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrflex
+
+../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrflex: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrflex ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../src -I../../TIesrDict/src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o ../src/TestTIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrflex
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrFlex/TestTIesrFlex/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..2ab65fb
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrFlex
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrflex
+
+../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrflex: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrflex ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -I../src -I../../TIesrDict/src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o ../src/TestTIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrflex
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrFlex/TestTIesrFlex/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..dad01b0
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrFlex
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/bin/testtiesrflex
+
+../../Dist/LinuxDebugGnu/bin/testtiesrflex: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrflex ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../src -I../../TIesrDict/src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o ../src/TestTIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/bin/testtiesrflex
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrFlex/TestTIesrFlex/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..feadcbb
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrFlex
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/bin/testtiesrflex
+
+../../Dist/LinuxReleaseGnu/bin/testtiesrflex: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrflex ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -I../src -I../../TIesrDict/src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o ../src/TestTIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/bin/testtiesrflex
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrFlex/TestTIesrFlex/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..de310b5
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF} -lTIesrFlex
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/testtiesrflex.exe
+
+../../Dist/WindowsDebugMinGW/testtiesrflex.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrflex.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -I../src -I../../TIesrDict/src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o ../src/TestTIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/testtiesrflex.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrFlex/TestTIesrFlex/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..f0b8f14
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF} -lTIesrFlex
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/testtiesrflex.exe
+
+../../Dist/WindowsReleaseMinGW/testtiesrflex.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrflex.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrFlex.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -I../src -I../../TIesrDict/src -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrFlex.o ../src/TestTIesrFlex.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/testtiesrflex.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Makefile-impl.mk b/TIesrFlex/TestTIesrFlex/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..f335f37
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TestTIesrFlex
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Makefile-variables.mk b/TIesrFlex/TestTIesrFlex/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..fb3d382
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=testtiesrflex.exe
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/testtiesrflex.exe
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=testtiesrflex.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/testtiesrflex.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=testtiesrflex.exe
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/testtiesrflex.exe
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=testtiesrflex.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/testtiesrflex.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin
+CND_ARTIFACT_NAME_LinuxDebugGnu=testtiesrflex
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin/testtiesrflex
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=testtiesrflex.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/testtiesrflex.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin
+CND_ARTIFACT_NAME_LinuxReleaseGnu=testtiesrflex
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin/testtiesrflex
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=testtiesrflex.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/testtiesrflex.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=testtiesrflex
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrflex
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=testtiesrflex.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrflex.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=testtiesrflex
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrflex
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=testtiesrflex.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrflex.tar
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrFlex/TestTIesrFlex/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..c6e8efa
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrflex
+OUTPUT_BASENAME=testtiesrflex
+PACKAGE_TOP_DIR=testtiesrflex/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrflex/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrFlex/TestTIesrFlex/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..bb0114b
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrflex
+OUTPUT_BASENAME=testtiesrflex
+PACKAGE_TOP_DIR=testtiesrflex/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrflex/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Package-LinuxDebugGnu.bash b/TIesrFlex/TestTIesrFlex/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..b5b40f6
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrflex
+OUTPUT_BASENAME=testtiesrflex
+PACKAGE_TOP_DIR=testtiesrflex/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrflex/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Package-LinuxReleaseGnu.bash b/TIesrFlex/TestTIesrFlex/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..73308e3
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrflex
+OUTPUT_BASENAME=testtiesrflex
+PACKAGE_TOP_DIR=testtiesrflex/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrflex/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Package-WindowsDebugMinGW.bash b/TIesrFlex/TestTIesrFlex/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..4469f02
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrflex.exe
+OUTPUT_BASENAME=testtiesrflex.exe
+PACKAGE_TOP_DIR=testtiesrflex/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrflex/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrFlex/TestTIesrFlex/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..c531127
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrflex.exe
+OUTPUT_BASENAME=testtiesrflex.exe
+PACKAGE_TOP_DIR=testtiesrflex/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrflex/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrflex.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/configurations.xml b/TIesrFlex/TestTIesrFlex/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..2c8fa1f
--- /dev/null
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TestTIesrFlex.cpp</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrflex.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFlex</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrflex.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFlex</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrflex</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFlex</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrflex</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFlex</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrflex</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFlex</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../src</pElem>
+            <pElem>../../TIesrDict/src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrflex</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrFlex</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/private/configurations.xml b/TIesrFlex/TestTIesrFlex/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..79bc1dc
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>"start(_G). _G ---> yes | no | maybe."  ../../Data/GramDir ../../Data/OffDT_GenDict_PhbVR_LE_MQ 2 0 1 1 1 1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>"start(_G). _G ---> yes | no | maybe."  ../../Data/GramDir ../../Data/OffDT_GenDict_PhbVR_LE_MQ 2 0 1 1 1 1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>"start(_G). _G ---> yes | no | maybe."  ../../Data/GramDir ../../Data/OffDT_GenDict_PhbVR_LE_MQ 2 0 1 1 1 1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>"start(_G). _G ---> yes | no | maybe."  ../../Data/GramDir ../../Data/OffDT_GenDict_PhbVR_LE_MQ 2 0 1 1 1 1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>"start(_G). _G ---> yes | no | maybe."  ../../Data/GramDir ../../Data/OffDT_GenDict_PhbVR_LE_MQ 2 0 1 1 1 1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>"start(_G). _G ---> yes | no | maybe."  ../../Data/GramDir ../../Data/OffDT_GenDict_PhbVR_LE_MQ 2 0 1 1 1 1</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/private/private.properties b/TIesrFlex/TestTIesrFlex/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/private/private.xml b/TIesrFlex/TestTIesrFlex/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/project.properties b/TIesrFlex/TestTIesrFlex/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrFlex/TestTIesrFlex/nbproject/project.xml b/TIesrFlex/TestTIesrFlex/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..13249c5
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TestTIesrFlex</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions/>
+            <cpp-extensions>cpp</cpp-extensions>
+            <header-extensions/>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrFlex/resource/TIesrFlexso.map b/TIesrFlex/resource/TIesrFlexso.map
new file mode 100644 (file)
index 0000000..00773a6
--- /dev/null
@@ -0,0 +1,13 @@
+TXN_1.1 {  
+   global:
+      # TIesrFlex.o
+      __10CTIesrFlex;
+      _._10CTIesrFlex;
+      LoadLanguage__10CTIesrFlexPCcN31i;
+      ParseGrammar__10CTIesrFlexPCcUiii;
+      DownloadGrammar__10CTIesrFlex;
+      OutputGrammar__10CTIesrFlexPciii;
+
+        local: 
+                * ;
+};
\ No newline at end of file
diff --git a/TIesrFlex/resource/TIesrFlexso.ver b/TIesrFlex/resource/TIesrFlexso.ver
new file mode 100644 (file)
index 0000000..c80af41
--- /dev/null
@@ -0,0 +1,15 @@
+TXN_1.1 {
+        global:
+                # TIesrFlex.o
+                _ZN10CTIesrFlexC1Ev;
+                _ZN10CTIesrFlexC2Ev;
+                _ZN10CTIesrFlexD1Ev;
+                _ZN10CTIesrFlexD2Ev;
+                _ZN10CTIesrFlex12LoadLanguageEPKcS1_S1_S1_ii;
+                _ZN10CTIesrFlex12ParseGrammarEPKcjii;
+                _ZN10CTIesrFlex15DownloadGrammarEv;
+                _ZN10CTIesrFlex13OutputGrammarEPciii;
+
+        local:
+                * ;
+};
diff --git a/TIesrFlex/src/TIesrFlex.cpp b/TIesrFlex/src/TIesrFlex.cpp
new file mode 100755 (executable)
index 0000000..5c7a74f
--- /dev/null
@@ -0,0 +1,6961 @@
+/*=======================================================================
+ TIesrFlex.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This source defines the functionality that allows a user to
+ dynamically generate a TIesr binary grammar network file and a set
+ of binary HMM model files for a specific grammar that is input as a
+ string.  These files can be used by TIesr to create dynamic, state
+ dependent recognition results.
+
+======================================================================*/
+
+/* Headers required by Windows OS */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+// C++ include files
+#include <cstdlib>
+#include <new>
+#include <cstring>
+#include <cctype>
+
+
+#include "TIesrFlex.h"
+#include "TIesrFlexLocal.h"
+
+
+/* Windows OS specific DLL entry */
+#if defined (WIN32) || defined (WINCE)
+BOOL APIENTRY DllMain( HANDLE hModule,
+                      DWORD  ul_reason_for_call,
+                      LPVOID lpReserved
+                      )
+{
+   switch (ul_reason_for_call)
+   {
+   case DLL_PROCESS_ATTACH:
+   case DLL_THREAD_ATTACH:
+   case DLL_THREAD_DETACH:
+   case DLL_PROCESS_DETACH:
+      break;
+   }
+   return TRUE;
+}
+#endif
+
+
+#ifdef USE_NET_OPTIMIZE
+
+#include "nfa_basic.h"
+#include "nettype.h"
+#include "autotype.h"
+#include "interface.h"
+#include "automaton_io.h"
+#include "genlist.h" /* list processing macros */
+#include "gen_1d.h"  /* one-D array processing macros */
+
+FREELIST(free_augm, AugmType)
+
+static void free_augm_list(PtAugmType *p, int nbr)
+{
+   int i;
+   for (i=0; i<nbr; i++) free_augm(p[i]);
+}
+
+SETCONST1D(init_cwd, PtAugmType)
+
+#endif
+
+
+//--------------------------------------------------------------------
+// This is the constructor of a class that has been exported.
+// see Grammar.h for the class definition
+CTIesrFlex::CTIesrFlex(void)
+{
+   
+   // initially no allocated data for questions and hmms
+   qs_base = NULL;
+   qs_offset = NULL;
+   
+   tree_base = NULL;
+   treetbl_base = NULL;
+   
+   tran_base = NULL;
+   tranoffset_base = NULL;
+   m_numTrans = 0;
+   tran_offset = NULL;
+   tran_idx_aug = NULL;
+   
+   cluster_base = NULL;
+   clusteroffset_base = NULL;
+   m_numClusters = 0;
+   cluster_offset = NULL;
+   cluster_idx_aug = NULL;
+   
+   
+   // Initialize mixture pdf clustered weight vector pointer
+   weight_base = NULL;
+   
+   mean_base = NULL;
+   mean_idx_aug = NULL;
+   m_numMeans = 0;
+   
+   // Used by VQHMM for fast JAC and ORM
+   mean_idx = NULL;
+   
+   var_base = NULL;
+   var_idx_aug = NULL;
+   m_numVars = 0;
+   
+   gconst_base = NULL;
+   scale_base = NULL;
+   sil_hmm = NULL;
+   m_dict = NULL;
+   
+   
+   #ifdef OFFLINE_CLS
+   vq_centroid = NULL;
+   pROM2Cls = NULL;
+   #endif
+   
+   // initially there is no grammar loaded in this object
+   cfg = NULL;
+   
+   // Allocation for storing pronunciations of words
+   m_wordProns = NULL;
+   
+   // Initialize dynamic allocation of tokens in grammar parse
+   token = NULL;
+   m_tokenMax = 0;
+   token_idx = 0;
+   
+   // Initialize dynamic allocation of rules
+   rule = NULL;
+   m_ruleMax = 0;
+   rule_idx = 0;
+   
+   // Initialize dynamic allocation of nodes
+   node = NULL;
+   m_nodeMax = 0;
+   node_idx = 0;
+   
+   // Initialize dynamic allocation of dependencies in grammar
+   depend = NULL;
+   m_dependMax = 0;
+   depend_idx = 0;
+   
+   // Initialize dynamic allocation of sentnodes
+   sentnode = NULL;
+   m_sentnodeMax = 0;
+   sentnode_idx = 0;
+   
+   // Initialize dynamic allocation of sentnodes
+   senttran = NULL;
+   m_senttranMax = 0;
+   senttran_idx = 0;
+   
+   // Initialize dynamic allocation of words in grammar
+   word = NULL;
+   m_wordMax = 0;
+   word_idx = 0;
+   
+   // Initialize dynamic allocation of hmm entries in grammar
+   hmm = NULL;
+   m_hmmMax = 0;
+   hmm_idx = 0;
+   
+   // Initialize dynamic allocation of symbols, which are
+   // grammar context-expanded hmms.
+   sym = NULL;
+   m_symMax = 0;
+   sym_idx = 0;
+   
+   // Initialize dynamic allocation of list of stop symbols
+   stop_next = NULL;
+   m_stopMax = 0;
+   n_stop_next = 0;
+   
+   return;
+}
+
+
+//--------------------------------
+CTIesrFlex::~CTIesrFlex(void)
+{
+   
+   // Remove input codebook information
+   // This includes dynamic arrays used for data output
+   free_codebook();
+   
+   // Remove any existing word pronunciations
+   delete [] m_wordProns;
+   
+   
+   #ifdef OFFLINE_CLS
+   FreeVQHMM();
+   #endif
+   
+   // remove the dictionary
+   delete m_dict;
+   
+   // Free all of the grammar structures allocated
+   FreeGrammarData();
+   
+   return;
+}
+
+
+#ifdef OFFLINE_CLS
+
+//--------------------------------
+short CTIesrFlex::LoadVQHMM(const char* dirname)
+{
+   char buf[FILENAME_MAX];
+   short nread , sz_ROMMean;
+   FILE *fp;
+   
+   
+   /* read ROM mean to cluster mapping */
+   /* load RAM mean to ROM mean index mapping */
+   
+   // Load ROM mean to cluster mapping information
+   
+   // Open ROM mean to cluster class mapping file
+   strcpy( buf, dirname);
+   strcat( buf, "/ROM2cls.bin");
+   fp = fopen( buf, "rb");
+   if ( !fp )
+      goto FailedLoad;
+   
+   // Allocate space for ROM to cluster mapping table
+   nread = fread(&sz_ROMMean, sizeof(short), 1, fp);
+   nread = fread(&vq_n_cs, sizeof(short), 1, fp);
+   if( nread != 1 )
+      goto FailedLoad;
+   pROM2Cls = (short*) malloc(sizeof(short)*sz_ROMMean);
+   if( ! pROM2Cls )
+      goto FailedLoad;
+   
+   // Read the mapping table
+   nread = fread(pROM2Cls, sizeof(short), sz_ROMMean, fp);
+   if( nread != sz_ROMMean )
+      goto FailedLoad;
+   fclose(fp);
+   
+   
+   // Read cluster centroid information
+   
+   // Open cluster centroid file
+   strcpy( buf, dirname);
+   strcat( buf, "/cls_centr.bin");
+   fp = fopen( buf, "rb");
+   if( !fp )
+      goto FailedLoad;
+   
+   // Allocate space for centroids
+   nread = fread(&vq_n_cs, sizeof(short), 1, fp);
+   nread = fread(&vq_nbr_dim, sizeof(short), 1, fp);
+   if( nread != 1 )
+      goto FailedLoad;
+   vq_centroid = (short*) malloc(sizeof(short)* vq_n_cs * vq_nbr_dim);
+   if( !vq_centroid )
+      goto FailedLoad;
+   
+   // Read vq centroids
+   nread = fread(vq_centroid, sizeof(short), vq_n_cs * vq_nbr_dim, fp);
+   if( nread != vq_n_cs * vq_nbr_dim )
+      goto FailedLoad;
+   fclose( fp );
+   
+   return OK;
+   
+   
+   // Failure to load successfully
+   FailedLoad:
+      if( fp )
+      {
+         fclose(fp);
+      }
+      
+      FreeVQHMM();
+      
+      return FAIL;
+      
+}
+
+
+
+//--------------------------------
+short CTIesrFlex::SaveVQHMM(const char* dirname)
+{
+   char buf[FILENAME_MAX];
+   FILE *fp;
+   unsigned char* pRAM2Cls;
+   short nwrite;
+   short i, im;
+   
+   
+   // Allocate RAM to cluster mapping arrray
+   im = (mean_idx_cnt&0x0001) ?  mean_idx_cnt + 1 : mean_idx_cnt + 2;
+   pRAM2Cls = (unsigned char*) malloc(sizeof(unsigned char) * im );
+   if( !pRAM2Cls )
+      return FAIL;
+   
+   /* Determine mapping of RAM mean to ROM mean cluster index */
+   for (i=0;i<mean_idx_cnt;i++)
+   {
+      im = mean_idx[i];
+      im = pROM2Cls[im];
+      pRAM2Cls[i] = (unsigned char)im;
+   }
+   
+   
+   /* Open file to save table mapping RAM mean to ROM mean cluster class */
+   strcpy( buf, dirname);
+   strcat( buf, "/o2amidx.bin" );
+   fp = fopen( buf, "wb" );
+   if( !fp )
+      goto SaveFail;
+   
+   // Write the table
+   i = mean_idx_cnt;
+   
+   // Must write proper endian format
+   // fwrite(&i, sizeof(short), 1, fp);
+   int failed;
+   failed = output_int16( fp, i );
+   if( failed )
+      goto SaveFail;
+   
+   // Indices are all unsigned char so don't care about endian format
+   nwrite = fwrite(pRAM2Cls, sizeof(unsigned char), i, fp);
+   if(  nwrite != i )
+      goto SaveFail;
+   
+   // Finished writing mean to centroid mapping
+   fclose(fp);
+   free(pRAM2Cls);
+   pRAM2Cls = NULL;
+   
+   
+   /* Open file to hold cluster centriods */
+   strcpy(buf, dirname);
+   strcat( buf, "/vqcentr.bin");
+   fp = fopen(buf, "wb");
+   if( !fp )
+      goto SaveFail;
+   
+   // Write the centroid information
+   // Must write in proper endian format
+   // nwrite = fwrite(&vq_n_cs, sizeof(short), 1, fp);
+   failed = output_int16( fp, vq_n_cs );
+   if( failed )
+      goto SaveFail;
+   
+   // nwrite = fwrite(&vq_nbr_dim, sizeof(short), 1, fp);
+   failed = output_int16( fp, vq_nbr_dim );
+   if( failed )
+      goto SaveFail;
+   
+   // nwrite = fwrite(vq_centroid, sizeof(short), vq_n_cs * vq_nbr_dim, fp);
+   for( int numEl = 0; numEl < vq_n_cs*vq_nbr_dim; numEl++ )
+   {
+      failed = output_int16( fp, vq_centroid[numEl] );
+      if( failed )
+         goto SaveFail;
+   }
+   
+   
+   fclose( fp );
+   
+   return OK;
+   
+   
+   // Failed to save mapping or vq centroids
+   SaveFail:
+      
+      if( fp )
+         fclose(fp);
+      
+      
+      if( pRAM2Cls )
+      {
+         free( pRAM2Cls );
+      }
+      
+      return FAIL;
+}
+
+
+/*--------------------------------
+ FreeVQHMM
+
+ Free space allocated for codebook mean to cluster class map and
+ codebook mean cluster class centroids.
+ --------------------------------*/
+void CTIesrFlex::FreeVQHMM()
+{
+   if( pROM2Cls )
+   {
+      free(pROM2Cls);
+      pROM2Cls = NULL;
+   }
+   
+   if( vq_centroid )
+   {
+      free(vq_centroid);
+      vq_centroid = NULL;
+   }
+   
+   return;
+}
+
+#endif
+
+
+//-----------------------------
+CTIesrFlex::Errors CTIesrFlex::LoadLanguage( const char *direct,
+const char *language,
+const char *dict_ident,
+const char *hmm_ident,
+const int lit_end,
+const int addClosure )
+{
+   char dir[FILENAME_MAX];
+   char fname[FILENAME_MAX];
+   
+   // Symbian OS
+   //TText tfname[MAX_STR];
+   //TBufC<MAX_STR> dfname;
+   
+   int failed;
+   
+   CTIesrDict::Errors dError;
+   
+   // specify whether to output little-endian
+   little_endian = lit_end;
+   
+   // free any existing model data and dynamic structures for model output
+   free_codebook();
+   
+   
+   // Construct the dictionary for looking up words
+   // This dictionary is a class member
+   try
+   { m_dict = new CTIesrDict(); }
+   catch( std::bad_alloc &ex )
+   {
+      return ErrFail;
+   }
+   
+   dError = m_dict->LoadDictionary( direct, language, dict_ident, addClosure );
+   if( dError != CTIesrDict::ErrNone )
+   {
+      delete m_dict;
+      m_dict = NULL;
+      return ErrDict;
+   }
+   
+   // number of phones in dictionary. Does not include 'sil' model
+   n_phone = m_dict->GetPhoneCount();
+   
+   // directory containing the hmm information
+   strcpy( dir, direct);
+   strcat( dir, "/" );
+   strcat( dir, language );
+   strcat( dir, "/" );
+   strcat( dir, hmm_ident );
+   strcat( dir, "/" );
+   
+   
+   // For PC, load files to RAM
+   // For embedded device, pointers to data in ROM would save RAM
+   
+   
+   // Obtain the configuration of the input tree and HMM information
+   strcpy( fname, dir );
+   strcat( fname, "fxconfig.bin" );
+   failed = read_config( fname );
+   if( failed )
+      goto readfail;
+   
+   // For now can not handle CMN byte means.  There is not software to
+   // expand byte means to short means and add the bias.
+   if( m_bInputByteMeans && m_bInputCMN )
+      return ErrType;
+   
+   // Read in scale data if mean or variance in bytes
+   if( m_bInputByteMeans || m_bInputByteVars )
+   {
+      strcpy( fname, dir );
+      strcat( fname, "scale.bin" );
+      failed = read_scale( fname );
+      if( failed )
+         goto readfail;
+   }
+   
+   
+   // File of questions and establish pointers
+   // for DSP want pointers to questions and question table in ROM
+   // questions
+   strcpy( fname, dir );
+   strcat( fname, "_qs.bin" );
+   
+   
+   // Determine if questions file exists.
+   // If it does not, assume input describes a monophone HMM set
+   FILE* fp;
+   fp = fopen( fname, "r" );
+   if( fp )
+   {
+      fclose(fp);
+      m_bInputMonophone = false;
+   }
+   else
+   {
+      m_bInputMonophone = true;
+   }
+   
+   // If input is not monophone, then read acoustic decision tree data,
+   // since the input must describe a triphone HMM set
+   if( !m_bInputMonophone )
+   {
+      failed = read_qs( fname );
+      if( failed )
+         goto readfail;
+      
+      // question table - offsets of questions, turned into addresses
+      // by read_qstbl
+      strcpy( fname, dir );
+      strcat( fname, "_qstbl.bin" );
+      failed = read_qstbl( fname );
+      if( failed )
+         goto readfail;
+      
+      // find pointers to tree
+      strcpy( fname, dir );
+      strcat( fname, "_tree.bin" );
+      failed = read_tree( fname );
+      if( failed )
+         goto readfail;
+      
+      // read tree table, and adjust to memory locations
+      strcpy( fname, dir );
+      strcat( fname, "_treetbl.bin" );
+      failed = read_treetbl( fname );
+      if( failed )
+         goto readfail;
+   }
+   
+   // find pointers to hmm transition info and offsets in ROM
+   strcpy( fname, dir );
+   strcat( fname, "fxtran.cb" );
+   failed = read_fxtran( fname );
+   if( failed )
+      goto readfail;
+   
+   strcpy( fname, dir );
+   strcat( fname, "fxtran.off" );
+   failed = read_fxtroff( fname );
+   if( failed )
+      goto readfail;
+   
+
+   
+   // find pointers to hmm clustered pdf info in ROM
+   strcpy( fname, dir );
+   strcat( fname, "fxclust.cb" );
+   failed = read_fxclust( fname);
+   if( failed )
+      goto readfail;
+   
+   //find pointers to read the base file
+   if(m_bInputWeightConfig != 0 )
+   {
+      strcpy( fname, dir );
+      strcat( fname, "fxweight.cb" );
+      failed = read_weight(fname);
+      if( failed )
+         goto readfail;
+   }
+   
+   strcpy( fname, dir );
+   strcat( fname, "fxclust.off" );
+   failed = read_fxcloff( fname);
+   if( failed )
+      goto readfail;
+   
+
+   
+   // find pointers to hmm mean, variance, and gconst information in ROM
+   strcpy( fname, dir );
+   strcat( fname, "fxmean.cb" );
+   fp = fopen(fname, "r");
+   if(fp != NULL)
+   {
+      fclose(fp);
+      failed = read_mean( fname );
+      if(failed)
+         goto readfail;
+   }
+   else
+   {
+      failed = makemean(dir);
+      if( failed )
+         goto  readfail;
+   }
+   strcpy( fname, dir );
+   strcat( fname, "fxvar.cb" );
+   failed = read_var( fname );
+   if( failed )
+      goto readfail;
+   
+   strcpy( fname, dir );
+   strcat( fname, "fxgconst.cb" );
+   failed = read_gconst( fname );
+   if( failed )
+      goto readfail;
+   
+   // get silence hmm number of states and pointer to hmm info
+   strcpy( fname, dir );
+   strcat( fname, "fxsil.hmm" );
+   failed = read_sil( fname );
+   if( failed )
+      goto readfail;
+   
+   
+   #ifdef OFFLINE_CLS
+   failed = LoadVQHMM(dir);
+   if (failed)
+      goto readfail;
+   #endif
+   
+   return ErrNone;
+   
+   readfail:
+      delete m_dict;
+      m_dict = NULL;
+      
+      free_codebook();
+      
+      #ifdef OFFLINE_CLS
+      FreeVQHMM();
+      #endif
+      
+      return ErrFail;
+}
+
+
+//------------------------------------------------
+CTIesrFlex::Errors CTIesrFlex::ParseGrammar( const char * cfg_string,
+unsigned int aMaxPronunciations,
+int aIncludeRulePron,
+int aAutoSilence )
+{
+   int result;
+   CTIesrFlex::Errors error;
+   
+   // Free any preexisting data
+   FreeGrammarData();
+   
+   // Allocate a new copy of the grammar text
+   try
+   { cfg = new char[strlen(cfg_string) + 1]; }
+   catch( std::bad_alloc &ex )
+   {
+      return ErrMemory;
+   }
+   
+   strcpy( cfg, cfg_string );
+   
+   
+   // Maintain a copy of the autosilence request
+   m_bAutoSilence = aAutoSilence;
+   
+   
+   // Initialize variables for the parse.  Since this includes allocating
+   // space for structures, it must be tested for throwing exceptions.
+   try
+   {
+      init();
+   }
+   catch( char const* err )
+   {
+      return ErrMemory;
+   }
+   
+   
+   // parse the grammar.  Note that exception handling must be
+   // checked within yyparse so that if stack memory is allocated then
+   // it can be released appropriately when an exception is raised.
+   result = yyparse();
+   if( result != 0 )
+      return ErrFail;
+   
+   
+   // At the conclusion of yyparse, an fsa2 word network (Mealy network
+   // with words on transitions) has been created.  Now, if multiple
+   // pronunciations are desired, the multiple words must be added to
+   // the fsa2 network.
+   m_bIncludeRulePron = aIncludeRulePron;
+   m_maxPronunciations = aMaxPronunciations;
+   
+   // Keep track of the number of base word entries before adding multiple
+   // pronunciations.
+   m_baseWordIndex = word_idx;
+   
+   if( aMaxPronunciations > 1 )
+   {
+      error = AddMultiplePronunciations( );
+      if( error != ErrNone )
+         return error;
+   }
+   
+   
+   // Create structure to hold pronunciations of words
+   // Avoids doing lookup of pronunciations twice; once in
+   // create_hmm and once in create_sym_net.
+   try
+   { m_wordProns = new Pron_t[word_idx]; }
+   catch( std::bad_alloc &ex )
+   {
+      return ErrFail;
+   }
+   
+   
+   // Create hmm[] list. This function makes a list of all of the
+   // context-sensitive HMMs that are needed for the grammar.
+   // create_hmm uses 'demand', so may raise an exception.
+   
+   /* Old WinCE version
+    __try
+    {
+    create_hmm();
+    }
+    __except( GetExceptionCode() == CTIesrFlex::STATUS_FAIL_PARSE )
+    {
+    m_parseFail = true;
+    }
+    */
+   
+   // C++ version
+   try
+   {
+      create_hmm();
+   }
+   catch( char* exc )
+   {
+      m_parseFail = true;
+   }
+   if( m_parseFail )
+   {
+      delete [] m_wordProns;
+      m_wordProns = NULL;
+      return ErrFail;
+   }
+   
+   
+   /* --------------------------------------------------
+    create sym net (sym[]) from fsa2:
+   
+    start_sym and stop_sym are extra,
+    they do not have hmm associated,
+    sym_idx does not count these two sym
+    -------------------------------------------------- */
+   
+   // These should be handled by FreeGrammarData now
+   // sym_idx = 0;
+   // n_stop_next = 0;
+   
+   clear_sentnode_visit_flag();
+   
+   // create_sym_net uses 'demand' function, so may raise an
+   // exception
+   
+   /* old WinCE version
+    __try
+    {
+    create_sym_net( &sentnode[ 0 ] );
+    }
+    __except( GetExceptionCode() == CTIesrFlex::STATUS_FAIL_PARSE )
+    {
+    m_parseFail = true;
+    }
+    */
+   
+   // C++ version
+   try
+   {
+      create_sym_net(  0 );
+   }
+   catch( char* exc )
+   {
+      m_parseFail = true;
+   }
+   if( m_parseFail )
+   {
+      delete [] m_wordProns;
+      m_wordProns = NULL;
+      return ErrFail;
+   }
+   
+   //  printf("n_hmm = %d, n_sym = %d, n_start_sym = %d, n_stop_sym = %d\n",
+   //   hmm_idx * 2,        /* male & female */
+   //   sym_idx, sentnode[ 0 ].n_next, n_stop_next);
+   
+   /* --------------------------------------------------
+    debug: expand sym net
+    Check if the sym net (sym[], hmm[]) is correct?
+    you can choose to print either phone (0) or word (1)
+    -------------------------------------------------- */
+   /*
+    buf[0] = '\0';
+   
+    expand_sym_net( sentnode[ 0 ].n_next, sentnode[ 0 ].next, buf, 1 );
+    */
+   
+   /* --------------------------------------------------
+    output models
+    -------------------------------------------------- */
+   
+   // Now a separate member function
+   //output_models( argv[3] );
+   
+   
+   // Done with pronunciation
+   delete [] m_wordProns;
+   m_wordProns = NULL;
+   
+   return ErrNone;
+}
+
+//--------------------------------
+CTIesrFlex::Errors CTIesrFlex::DownloadGrammar()
+{
+   int failed;
+   
+   // TODO: figure out how to construct and download all of the
+   // binary data to device memory.  This may be to the DSP via a DSP Bridge.
+   // This will include several existing functions in flexphone to
+   // create the binary data, but it must be loaded to memory a chunk
+   // at a time, not written out to files, as was done in the original
+   // function output_models().
+   
+   
+   failed = download_net();
+   if( failed )
+      return ErrFail;
+   
+   failed = download_hmm2phone();
+   if( failed )
+      return ErrFail;
+   
+   failed = download_gtm();
+   if( failed )
+      return ErrFail;
+   
+   return ErrNone;
+}
+
+
+
+/*-----------------------------------------------------
+ OutputGrammar
+
+ This function outputs the grammar network file and HMM model files
+ that can be used by TIesrSI to recognize the grammar.  The user can
+ specify the directory where the files are to be written, and whether
+ byte means or byte variances are desired in the output model set.
+
+ Further, the user can specify if the grammar is to be optimized
+ after being output in non-optimized format.  This processing step
+ requires additional time, and requires the TIesrOptimize API.  This
+ API is not needed if the USE_NET_OPTIMIZATION macro is not defined.
+ ----------------------------------------------------------------*/
+CTIesrFlex::Errors CTIesrFlex::OutputGrammar(char *aDirName, int aByteMeans, int aByteVars ,
+int aOptimize )
+{
+   int failed;
+   
+   
+   // TODO: figure out how to construct and download all of the
+   // binary data to device memory.  This may be to the DSP via a DSP Bridge.
+   // This will include several existing functions in flexphone to
+   // create the binary data, but it must be loaded to memory a chunk
+   // at a time, not written out to files, as was done in the original
+   // function output_models().
+   
+   
+   // Check for validity of byte/short output request.  There is not software
+   // in TIesrFlex available to expand byte means or vars to short means or vars.
+   if( (m_bInputByteMeans && !aByteMeans) ||
+   (m_bInputByteVars && !aByteVars) )
+   {
+      return ErrType;
+   }
+   
+   
+   failed = output_net( aDirName, "/net.bin" );
+   
+   if( failed )
+      return ErrFail;
+   
+   failed = output_hmm2phone( aDirName );
+   if( failed )
+      return ErrFail;
+   
+   failed = output_gtm( aDirName );
+   if( failed )
+      return ErrFail;
+   
+   
+   // If input mean or variance are in short, and output is requesting
+   // byte, then convert to byte.
+   if( ( ! m_bInputByteMeans  && aByteMeans ) ||
+   ( ! m_bInputByteVars && aByteVars ) )
+   {
+      // Note: bias has already been added to short mean vectors in the file
+      failed = model_bit_16_to_8( aDirName, aDirName, true, 0, aByteMeans, aByteVars );
+   }
+   if( failed )
+      return ErrFail;
+   
+   
+   // Output the configuration file for the models, which specifies
+   // the type of mean and variance vectors, byte or short, and
+   // the endian of the data.
+   failed = output_config( aDirName, aByteMeans, aByteVars );
+   if( failed )
+      return ErrFail;
+   
+   
+   #ifdef OFFLINE_CLS
+   SaveVQHMM(aDirName);
+   #endif
+   
+   
+   #ifdef USE_NET_OPTIMIZE
+   
+   if( aOptimize )
+   {
+      /* The code below was for quick implmentation of network
+       * optimization.  These functions are
+       * not API compliant - they do not check mallocs etc. Not to be used
+       * now. */
+      
+      NetTransType trans;
+      int disp_automaton = false;
+      StateType *nfa;
+      int nbr_labels, nbr_nfa_states, initial_state, eps_order;
+      PtAugmType *composed_words;
+      char inputnet[300], outputnet[300];
+      
+      
+      strcpy(inputnet, aDirName);
+      strcat(inputnet, "/net.bin.org");
+      strcpy(outputnet, aDirName);
+      strcat(outputnet, "/net.bin");
+      nbr_nfa_states = read_net(  inputnet, "ueslesshmmlist", &trans);    /* net file */
+      if (nbr_nfa_states==0) return ErrFail;
+      
+      nfa = newmem(StateType, nbr_nfa_states);
+      composed_words = newmem(PtAugmType, trans.n_word);
+      
+      init_cwd( composed_words, trans.n_word, NULL);
+      initial_state = convert_to_nfa(&trans, nfa, &nbr_labels, composed_words);
+      
+      eps_order = nbr_labels -1; /* always the last (the last is EPS) */
+      call_determinize_min(nfa, nbr_labels - 1, nbr_nfa_states, initial_state,
+      composed_words, trans.hmm_name, trans.n_hmm,
+      trans.words, trans.n_word, outputnet, eps_order, disp_automaton);
+      
+      free_net(&trans);  /* placed here because c.d.m. uses hmm, wrd */
+      free_augm_list(composed_words, trans.n_word);
+      free(composed_words);
+      free_automaton(nfa, nbr_nfa_states);
+   }
+   else
+   {
+      return ErrNone;
+   }
+   
+   #else
+   
+   if( aOptimize )
+      return ErrNoOptimize;
+   else
+      return ErrNone;
+   
+   #endif
+   
+   return ErrNone;
+}
+
+
+//----------------------------------------------------------------
+//  Private CTIesrFlex class function implementation
+
+
+//--------------------------------
+void CTIesrFlex::init()
+{
+   // Initial rule allocation.  m_ruleMax should be zero.
+   if( 0 >= m_ruleMax )
+   {
+      rule = reinterpret_cast<Grule*>
+      ( ExpandArray( reinterpret_cast<void*>(rule), sizeof(Grule), RULE_ALLOC, &m_ruleMax ) );
+   }
+   
+   /* accommodate null grammar, enrollment only */
+   rule[0].node = -1;
+   rule[0].name = NULL;
+   
+   
+   //for lexical analysis - local replacement for yylex
+   cfg_char = cfg;
+   
+   // For exception handling
+   m_parseFail = false;
+   
+   
+   //yylineno = 1;
+}
+
+//-------------------------------------------------------------
+// This yylex function, which supports the yyparse grammar parser
+// is written by hand to avoid using the lex utility
+// since the lexical analyzer is simple, and it will avoid use
+// of global tables.
+//
+
+//int CTIesrFlex::yylex( int *yylval )
+int CTIesrFlex::yylex( long *yylval )
+{
+   
+   
+   char newtoken[MAX_WORDLEN];
+   int  newtokidx = 0;
+   char* tokensave;
+   
+   
+   // Find next token
+   while( true )
+   {
+      while( *cfg_char == ' ' || *cfg_char == '\n' || *cfg_char == '\t' )
+      {
+         cfg_char++;
+      }
+      
+      if( *cfg_char == '\0')
+         return 0;
+      
+      else if( *cfg_char == '(' )
+      {
+         cfg_char++;
+         return LPRN;
+      }
+      
+      else if( *cfg_char == ')' )
+      {
+         cfg_char++;
+         return RPRN;
+      }
+      
+      else if( *cfg_char == '[' )
+      {
+         cfg_char++;
+         return LBKT;
+      }
+      
+      else if( *cfg_char == ']' )
+      {
+         cfg_char++;
+         return RBKT;
+      }
+      
+      else if( *cfg_char == '|' )
+      {
+         cfg_char++;
+         return VBAR;
+      }
+      
+      
+      else if( *cfg_char == '.' )
+      {
+         cfg_char++;
+         return PERIOD;
+      }
+      
+      else if( strncmp( cfg_char, "--->", 4) == 0 )
+      {
+         cfg_char += 4;
+         return ARROW;
+      }
+      
+      else if( strncmp( cfg_char, "start", 5 ) == 0 )
+      {
+         cfg_char += 5;
+         return START;
+      }
+      
+      else if( myisalpha( (int) *cfg_char ) || *cfg_char == '-'
+      || *cfg_char == '\'' || *cfg_char == '_' )
+      {
+         while( myisalpha( (int) *cfg_char ) || *cfg_char == '-'
+         || *cfg_char == '\'' || *cfg_char == '_' )
+         {
+            newtoken[ newtokidx++ ] = *cfg_char++;
+         }
+         
+         newtoken[newtokidx] = '\0';
+         
+         // Check if all token pointers in the token pointer array are used
+         if( token_idx >= m_tokenMax )
+         {
+            // Allocate TOKEN_ALLOC more tokens in the dynamic token array.
+            // This will throw an exception if the expansion fails.
+            token = reinterpret_cast<char**>
+            ( ExpandArray( reinterpret_cast<void*>(token), sizeof(char*), TOKEN_ALLOC, &m_tokenMax ) );
+         }
+         
+         tokensave = (char*)malloc( strlen(newtoken) + 1 );
+         if( !tokensave )
+            throw( "Token malloc fail in yylex" );
+         
+         // Save the character string pointer in order to free it later
+         token[token_idx] = tokensave;
+         token_idx++;
+         
+         // Send yyparse the location of the new token character string
+         // *yylval = (int) strcpy( tokensave, newtoken );
+         *yylval = (long) strcpy( tokensave, newtoken );
+         return NAME;
+      }
+      
+      else
+      {
+         cfg_char++;
+      }
+   }
+}
+
+
+//-------------------------------------------------------------------------
+// This is the generated grammar string parse function.
+//--------------------------------------------------------------------------
+int CTIesrFlex::yyparse()
+{
+   
+   register int yystate;
+   register int yyn;
+   register short *yyssp;
+   
+   // register int *yyvsp;
+   register long *yyvsp;
+
+   int yyerrstatus;
+   int yychar1 = 0;
+   
+   short yyssa[200];
+
+   // int yyvsa[200];
+   long yyvsa[200];
+   
+   short *yyss = yyssa;
+
+   // int *yyvs = yyvsa;
+   long *yyvs = yyvsa;
+
+   int yystacksize = 200;
+   int yyfree_stacks = 0;
+   
+   int yychar;
+   
+   // int yylval;
+   long yylval;
+
+   int yynerrs;
+   
+   // int yyval;
+   long yyval;
+   
+   int yylen;
+   
+   yystate = 0;
+   yyerrstatus = 0;
+   yynerrs = 0;
+   yychar = -2;
+   
+   yyssp = yyss - 1;
+   yyvsp = yyvs;
+   
+   yynewstate:
+      
+      *++yyssp = yystate;
+      
+      if (yyssp >= yyss + yystacksize - 1)
+      {
+         
+         // maintain pointers to old stacks
+         
+          // int *yyvs1 = yyvs;
+         long *yyvs1 = yyvs;
+         
+         short *yyss1 = yyss;
+         int yystacksize1 = yystacksize;
+         
+         
+         int size = yyssp - yyss + 1;
+         
+         // if present stack size is maximum allowed, then exit with failure
+         if (yystacksize >= 10000)
+         {
+            yyerror("parser stack overflow");
+            if (yyfree_stacks)
+            {
+               free(yyss);
+               free(yyvs);
+               
+            }
+            return 2;
+         }
+         // create new stacks with larger size limited by max
+         yystacksize *= 2;
+         if (yystacksize > 10000)
+            yystacksize = 10000;
+         
+         yyfree_stacks = 1;
+         
+         yyss = (short *) malloc(yystacksize * sizeof (*yyssp));
+         if( yyss )
+            __yy_memcpy((char *)yyss, (char *)yyss1,
+            size * (unsigned int) sizeof (*yyssp));
+         
+         // yyvs = (int *) malloc(yystacksize * sizeof (*yyvsp));
+         yyvs = (long *) malloc(yystacksize * sizeof (*yyvsp));
+
+         if( yyvs )
+            __yy_memcpy((char *)yyvs, (char *)yyvs1,
+            size * (unsigned int) sizeof (*yyvsp));
+         
+         // free old malloc allocated stacks
+         if( yystacksize1 > 200 )
+         {
+            free(yyss1);
+            free(yyvs1);
+         }
+         
+         // return if malloc fail
+         if( yyss == 0 || yyvs == 0 )
+            goto yyabortlab;
+         
+         
+         yyssp = yyss + size - 1;
+         yyvsp = yyvs + size - 1;
+         
+         if (yyssp >= yyss + yystacksize - 1)
+            goto yyabortlab;
+      }
+      
+      goto yybackup;
+      yybackup:
+         
+         yyn = yypact[yystate];
+         if (yyn == -32768)
+            goto yydefault;
+         
+         if (yychar == -2)
+         {
+            
+            // The TIesrFlex specific yylex keeps a running store of malloced tokens
+            // and will throw an exception if not able to malloc space.  If this fails
+            // then yyparse must abort, freeing its stacks.
+            try
+            {
+               yychar = yylex(&yylval);
+            }
+            catch( char* ex )
+            {
+               goto yyabortlab;
+            }
+         }
+         
+         if (yychar <= 0)
+         {
+            yychar1 = 0;
+            yychar = 0;
+            
+         }
+         else
+         {
+            yychar1 = ((unsigned)(yychar) <= 265 ? yytranslate[yychar] : 18);
+            
+            
+         }
+         
+         yyn += yychar1;
+         if (yyn < 0 || yyn > 26 || yycheck[yyn] != yychar1)
+            goto yydefault;
+         
+         yyn = yytable[yyn];
+         
+         
+         if (yyn < 0)
+         {
+            if (yyn == -32768)
+               goto yyerrlab;
+            yyn = -yyn;
+            goto yyreduce;
+         }
+         else if (yyn == 0)
+            goto yyerrlab;
+         
+         if (yyn == 27)
+            goto yyacceptlab;
+         
+         if (yychar != 0)
+            yychar = -2;
+         
+         *++yyvsp = yylval;
+         
+         
+         if (yyerrstatus) yyerrstatus--;
+         
+         yystate = yyn;
+         goto yynewstate;
+         
+         
+         yydefault:
+            
+            yyn = yydefact[yystate];
+            if (yyn == 0)
+               goto yyerrlab;
+            
+            
+            yyreduce:
+               yylen = yyr2[yyn];
+               if (yylen > 0)
+                  yyval = yyvsp[1-yylen];
+               
+               // Each call to functions that may raise an exception
+               // must be guarded
+               switch (yyn)
+               {
+                  
+                  case 1:
+                  {
+                     strcpy(start_name, (char *) yyvsp[-2]);
+                     
+                     /*
+                      __try
+                      {
+                      process_grammar();
+                      }
+                      __except( GetExceptionCode() == CTIesrFlex::STATUS_FAIL_PARSE )
+                      {
+                      m_parseFail = true;
+                      }
+                      ;*/
+                     
+                     try
+                     {
+                        process_grammar();
+                     }
+                     catch( char* exc )
+                     {
+                        //if( exc == CTIesrFlex::STATUS_FAIL_PARSE )
+                        m_parseFail = true;
+                     }
+                     
+                     break;
+                  }
+                  case 2:
+                  {
+                     strcpy(start_name, (char *) yyvsp[-3]);
+                     
+                     /*
+                      __try
+                      {
+                      process_grammar();
+                      }
+                      __except( GetExceptionCode() == CTIesrFlex::STATUS_FAIL_PARSE )
+                      {
+                      m_parseFail = true;
+                      }
+                      ; */
+                     
+                     
+                     try
+                     {
+                        process_grammar();
+                     }
+                     catch( char* exc )
+                     {
+                        //if( exc == CTIesrFlex::STATUS_FAIL_PARSE )
+                        m_parseFail = true;
+                     }
+                     
+                     break;
+                  }
+                  case 5:
+                  {
+                     /*
+                      __try
+                      {
+                      yyval = (int) create_rule( (char *) yyvsp[-3], (Gnode *) yyvsp[-1] );
+                      }
+                      __except( GetExceptionCode() == CTIesrFlex::STATUS_FAIL_PARSE )
+                      {
+                      m_parseFail = true;
+                      }
+                      ;*/
+                     
+                     
+                     try
+                     {
+                        yyval = (int) create_rule( (char *) yyvsp[-3], (int) yyvsp[-1] );
+                     }
+                     catch( char* exc )
+                     {
+                        // if( exc ==  CTIesrFlex::STATUS_FAIL_PARSE )
+                        m_parseFail = true;
+                     }
+                     break;
+                  }
+                  case 6:
+                  {
+                     /*
+                      __try
+                      {
+                      yyval = (int) create_node((char *) yyvsp[0], NULL, NULL, 0);
+                      }
+                      __except( GetExceptionCode() == CTIesrFlex::STATUS_FAIL_PARSE )
+                      {
+                      m_parseFail = true;
+                      }
+                      ; */
+                     
+                     try
+                     {
+                        yyval = (int) create_node((char *) yyvsp[0], -1, -1, 0);
+                     }
+                     catch( char* exc )
+                     {
+                        //if( exc ==  CTIesrFlex::STATUS_FAIL_PARSE )
+                        m_parseFail = true;
+                     }
+                     break;
+                  }
+                  case 7:
+                  {
+                     yyval = yyvsp[-1];
+                     ;
+                     break;}
+                  case 8:
+                  {
+                     /*
+                      __try
+                      {
+                      yyval = (int) process_optional( (int) yyvsp[-1] );
+                      }
+                      __except( GetExceptionCode() == CTIesrFlex::STATUS_FAIL_PARSE )
+                      {
+                      m_parseFail = true;
+                      }
+                      ;*/
+                     
+                     try
+                     {
+                        yyval = (int) process_optional( (int) yyvsp[-1] );
+                     }
+                     catch( char* exc )
+                     {
+                        // if( exc ==  CTIesrFlex::STATUS_FAIL_PARSE )
+                        m_parseFail = true;
+                     }
+                     break;
+                  }
+                  case 9:
+                  {
+                     yyval = yyvsp[0];
+                     ;
+                     break;}
+                  case 10:
+                  {
+                     /*
+                      __try
+                      {
+                      attach_at_end(( Gnode *) yyvsp[-1], ( Gnode *) yyvsp[0]);
+                      }
+                      __except( GetExceptionCode() == CTIesrFlex::STATUS_FAIL_PARSE )
+                      {
+                      m_parseFail = true;
+                      }
+                      */
+                     
+                     try
+                     {
+                        attach_at_end( (int) yyvsp[-1], (int) yyvsp[0]);
+                     }
+                     catch( char* exc )
+                     {
+                        //if( exc ==  CTIesrFlex::STATUS_FAIL_PARSE )
+                        m_parseFail = true;
+                     }
+                     yyval = yyvsp[-1];
+                     
+                     break;
+                  }
+                  case 11:
+                  {
+                     yyval = yyvsp[0];
+                     ;
+                     break;}
+                  case 12:
+                  {
+                     try
+                     {
+                        /*// the function attach_at_para_end_tree constructs prefix tree
+                         // of the symbol network.
+                         // However, it is not yet the default
+                         attach_at_para_end_tree((Gnode *) yyvsp[-2], ( Gnode *) yyvsp[0]);
+                         */
+                        attach_at_para_end( (int) yyvsp[-2], (int) yyvsp[0] );
+                     }
+                     catch( char* exc )
+                     {
+                        //if( exc ==  CTIesrFlex::STATUS_FAIL_PARSE )
+                        m_parseFail = true;
+                     }
+                     
+                     yyval = yyvsp[-2];
+                     ;
+                     break;
+                  }
+               }
+               
+               // if an exception was raised in the switch statement, abort immediately
+               if( m_parseFail )
+                  goto yyabortlab;
+               
+               
+               yyvsp -= yylen;
+               yyssp -= yylen;
+               
+               
+               *++yyvsp = yyval;
+               
+               
+               yyn = yyr1[yyn];
+               
+               yystate = yypgoto[yyn - 12] + *yyssp;
+               if (yystate >= 0 && yystate <= 26 && yycheck[yystate] == *yyssp)
+                  yystate = yytable[yystate];
+               else
+                  yystate = yydefgoto[yyn - 12];
+               
+               goto yynewstate;
+               
+               yyerrlab:
+                  
+                  if (! yyerrstatus)
+                     
+                  {
+                     ++yynerrs;
+                     
+                     
+                     yyerror("parse error");
+                  }
+                  
+                  goto yyerrlab1;
+                  yyerrlab1:
+                     
+                     if (yyerrstatus == 3)
+                     {
+                        
+                        if (yychar == 0)
+                           goto yyabortlab;
+                        
+                        yychar = -2;
+                     }
+                     
+                     
+                     yyerrstatus = 3;
+                     
+                     goto yyerrhandle;
+                     
+                     yyerrdefault:
+                        
+                        
+                        
+                        yyerrpop:
+                           
+                           if (yyssp == yyss) goto yyabortlab;
+                           yyvsp--;
+                           yystate = *--yyssp;
+                           
+                           
+                           
+                           
+                           yyerrhandle:
+                              
+                              yyn = yypact[yystate];
+                              if (yyn == -32768)
+                                 goto yyerrdefault;
+                              
+                              yyn += 1;
+                              if (yyn < 0 || yyn > 26 || yycheck[yyn] != 1)
+                                 goto yyerrdefault;
+                              
+                              yyn = yytable[yyn];
+                              if (yyn < 0)
+                              {
+                                 if (yyn == -32768)
+                                    goto yyerrpop;
+                                 yyn = -yyn;
+                                 goto yyreduce;
+                              }
+                              else if (yyn == 0)
+                                 goto yyerrpop;
+                              
+                              if (yyn == 27)
+                                 goto yyacceptlab;
+                              
+                              
+                              
+                              *++yyvsp = yylval;
+                              
+                              
+                              yystate = yyn;
+                              goto yynewstate;
+                              
+                              yyacceptlab:
+                                 
+                                 if (yyfree_stacks)
+                                 {
+                                    free(yyss);
+                                    free(yyvs);
+                                    
+                                 }
+                                 return 0;
+                                 
+                                 yyabortlab:
+                                    
+                                    if (yyfree_stacks)
+                                    {
+                                       if(yyss) free(yyss);
+                                       if(yyvs) free(yyvs);
+                                       
+                                    }
+                                    return 1;
+                                    
+                                    
+}
+
+
+// helper function needed by yyparse
+void CTIesrFlex::__yy_memcpy(char *to, char *from, unsigned int count)
+{
+   register char *t = to;
+   register char *f = from;
+   register int i = count;
+   
+   while (i-- > 0)
+      *t++ = *f++;
+   
+}
+
+
+int CTIesrFlex::yywrap()
+{
+   return 1;
+}
+
+void CTIesrFlex::yyerror(const char *msg)
+{
+   //TODO: define what to do in case of an error in yy parser.
+}
+
+
+/*--------------------------------
+ read_config
+
+ This function reads the configuration file that defines the type of
+ information in the input fixed point tree and HMM files.
+ --------------------------------*/
+int CTIesrFlex::read_config( char *fname )
+{
+   FILE *fp;
+   size_t nread = 0;
+   size_t wtconf = 0;
+   size_t pkbyte = 0;
+   
+   // Attempt to open the configuration file.  If it can't be opened,
+   // use defaults.
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      // Default assumptions made for input trees and HMMs
+      
+      // Feature vector dimensions
+      m_inputFeatDim = 16;
+      
+      // Static feature vector dimensions
+      m_inputStaticDim = 8;
+      
+      // Features are in 16-bit shorts
+      m_bInputByteMeans = false;
+      
+      m_bInputByteVars = false;
+      
+      // Features are CMN mean normalized, and need bias added.
+      // Bias is added as part of TIesrFlex converting means
+      // to bytes.
+      m_bInputCMN = true;
+      
+      // Features are not little endian
+      m_bInputLittleEndian = false;
+      
+      // Male and female sets, denoted by :f and :m
+      m_inputSets = 2;
+      
+      // Monophone transitions are set ("gender") independent
+      m_bInputGDTrans = false;
+      
+      // Acoustic decision trees are set ("gender") dependent
+      m_bInputGDTrees = true;
+      
+      return OK;
+   }
+   
+   
+   // Number of features in input mean and variance vectors
+   // This may include delta and accel. in addition to static
+   fread( &m_inputFeatDim, sizeof(int), 1, fp );
+   
+   // Static feature dimensions in input mean and variance vectors
+   // This is only the number of static features.  If delta and acc
+   // features are in the input, then delta and acc must also have
+   // this number of dimensions.
+   fread( &m_inputStaticDim, sizeof(int), 1, fp );
+   
+   // Flag, input feature means are in bytes
+   fread( &m_bInputByteMeans, sizeof(int), 1, fp );
+   
+   // Flag, input feature inverse variances are in bytes
+   fread( &m_bInputByteVars, sizeof(int), 1, fp );
+   
+   // Flag, data is mean normalized and needs mean added
+   fread( &m_bInputCMN, sizeof(int), 1, fp );
+   
+   // Flag, data is in little endian format
+   fread( &m_bInputLittleEndian, sizeof(int), 1, fp );
+   
+   // Number of "genders" or hmm model sets in data
+   fread( &m_inputSets, sizeof(int), 1, fp );
+   
+   // Flag, gender-dependent transitions
+   fread( &m_bInputGDTrans, sizeof(int), 1, fp );
+   
+   // Flag, gender-dependent trees
+   nread = fread( &m_bInputGDTrees, sizeof(int), 1, fp );
+   
+   // incorporate the changes in the fxweight file
+   // 0 for default
+   // 1 for indexed weights more than one weight
+   // 2 for weight clustering when each mixture class using one weight vector
+   //   so the mixture index being used as the index;
+   //   this also enables algorithmic methods of weight generation to be used.
+   
+   wtconf = fread(&m_bInputWeightConfig, sizeof(int), 1, fp);
+   if (wtconf != 1)
+   {
+      m_bInputWeightConfig = 0;
+   }
+   
+   pkbyte = fread(&m_bPackWtNmix, sizeof(int), 1, fp);
+   if(pkbyte != 1)
+   {
+      m_bPackWtNmix = 0;
+   }
+   
+   fclose( fp );
+   
+   if( nread != 1 )
+   {
+      return FAIL;
+   }
+   
+   return OK;
+}
+
+
+/*--------------------------------
+ read_scale
+
+ This function reads word to byte scaling information.  This will
+ only be read if the input mean and variance vector information
+ is stored as bytes.  This information is output to the output
+ scale.bin file.
+ --------------------------------*/
+int CTIesrFlex::read_scale( char *fname )
+{
+   FILE *fp;
+   size_t nread = 0;
+   size_t scaleSize;
+   
+   
+   // The number of scales should be twice the number of features,
+   // since we are getting the scales for mean and variance.  The
+   // scales are in signed short.
+   scaleSize =  2 * m_inputFeatDim * sizeof(short);
+   scale_base = (short*) malloc( scaleSize );
+   if( scale_base == NULL )
+   {
+      return FAIL;
+   }
+   
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   nread = fread( scale_base, sizeof(short), 2*m_inputFeatDim, fp );
+   fclose( fp );
+   
+   if( nread != (size_t)(2*m_inputFeatDim) )
+   {
+      return FAIL;
+   }
+   
+   return OK;
+}
+
+
+//--------------------------------
+
+int CTIesrFlex::read_qs(char *fname)
+{
+   FILE  *fp;
+   int   size;
+   
+   // if question data exists, free it
+   if( qs_base != NULL )
+      free( qs_base );
+   
+   // open question file and read data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&size, sizeof(int), 1, fp);
+   qs_base = (char *) malloc( size*sizeof(char) );
+   
+   if( !qs_base )
+   {
+      fclose( fp );
+      return FAIL;
+   }
+   
+   fread(qs_base, sizeof(char), size, fp);
+   fclose( fp );
+   
+   return OK;
+}
+
+
+//---------------------
+int CTIesrFlex::read_qstbl(char *fname)
+{
+   FILE  *fp;
+   int   size;
+   int idx;
+   
+   // if question table data exists, free it
+   if( qs_offset != NULL )
+      free( qs_offset );
+   
+   // read question offsets
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&size, sizeof(int), 1, fp);
+   qs_offset = (int *) malloc( size*sizeof(int) );
+   
+   if( !qs_offset )
+   {
+      fclose( fp );
+      return FAIL;
+   }
+   fread(qs_offset, sizeof(int), size, fp);
+   fclose( fp );
+   
+   
+//   for( idx = 0; idx < size; idx++ )
+//   {
+//      qs_offset[idx] += (int)qs_base;
+//   }
+   
+   return OK;
+}
+
+
+//--------------------
+int CTIesrFlex::read_tree(char *fname)
+{
+   FILE  *fp;
+   int   size;
+   
+   // if tree data exists, free it
+   if( tree_base != NULL )
+      free( tree_base );
+   
+   // read tree data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&size, sizeof(int), 1, fp);
+   size /= sizeof(short);
+   tree_base = (short *) malloc( size*sizeof(short) );
+   
+   if( !tree_base )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   fread(tree_base, sizeof(short), size, fp);
+   fclose( fp );
+   
+   return OK;
+}
+
+
+//----------------------
+int CTIesrFlex::read_treetbl(char *fname)
+{
+   FILE  *fp;
+   int   size;
+   int   i, j, n_state;
+   int   *ptr;
+   int   numPhones;
+   
+   // if tree table data exists, free it
+   if( treetbl_base != NULL )
+      free( treetbl_base );
+   
+   // read tree data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&size, sizeof(int), 1, fp);
+   size /= sizeof(int);
+   treetbl_base = (int *) malloc( size*sizeof(int) );
+   
+   if( !treetbl_base )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   fread(treetbl_base, sizeof(int), size, fp);
+   fclose( fp );
+   
+//   // adjust to memory addresses within the table from offsets to
+//   // pointers to each tree.  Trees may be gender-dependent.
+//   numPhones = m_bInputGDTrees ?  m_inputSets*n_phone  :  n_phone;
+//
+//   for( i = 0; i < numPhones; i++ )
+//   {
+//      // start of tree table contains address of locations of trees
+//      treetbl_base[i] = (int)treetbl_base +
+//      ( treetbl_base[i]*sizeof(int) );
+//
+//
+//      // each state entry for each phone changed from
+//      // offset in trees data to address of tree for each phone and state
+//
+//      // pointer to state count
+//      ptr = (int *)treetbl_base[i];
+//      n_state = *ptr;
+//
+//      // ptr changed to point to offset in tree_base for each state.
+//      // Change offset to pointer to tree_base data for this phone and state.
+//      ptr++;
+//      for( j = 0; j < n_state; j++ )
+//      {
+//         ptr[j] = (int)tree_base + ( ptr[j]*sizeof(short) );
+//      }
+//   }
+   
+   return OK;
+}
+
+
+//-------------------
+int CTIesrFlex::read_fxtran(char *fname)
+{
+   FILE  *fp;
+   int   size;
+   
+   // if transition data exists, free it
+   if( tran_base != NULL )
+      free( tran_base );
+   
+   // read transition data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&size, sizeof(int), 1, fp);
+   tran_base = (short *) malloc( size*sizeof(short) );
+   
+   if( !tran_base )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   fread(tran_base, sizeof(short), size, fp);
+   fclose( fp );
+   
+   return OK;
+}
+
+
+//------------------------
+int CTIesrFlex::read_fxtroff(char *fname)
+{
+   FILE  *fp;
+   int   size;
+   
+   // if transition offset data exists, free it
+   if( tranoffset_base != NULL )
+   {
+      free( tranoffset_base );
+      m_numTrans = 0;
+   }
+   
+   if( tran_offset )
+      free( tran_offset );
+   
+   if( tran_idx_aug )
+      free( tran_idx_aug );
+   
+   
+   
+   // read transition offset data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&size, sizeof(int), 1, fp);
+   tranoffset_base = (int *) malloc( size*sizeof(int) );
+   
+   if( !tranoffset_base )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   fread(tranoffset_base, sizeof(int), size, fp);
+   fclose( fp );
+   
+   m_numTrans = size;
+   
+   // Determine the maximum number of emitting states in the input hmms
+   m_maxStates = 0;
+   for (int tran = 0; tran < m_numTrans; tran++ )
+   {
+      int offset = tranoffset_base[tran];
+      int nStates = (int)( tran_base[offset] - 1);
+      
+      if( nStates > m_maxStates )
+         m_maxStates = nStates;
+   }
+   
+   
+   // tran_offset will have one extra entry at the end
+   tran_offset = (int*)malloc( (m_numTrans + 1) * sizeof(int) );
+   tran_idx_aug = (int*)malloc( size * sizeof(int) );
+   if( !tran_offset || !tran_idx_aug )
+   {
+      return FAIL;
+   }
+   
+   
+   return OK;
+}
+
+//--------------------------
+int CTIesrFlex::read_fxclust(char *fname)
+{
+   FILE  *fp;
+   int   size;
+   
+   // if cluster data exists, free it
+   if( cluster_base != NULL )
+   {
+      free( cluster_base );
+   }
+   
+   
+   // read cluster (pdf) data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&size, sizeof(int), 1, fp);
+   cluster_base = (short *) malloc( size*sizeof(short) );
+   
+   if( !cluster_base )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   fread(cluster_base, sizeof(short), size, fp);
+   fclose( fp );
+   
+   return OK;
+}
+
+//--------------------------
+//
+// modified to generate the offset indices from the recursive difference, 
+//
+int CTIesrFlex::read_fxcloff(char *fname)
+{
+   FILE  *fp = NULL;
+   int   size;
+   int   nClusters;
+   int   offset_idx =0 ;
+   int n_mix, offset;
+   size_t readFlag;
+   int fx_offset_increment  = 1;
+   int fx_clust_entries = 3;
+   int status = FAIL;
+   
+   //switch case added to select the configureation at runtime bu reading the fxconfig file
+   
+   switch(m_bInputWeightConfig)
+   {
+      case 0:
+         fx_clust_entries = 3;
+         fx_offset_increment = 1;
+         break;
+         
+      case 1:
+         fx_offset_increment = 2;
+         fx_clust_entries = 2;
+         break;
+         
+      case 2:
+         fx_offset_increment=1;
+         fx_clust_entries = 2;
+         break;
+   }
+   
+   // if cluster offset data exists, free it
+   if( clusteroffset_base != NULL )
+   {
+      free( clusteroffset_base );
+      m_numClusters = 0;
+   }
+   
+   if( cluster_offset )
+      free( cluster_offset );
+   
+   if( cluster_idx_aug )
+      free( cluster_idx_aug );
+   
+   
+   // read cluster offset data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      goto EXITREAD;
+   }
+   
+   // Read number of offsets, which is also the number of clusters
+   readFlag = fread(&size, sizeof(int), 1, fp);
+   if(readFlag != 1)
+   {
+      goto EXITREAD;
+   }
+   
+   clusteroffset_base = (int *) malloc( size*sizeof(int) );
+   if( !clusteroffset_base )
+   {
+      goto EXITREAD;
+   }
+   
+   
+   // Check if number of mix and weight index packed in single short in fxclust file.
+   // Build the offset array dynamically (used to be read in from fxclust.off).
+   if(m_bPackWtNmix == 1)
+   {
+      n_mix = (int) (0xff & cluster_base[0]);
+      clusteroffset_base[0] = 0;
+      for(offset_idx=1;offset_idx<size;offset_idx++)
+      {
+         offset = 1 +  n_mix*2;
+         clusteroffset_base[offset_idx] = (int)(clusteroffset_base[offset_idx-1] + offset);
+         n_mix = (int)(0xff & cluster_base[clusteroffset_base[offset_idx]]);
+      }
+   }
+   else
+   {
+      // the data is read in through in short as compared to int
+      // nClusters = fread(clusteroffset_base, sizeof(short), size, fp);
+      // fclose( fp );
+      // we can get rid of the fxclust.off file by generating the offset file in situ
+      //post processing to generate indices from the fxclust.cb data
+      //the change in offsets is done so tha offsets need not be stored
+      // the difference is offsets are then added recursively to generate the offset back
+      n_mix = (int) cluster_base[0];
+      clusteroffset_base[0] = 0;
+      for(offset_idx=1;offset_idx<size;offset_idx++)
+      {
+         offset = fx_offset_increment +  n_mix*fx_clust_entries;
+         clusteroffset_base[offset_idx] = clusteroffset_base[offset_idx-1] + offset;
+         n_mix = (int)cluster_base[clusteroffset_base[offset_idx]];
+      }
+   }
+   
+   nClusters = size ;
+   
+   //   if( nClusters != size )
+   // {
+   //  return FAIL;
+   // }
+   
+   m_numClusters = nClusters;
+   
+   
+   // Allocate the dynamic arrays used during model output
+   cluster_offset = (int*)malloc( (nClusters+1) * sizeof(int) );
+   cluster_idx_aug = (int*)malloc( nClusters * sizeof(int) );
+   if( !cluster_offset || !cluster_idx_aug )
+   {
+      goto EXITREAD;
+   }
+   
+   // All processing and allocations succeeded
+   status = OK;
+   
+   EXITREAD:
+      if( fp )
+         fclose(fp);
+      
+      return status;
+}
+
+
+//-----------------------
+int CTIesrFlex::read_mean(char *fname)
+{
+   FILE  *fp;
+   unsigned int   nMean;
+   size_t elementSize;
+   int vectorSize;
+   
+   // Free any exisng  mean data
+   if( mean_base != NULL )
+   {
+      free( mean_base );
+      m_numMeans = 0;
+   }
+   
+   if( mean_idx_aug )
+      free( mean_idx_aug );
+   
+   
+   // Determine sizes of input and output vectors
+   elementSize = m_bInputByteMeans ? sizeof( unsigned char ) :
+      sizeof( short );
+      
+      vectorSize = elementSize * m_inputFeatDim;
+      
+      // Open the mean file and get number of mean vectors
+      fp = fopen(fname, "rb");
+      if ( fp == NULL )
+      {
+         return FAIL;
+      }
+      
+      fread(&nMean, sizeof(unsigned int), 1, fp);
+      
+      
+      // Allocate space to hold the mean vectors
+      mean_base = malloc( nMean * vectorSize );
+      if( !mean_base )
+      {
+         fclose(fp);
+         return FAIL;
+      }
+      
+      
+      // Read in the vector data, stepping over unused dimensions
+      size_t nRead = fread( mean_base, vectorSize, nMean, fp );
+      
+      fclose( fp );
+      
+      if( nRead != nMean )
+         return FAIL;
+      
+      m_numMeans = nMean;
+      
+      // Allocate space to track usage of mean vectors
+      mean_idx = (int*)malloc( nMean *sizeof(int) );
+      mean_idx_aug = (int*)malloc( nMean * sizeof(int) );
+      if( !mean_idx || !mean_idx_aug )
+      {
+         return FAIL;
+      }
+      
+      return OK;
+}
+
+int CTIesrFlex::read_weight(char *fname)
+{
+   FILE *fp;
+   unsigned int nWts;
+   size_t elementSize;
+   size_t readFlag;
+   
+   
+   m_bInputByteWgts = false;
+   
+   //if weight data exists, free it
+   if( weight_base != NULL )
+   {
+      free(weight_base);
+      m_numWeights = 0;
+   }
+   
+   //find if the weights are written in byte or short
+   elementSize = m_bInputByteWgts ? sizeof( unsigned char ) :
+      sizeof( short );
+      
+      fp = fopen(fname, "rb");
+      if ( fp == NULL )
+      {
+         return FAIL;
+      }
+      //find the total number of weight vectors
+      readFlag = fread(&nWts, sizeof(unsigned int), 1, fp);
+      if(readFlag != 1)
+      {
+         return FAIL;
+         
+      }
+      
+      //read in the dimension of the weight Vectors
+      fread(&m_lengthWtVec, sizeof(short), 1, fp);
+      
+      
+      //allocate space to weights
+      weight_base =(short *) malloc( nWts * elementSize );
+      
+      if( !weight_base )
+      {
+         fclose(fp);
+         return FAIL;
+      }
+      size_t nRead = fread( weight_base, elementSize, nWts, fp );
+      fclose( fp );
+      
+      if( nRead != nWts )
+         return FAIL;
+      
+      return OK;
+      
+}
+//---------------------------
+int CTIesrFlex::read_var(char *fname)
+{
+   FILE  *fp;
+   unsigned int   nVar;
+   size_t elementSize;
+   int vectorSize;
+   
+   // if inverse variance data exists, free it
+   if( var_base != NULL )
+   {
+      free( var_base );
+      m_numVars = 0;
+   }
+   
+   if( var_idx_aug )
+   {
+      free(var_idx_aug );
+   }
+   
+   
+   // Determine sizes of input and output vectors
+   elementSize = m_bInputByteVars ? sizeof( unsigned char ) :
+      sizeof( short );
+      
+      vectorSize = elementSize * m_inputFeatDim;
+      
+      // Open the mean file and get number of mean vectors
+      fp = fopen(fname, "rb");
+      if ( fp == NULL )
+      {
+         return FAIL;
+      }
+      
+      fread(&nVar, sizeof(unsigned int), 1, fp);
+      
+      
+      // Allocate space to hold the mean vectors
+      var_base = malloc( nVar * vectorSize );
+      if( !var_base )
+      {
+         fclose(fp);
+         return FAIL;
+      }
+      
+      
+      // Read in the vector data, stepping over unused dimensions
+      size_t nRead = fread( var_base, vectorSize, nVar, fp );
+      
+      fclose( fp );
+      
+      if( nRead != nVar )
+         return FAIL;
+      
+      m_numVars = nVar;
+      
+      // Allocate space to track usage of variance vectors during model output
+      // var_idx = (int*)malloc( nVar * sizeof(int) );
+      var_idx_aug = (int*)malloc( nVar * sizeof(int) );
+      if( !var_idx_aug )
+         return FAIL;
+      
+      
+      return OK;
+}
+
+
+//-----------------------------
+int CTIesrFlex::read_gconst(char *fname)
+{
+   FILE  *fp;
+   int   size;
+   
+   // if gconst data exists, free it
+   if( gconst_base != NULL )
+      free( gconst_base );
+   
+   // read gconst data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&size, sizeof(int), 1, fp);
+   gconst_base = (short *) malloc( size*sizeof(short) );
+   
+   if( !gconst_base )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   fread(gconst_base, sizeof(short), size, fp);
+   fclose( fp );
+   
+   return OK;
+}
+
+
+//-------------------------------
+int CTIesrFlex::read_sil(char *fname)
+{
+   FILE  *fp;
+   int nRead;
+   
+   // if silence hmm data exists, free it
+   if( sil_hmm != NULL )
+      free( sil_hmm );
+   
+   // read silence hmm data
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   // Number of states in silence model
+   nRead = fread(&sil_n_state, sizeof(short), 1, fp);
+   if( nRead != 1 )
+      return FAIL;
+   
+   sil_hmm = (short *) malloc( sil_n_state*sizeof(short) );
+   if( !sil_hmm )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   // Transition index and cluster data for the silence model
+   nRead = fread(sil_hmm, sizeof(short), sil_n_state, fp);
+   fclose( fp );
+   
+   if( nRead != sil_n_state )
+      return FAIL;
+   
+   return OK;
+}
+
+
+
+//-----------------------------------------------
+void CTIesrFlex::free_codebook()
+{
+   if( qs_base )
+   {
+      free( qs_base );
+      qs_base = NULL;
+   }
+   
+   if( qs_offset )
+   {
+      free( qs_offset );
+      qs_offset = NULL;
+   }
+   
+   
+   if( tree_base )
+   {
+      free( tree_base );
+      tree_base = NULL;
+   }
+   
+   if( treetbl_base )
+   {
+      free( treetbl_base );
+      treetbl_base = NULL;
+   }
+   
+   if( tran_base )
+   {
+      free( tran_base );
+      tran_base = NULL;
+   }
+   
+   if( tranoffset_base )
+   {
+      free( tranoffset_base );
+      tranoffset_base = NULL;
+      m_numTrans = 0;
+   }
+   
+   if( tran_offset )
+   {
+      free( tran_offset );
+      tran_offset = NULL;
+   }
+   
+   if( tran_idx_aug )
+   {
+      free(tran_idx_aug );
+      tran_idx_aug = NULL;
+   }
+   
+   if( cluster_base )
+   {
+      free( cluster_base );
+      cluster_base = NULL;
+   }
+   
+   if( clusteroffset_base )
+   {
+      free( clusteroffset_base );
+      clusteroffset_base = NULL;
+      m_numClusters = 0;
+   }
+   
+   if( cluster_offset )
+   {
+      free( cluster_offset );
+      cluster_offset = NULL;
+   }
+   
+   //free the weight array if used
+   if(weight_base)
+   {
+      free(weight_base);
+      weight_base = NULL;
+   }
+   
+   if( cluster_idx_aug )
+   {
+      free( cluster_idx_aug );
+      cluster_idx_aug = NULL;
+   }
+   
+   
+   if( mean_base )
+   {
+      free( mean_base );
+      mean_base = NULL;
+      m_numMeans = 0;
+   }
+   
+   if( mean_idx )
+   {
+      free( mean_idx );
+      mean_idx = NULL;
+   }
+   
+   if( mean_idx_aug )
+   {
+      free( mean_idx_aug );
+      mean_idx_aug = NULL;
+   }
+   
+   if( var_base )
+   {
+      free( var_base );
+      var_base = NULL;
+      m_numVars = 0;
+   }
+   
+   if( var_idx_aug )
+   {
+      free( var_idx_aug );
+      var_idx_aug = NULL;
+   }
+   
+   if( gconst_base )
+   {
+      free( gconst_base );
+      gconst_base = NULL;
+   }
+   
+   if( scale_base )
+   {
+      free( scale_base );
+      scale_base = NULL;
+   }
+   
+   if( sil_hmm )
+   {
+      free( sil_hmm );
+      sil_hmm = NULL;
+   }
+}
+
+
+/*----------------------------------------------------------------
+ process_optional
+
+ Create a new empty node named "", which implments an optional node
+ branch.  The argument to this function specifies the node that
+ should be in parallel as the optional branch.
+ ----------------------------------------------------------------*/
+int CTIesrFlex::process_optional( int aNode )
+{
+   /* Need empty node for optional.  Paranext node is the node that
+    is in parallel with this empty node.*/
+   return create_node("", -1, aNode, 0);
+}
+
+
+/*----------------------------------------------------------------
+ create_node
+
+ Fill a node with the information for a node, and return the index to the node.  If the
+ dynamic node array is full, allocate additional array space.
+ ----------------------------------------------------------------*/
+int CTIesrFlex::create_node(char *name, int aNextNode, int aParaNextNode, int flag)
+{
+   
+   // Check if all nodes in the dynamic node array used.
+   if( node_idx >= m_nodeMax )
+   {
+      // Allocate NODE_ALLOC more nodes in the dynamic node array.
+      // This will throw an exception if the expansion fails.
+      node = reinterpret_cast<Gnode*>
+      ( ExpandArray( reinterpret_cast<void*>(node), sizeof(Gnode), NODE_ALLOC, &m_nodeMax ) );
+   }
+   
+   
+   // Fill the information for the new node.
+   node[ node_idx ].name = name;
+   node[ node_idx ].next = aNextNode;
+   node[ node_idx ].paranext = aParaNextNode;
+   node[ node_idx ].flag = flag;
+   
+   node_idx ++;
+   
+   // Now return the node index, not a pointer to the node
+   // return &node[ node_idx - 1 ];
+   return ( node_idx - 1 );
+}
+
+/*----------------------------------------------------------------
+ attach_at_end_sub
+
+ Attach node aNode2 to the end of all paths starting from node aNode1
+ that have not been visited yet.
+ ----------------------------------------------------------------------*/
+void CTIesrFlex::attach_at_end_sub( int aNode1, int aNode2 )
+{
+   
+   // If node is a null node, or node has been visited, then
+   // do not need to continue further.
+   if ( aNode1 == -1 || node[aNode1].flag ) return;
+   
+   /* Mark node as visited, so it won't be expanded again */
+   node[aNode1].flag = 1;
+   
+   
+   if ( node[aNode1].next == -1 )
+   {
+      // Found end of a next path, attach Node2 to end
+      node[aNode1].next = aNode2;
+   }
+   else
+   {
+      // Continue working down the next path
+      attach_at_end_sub( node[aNode1].next, aNode2 );
+   }
+   
+   // Follow the next path of the paranext node of Node1 to add Node2
+   attach_at_end_sub( node[aNode1].paranext, aNode2 );
+}
+
+
+
+/*----------------------------------------------------------------
+ attach_at_end
+
+ Attach node aNode2 as the next node to the end of all paths starting
+ from node aNode1.
+ ----------------------------------------------------------------*/
+void CTIesrFlex::attach_at_end( int aNode1, int aNode2 )
+{
+   clear_visit_flag();
+   
+   attach_at_end_sub( aNode1, aNode2 );
+   
+}
+
+
+/*----------------------------------------------------------------
+ attach_at_para_end_tree
+
+ Function to create a tree structured grammar.
+
+ have uniq siblings
+ @param n1 the starting node
+ @param n_cmp the node to be uniqed
+
+ ----------------------------------------------------------------*/
+void CTIesrFlex::attach_at_para_end_tree( int an1Node, int an_cmpNode)
+{
+   short bFound = 0;
+   
+   while ( an1Node != -1 )
+   {
+      if( strcmp( node[an1Node].name, node[an_cmpNode].name ) == 0 )
+      {
+         /* treenization */
+         attach_at_para_end( node[an1Node].next, node[an_cmpNode].next );
+         node[an_cmpNode].next = -1;
+         node[an_cmpNode].paranext = -1;
+         node[an_cmpNode].flag = 1;
+         bFound = 1;
+         break;
+      }
+      
+      if( node[an1Node].paranext != -1 )
+         an1Node = node[an1Node].paranext;
+      else
+         break;
+   }
+   
+   if (!bFound)
+      node[an1Node].paranext = an_cmpNode;
+}
+
+
+/* ---------------------------------------------------------------------------
+ attach_at_para_end
+
+ Attach node aNode2 to the end of the parallel path starting at aNode1.
+ parallel path
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::attach_at_para_end( int aNode1, int aNode2 )
+{
+   // Find the end of the paranext path for aNode1
+   while ( node[aNode1].paranext != -1 )
+      aNode1 = node[aNode1].paranext;
+   
+   // Add aNode2 at the end of the paranext path
+   node[aNode1].paranext = aNode2;
+}
+
+
+/* ---------------------------------------------------------------------------
+ clear_visit_flag
+
+ Clear all existing node flags.  These are used to keep track of
+ nodes visited while recursing down the tree of nodes.
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::clear_visit_flag()
+{
+   int   i;
+   
+   for ( i = 0; i < m_nodeMax; i++) node[i].flag = 0;
+}
+
+
+/*----------------------------------------------------------------
+ ClearNodeNetFlags
+
+ This function clears only the nodes corresponding to a node network.
+ The input argument is the top node of the network.  All nodes under
+ the top node will be cleared.  This function may result in node
+ flags being cleared more than once, since the flags obviously can
+ not be used to determine if a node has already been visited.
+
+ ----------------------------------------------------------------*/
+void CTIesrFlex::ClearNodeNetFlags( int aNode )
+{
+   if( aNode == -1 )
+      return;
+   
+   // Breadth first search to clear network node flags
+   ClearNodeNetFlags( node[aNode].paranext );
+   
+   // Then depth first search to clear node flags
+   ClearNodeNetFlags( node[aNode].next );
+   
+   node[aNode].flag = 0;
+   
+   return;
+}
+
+
+
+/* ---------------------------------------------------------------------------
+ clear duplicate flag
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::clear_sentnode_visit_flag()
+{
+   int   i;
+   
+   for ( i = 0; i < m_sentnodeMax; i++) sentnode[i].flag = 0;
+   
+}
+
+
+/* ---------------------------------------------------------------------------
+ duplicate_node_net_copy
+
+ Make a duplicate of a node-network so that it can be inserted in place
+ of a non-terminal reference in another rule.
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::duplicate_node_net_copy( int aNode )
+{
+   int n_new, r_node;
+   
+   // If invalid (NULL) node, then just return
+   if ( aNode == -1 ) return -1;
+   
+   
+   // If node not flagged, duplicate the node
+   if ( node[aNode].flag == 0 )
+   {
+      
+      n_new = create_node(node[aNode].name, -1, -1, 0);
+      node[aNode].flag = n_new;
+      
+   } else
+   {
+      /* Node has been duplicated, stop, avoid duplicate */
+      return( node[aNode].flag );
+   }
+   
+   /* Follow the network, to duplicate breadth first */
+   
+   /* Node pointer may change by adding new nodes in recursive calls, 
+   so must ensure that return location of node index is valid.  This
+   appears important for linux compiler. */
+   // node[n_new].paranext = duplicate_node_net_copy( node[aNode].paranext );
+   r_node = duplicate_node_net_copy( node[aNode].paranext );
+   node[n_new].paranext = r_node;
+   
+   
+   /* The follow the network to duplicate by depth */
+
+   /* Node pointer may change by adding new nodes in recursive calls, 
+   so must ensure that return location of node index is valid. This 
+   appears important for linux compiler. */
+   // node[n_new].next = duplicate_node_net_copy( node[aNode].next );
+   r_node = duplicate_node_net_copy( node[aNode].next );
+   node[n_new].next = r_node;
+   
+   
+   return( n_new );
+}
+
+
+/* ---------------------------------------------------------------------------
+ duplicate a node-network
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::duplicate_node_net(int aNode )
+{
+   /* use flag this time to keep track of the duplicate node of a node */
+   // clear_visit_flag();
+   
+   // Clear only the visit flags for this node network corresponding to
+   // a rule.  Do not clear all visit flags, because they are being used
+   // to determine whether a node has already been tested to see if the
+   // node should undergo rule node network substitution.
+   ClearNodeNetFlags( aNode );
+   
+   return( duplicate_node_net_copy( aNode ) );
+}
+
+
+/* ---------------------------------------------------------------------------
+ create rule
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::create_rule(char *nonterm, int aNode )
+{
+   
+   // Now we are allocating rule array dynamically
+   // demand( rule_idx < MAX_RULE, "Error: Exceed MAX_RULE");
+   
+   // Check if an unused entry is available in the dynamic rule array.
+   if( rule_idx >= m_ruleMax )
+   {
+      // Allocate RULE_ALLOC more entries.  This will throw an exception if array expansion fails.
+      rule = reinterpret_cast<Grule*>
+      ( ExpandArray( reinterpret_cast<void*>(rule), sizeof(Grule), RULE_ALLOC, &m_ruleMax ) );
+   }
+   
+   
+   // Fill the next rule with the non-terminal rule name and starting node of the rule.
+   rule[ rule_idx ].name = nonterm;
+   rule[ rule_idx ].node = aNode;
+   
+   rule_idx++;
+   
+   
+   #ifdef TIESRFLEXDEBUG
+   /* debug: print all possible expansions for diagnostic */
+   /*
+    char buf[ MAX_STR ];
+    printf("RULE( %s ):\n", nonterm);
+   
+    buf[0] = '\0';
+   
+    expand(aNode, buf);
+    */
+   #endif
+   
+   
+   /* return rule pointer */
+   
+   // Now return rule index, not pointer to the rule
+   return( rule_idx - 1 );
+}
+
+
+/* ---------------------------------------------------------------------------
+ replace_old_with_new
+
+ Replace occurrences of an old node index in the dynamic node array
+ next and paranext fields with a new index.  Also replace
+ occurrences of the old node index in all rules with the new node
+ index.
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::replace_old_with_new( int aOldNode, int aNewNode )
+{
+   int   i;
+   
+   for (i = 0; i < node_idx; i++)
+   {
+      if ( node[i].next == aOldNode ) node[i].next = aNewNode;
+      if ( node[i].paranext == aOldNode ) node[i].paranext = aNewNode;
+   }
+   
+   for (i = 0; i < rule_idx; i++)
+   {
+      if ( rule[i].node == aOldNode ) rule[i].node = aNewNode;
+   }
+}
+
+
+/*---------------------------------------------------------------------------
+ referencing
+
+ Determine if the rule given by the input rule index argument is
+ referencing any other rule.  If not, then this rule is made up only of
+ terminals.
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::referencing(int idx)
+{
+   int   i;
+   
+   for ( i = 0; i < depend_idx; i++ )
+   {
+      if ( depend[i].referencing == idx )
+         return 1;
+   }
+   
+   return 0;
+   
+}
+
+
+/* ---------------------------------------------------------------------------
+ referenced_sub
+
+ Determine if a name is referenced in a node network or if the node network
+ has already been checked as indicated by the node flag.
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::referenced_sub(char *name, int aNode )
+{
+   
+   // If the node is invalid (NULL) or the node network has
+   // already been checked, return
+   if ( aNode == -1 || node[aNode].flag )
+      return 0;
+   
+   /* visited, don't expand it again */
+   node[aNode].flag = 1;
+   
+   
+   // If node name matches, the name is referenced and function can return
+   // immediately without any further checking
+   if ( strcmp( node[aNode].name, name ) == 0 )
+      return 1;
+   
+   // Follow all next and paranext nodes down the network
+   else if ( referenced_sub(name, node[aNode].paranext ) ||
+   referenced_sub(name, node[aNode].next) )
+      return 1;
+   
+   // No reference found
+   else return 0;
+   
+}
+
+
+/*----------------------------------------------------------------
+ referenced
+
+ Find if a name is referenced in a node network.
+ ----------------------------------------------------------------*/
+int CTIesrFlex::referenced(char *name, int aNode )
+{
+   clear_visit_flag();
+   
+   return referenced_sub( name, aNode );
+}
+
+
+/* ---------------------------------------------------------------------------
+ substitute non-terminal
+ ---------------------------------------------------------------------- */
+int  CTIesrFlex::substitute_nonterm( int aNode, int aRule )
+{
+   int n_new, paranext, next;
+   
+   if ( aNode == -1 ) return -1;
+   
+   if ( node[aNode].flag ) return aNode;
+   
+   /* breadth first */
+   
+   paranext = substitute_nonterm( node[aNode].paranext, aRule );
+   
+   /* then depth */
+   
+   next = substitute_nonterm( node[aNode].next, aRule );
+   
+   /* test if it is the nonterm in rule */
+   if ( strcmp( node[aNode].name, rule[aRule].name ) == 0 )
+   {
+      /* duplicate network for this context */
+      n_new = duplicate_node_net( rule[aRule].node );
+      
+      /* connect with parent network */
+      attach_at_end( n_new, next );
+      
+      attach_at_para_end( n_new, paranext );
+      
+      /* update all pointers from the old node to the new node */
+      
+      replace_old_with_new( aNode, n_new );
+      
+      node[n_new].flag = 1;
+      
+      return( n_new );
+      
+   }
+   
+   else
+   {
+      
+      node[aNode].next = next;
+      
+      node[aNode].paranext = paranext;
+      
+      node[aNode].flag = 1;
+      
+      return( aNode );
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ add to the sentnode list when not found
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::add_sentnode(int aNode)
+{
+   int   i;
+   
+   /* If node already added, return */
+   for (i = 0; i < sentnode_idx; i++)
+   {
+      if ( aNode == sentnode[ i ].node )
+         return;
+   }
+   
+   /* Add a sentnode corresponding to this node */
+   // demand( sentnode_idx < MAX_SENTNODE, "Error: Exceed MAX_SENTNODE");
+   
+   // Check if all sentnodes in the dynamic array are in use.
+   if( sentnode_idx >= m_sentnodeMax )
+   {
+      // Allocate SENTNODE_ALLOC more sentnodes in the dynamic sentnode array.
+      // This will throw an exception if the expansion fails.
+      sentnode = reinterpret_cast<Sentnode*>
+      ( ExpandArray( reinterpret_cast<void*>(sentnode),
+      sizeof(Sentnode), SENTNODE_ALLOC, &m_sentnodeMax ) );
+   }
+   
+   sentnode[ sentnode_idx ].node = aNode;
+   sentnode[ sentnode_idx ].stop = 0;
+   sentnode[ sentnode_idx ].n_next = 0;
+   sentnode[ sentnode_idx ].nextMax = 0;
+   sentnode[ sentnode_idx ].next = NULL;
+   
+   sentnode_idx ++;
+}
+
+
+/* ---------------------------------------------------------------------------
+ recursively traverse the network and add sentence node
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::traverse_and_add_sentnode(int aNode )
+{
+   if ( aNode == -1 || node[aNode].flag == 1 )
+      return;
+   
+   /* visited, don't expand again */
+   node[aNode].flag = 1;
+   
+   /* add sentnode for sequential */
+   add_sentnode( node[aNode].next );
+   traverse_and_add_sentnode( node[aNode].next );
+   
+   /* no sentnode for parallel,
+    because it is the same start sentnode and just alternative transition */
+   traverse_and_add_sentnode( node[aNode].paranext );
+}
+
+
+/* ---------------------------------------------------------------------------
+ create sentence node list
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::create_sentnode_list(int aNode )
+{
+   /* start node, only one */
+   add_sentnode( aNode );
+   if ( aNode == -1 )
+      /* accommodate NULL grammar */
+      sentnode[ 0 ].stop = 1;
+   else
+      sentnode[ 0 ].stop = 0;
+   
+   /* end node, may have more others */
+   add_sentnode( -1 );
+   sentnode[ 1 ].stop = 1;
+   
+   clear_visit_flag();
+   
+   traverse_and_add_sentnode( aNode );
+}
+
+
+/* ---------------------------------------------------------------------------
+ add to word list when not found
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::add_word(const char *s)
+{
+   int   i;
+   
+   /* If word already added, return */
+   for (i = 0; i < word_idx; i++)
+   {
+      if ( strcmp( word[i], s ) == 0 )
+         return;
+   }
+   
+   
+   // demand( word_idx < MAX_WORD, "Error: Exceed MAX_WORD");
+   
+   // Check if all word elements in dynamic array are used
+   if( word_idx >= m_wordMax )
+   {
+      // Allocate WORD_ALLOC more words in the dynamic word array.
+      // This will throw an exception if the expansion fails.
+      word = reinterpret_cast<Word_t*>
+      ( ExpandArray( reinterpret_cast<void*>(word),
+      sizeof(Word_t), WORD_ALLOC, &m_wordMax ) );
+   }
+   
+   strcpy( word[ word_idx ], s );              /* not found, add */
+   word_idx ++;
+}
+
+
+/* ---------------------------------------------------------------------------
+ recursively create word list
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::create_word_list( int aNode )
+{
+   if ( aNode == -1 || node[aNode].flag == 1 )
+      return;
+   
+   /* visited, don't expand again */
+   node[aNode].flag = 1;
+   
+   if ( node[aNode].name[0] != '\0' )
+      add_word( node[aNode].name );
+   
+   create_word_list( node[aNode].next );
+   create_word_list( node[aNode].paranext );
+}
+
+
+/* ---------------------------------------------------------------------------
+ debug, parallel node can not be a sentence node
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::not_in_sentnode_list( int aNode )
+{
+   int   i;
+   
+   for (i = 0; i < sentnode_idx; i++)
+      if ( aNode == sentnode[ i ].node )
+         demand(0, "Error: parallel node in sentence node list\n");
+}
+
+
+
+/*----------------------------------------------------------------
+ check_parallel_node
+
+ For debugging purposes, confirm that no paranode is a sentnode.
+ ----------------------------------------------------------------*/
+void CTIesrFlex::check_parallel_node( int aNode )
+{
+   if ( aNode == -1 || node[aNode].flag == 1 )
+      return;
+   
+   /* visited, don't expand again */
+   node[aNode].flag = 1;
+   
+   // Check that sentnodes do not reference para nodes
+   if ( node[aNode].paranext != -1 )
+      not_in_sentnode_list( node[aNode].paranext );
+   
+   check_parallel_node( node[aNode].next );
+   check_parallel_node( node[aNode].paranext );
+}
+
+
+/* ---------------------------------------------------------------------------
+ find sentence node index, 1 based
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::find_sentnode_idx( int aNode )
+{
+   int   i;
+   
+   for (i = 0; i < sentnode_idx; i++)
+   {
+      if ( sentnode[i].node == aNode ) return( i + 1 );
+   }
+   
+   demand(0, "Error: sentence node not found\n");
+   
+   return 1;
+}
+
+
+/* ---------------------------------------------------------------------------
+ find word index, 1 based, 1 reserved for empty name
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::find_word_idx(char *s)
+{
+   int   i;
+   
+   if ( *s == '\0' ) return 1;
+   
+   for (i = 0; i < word_idx; i++)
+   {
+      if ( strcmp( word[i], s ) == 0 ) return( i + 2 );
+   }
+   demand(0, "Error: word not found\n");
+   return 1;
+}
+
+
+/* ---------------------------------------------------------------------------
+ create one sentence level transition, word associated with transition
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::create_tran(int src, int dst, int type, int next)
+{
+   
+   
+   // demand( senttran_idx < MAX_SENTTRAN,
+   // "Error: Exceed max sentence transitions");
+   
+   // Check if all senttran structures in dynamic array are used
+   if( senttran_idx >= m_senttranMax )
+   {
+      // Allocate SENTTRAN_ALLOC more structures in the dynamic senttran array.
+      // This will throw an exception if the expansion fails.
+      senttran =  reinterpret_cast<Senttran*>
+      ( ExpandArray( reinterpret_cast<void*>(senttran),
+      sizeof(Senttran), SENTTRAN_ALLOC, &m_senttranMax ) );
+   }
+   
+   senttran[ senttran_idx ].src = src;
+   senttran[ senttran_idx ].dst = dst;
+   senttran[ senttran_idx ].type = type;
+   senttran[ senttran_idx ].next = next;
+   
+   senttran_idx ++;
+}
+
+
+/* ---------------------------------------------------------------------------
+ keep looking until seeing a non-empty node
+ the src stays the same through out the recursion
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::skip_empty_node(int src, int aNode )
+{
+   int   type, dst;
+   
+   /* can be a stop node */
+   if ( aNode == -1 )
+   {
+      sentnode[ src - 1 ].stop = 1;
+      return;
+   }
+   
+   while ( aNode != -1 )
+   {
+      
+      /* Check for empty (option) node */
+      if ( ( type = find_word_idx( node[aNode].name ) ) == 1 )
+      {
+         skip_empty_node( src, node[aNode].next );
+         
+      }
+      
+      /* non-empty node */
+      else
+      {
+         dst = find_sentnode_idx( node[aNode].next );
+         
+         create_tran(src, dst, type, 0);
+      }
+      
+      /* next transition from the same src */
+      
+      aNode = node[aNode].paranext;
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ create all transitions, but next is not set
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::expand_all_trans( int aNode )
+{
+   int   src, dst, type;
+   
+   /* avoid duplicate */
+   if ( aNode == -1 || node[aNode].flag == 1 )
+      return;
+   
+   /* start sentnode */
+   src = find_sentnode_idx( aNode );
+   
+   /* don't do it again */
+   node[aNode].flag = 1;
+   
+   while ( aNode != -1 )
+   {
+      
+      /* Check for empty (option) node */
+      if ( ( type = find_word_idx( node[aNode].name ) ) == 1 )
+      {
+         skip_empty_node( src, node[aNode].next );
+         
+      }
+      
+      /* non-empty node */
+      else
+      {
+         dst = find_sentnode_idx( node[aNode].next );
+         create_tran(src, dst, type, 0);
+      }
+      
+      /* recursive expand */
+      expand_all_trans( node[aNode].next );
+      
+      /* next transition from the same src */
+      aNode = node[aNode].paranext;
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ set next in all trans
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::connect_all_trans()
+{
+   int   i, j, tran;
+   
+   for (i = 0; i < sentnode_idx; i++)
+   {
+      
+      tran = 0;
+      
+      for (j = 0; j < senttran_idx; j++)
+      {
+         
+         /* src of tran is this sentnode */
+         if ( senttran[ j ].src == i + 1 )
+         {
+            senttran[ j ].next = tran;
+            
+            /* link all the trans from this sentnode */
+            tran = j + 1;
+         }
+         
+         sentnode[ i ].tran = tran;   /* assign this list of trans to sentnode */
+      }
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ create all transitions
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::create_all_trans( int aNode )
+{
+   clear_visit_flag();     /* avoid duplicate */
+   
+   expand_all_trans( aNode );  /* create all transitions, but ->next not set yet */
+   
+   connect_all_trans();    /* set senttran[].next */
+   
+}
+
+
+#ifdef TIESRFLEXDEBUG
+
+/* ---------------------------------------------------------------------------
+ expand all paths using original structure,
+ where word is associated with node
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::expand(int aNode, char *buf)
+{
+   char   buf_local[ MAX_STR ];
+   
+   if ( aNode == -1 ) return;
+   
+   strcpy(buf_local, buf);
+   
+   /* breadth first */
+   
+   expand( node[aNode].paranext, buf_local );
+   
+   /* current word */
+   
+   strcat(buf_local, node[aNode].name);
+   if ( node[aNode].name[0] != '\0' ) strcat(buf_local, " ");
+   
+   /* then depth */
+   
+   if ( node[aNode].next == -1 )
+   {
+      
+      printf("%s\n", buf_local);
+      
+   } else
+   {
+      
+      expand( node[aNode].next, buf_local );
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ expand all paths using fsa2 structure,
+ where word is associated with transition
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::expand_fsa2( int aSentNode, char *buf)
+{
+   char   buf_local[ MAX_STR ];
+   int    tran;
+   
+   //if ( n->stop ) printf("%s\n", buf);  /* end of path, print */
+   
+   tran = sentnode[aSentNode].tran;
+   
+   while ( tran )
+   {
+      
+      strcpybuf_local, buf);
+      strcat(buf_local, word[ senttran[ tran - 1 ].type - 2 ]);
+      strcat(buf_local, " ");
+      
+      expand_fsa2( senttran[ tran - 1 ].dst - 1, buf_local );
+      
+      tran = senttran[ tran - 1 ].next;  /* next tran from this src node */
+   }
+}
+
+#endif
+
+
+/* ---------------------------------------------------------------------------
+ create one sym in sym[]
+ ---------------------------------------------------------------------- */
+
+int CTIesrFlex::create_sym(int hmm_code, int word_code, int n_next, int *next)
+{
+   // Check if all symbols in array used
+   if( sym_idx >= m_symMax )
+   {
+      // Allocate SYM_ALLOC more sym entries in the dynamic sym array.
+      // This will throw an exception if the expansion fails.
+      sym = reinterpret_cast<Symnode*>
+      ( ExpandArray( reinterpret_cast<void*>(sym), sizeof(Symnode),
+      SYM_ALLOC, &m_symMax ) );
+   }
+   
+   sym[ sym_idx ].hmm = hmm_code;
+   sym[ sym_idx ].word = word_code;
+   sym[ sym_idx ].next = NULL;
+   sym[ sym_idx ].n_next = 0;
+   sym[ sym_idx ].nextMax = 0;
+   
+   // Add transition indices to symbol next list
+   AddNext( &sym[sym_idx].next, &sym[sym_idx].n_next, &sym[sym_idx].nextMax,
+   n_next, next );
+   /*
+    int   i;
+   
+    sym[ sym_idx ].n_next = n_next;
+    for ( i = 0; i < n_next; i++ )
+    sym[ sym_idx ].next[i] = next[i];
+    */
+   
+   sym_idx ++;
+   return( sym_idx - 1 );
+   
+}
+
+/* ---------------------------------------------------------------------------
+ build sym[]
+
+ from an fsa2, where word are associated with transition;
+ convert it to sym net, where sym is a phone
+
+ each sym is followed by a list of syms (phone associated with sym)
+
+ do phonetic pronunciation lookup
+
+ insert optional silence between all the words (not between syms)
+
+ silence's hmm_idx = 0, but there are more than one silence sym
+ ---------------------------------------------------------------------- */
+
+void CTIesrFlex::create_sym_net( int aSentNode )
+{
+   int    i;
+   int    tran;
+   char*  pron;
+   int    c, l, r;
+   int    hmm_code, word_code;
+   int    dst;
+   int    idx;
+   
+   //Errors error;
+   
+   /* If node already visited, return */
+   if ( sentnode[aSentNode].flag )
+      return;
+   
+   /* set visited */
+   sentnode[aSentNode].flag = 1;
+   
+   /* init, should already be initialized by sentnode creation */
+   /* check to see if this can be removed */
+   sentnode[aSentNode].n_next = 0;
+   sentnode[aSentNode].nextMax = 0;
+   sentnode[aSentNode].next = NULL;
+   
+   /* first transition with aSentNode as the source */
+   tran = sentnode[aSentNode].tran;
+   
+   /* loop thru all transitions */
+   while ( tran )
+   {
+      
+      /* depth first to build next array */
+      
+      /* Access requires conversion from
+       one-based tran and sentnode indices to zero based */
+      dst = senttran[ tran - 1 ].dst - 1;
+      create_sym_net( dst );
+      
+      /* expand this word into sym (phone) */
+      
+      // Old way was to look up pronunciation again, even though already looked up
+      // in create_hmms function call.
+      // error = LookupPronunciation( word[ senttran[ tran - 1 ].type - 2 ], pron );
+      // demand( error == ErrNone, "create_sym_net: lookup pronunciation failed\n" );
+      
+      // New way is to get stored pronunciation created during create_hmms call.
+      // type is one based, and sil is first "word".
+      pron = m_wordProns[ senttran[ tran - 1 ].type - 2 ];
+      
+      for (i = pron[0] - 1; i >= 0; i--)
+      {
+         
+         c = pron[ i + 1 ];
+         
+         // If using monophones, or the word is "_SIL*" as indicated by
+         // c = -1, then set dummy left and right context to -1,
+         // otherwise, set left and right triphone context.
+         if( m_bInputMonophone || c == -1 )
+         {
+            l = -1;
+            r = -1;
+         }
+         else
+         {
+            l = i == 0 ? n_phone : pron[ i ];
+            r = i == (pron[0] - 1) ? n_phone : pron[ i + 2 ];
+         }
+         
+         // Handle _SIL* models code uniquely
+         if( c == -1 )
+            hmm_code = 0;
+         else
+            hmm_code = find_hmm_idx(c, l, r);
+         
+         
+         // If this is the last phone of the word, then determine the
+         // word code to output.  Now the "_SIL*" words will have a word
+         // code so no checking is necessary for it.
+         // if(  i == (pron[0] - 1) && c != -1 )
+         if(  i == (pron[0] - 1) )
+         {
+            word_code = (senttran[ tran - 1 ].type - 2);
+         }
+         else
+         {
+            word_code = MCODE;
+         }
+         
+         /* word end sym */
+         if ( i == (pron[0] - 1) )
+         {
+            
+            create_sym(hmm_code, word_code, sentnode[dst].n_next, sentnode[dst].next);
+            
+            /* stop at this word? */
+            if ( sentnode[dst].stop )
+            {
+               idx = sym_idx - 1;
+               
+               AddNext( &stop_next, &n_stop_next, &m_stopMax, 1, &idx );
+            }
+         }
+         
+         else
+         {
+            /* not word end, followed by one sym */
+            
+            // create_sym(hmm_code, word_code, 0, NULL);
+            // create_sym increments sym_idx at end of the function, so now
+            // sym_idx-1 is the index created by the latest call to create_sym
+            // sym[ sym_idx - 1 ].next[ 0 ] = sym_idx - 2;
+            // sym[ sym_idx - 1 ].n_next = 1;
+            
+            int prior_sym = sym_idx - 1;
+            create_sym( hmm_code, word_code, 1, &prior_sym );
+         }
+         
+         
+         /* next[] array  for the preceding sym in the sym_net */
+         if ( i == 0 )
+         {
+            // Add first sym (hmm) for word to source sentnode list of next syms
+            int begin_sym = sym_idx - 1;
+            AddNext( &sentnode[aSentNode].next, &sentnode[aSentNode].n_next,
+            &sentnode[aSentNode].nextMax, 1, &begin_sym );
+         }
+      }
+      
+      tran = senttran[ tran - 1 ].next;  /* next tran from this src node */
+   }
+   
+   
+   /* optional silence before this group of words */
+   if( m_bAutoSilence )
+   {
+      // Create silence symbol that goes to all other word starting
+      // symbols from this sentnode.  If m_bAutoSilence has been set,
+      // then the "_SIL" word is the first word in the list.
+      // create_sym(0, MCODE, sentnode[aSentNode].n_next, sentnode[aSentNode].next);
+      create_sym(0, 0, sentnode[aSentNode].n_next, sentnode[aSentNode].next);
+      
+      /* Add silence self loop */
+      idx = sym_idx - 1;
+      AddNext(  &sym[ sym_idx - 1 ].next, &sym[sym_idx-1].n_next,
+      &sym[ sym_idx - 1 ].nextMax, 1, &idx );
+      
+      /* Add this silence in parallel with this group of words as another
+       symbol starting from this sentnode. */
+      AddNext( &sentnode[aSentNode].next, &sentnode[aSentNode].n_next,
+      &sentnode[aSentNode].nextMax, 1, &idx );
+      
+      /* If sentnode is a stop node, then the loop silence is a stop symbol */
+      if ( sentnode[aSentNode].stop )
+      {
+         idx = sym_idx - 1;
+         
+         AddNext( &stop_next, &n_stop_next, &m_stopMax, 1, &idx );
+      }
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ is this an end sym
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::is_end_sym(int sym_code)
+{
+   int   i;
+   
+   for ( i = 0; i < n_stop_next; i++ )
+   {
+      if ( stop_next[i] == sym_code ) return 1;
+   }
+   
+   return 0;
+   
+}
+
+#ifdef TIESRFLEXDEBUG
+/* ---------------------------------------------------------------------------
+ construct sym name, only used for debug by expand sym net
+ requires access to phone list of dictionary, not supplied by the
+ dictionary class at this time.
+ ---------------------------------------------------------------------- */
+
+void CTIesrFlex::construct_sym_name(char *buf, int sym_code, int phone_or_word)
+{
+   /*   int   hmm_code;
+   
+    hmm_code = sym[ sym_code ].hmm;
+   
+    if ( hmm_code == 0 ) {
+   
+    strcpy( buf, "sil" );
+   
+    } else {
+   
+    if ( phone_or_word == 1 ) {
+   
+    if ( sym[ sym_code ].word == MCODE ) {
+    buf[0] = '\0';
+    } else {
+    strcpy( buf, word[ sym[ sym_code ].word ] );
+    }
+   
+    } else if ( phone_or_word == 0 ) {
+   
+    strcpy( buf, phone[ hmm[ hmm_code ].c ] );
+   
+    } else {
+   
+    demand(0, "Error: must be 0 (phone) or 1 (word)\n");
+    }
+    }
+    */
+}
+
+
+/* ---------------------------------------------------------------------------
+ debug, expand sym net, not used at present time
+ ---------------------------------------------------------------------- */
+
+void CTIesrFlex::expand_sym_net(int n_next, int *next, char *buf, int phone_or_word)
+{
+   //   int   i;
+   //   char  sym_name[ MAX_STR ];
+   //   char  buf_local[ MAX_STR ];
+   //
+   //   for ( i = 0; i < n_next; i++ ) {         /* loop thru next[] */
+   //
+   //      strcpy( buf_local, buf );           /* reset */
+   //      construct_sym_name( sym_name, next[i], phone_or_word );
+   //      strcat( buf_local, " " );
+   //      strcat( buf_local, sym_name );      /* append this sym str */
+   //
+   //      if ( is_end_sym( next[i] ) )           /* print if sentence end */
+   //         printf("%s\n", buf_local );
+   //
+   //      expand_sym_net( sym[ next[i] ].n_next, /* depth expand */
+   //         sym[ next[i] ].next,
+   //         buf_local,
+   //         phone_or_word );
+   //   }
+}
+
+#endif
+
+/* ---------------------------------------------------------------------------
+ find hmm idx
+ ---------------------------------------------------------------------- */
+int CTIesrFlex::find_hmm_idx(int c, int l, int r)
+{
+   int   i;
+   
+   for ( i = 0; i < hmm_idx; i++ )
+   {
+      if ( hmm[i].c == c && hmm[i].l == l && hmm[i].r == r )
+         return i;
+   }
+   
+   /* should not happen */
+   
+   demand(0, "Error: triphone not in the list\n");
+   return 1;
+   
+}
+
+
+/* ---------------------------------------------------------------------------
+ add to hmm[] if new
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::add_hmm_entry(int c, int l, int r)
+{
+   int   i;
+   
+   /* Check if hmm is already in the hmm table */
+   for ( i = 0; i < hmm_idx; i++ )
+   {
+      if ( hmm[i].c == c && hmm[i].l == l && hmm[i].r == r )
+         return;
+   }
+   
+   /* Add new HMM to HMM table */
+   
+   // Check to see if all hmm entries used
+   if( hmm_idx >= m_hmmMax )
+   {
+      // Allocate HMM_ALLOC more hmm entries in the dynamic hmm array.
+      // This will throw an exception if the expansion fails.
+      hmm = reinterpret_cast<Hmmtbl*>
+      ( ExpandArray( reinterpret_cast<void*>(hmm), sizeof(Hmmtbl),
+      HMM_ALLOC, &m_hmmMax ) );
+   }
+   
+   hmm[ hmm_idx ].c = c;
+   hmm[ hmm_idx ].l = l;
+   hmm[ hmm_idx ].r = r;
+   
+   hmm_idx++;
+}
+
+
+/* ---------------------------------------------------------------------------
+ lookup pronunciation, build hmm[]
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::create_hmm()
+{
+   int   j;
+   int   c, l, r;           /* center, left, right */
+   char  pron[ MAX_PRON ];
+   
+   int baseIndex;
+   // char  pronstr[ MAX_STR ];
+   Errors error;
+   
+   /* hmm[0] is sil */
+   add_hmm_entry( -1, -1, -1 );
+   
+   // Flag indicating multipronunciations exist
+   int doMulti = ( word_idx > m_baseWordIndex );
+   
+   // Word index for starting of multiple words, which come after the base words
+   // in the word table
+   int multiIndex = m_baseWordIndex;
+   
+   
+   // Loop over all base words, getting their pronunciations and triphone hmms
+   int silLen = strlen( SIL );
+   for ( baseIndex = 0; baseIndex < m_baseWordIndex; baseIndex++ )
+   {
+      
+      // Handle "_SIL*" words independently.  It is a synonym for the silence model.
+      if( strncmp( word[baseIndex], SIL, silLen ) == 0 )
+      {
+         // The silence model is already in the hmm list as hmm[0]
+         m_wordProns[baseIndex][0] = 1;
+         m_wordProns[baseIndex][1] = -1;
+         
+         continue;
+      }
+      
+      
+      // Get base pronunciation, which may be the first dictionary pronunciation
+      // or may be the default rule pronunciation
+      //m_dict->GetPron(word[i], pron, pronstr );
+      error = LookupBasePronunciation( word[baseIndex], pron );
+      demand( error == ErrNone, "create_hmm: lookup pronunciation failed\n" );
+      
+      //  For OMAP application, do not allow printing of pronunciations
+      /*  if ( print_pron ) {
+       printf("%s\t", word[i]);
+       for ( j = 0; j < pron[0]; j++ ) {
+       printf("%s ", phone[ pron[ j + 1 ] ]);
+       }
+       printf("\n");
+       }
+       */
+      
+      
+      // Store size of pronunciation of base word indexed by baseIndex
+      m_wordProns[baseIndex][0] = pron[0];
+      
+      /* Add hmms making up the word to the hmm[] list */
+      for ( j = 0; j < pron[0]; j++ )
+      {
+         
+         c = pron[ j + 1 ];
+         
+         // If using monophones, set dummy left and right context to -1,
+         // otherwise, set left and right triphone context.
+         if( m_bInputMonophone )
+         {
+            l = -1;
+            r = -1;
+         }
+         else
+         {
+            l = j == 0 ? n_phone : pron[ j ];
+            r = j == (pron[0] - 1) ? n_phone : pron[ j + 2 ];
+         }
+         
+         add_hmm_entry(c, l, r);
+         
+         // Store pronunciation of base word indexed by baseIndex
+         m_wordProns[baseIndex][j+1] = c;
+      }
+      
+      
+      // If multiple pronunciations exist, and there are still more
+      // to process, get any multipronunciations for the base word
+      // that may have been put in the word table
+      if( doMulti && multiIndex < word_idx )
+      {
+         
+         // Loop over all multipronunciation words that match this word as long as any
+         // multipronunciation words in the word table remain to be processed
+         error = LookupMultiPronunciation( word[baseIndex], word[multiIndex], pron );
+         
+         // Check for failure
+         demand( error != ErrFail, "create_hmm: lookup pronunciation failed\n" );
+         
+         
+         while( multiIndex < word_idx && error != ErrNoMatch  )
+         {
+            // Store size of pronunciation of multi word indexed by multiIndex
+            m_wordProns[multiIndex][0] = pron[0];
+            
+            
+            /* add to the hmm[] list */
+            for ( j = 0; j < pron[0]; j++ )
+            {
+               
+               c = pron[ j + 1 ];
+               
+               
+               // If using monophones, set dummy left and right context to -1,
+               // otherwise, set left and right triphone context.
+               if( m_bInputMonophone )
+               {
+                  l = -1;
+                  r = -1;
+               }
+               else
+               {
+                  l = j == 0 ? n_phone : pron[ j ];
+                  r = j == (pron[0] - 1) ? n_phone : pron[ j + 2 ];
+               }
+               
+               add_hmm_entry(c, l, r);
+               
+               // Store pronunciation of multi word indexed by multiIndex
+               m_wordProns[multiIndex][j+1] = c;
+            }
+            
+            
+            // Get next matching multipronunciation as long as any remain
+            multiIndex++;
+            if( multiIndex < word_idx )
+               error = LookupMultiPronunciation( word[baseIndex], word[multiIndex], pron );
+         }
+      }
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ create dependency list
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::create_dependency_list()
+{
+   int   i, j;
+   
+   depend_idx = 0;
+   
+   for ( j = 0; j < rule_idx; j++)
+   {
+      
+      for ( i = 0; i < rule_idx; i++ )
+      {
+         
+         if ( referenced(rule[i].name, rule[j].node) )
+         {
+            
+            demand( i != j, "Error: self referencing in grammar");
+            
+            
+            // demand( depend_idx < MAX_DEPEND, "Error: Exceed MAX_DEPEND");
+            if( depend_idx >= m_dependMax )
+            {
+               // Allocate DEPEND_ALLOC more structures in the dynamic depend array.
+               // This will throw an exception if the expansion fails.
+               depend =  reinterpret_cast<Depend*>
+               ( ExpandArray( reinterpret_cast<void*>(depend),
+               sizeof(Depend), DEPEND_ALLOC, &m_dependMax ) );
+            }
+            
+            depend[ depend_idx ].referenced = i;
+            depend[ depend_idx ].referencing = j;
+            
+            depend_idx++;
+         }
+      }
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ if there are any rules unreferenced?
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::check_unreferenced()
+{
+   int   i, j, cnt;
+   
+   for ( i = 1; i < rule_idx; i++ )
+   {
+      
+      cnt = 0;
+      for ( j = 0; j < depend_idx; j++ )
+      {
+         if ( i == depend[j].referenced ) cnt++;
+      }
+      
+      // TODO: for OMAP generate some kind of warning
+      //if ( cnt == 0 )
+      /* printf("Error: rule %s not referenced\n", rule[i].name) */;
+   }
+}
+
+
+/* ---------------------------------------------------------------------------
+ cyclic definition in grammar?
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::check_cyclic_grammar()
+{
+   int   i, cnt;
+   int depend_idx_save;
+   Depend *depend_save;
+   
+   
+   // Allocate space to hold a temporary copy of the dependency list.
+   depend_save = (Depend*)malloc( depend_idx * sizeof( Depend ) );
+   if( !depend_save )
+      throw "Memory fail";
+   
+   
+   /* save dependency list */
+   for ( i = 0; i < depend_idx; i++ )
+   {
+      depend_save[i].referenced = depend[i].referenced;
+      depend_save[i].referencing = depend[i].referencing;
+   }
+   depend_idx_save = depend_idx;
+   
+   
+   /* check cyclic definition in the grammar */
+   while ( depend_idx > 0 )
+   {
+      
+      cnt = 0;
+      
+      for ( i = 0; i < depend_idx; i++ )
+      {
+         
+         if ( ! referencing( depend[i].referenced ) )
+         {
+            
+            /* the referenced is not referencing others, substitute and erase */
+            depend[i].referenced = -1;
+            depend[i].referencing = -1;
+            
+            cnt++;
+         }
+      }
+      
+      // If all rules are referencing other rules, then a cycle exists somewhere.
+      // Must deallocate the temporary storage space prior to throwing an
+      // exception.
+      if( !cnt )
+      {
+         free(depend_save);
+      }
+      
+      demand( cnt, "Error: cyclic definition in the grammar");
+      
+      /* compact dependency list */
+      
+      cnt = 0;
+      for ( i = 0; i < depend_idx; i++ )
+      {
+         if ( depend[i].referenced != -1 )
+         {
+            depend[cnt].referenced = depend[i].referenced;
+            depend[cnt].referencing = depend[i].referencing;
+            cnt++;
+         }
+      }
+      
+      depend_idx = cnt;
+   }
+   
+   
+   /* restore dependency list */
+   for ( i = 0; i < depend_idx_save; i++ )
+   {
+      depend[i].referenced = depend_save[i].referenced;
+      depend[i].referencing = depend_save[i].referencing;
+   }
+   depend_idx = depend_idx_save;
+   
+   free( depend_save );
+}
+
+
+/* ---------------------------------------------------------------------------
+ first rule is the only start rule
+ ---------------------------------------------------------------------- */
+
+void CTIesrFlex::check_one_start_rule()
+{
+   int   i;
+   
+   demand( rule[0].name == NULL
+   || strcmp( start_name, rule[0].name ) == 0,
+   "Error: first rule is not the start symbol");
+   
+   for( i = 1; i < rule_idx; i++ )
+      demand( strcmp( start_name, rule[i].name ),
+      "Error: allow only one start rule");
+   
+}
+
+
+/* ---------------------------------------------------------------------------
+ process grammar
+ ---------------------------------------------------------------------- */
+void CTIesrFlex::process_grammar()
+{
+   
+   /* --------------------------------------------------
+    now we have read all the rules,
+    assume the first rule is the grammar,
+    other rules are nonterminal expansion
+    -------------------------------------------------- */
+   
+   check_one_start_rule();
+   
+   /* --------------------------------------------------
+    create dependency list
+    -------------------------------------------------- */
+   
+   create_dependency_list();
+   
+   /* --------------------------------------------------
+    check for unreferenced rule
+    -------------------------------------------------- */
+   
+   check_unreferenced();
+   
+   /* --------------------------------------------------
+    check cyclic definition in the grammar
+    -------------------------------------------------- */
+   
+   check_cyclic_grammar();
+   
+   /* --------------------------------------------------
+    expand all non-terminals in the start rule
+    -------------------------------------------------- */
+   
+   // While dependencies exist, and the start rule is still referencing
+   // some other rule
+   while ( depend_idx && depend[0].referencing == 0 )
+   {
+      
+      /* expand the referenced non-terminal symbol in the start rule */
+      
+      clear_visit_flag();
+      
+      rule[ 0 ].node =
+      substitute_nonterm( rule[ 0 ].node, depend[ 0 ].referenced );
+      
+      /* create dependency list again */
+      
+      create_dependency_list();
+   }
+   
+   /* --------------------------------------------------
+    debug: print all possible expansions for diagnostic
+    Check if the node[] structure is correct
+    -------------------------------------------------- */
+   /*
+    char  buf[ MAX_STR ];
+    buf[0] = '\0';
+   
+    expand( rule[0].node, buf);
+    */
+   
+   /* --------------------------------------------------
+    turn it into fsa2, where words are associated with transition
+    -------------------------------------------------- */
+   
+   create_sentnode_list( rule[0].node );
+   
+   /* printf("Sentence node count: %d\n", sentnode_idx); */
+   
+   clear_visit_flag();
+   check_parallel_node( rule[0].node );   /* debug */
+   
+   clear_visit_flag();
+   
+   // If silence will automatically be added between words, then
+   // add the SIL word to the word list, as the first word in the list.
+   if( m_bAutoSilence)
+   {
+      add_word( SIL );
+   }
+   
+   create_word_list( rule[0].node );
+   
+   /* printf("Word count: %d\n", word_idx); */
+   
+   create_all_trans( rule[0].node );
+   
+   /* printf("Sent Tran count: %d\n", senttran_idx); */
+   
+   /* --------------------------------------------------
+    debug: print all possible expansions for diagnostic
+    Check if the fsa2 (sentnode[], senttran[]) is correct?
+    -------------------------------------------------- */
+   /*
+    buf[0] = '\0';
+   
+    expand_fsa2( &sentnode[ 0 ], buf );
+    */
+   
+}
+
+
+//----------------------------------------------
+// Placeholder function for now - not operational
+int CTIesrFlex::download_net()
+{
+   /* --------------------------------------------------
+    TODO: output wordlist
+    -------------------------------------------------- */
+   
+   // TODO: tell DSP word info is complete
+   
+   /* --------------------------------------------------
+    TODO: output net
+    -------------------------------------------------- */
+   
+   //TODO: Tell DSP .net info is complete
+   
+   return OK;
+}
+
+//------------------------------------
+// Placeholder function for now - not operational
+int CTIesrFlex::download_hmm2phone()
+{
+   
+   // TODO: download hmm to monophone index mapping
+   // TODO: Tell DSP hmm to monphone index info is complete
+   
+   return OK;
+   
+}
+
+
+//---------------------------------------------
+// Placeholder function for now - not operational
+int CTIesrFlex::download_gtm()
+{
+   // TODO: download gtm structures to memory
+   // TODO: Tell DSP gtm location is loaded
+   
+   return OK;
+   
+}
+
+
+//-----------------------------------------
+int CTIesrFlex::output_int16(FILE *fp, int i32)
+{
+   // output a 16-bit, big endian or little endian to a file,
+   // checking for overflow
+   
+   short i16;
+   int failed;
+   
+   failed = 0;
+   
+   if ( ( i32 != MCODE ) &&                 /* only exception */
+   ( i32 < -32768 || i32 > 65535 ) )
+   {
+      return -1;
+   }
+   
+   i16 = i32;
+   
+   if ( little_endian )
+   {
+      failed |= ( fputc( 0xff & i16, fp) == EOF );
+      i16 = i16 >> 8;
+      failed |= ( fputc( 0xff & i16, fp) == EOF );
+   }
+   else
+   {
+      failed |= ( fputc( ( i16 >> 8 ) & 0xff, fp ) == EOF );
+      failed |= ( fputc( i16 & 0xff, fp ) == EOF );
+   }
+   
+   return failed;
+}
+
+
+//------------------------------------------------
+int CTIesrFlex::output_sym( FILE *fp, int hmm_code, int word_code, int n_next, int *next)
+{
+   // output one symbol
+   int   i;
+   
+   // track if output_sym fails
+   int failed = false;
+   
+   failed |= output_int16( fp, hmm_code );
+   
+   i = word_code == MCODE ? n_next : n_next | 0x8000;
+   failed |= output_int16( fp, i );
+   
+   for (i = 0 ; i < n_next; i++)
+   {
+      failed |= output_int16( fp, next[i] );
+   }
+   
+   if ( word_code != MCODE )
+   {
+      failed |= output_int16( fp, word_code );
+   }
+   
+   return failed;
+}
+
+
+//-------------------------------------
+int CTIesrFlex::output_net(char *dirname, char *filename)
+{
+   // This function outputs the wordlist and the grammar network
+   
+   int   i;
+   short cnt = 0;
+   FILE  *fp;
+   char fname[FILENAME_MAX];
+   
+   // track any failure to write correctly
+   int failed =  false;
+   
+   
+   //output wordlist
+   strcpy( fname, dirname );
+   strcat( fname, "/word.lis" );
+   
+   fp = fopen( fname, "w");
+   if ( fp == NULL )
+      return -1;
+   
+   for ( i = 0; i < word_idx; i++ )
+   {
+      /* loop thru all words */
+      failed |= ( fprintf( fp, "%s\n", word[i] ) < 0 );
+   }
+   
+   fclose( fp );
+   
+   if( failed )
+      return failed;
+   
+   
+   // output net
+   strcpy( fname, dirname );
+   //   strcat( fname, "/net.bin" );
+   strcat( fname, filename);
+   
+   fp = fopen( fname, "wb" );
+   if ( fp == NULL )
+      return -1;
+   
+   
+   failed |= output_int16( fp, cnt );       // # of short, dummy, fill at end
+   failed |= output_int16(fp, hmm_idx * m_inputSets); // n_hmm for all genders
+   failed |= output_int16(fp, sym_idx);     // n_sym
+   failed |= output_int16(fp, word_idx);    // n_word
+   failed |= output_int16(fp, m_inputSets);  // n_set
+   failed |= output_int16(fp, hmm_idx);     // n_hmm_set
+   
+   cnt = 5 +                             /* 5 n_* */
+   2 +                                 /* offset pointer to start and stop */
+   sym_idx;                            /* offset pointer to all sym */
+   
+   failed |= output_int16( fp, cnt );     /* start offset */
+   
+   cnt += 2 + sentnode[ 0 ].n_next;
+   
+   failed |= output_int16( fp, cnt );     // stop offset
+   
+   cnt += 2 + n_stop_next;
+   
+   for (i = 0; i < sym_idx; i++)
+   {
+      
+      failed |= output_int16( fp, cnt );            /* n_sym offset */
+      
+      cnt += sym[i].word == MCODE ? 2 + sym[i].n_next : 3 + sym[i].n_next;
+   }
+   
+   failed |= output_sym( fp, 0, MCODE,
+   sentnode[ 0 ].n_next, sentnode[ 0 ].next ); /* start */
+   
+   failed |= output_sym( fp, 0, MCODE,
+   n_stop_next, stop_next );                   /* stop */
+   
+   for (i = 0; i < sym_idx; i++)
+   {                         /* all */
+      failed |= output_sym( fp, sym[i].hmm, sym[i].word, sym[i].n_next, sym[i].next );
+   }
+   
+   rewind( fp );
+   failed |= output_int16( fp, cnt );              /* # of short */
+   
+   //net_size = cnt;
+   
+   fclose( fp );
+   
+   return failed;
+   
+}
+
+
+//---------------------------------------------
+int CTIesrFlex::output_hmm2phone(char *dirname )
+{
+   // output HMM to phone map
+   
+   FILE  *fp;
+   int   i;
+   char fname[FILENAME_MAX];
+   
+   // track any failure to write correctly
+   int failed = false;
+   
+   strcpy( fname, dirname );
+   strcat( fname, "/hmm2phone.bin" );
+   
+   fp = fopen( fname, "wb");
+   if ( fp == NULL )
+      return -1;
+   
+   for ( i = 0; i < hmm_idx; i++)
+      failed |= output_int16( fp, hmm[ i ].c );
+   
+   fclose( fp );
+   
+   return failed;
+}
+
+
+/*----------------------------------------------------------------
+ output_gtm
+
+ This function outputs all files needed by the TIesrSI Engine in order
+ to recognize a grammar.  Files are output to the directory specified as
+ the input argument.
+
+ This code has been updated to handle an arbitrary number of HMM
+ sets, usually used to separate between male and female HMM
+ sets. Note that all HMM sets will be identical in number
+ and triphone definition since the grammar network is always
+ set-independent.  The code has also been updated to include the
+ possibility of either set-independent or set-dependent transition
+ matrices.
+
+ ----------------------------------------------------------------*/
+int CTIesrFlex:: output_gtm( char *dirname )
+{
+   // Output all of the generalized tied HMM model information for this grammar
+   
+   int   i, j, offset, n_state;
+   short *pshort;
+   char  buf[ FILENAME_MAX ];
+   int tempidx;
+   
+   short *cluster = NULL;
+   int* hmm_offset = NULL;
+   
+   // zero-based count of output HMMs
+   int ihmm;
+   
+   // Index to track hmm sets
+   int hmmSet;
+   
+   // Transition set offset
+   int tranSetOffset;
+   
+   FILE* fp_scale;
+   int scaleIndex;
+   
+   // track failure to write gtm files
+   int failed = false;
+   
+   
+   // Initialize output array data indices
+   mean_idx_cnt = 0;
+   
+   var_idx_cnt = 0;
+   
+   cluster_idx_cnt = 0;
+   cluster_offset[0] = 0;
+   
+   tran_idx_cnt = 0;
+   tran_offset[0] = 0;
+   
+   
+   // Initialize index usage cross-reference arrays.  This eliminates the need to do a
+   // linear search to determine if a codebook element has already been output to the
+   // model binary files.
+   for (int i=0; i< m_numMeans; i++)
+   {
+      mean_idx_aug[i]=-1;
+   }
+   
+   for (int i=0; i< m_numClusters; i++)
+   {
+      cluster_idx_aug[i]=-1;
+   }
+   
+   for (int i=0; i< m_numTrans; i++)
+   {
+      tran_idx_aug[i]=-1;
+   }
+   
+   for (int i=0; i< m_numVars; i++)
+   {
+      var_idx_aug[i]=-1;
+   }
+   
+   // Dynamic allocation of hmm_offset array.  This data is local
+   // to this function, so does not need to be a class variable
+   // There will be one more offset than number of models output.  The last
+   // offset contains the total size of output data in int.
+   hmm_offset = (int*)malloc( (hmm_idx * m_inputSets + 1) * sizeof(int) );
+   if( !hmm_offset )
+   {
+      failed = 1;
+      goto failure;
+   }
+   
+   // First hmm offset is after pointers to hmm data offsets
+   hmm_offset[0] = hmm_idx * m_inputSets;
+   
+   // Dynamic allocation of cluster array
+   cluster = (short*)malloc( m_maxStates * sizeof(short) );
+   if( !cluster )
+   {
+      failed = 1;
+      goto failure;
+   }
+   
+   
+   /* --------------------------------------------------
+    open GTM files
+    -------------------------------------------------- */
+   
+   strcpy( buf, dirname);
+   strcat( buf, "/hmm.bin" );
+   fp_hmm = fopen( buf, "wb" );
+   failed = ( fp_hmm == NULL );
+   failed |= output_int16( fp_hmm, 0 );        /* # of short, dummy */
+   
+   
+   /* Was for male & female.  Now for each HMM set. */
+   for (i = 0; i < hmm_idx * m_inputSets; i++)
+   {
+      // Will eventually be offset in hmm.bin to each hmm's info
+      failed |= output_int16( fp_hmm, 0 );     /* offset, dummy */
+   }
+   if( failed ) goto failure;
+   
+   
+   strcpy( buf, dirname );
+   strcat( buf, "/mu.bin" );
+   fp_mean = fopen( buf, "wb" );
+   failed |= ( fp_mean == NULL );
+   failed |= output_int16( fp_mean, mean_idx_cnt );      /* dummy */
+   if( failed ) goto failure;
+   
+   
+   strcpy( buf, dirname );
+   strcat( buf, "/var.bin" );
+   fp_var = fopen( buf, "wb" );
+   failed |= ( fp_var == NULL );
+   failed |= output_int16( fp_var, var_idx_cnt );        /* dummy */
+   if( failed ) goto failure;
+   
+   
+   strcpy( buf, dirname );
+   strcat( buf, "/tran.bin" );
+   fp_tran = fopen( buf, "wb" );
+   failed |= ( fp_tran == NULL );
+   failed |= output_int16( fp_tran, 0 );                 /* dummy */
+   if( failed ) goto failure;
+   
+   strcpy( buf, dirname );
+   strcat( buf, "/pdf.bin" );
+   fp_pdf = fopen( buf, "wb" );
+   failed |= ( fp_pdf == NULL );
+   if( failed ) goto failure;
+   
+   strcpy( buf, dirname );
+   strcat( buf, "/mixture.bin" );
+   fp_mixture = fopen( buf, "wb" );
+   failed |= ( fp_mixture == NULL );
+   failed |= output_int16( fp_mixture, 0 );              /* dummy */
+   if( failed ) goto failure;
+   
+   strcpy( buf, dirname );
+   strcat( buf, "/gconst.bin" );
+   fp_gconst = fopen( buf, "wb" );
+   failed |= ( fp_gconst == NULL );
+   failed |= output_int16( fp_gconst, var_idx_cnt );     /* dummy */
+   if( failed ) goto failure;
+   
+   
+   // If input HMM mean or variance in byte, then output scale.bin
+   // file immediately.  Output scales for mean and variance for
+   // all dimensions.  If mean or variance is in short, the user
+   // may still be requesting output in byte, in which case the
+   // scale file will be output again after the conversion.
+   if( m_bInputByteMeans || m_bInputByteVars )
+   {
+      strcpy( buf, dirname );
+      strcat( buf, "/scale.bin" );
+      fp_scale = fopen( buf, "wb" );
+      failed |= ( fp_scale == NULL );
+      if( failed ) goto failure;
+      
+      
+      for( scaleIndex=0; scaleIndex < 2*m_inputFeatDim; scaleIndex++ )
+      {
+         failed |= output_int16( fp_scale, scale_base[scaleIndex] );
+      }
+      fclose( fp_scale );
+      if( failed ) goto failure;
+   }
+   
+   
+   /* zero-based count of output hmms */
+   ihmm = 0;
+   
+   /* Loop over all hmm sets, usually male and female */
+   for( hmmSet = 0; hmmSet < m_inputSets; hmmSet++ )
+   {
+      /*  first hmm of each set is silence */
+      failed |= process_one_hmm( (int) sil_n_state,
+      (int) sil_hmm[ sil_n_state - 1 ],
+      sil_hmm );
+      if( failed ) goto failure;
+      
+      hmm_offset[ihmm+1] = hmm_offset[ihmm] + sil_n_state;
+      ihmm++;
+      
+      /* Remaining hmms of set, hmm[ 1 .. hmm_idx - 1 ] */
+      for ( i = 1; i < hmm_idx; i++ )
+      {
+         
+         tranSetOffset =  m_bInputGDTrans ?  hmm[i].c*m_inputSets + hmmSet : hmm[i].c;
+         offset = tranoffset_base[ tranSetOffset ];
+         
+         pshort = &tran_base[ offset ];
+         n_state = (int) *pshort;
+         
+         // Now cluster[] array dynamically allocated to max states in hmm
+         //demand( n_state < MAX_STATE, "Error; exceed MAX_STATE\n");
+         //failed |= !(n_state < MAX_STATE );
+         //if( failed ) goto failure;
+         
+         // Determine the pdf cluster for each state of the hmm[i]
+         for ( j = 0; j < n_state - 1; j++ )
+         {
+            
+            /* decision tree classification */
+            
+            failed |= get_cluster_idx( hmm[i].c, hmm[i].l, hmm[i].r, j,
+            hmmSet, &tempidx );
+            if( failed ) goto failure;
+            cluster[j] = (short) tempidx;
+         }
+         
+         failed |= process_one_hmm( n_state, tranSetOffset, cluster );
+         if( failed ) goto failure;
+         
+         hmm_offset[ihmm + 1] = hmm_offset[ihmm] + n_state;
+         ihmm++;
+      }
+   }
+   
+   /* --------------------------------------------------
+    output pdf (mixture, cluster) offset
+    -------------------------------------------------- */
+   
+   failed |= output_int16( fp_pdf, cluster_idx_cnt );
+   for ( i = 0; i < cluster_idx_cnt; i++ )
+      failed |= output_int16( fp_pdf, cluster_offset[ i ] );
+   
+   if( failed ) goto failure;
+   
+   /* --------------------------------------------------
+    output size
+    -------------------------------------------------- */
+   
+   // Size in number of mean vectors
+   rewind( fp_mean );
+   failed |= output_int16( fp_mean, mean_idx_cnt );
+   
+   // Size in number of variance vectors
+   rewind( fp_var );
+   failed |= output_int16( fp_var, var_idx_cnt );
+   
+   // Size in number of gconst values (same as number of variance vectors)
+   rewind( fp_gconst );
+   failed |= output_int16( fp_gconst, var_idx_cnt );
+   
+   // Size of data in int
+   rewind( fp_mixture );
+   failed |= output_int16( fp_mixture, cluster_offset[ cluster_idx_cnt ] );
+   
+   // Size of data in int
+   rewind( fp_tran );
+   failed |= output_int16( fp_tran, tran_offset[ tran_idx_cnt ] );
+   
+   // Size of data in int
+   rewind( fp_hmm );
+   failed |= output_int16( fp_hmm, hmm_offset[ hmm_idx * m_inputSets ] );
+   
+   // Output offsets to each hmm in the output hmm binary file
+   for (i = 0; i < hmm_idx * m_inputSets; i++)
+   {
+      failed |= output_int16( fp_hmm, hmm_offset[i] );
+   }
+   
+   
+   // dim.bin holds the
+   // number of static mfcc elements in the feature vector.
+   FILE *fp;
+   strcpy( buf, dirname);
+   strcat( buf, "/dim.bin" );
+   fp = fopen( buf, "wb" );
+   failed |= ( fp == NULL );
+   failed |= output_int16( fp, m_inputStaticDim );
+   fclose( fp );
+   
+   #ifdef OFFLINE_CLS
+   /* save RAM mean to ROM mean index mapping */
+   strcpy( buf, dirname);
+   strcat( buf, "/o2amidx.bin" );
+   fp = fopen( buf, "wb" );
+   failed |= ( fp == NULL );
+   failed |= output_int16( fp, mean_idx_cnt - 1);
+   for (i=0;i<mean_idx_cnt;i++)
+      failed |= output_int16( fp, mean_idx[i]);
+   fclose( fp );
+   #endif
+   
+   
+   failure:
+      
+      /* --------------------------------------------------
+       close files
+       -------------------------------------------------- */
+      
+      fclose( fp_hmm );
+      fclose( fp_mean );
+      fclose( fp_var );
+      fclose( fp_tran );
+      fclose( fp_pdf );
+      fclose( fp_mixture );
+      fclose( fp_gconst );
+      
+      // Free the hmm_offset data
+      if( hmm_offset )
+         free( hmm_offset );
+      
+      // Free cluster array
+      if( cluster )
+         free( cluster );
+      
+      /*
+       printf("dim = %d, n_tran = %d, n_mean = %d, n_variance = %d, "
+       "n_cluster = %d\n",
+       DIM, tran_idx_cnt, mean_idx_cnt, var_idx_cnt, cluster_idx_cnt);
+      
+       i = net_size +
+       hmm_offset[ hmm_idx * 2 ] +
+       mean_idx_cnt * DIM +
+       var_idx_cnt * DIM +
+       tran_offset[ tran_idx_cnt ] +
+       cluster_idx_cnt +
+       var_idx_cnt +
+       cluster_offset[ cluster_idx_cnt ];
+      
+       printf("Vocabulary = %d, Total model size = %d words\n", word_idx, i);
+       */
+      
+      return failed;
+}
+
+
+//-------------------------------
+int CTIesrFlex::process_one_hmm(int n_state, int idx, short *cluster)
+{
+   
+   int   i, offset, size;
+   int   old_cnt;                        /* if add to idx list, update offset */
+   int   new_idx;
+   short *pshort;
+   
+   // track any failure
+   int failed = false;
+   
+   /* --------------------------------------------------
+    transition
+    -------------------------------------------------- */
+   
+   offset = tranoffset_base[ idx ];
+   pshort = &tran_base[ offset ];
+   
+   //demand( n_state == *pshort, "Error: tran dim mismatch\n");
+   failed |=  !(n_state == *pshort);
+   if( failed ) return failed;
+   
+   old_cnt = tran_idx_cnt;
+   
+   if ( tran_idx_aug[ idx ] == -1 )
+   {
+      new_idx = tran_idx_cnt;
+      tran_idx_cnt++;
+      tran_idx_aug[ idx ] = new_idx;
+   }
+   else
+      new_idx=tran_idx_aug[ idx ];
+   
+   
+   if ( tran_idx_cnt > old_cnt )
+   {       /* add, update offset */
+      
+      size = n_state * n_state;           /* transition matrix size */
+      
+      /* output */
+      
+      failed |= output_int16( fp_tran, n_state );
+      for (i = 1; i < size; i++)
+         failed |= output_int16( fp_tran, (int) tran_base[ offset + i ] );
+      
+      
+      /* update offset for next tran entry.  The last entry in the tran_offset
+       array points to just past the location of the transitions. */
+      tran_offset[ tran_idx_cnt ] = tran_offset[ old_cnt ] + size;
+   }
+   
+   /* --------------------------------------------------
+    hmm
+    -------------------------------------------------- */
+   
+   failed |= output_int16( fp_hmm, (int) tran_offset[ new_idx ] );   /* tran offset */
+   
+   for ( i = 0; i < n_state - 1; i++ )
+   {
+      
+      old_cnt = cluster_idx_cnt;
+      
+      if ( cluster_idx_aug[ (int) cluster[i] ] == -1 )
+      {
+         
+         new_idx=cluster_idx_cnt;
+         cluster_idx_cnt++;
+         
+         cluster_idx_aug[ (int) cluster[i] ]= new_idx;
+      }
+      else
+         new_idx=cluster_idx_aug[ (int) cluster[i] ];
+      
+      if ( cluster_idx_cnt > old_cnt )
+      {
+         
+         offset =  clusteroffset_base[ cluster[i] ];
+         
+         if(m_bPackWtNmix == 1)
+         {
+            size = (int) (0xff & cluster_base[ offset ]);                /* n_mix */
+         }
+         
+         else
+         {
+            size = cluster_base[ offset ];
+            
+         }
+         
+         size = size * 3 + 1;
+         
+         /* output */
+         
+         failed |= process_one_cluster( (int) cluster[i] );
+         if( failed ) return failed;
+         
+         /* update offset for next cluster entry (i.e. mixture, pdf) */
+         
+         cluster_offset[ cluster_idx_cnt ] = cluster_offset[ old_cnt ] + size;
+      }
+      
+      failed |= output_int16( fp_hmm, new_idx );                      /* pdf_idx */
+   }
+   
+   return failed;
+}
+
+
+//-----------------------------
+int CTIesrFlex::find_idx_idx(int *list, int *n_list, int max, int idx, int *new_idx)
+{
+   /*---------------------------------------------------------------------------
+    find the new index (codebook used in small vocabulary) of an
+    index (complete codebook)
+    if not found, add it to the index list
+    ---------------------------------------------------------------------- */
+   
+   int   i;
+   int failed = false;
+   
+   for ( i = 0; i < *n_list; i++ )
+   {
+      if ( list[ i ] == idx )
+      {
+         *new_idx = i;    /* found */
+         return failed;
+      }
+   }
+   
+   //demand( *n_list < max, "Error: exceed max index list\n");
+   failed |= !( *n_list < max );
+   if( failed ) return failed;
+   
+   list[ *n_list ] = idx;                 /* not found, add to the idx list */
+   *n_list += 1;
+   
+   *new_idx = ( *n_list - 1 );
+   return failed;
+}
+
+
+
+/*----------------------------------------------------------------
+ process one cluster
+
+ output to various GTM files
+ ----------------------------------------------------------------*/
+int CTIesrFlex::process_one_cluster(int idx)
+{
+   int   i, offset, n_mix;
+   int   new_idx, old_cnt, wt_idx, wt_idx_temp;  //wt_idx temp is used when the data is packed
+   short * pshort;
+   int failed = false;
+   int offset_inc = 3; // for wt, mean idx, var idx
+   
+   offset = clusteroffset_base[idx];
+   if(m_bPackWtNmix != 1) //if weight index and nummix are not packed together
+   {
+      n_mix = (int) cluster_base[ offset ];
+   }
+   else //read the last 8 bits as nummix and the first  8 as wt_index
+   {
+      n_mix = (int)(0xff & cluster_base[offset]);
+      wt_idx_temp = (int)( (0xff00 & cluster_base[offset]) >> 8 ) ;
+   }
+   
+   failed |= output_int16( fp_mixture, n_mix );
+   if( failed ) return failed;
+   
+   offset++;
+   
+   
+   
+   //code to read the weights file and add it on to the current exisiting structure
+   //when weights are not explicitly specified weights are VQ'ed
+   if(m_bInputWeightConfig != 0) 
+   {
+      if(m_bPackWtNmix == 1)
+      {
+         wt_idx = wt_idx_temp * m_lengthWtVec;
+         offset_inc = 2;
+         offset--;
+      }
+      else if(m_bInputWeightConfig == 2)
+      {
+         wt_idx = (n_mix-1) * m_lengthWtVec ;
+         offset--;
+         offset_inc = 2;
+      }
+      else
+      {
+         wt_idx = cluster_base[offset] * m_lengthWtVec; //read the weight index
+         offset_inc = 2;
+      }
+      
+   }
+   
+   /* loop thru all Gaussian components */
+   
+   for ( i = 0; i < n_mix; i++, offset += offset_inc )
+   {
+      
+      /* --------------------------------------------------
+       wgt
+       -------------------------------------------------- */
+      if(m_bInputWeightConfig == 0) //if weights explicitly specified
+      {
+         
+         pshort = &cluster_base[ offset ];
+         failed |= output_int16( fp_mixture, (int)* pshort );
+         if( failed ) return failed;
+      }
+      else   // if weights are codebook entries
+      {
+         pshort = & weight_base[wt_idx+i] ;
+         failed |= output_int16( fp_mixture, (int)* pshort );
+         if( failed ) return failed;
+      }
+      
+      /* --------------------------------------------------
+       mean
+       -------------------------------------------------- */
+      
+      old_cnt = mean_idx_cnt;
+      
+      
+      if ( mean_idx_aug[cluster_base[ offset + 1 ] ] == -1 )
+      {
+         new_idx= mean_idx_cnt;
+         
+         // mean_idx is used by VQHMM
+         mean_idx[mean_idx_cnt] = cluster_base[offset+1];
+         
+         mean_idx_cnt++;
+         mean_idx_aug[cluster_base[ offset + 1 ] ]= new_idx;
+      }
+      else
+         new_idx=mean_idx_aug[cluster_base[ offset + 1 ] ];
+      
+      
+      
+      /* If mean vector of this index has not been output, then
+       output it, adding bias if necessary */
+      if ( mean_idx_cnt > old_cnt )
+      {
+         unsigned int meanIndex = cluster_base[ offset + 1 ];
+         
+         /* If mean vector is in short and is CMN, then add bias */
+         if( !m_bInputByteMeans && m_bInputCMN )
+         {
+            short* fvector = (short*)mean_base + meanIndex*m_inputFeatDim;
+            add_mean( fvector, m_inputStaticDim, 1);
+         }
+         
+         failed |= output_feature_vector( fp_mean, mean_base, meanIndex, m_bInputByteMeans );
+         
+      }
+      
+      failed |= output_int16( fp_mixture, new_idx );
+      if( failed ) return failed;
+      
+      /* --------------------------------------------------
+       var
+       -------------------------------------------------- */
+      
+      old_cnt = var_idx_cnt;
+      
+      if ( var_idx_aug[ cluster_base[ offset + 2 ] ] == -1 )
+      {
+         new_idx=var_idx_cnt;
+         var_idx_cnt++;
+         var_idx_aug[ cluster_base[ offset + 2 ] ]= new_idx;
+      }
+      else
+         new_idx=var_idx_aug[ cluster_base[ offset + 2 ] ];
+      
+      
+      if ( var_idx_cnt > old_cnt )
+      {
+         unsigned int varIndex = cluster_base[offset + 2];
+         
+         failed |= output_feature_vector( fp_var, var_base, varIndex, m_bInputByteVars );
+         
+         failed |= output_int16(fp_gconst, (int) gconst_base[varIndex] );
+         
+         if( failed ) return failed;
+      }
+      
+      failed |= output_int16( fp_mixture, new_idx );
+   }
+   
+   return failed;
+}
+
+
+/*----------------------------------------------------------------
+ get_cluster_idx
+
+ Given the center, left, and right context of a triphone, and the
+ state of the triphone, and the gender, determine the pdf cluster
+ index corresponding to the hmm from the acoustic decision trees and
+ questions.
+ ----------------------------------------------------------------*/
+int CTIesrFlex::get_cluster_idx(int c, int l, int r, int s, int gender, int *index)
+{
+   int    n_state, idx;
+   int    base_offset;
+   Modelnode model;
+   // Treenode  *ptmptnode;
+   int    failed = false;
+   int clusterOffset;
+   int tranSetOffset;
+   int phnIndex;
+   int hmmSet;
+   int emitStates;
+   short *tree_ptr;
+   
+   // If input is monophones, cluster index must be obtained
+   // directly from data since no decision tree information exists.
+   // This assumes monophone cluster data is in a specific order.  Cluster data
+   // is in the order of monophones according to the monophone list,
+   // and all clusters (states) for one set (gender) are together sequentially
+   // in the fxclust.cb file, and the gender-independent sil clusters are at
+   // the end of fxclust.cb.
+   if( m_bInputMonophone )
+   {
+      clusterOffset = 0;
+      for( phnIndex = 0; phnIndex < c; phnIndex++ )
+      {
+         for( hmmSet = 0; hmmSet < m_inputSets; hmmSet++ )
+         {
+            // Find number of emitting states for preceding monophones and sets
+            tranSetOffset =  m_bInputGDTrans ?  m_inputSets*phnIndex + hmmSet  :  phnIndex;
+            emitStates = tran_base[ tranoffset_base[ tranSetOffset ] ] - 1;
+            
+            clusterOffset += emitStates;
+         }
+      }
+      
+      for( hmmSet = 0; hmmSet < gender; hmmSet++ )
+      {
+         // Find number of emitting states for desired phone but prior sets
+         tranSetOffset =  m_bInputGDTrans ?  m_inputSets*c + hmmSet  :  c;
+         emitStates = tran_base[ tranoffset_base[ tranSetOffset ] ] - 1;
+         
+         clusterOffset += emitStates;
+      }
+      
+      *index = clusterOffset + s;
+      
+      return false;
+   }
+   
+   
+   /* triphone state info */
+   
+   model.c = c;     /* center phone idx */
+   model.l = l;     /* left phone */
+   model.r = r;     /* right phone */
+   model.s = s;     /* state idx, 0 based */
+   
+   /* read tree and map */
+   
+   // i_ptr = (int *) treetbl_base[ model.c * m_inputSets + gender ];
+   base_offset = treetbl_base[model.c * m_inputSets + gender];
+   
+   // n_state = *i_ptr;
+   n_state = treetbl_base[ base_offset++ ];
+
+   // demand( s < n_state, "Error: state idx too large\n");
+   failed |= !( s < n_state );
+   if( failed ) return failed;
+   
+   tree_ptr = (short *) ( tree_base + treetbl_base[ base_offset + s ] );
+   
+   // cur_node = 0;
+   
+   failed |= ParseTree( &model, tree_ptr, &idx );
+   
+   *index = idx;
+   
+   return failed;
+   
+   /*
+    Now replaced by direct processing of acoustic decision tree
+    without building the tree structure.
+   
+    failed |= build_tree( &ptmptnode);
+    if( failed ) return failed;
+   
+    failed |= classify(tree, &model, &idx);
+    if( failed ) return failed;
+   
+    *index = idx;
+   
+    return failed;
+    */
+}
+
+/*----------------------------------------------------------------
+ ParseTree
+
+ Given a model set, and a pointer to the acoustic decision tree,
+ determine the cluster index of the cluster corresponding to the
+ present context-dependent triphone state by in-place processing of
+ the acoustic decision tree.
+
+ ----------------------------------------------------------------*/
+int CTIesrFlex::ParseTree( Modelnode const* apModel,  short const* aTopTreeNode,
+int* aClusterIndex )
+{
+   int failed = false;
+   int intree = true;
+   int yesAnswer;
+   short const* tree = aTopTreeNode;
+   
+   // This loop should continue until a cluster is found.  The only
+   // reason not to find a cluster is an invalid tree.
+   while( intree )
+   {
+      // Test if this tree node is terminal.  If so, then the cluster
+      // index has been found.
+      if( *tree & 0x8000 )
+      {
+         *aClusterIndex = *tree & 0x7FFF;
+         return failed;
+      }
+      
+      
+      // Tree node is a question node, so ask the question
+      yesAnswer = yes_to_question( apModel, *tree);
+      
+      // Advance in the tree node list to the "yes" node of the present
+      // question, which immediately follows in the tree node list.
+      tree++;
+      
+      // If the answer to the context question was no, advance in the
+      // tree node list to the tree node corresponding to a no answer.
+      // Note that tree starts at a node which is the "yes" node, and
+      // ends up at the no node.
+      if( !yesAnswer )
+      {
+         tree = SkipToNoNode( tree );
+      }
+   }
+   
+   // If the tree is valid, should never get here
+   failed = true;
+   return failed;
+}
+
+
+/*----------------------------------------------------------------
+ SkipToNoNode
+
+ This function goes down the list of nodes in the encoded tree
+ until it finds the corresponding "no" node to the "yes" node
+ which is input to this function.  Note that this function
+ must be called with a node that is a "yes" node.
+
+ ----------------------------------------------------------------*/
+short const* CTIesrFlex::SkipToNoNode( short const* aYesTreeNode )
+{
+   short const* noNode;
+   
+   // Check if the starting "yes" node is a terminal node.
+   // If so, the no node is immediately after it in the tree;
+   if( *aYesTreeNode & 0x8000 )
+   {
+      noNode = ++aYesTreeNode;
+   }
+   else
+   {
+      // Since the yes node was not terminal, decend the yes node,
+      // and return the node after all tree nodes in the yes node tree,
+      // which is the no node at the same level as the yes node.
+      noNode = DescendQuestionNode( aYesTreeNode );
+   }
+   
+   return noNode;
+}
+
+
+/*----------------------------------------------------------------
+ DescendQuestionNode
+
+ This function decends from a question node in the acoustic decision
+ tree to return the next node that comes after all the binary tree
+ nodes at and below the question node node.  At the present time,
+ local variables are used to hold yes, no and next nodes for
+ debugging. This could be simplified to a single node pointer.
+ The function now uses recursive calls to decend the tree
+
+ ----------------------------------------------------------------*/
+short const* CTIesrFlex::DescendQuestionNode( short const* aQuestionNode )
+{
+   short const* yesNode;
+   short const* noNode;
+   short const* nextNode;
+   
+   // Go to the yes node corresponding to the input question node,
+   // which immediately follows the question node in the tree node
+   // list.
+   yesNode = aQuestionNode;
+   yesNode++;
+   
+   // First decend the yes node of this present question node
+   
+   // Check if the yes node is a terminal node.
+   if( *yesNode & 0x8000 )
+   {
+      // If yes node is terminal, the node immediately
+      // following the yes node in the node list is the no node,
+      noNode = yesNode;
+      noNode++;
+   }
+   else
+   {
+      // If yes node is a question, decend the yes node and
+      // return the next node after the yes node portion of the
+      // tree, which is the no node for the current question.
+      noNode = DescendQuestionNode( yesNode );
+   }
+   
+   
+   // Now decend the no node
+   
+   
+   // Check if the no node is a terminal node.
+   if( *noNode & 0x8000 )
+   {
+      // If terminal,  the next node after the no node is
+      // the next node after the current question node.
+      nextNode = noNode;
+      nextNode++;
+   }
+   else
+   {
+      // Descend the node corresponding to this no node question
+      // and return the next node after the no node portion of
+      // the tree, which is the next node after the current
+      // question node.
+      nextNode = DescendQuestionNode( noNode );
+   }
+   
+   return nextNode;
+}
+
+
+/*----------------------------------
+
+ These functions no longer used, since tree parsing is done directly from
+ the encoded tree in memory.
+
+ //--------------------------------------
+ int CTIesrFlex::build_tree( Treenode **pptnode )
+ {
+ Treenode *node;
+ short word;
+ int failed = false;
+
+ word = *tree_offset;
+
+ if ( ( word & 0x8000 ) == 0 )
+ {
+ // question
+ failed |= create_tree_node(0, (int) word, &node );
+ if( failed ) return failed;
+
+ tree_offset++;
+
+ failed |= build_tree( &node->yes );
+ if( failed ) return failed;
+
+ tree_offset++;
+
+ failed |= build_tree( &node->no );
+ if( failed ) return failed;
+
+ *pptnode = node;
+
+ return failed;
+ }
+ else
+ {
+ // leaf
+ failed |= create_tree_node(1, (int) ( word & 0x7fff ), &node );
+
+ *pptnode = node;
+ return failed;
+ }
+ }
+
+
+ //--------------------------------
+ int CTIesrFlex::create_tree_node(int is_leaf, int value, Treenode **pptnode)
+ {
+ int failed = false;
+
+ //demand( cur_node < MAX_TREENODE, "Error: exceed MAX_TREENODE\n");
+ failed = !( cur_node < MAX_TREENODE );
+ if( failed ) return failed;
+
+ tree[ cur_node ].qs_frame = (is_leaf << 16) + value;
+ tree[ cur_node ].yes = 0;
+ tree[ cur_node ].no = 0;
+
+ cur_node++;
+ *pptnode = ( &tree[ cur_node - 1 ] );
+
+ return failed;
+ }
+
+
+ //---------------------------------
+ int CTIesrFlex::classify( Treenode *node, Modelnode *model, int *phnidx)
+ {
+ int failed = false;
+ int idx;
+
+ //demand( (int) tree, "Error: NULL tree input to classify()\n");
+ failed = !( (int) tree );
+ if( failed ) return failed;
+
+ if ( ( node->qs_frame & 0x10000 ) == 0x10000 )
+ {         // leaf node
+ *phnidx = ( node->qs_frame & 0xffff );
+ return failed;
+ }
+ else if ( yes_to_question(model, node->qs_frame) )
+ {   // yes
+ failed |= classify(node->yes, model, &idx );
+ if(failed ) return failed;
+
+ *phnidx = idx;
+ return failed;
+ }
+ else
+ {                                                 // no
+ failed |= classify(node->no, model, &idx);
+ if( failed ) return failed;
+
+ *phnidx = idx;
+ return failed;
+ }
+
+ return failed;
+ }
+
+ --------------------------------*/
+
+
+
+//-----------------------------
+int CTIesrFlex::yes_to_question( Modelnode const* model, int qs)
+{
+   unsigned char *c_ptr;
+   int  i, lr, idx, qs_len;
+   
+//   c_ptr = (unsigned char *) qs_offset[ qs ];
+   c_ptr = (unsigned char *) ( qs_base + qs_offset[ qs ] );
+
+   qs_len = (int) *c_ptr;
+   c_ptr++;
+   for (i = 0; i < qs_len; i++)
+   {
+      lr = c_ptr[i] & 0x80;        /* right: 0x80, left: 0 */
+      idx = c_ptr[i] & 0x7f;       /* phone index */
+      if ( lr )
+      {
+         if ( idx == model->r ) return 1;
+      } else
+      {
+         if ( idx == model->l ) return 1;
+      }
+   }
+   return 0;
+}
+
+
+/*----------------------------------------------------------------
+ demand
+
+ Check for a condition being true, and if not throw a character pointer
+ exception.
+ ----------------------------------------------------------------*/
+void CTIesrFlex::demand(int condition, char *msg)
+{
+   if( !condition )
+   {
+      // exit(1);
+      
+      // The demand function is only used within the
+      // parse_grammar public member function. We must not exit, so we
+      // raise an exception. Note that this implies that the call to
+      // the parse_grammar function must be guarded.
+      
+      // old WinCE way of throwing an exception
+      //RaiseException( CTIesrFlex::STATUS_FAIL_PARSE, 0, 0, NULL );
+      
+      // throw CTIesrFlex::STATUS_FAIL_PARSE;
+      throw msg;
+   }
+   return;
+}
+
+
+//-----------------------------------------------
+// This function is defined since the MS eMbedded C++ 3.0
+// Smartphone emulator returns non-zero if c is EOF.
+//
+int CTIesrFlex::myisalpha(int c)
+{
+   
+   if( c == EOF )
+      return 0;
+   
+   return( isalpha(c) );
+}
+
+
+//------------------------------------------------------
+// This function is defined since WCE does not support
+// rewind.
+//
+void CTIesrFlex::rewind(FILE *fp)
+{
+   fseek( fp, 0L, SEEK_SET );
+   clearerr( fp );
+}
+
+
+/*====================================================
+ Functions below this line convert from
+ 16-bit mfcc to 8-bit mfcc.  This is necessary to accommodate
+ the TIesr ability to use only 8-bit model features.
+ ===========================================================*/
+
+
+
+/*----------------------------------------------------------------
+ model_bit_16_to_8
+
+ This function is called to convert the mean and variance vectors of
+ grammar files already output by TIesrFlex into 8-bit feature mean
+ and variance files.  The user may select mean and/or variance to
+ convert to byte.  If the file format is already byte, then
+ conversion is not performed for that file.  However, scaling must be
+ read in order to output the proper scaling information.
+
+
+ ----------------------------------------------------------------*/
+int CTIesrFlex::model_bit_16_to_8(char *source_dir, char *dest_dir,
+short endien, short add_mean_vec,
+int aByteMeans, int aByteVars )
+{
+   short *max_scale;
+   short n_mfcc, n_dim, *vec, nbr;
+   char fname[ FILENAME_MAX ];
+   int failed;
+   short dim;
+   
+   // Ignore - function does not need endien, just retain for compatibility
+   //little_endian = endien;
+   
+   /* read the dimension of mfcc  */
+   sprintf(fname, "%s/%s", source_dir, "dim.bin");
+   n_mfcc = load_n_mfcc( fname );
+   if( n_mfcc == 0 )
+      return FAIL;
+   
+   
+   /* Allocate scale memory */
+   n_dim = n_mfcc * 2;
+   max_scale = (short *) malloc( sizeof(short) * 2 *n_dim );
+   if( max_scale == NULL )
+      return FAIL;
+   
+   /* Initialize scale memory by reading from memory or setting to zeros. */
+   sprintf(fname, "%s/%s", source_dir, "scale.bin");
+   failed = load_scales( fname, max_scale, n_dim );
+   if( failed )
+      goto failure;
+   
+   /* If byte means desired, and input mean data is in short,
+    convert short means to bytes.  This also sets the scaling for
+    the byte means in the max_scale array.  */
+   if( aByteMeans && ! m_bInputByteMeans )
+   {
+      /* load all mean vectors */
+      sprintf(fname, "%s/%s", source_dir, "mu.bin" );
+      vec = load_16( fname, n_mfcc , &nbr);
+      if( vec == NULL )
+         goto failure;
+      
+      /* add mean vector correction to word features if needed */
+      if ( add_mean_vec ) add_mean(vec, n_mfcc, nbr);
+      
+      // Convert to byte mean vectors and output them */
+      sprintf(fname, "%s/%s", dest_dir, "mu.bin" );
+      failed = output_obs(vec, nbr, n_dim, n_mfcc, max_scale, fname);
+      free(vec);
+      if( failed )
+         goto failure;
+   }
+   
+   /* Input data is in short, and short is requested, so scale not used for means. */
+   else if ( !aByteMeans && !m_bInputByteMeans )
+   {
+      /* Initialize scales to zero as placeholders.  They will not be used
+       in TIesr recognizer. */
+      for( dim = 0; dim < n_dim; dim++ )
+      {
+         max_scale[dim] = 0;
+      }
+   }
+   
+   
+   /* If byte inverse variance desired, and input data in short, convert to byte
+    which also loads the scale array. */
+   if( aByteVars && ! m_bInputByteVars )
+   {
+      /* load all variance vectors */
+      sprintf(fname, "%s/%s", source_dir, "var.bin");
+      vec = load_16( fname, n_mfcc , &nbr);
+      if( vec == NULL )
+         goto failure;
+      
+      
+      /* Convert to byte variances and output them */
+      sprintf(fname, "%s/%s", dest_dir, "var.bin");
+      failed = output_obs(vec, nbr, n_dim, n_mfcc, max_scale + n_dim, fname);
+      free(vec);
+      if(failed )
+         goto failure;
+   }
+   
+   /* Input var data is in short, and short desired, so zero the scale. */
+   else if( !aByteVars && !m_bInputByteVars )
+   {
+      /* Initialize scales to zero as placeholders.  They will not be used
+       in TIesr recognizer. */
+      for( dim = 0; dim < n_dim; dim++ )
+      {
+         max_scale[n_dim + dim] = 0;
+      }
+   }
+   
+   
+   /* Output the scale information */
+   sprintf(fname, "%s/%s", dest_dir, "scale.bin");
+   failed = save_scales(fname,  max_scale, n_dim);
+   if( failed )
+      goto failure;
+   
+   free( max_scale );
+   return OK;
+   
+   failure:
+      free(max_scale);
+      return FAIL;
+      
+}
+
+//---------------------------------------
+// Find MFCC dimension
+//
+short CTIesrFlex::load_n_mfcc(char *fname)
+{
+   FILE  *fp;
+   short n_mfcc;
+   
+   fp = fopen(fname, "rb");
+   if (!fp)
+   {
+      return 0;
+      //fprintf(stderr,"can't open %s\n",fname);
+      //exit(0);
+   }
+   
+   fread(&n_mfcc, sizeof(short), 1, fp);
+   fclose( fp );
+   return n_mfcc;
+}
+
+//--------------------------------------
+// Read all vectors from file into memory
+//
+short * CTIesrFlex::load_16(char *fname, short n_mfcc, short *nbr)
+{
+   FILE  *fp;
+   int n_dim = 2 * n_mfcc;
+   short *b;
+   
+   //printf("reading from \"%s\"\n", fname);
+   fp = fopen(fname, "rb");
+   if( fp == NULL )
+      return NULL;
+   
+   fread(nbr, sizeof(short), 1, fp);
+   //printf("size = %d\n", *nbr);
+   b = (short *) malloc( *nbr * n_dim * sizeof(short) );
+   if( b == NULL )
+   {
+      fclose( fp );
+      return NULL;
+   }
+   
+   fread(b, sizeof(short),  *nbr * n_dim, fp);
+   fclose( fp );
+   return b;
+}
+
+//--------------------------------
+//  Add mean vector obtained from WAVES digits parked_trn _d7_2*
+//
+void CTIesrFlex::add_mean(short *vec, int n_mfcc, int nbr)
+{
+   int i, d;
+   short *pv = vec;
+   long tmp;
+   for (i=0; i<nbr; i++, pv += n_mfcc * 2)
+   {
+      for (d=0; d<n_mfcc; d++)
+      {
+         tmp = (long) pv[d] + (long) mean_bias[d];
+         pv[d] = long2short(tmp);
+         if (tmp != pv[d])
+         {
+            /*fprintf(stderr,"vector %d clipped at dim %d: %ld to %d\n",
+             i, d, tmp, pv[d]); */
+         }
+      }
+   }
+}
+
+//------------------------------------------------
+// Output 8-bit observations
+//
+int CTIesrFlex::output_obs(short obs[], short size, int n_dim, int n_mfcc, short max_scale[], char fname[])
+{
+   short *mu, i;
+   FILE *pf;
+   int failed;
+   
+   calc_max(obs, size, n_dim, n_mfcc, max_scale);
+   
+   pf = fopen(fname, "wb");
+   if (!pf)
+   {
+      return FAIL;
+      //printf("failed to open %s\n",  fname);
+      //exit(0);
+   }
+   else
+   {
+      //printf("writing to \"%s\"\n", fname);
+   }
+   
+   
+   /* Output number of vectors */
+   failed = write_vec(&size, 1, pf);
+   if( failed )
+   {
+      fclose(pf);
+      return failed;
+   }
+   
+   for (mu = obs, i = 0; i < size; i++, mu += n_dim)
+   {
+      vector_packing(mu, (unsigned short *) mu, max_scale, n_mfcc);
+      failed = write_vec(mu, n_mfcc, pf);
+      if( failed )
+      {
+         fclose(pf);
+         return failed;
+      }
+   }
+   fclose(pf);
+   return OK;
+}
+
+//-----------------------------------------------------
+//
+void CTIesrFlex::calc_max(short mu[], int nbr, int n_dim, int n_mfcc, short max_mu[])
+{
+   int j, i;
+   for (j = 0; j < n_dim; j++) max_mu[j] = 0;
+   for (i = 0; i < nbr; i++)
+   {
+      for (j = 0; j < n_dim; j++)
+      {
+         short a_mu = mu[i * n_dim + j ];
+         if (a_mu < 0) a_mu = -a_mu;
+         if (max_mu[j] < a_mu) max_mu[j] = a_mu;
+      }
+   }
+   scale_max(max_mu, n_mfcc, n_dim);
+}
+
+//------------------------------------------------
+//
+void CTIesrFlex::scale_max(short max_mu[], int n_mfcc, int n_dim)
+{
+   int i, j;
+   
+   /*
+    for (i = 0; i < 2; i++) {
+    for (j = 0; j < n_mfcc; j++)
+    printf("%6d", max_mu[j+i*n_mfcc]);
+    printf("\n");
+    }
+    */
+   
+   for (j = 0; j < n_dim; j++)
+   {
+      i = 0;
+      while (!(0x4000 & max_mu[j]))
+      {
+         max_mu[j] <<= 1;
+         i++;
+      }
+      max_mu[j] = i;
+   }
+   
+   /*
+    for (i = 0; i < 2; i++) {
+    for (j = 0; j < n_mfcc; j++)
+    printf("%6d", max_mu[j+i*n_mfcc]);
+    printf("\n");
+    }
+    */
+}
+
+//--------------------------------
+//
+int CTIesrFlex::write_vec(short *vec, short nbr, FILE *fp)
+{
+   int i;
+   int failed;
+   for (i=0; i<nbr; i++)
+   {
+      failed = output_word(vec[i], fp);
+      if( failed )
+         return failed;
+   }
+   
+   return OK;
+}
+
+
+//--------------------------------------------
+//
+int CTIesrFlex::output_word(short value, FILE *fp)
+{
+   int failed;
+   
+   failed = output_int16( fp, value );
+   
+   return failed;
+}
+
+//-----------------------------------------------
+//
+void CTIesrFlex::vector_packing(short v_in[], unsigned short v_out[], short max_scale[], short D)
+{
+   short j;
+   char tmp1, tmp2;
+   
+   for (j = 0; j<D; j++)
+   {
+      tmp1 = nbr_coding(v_in[j], max_scale[j], 0)>>8;
+      tmp2 = nbr_coding(v_in[j + D], max_scale[j + D], 0)>>8;
+      v_out[j] = (tmp1 << 8) + (tmp2 & 0xff);
+   }
+   
+}
+
+//----------------------------------------------------
+//
+short CTIesrFlex::nbr_coding(short o_mu, short max_mu, int prt)
+{
+   short a_mu = o_mu,  sign = 0;
+   int tmp;
+   short clipped = 0;
+   
+   if (a_mu<0)
+   { /* make a positiver number */
+      a_mu = -a_mu;
+      sign = 1;
+   }
+   tmp = (a_mu << max_mu); /* shift */
+   if (tmp > 32767)
+   {
+      a_mu = 32767;
+      clipped = 1;
+   }
+   else a_mu = (short) tmp;
+   if (a_mu < 0x7f00) a_mu += (1<<7);
+   /*  else printf("a_mu = %x, no rounding\n", a_mu); */
+   a_mu &= 0xff00;     /* 8 bits precision coding */
+   #ifndef COMPACT
+   a_mu >>= max_mu; /* restore */
+   if (sign) a_mu = - a_mu;
+   if (prt)
+   {
+      /* printf("ZZ=%d, %5d %5d, %5d %9.5f\n", max_mu, a_mu, o_mu, a_mu - o_mu,
+       o_mu == 0? 0.: (a_mu - o_mu)/(float)(o_mu>0? o_mu:-o_mu)*100.); */
+   }
+   #else
+   if (sign) a_mu = - a_mu;
+   #endif
+   
+   /*
+    if (clipped)
+    fprintf(stderr,"clipping: original = %x (%d), actual = %x (%d) scale = %d)\n",
+    o_mu, o_mu, a_mu>> max_mu, a_mu>> max_mu, max_mu );
+    */
+   return a_mu;
+}
+
+//-----------------------------------------
+//
+int CTIesrFlex::save_scales(char *fname, short scale[], short n_dim)
+{
+   FILE  *fp;
+   int failed;
+   
+   fp = fopen(fname, "wb");
+   if (!fp)
+   {
+      return FAIL;
+      //fprintf(stderr,"can't open %s\n",fname);
+      //exit(0);
+   }
+   failed = write_vec(scale, n_dim * 2, fp);
+   fclose( fp );
+   
+   if( failed )
+      return failed;
+   
+   return OK;
+}
+
+/*----------------------------------------------------------------
+ load_scales
+
+ Try to load byte scale factors.  If the file does not exist, then
+ initialize scale with all zeros.  Otherwise read from file, and
+ report if failure to do so.
+ ----------------------------------------------------------------*/
+int CTIesrFlex::load_scales(char *fname, short scale[], short n_dim)
+{
+   FILE  *fp;
+   int dim;
+   size_t nread;
+   
+   
+   /* Open file and initialize scales if no file */
+   fp = fopen(fname, "rb");
+   if (!fp)
+   {
+      for(dim=0; dim < 2*n_dim; dim++)
+         scale[dim] = 0;
+      
+      return OK;
+   }
+   
+   
+   /* Read scales */
+   nread = fread( scale, sizeof(short), 2*n_dim, fp );
+   fclose( fp );
+   
+   if( nread != (unsigned int)2*n_dim )
+      return FAIL;
+   
+   return OK;
+}
+
+
+/*----------------------------------------------------------------
+ output_feature_vector
+
+ This function outputs a single feature vector based on its index in
+ the input data.
+ ----------------------------------------------------------------*/
+int CTIesrFlex::output_feature_vector( FILE* fp, void *aFeatures,
+unsigned int aIndex,
+int aByteFeatureVector)
+{
+   int failed = OK;
+   int feat;
+   
+   // Feature vector elements are bytes
+   if( aByteFeatureVector )
+   {
+      int nSubVectors = m_inputFeatDim/m_inputStaticDim;
+      unsigned short featWord;
+      unsigned char *features = (unsigned char *)aFeatures;
+      unsigned char *fvector = features + aIndex*m_inputFeatDim;
+      
+      // Byte features.  Presently TIesr Engine expects bytes according to
+      // interlaced static and delta.  Can't handle static by itself, or
+      // static, delta, and accel.
+      if( nSubVectors != 2 )
+      {
+         return FAIL;
+      }
+      
+      for ( feat = 0; feat < m_inputStaticDim; feat++ )
+      {
+         featWord = fvector[feat];
+         featWord <<= 8;
+         featWord |= fvector[feat + m_inputStaticDim];
+         failed |=  output_int16( fp, (int)featWord );
+      }
+   }
+   
+   else
+   {
+      short *features = (short *)aFeatures;
+      short *fvector = features + aIndex*m_inputFeatDim;
+      for ( feat = 0; feat < m_inputFeatDim; feat++ )
+      {
+         failed |= output_int16( fp, (int)fvector[feat] );
+      }
+   }
+   
+   return failed;
+}
+
+
+/*----------------------------------------------------------------
+ output_config
+
+ This function outputs the configuration data for the model set
+ just written out.
+ ----------------------------------------------------------------*/
+int CTIesrFlex::output_config( const char* aDirName, short aByteMeans, short aByteVars )
+{
+   FILE* fp;
+   char  buf[ FILENAME_MAX ];
+   int failed = 0;
+   
+   /* Open config file */
+   strcpy( buf, aDirName );
+   strcat( buf, "/config.bin" );
+   fp = fopen( buf, "wb" );
+   if( !fp )
+      return FAIL;
+   
+   failed |= output_int16( fp, aByteMeans );
+   failed |= output_int16( fp, aByteVars );
+   failed |= output_int16( fp, little_endian );
+   
+   
+   fclose(fp);
+   
+   if( failed )
+      return FAIL;
+   
+   return OK;
+}
+
+
+/*----------------------------------------------------------------
+ AddMultiplePronunciations
+
+ This function adds multiple pronunciations to the fsa2 grammar network
+ created by yyparse and process_grammar.  The multiple pronunciations are
+ determined by the dictionary.  The user may choose to include the default
+ rule pronunciation as a valid pronunciation, and to specify the maximum
+ number of pronunciations allowed for a word.
+
+ This function adds multiple pronunciations by adding new words to the word
+ list and new transitions between sent_nodes.  The base word is given by the
+ original word list.  If additional pronunciations are available from
+ TIesrDict, then new words are added as the base word, followed by "+N",
+ where N is >=1, indicating the word is the Nth multiple pronunciation.  For
+ example, if the word "Marilyn" has three possible pronunciations, then these
+ would be represented by the words in the word list of "Marilyn",
+ "Marilyn+1", and "Marilyn+2".
+
+ ----------------------------------------------------------------*/
+CTIesrFlex::Errors CTIesrFlex::AddMultiplePronunciations( )
+{
+   CTIesrDict::Errors dictError;
+   int src;
+   int dst;
+   int next;
+   int newTranIndex;
+   
+   
+   // Save the indices of the base number of words and transitions that
+   // will be added to.
+   int baseSentTranIndex = senttran_idx;
+   
+   
+   //  Should not have called function, no multiple pronunciations wanted.
+   if( m_maxPronunciations <= 1 )
+      return ErrNone;
+   
+   
+   // Add multiple pronunciations for each base word
+   for( int wrdIndex = 0; wrdIndex < m_baseWordIndex; wrdIndex++ )
+   {
+      unsigned int numPron;
+      
+      
+      // If the word is a _SIL* word, then continue, since this is a dummy for the
+      // silence model, and it does not have more pronunciations.
+      if( strncmp( word[wrdIndex], SIL, strlen(SIL)) == 0 )
+      {
+         continue;
+      }
+      
+      // Find how many pronunciations are available for the word in the
+      // dictionary, and also include the default pronunciation if the user
+      // wants it.
+      dictError = m_dict->GetNumberEntries( word[wrdIndex], &numPron );
+      if( dictError != CTIesrDict::ErrNone )
+      {
+         return ErrDict;
+      }
+      if( m_bIncludeRulePron )
+         numPron++;
+      
+      
+      // If only one pronunciation is available for the word, or no pronunciation
+      // then no need to add new pronunciations.
+      if( numPron <= 1 )
+         continue;
+      
+      
+      // Add the new pronunciations to word list and senttran up to the number
+      // available or the maximum number.
+      int maxPron = (numPron > m_maxPronunciations)  ?  m_maxPronunciations  :  numPron;
+      
+      for( int newPron = 1; newPron < maxPron; newPron++ )
+      {
+         char newWord[MAX_WORDLEN];
+         char suffix[MAX_WORDLEN];
+         int newWordIndex;
+         
+         // Create the new "word"
+         strcpy( newWord, word[wrdIndex] );
+         sprintf( suffix, "+%d", newPron );
+         strcat( newWord, suffix );
+         
+         // Try to add the new word to the word list
+         try
+         {
+            add_word( newWord );
+         }
+         catch( char* exc )
+         {
+            m_parseFail = true;
+         }
+         if( m_parseFail )
+            return ErrFail;
+         
+         // Zero-based word index
+         newWordIndex = word_idx - 1;
+         
+         
+         // Search all base transitions for the base word, and add a new
+         // transition with the new word.  Note that the new word index
+         // is offset by 2, since the senttran uses one-based word indices and
+         // the first word is by definition "", so all other words start at
+         // index 2.
+         for( int trnIndex = 0; trnIndex < baseSentTranIndex; trnIndex++ )
+         {
+            // Check if transition matches base word.  If so, add a new
+            // senttran transition for the new word.
+            if( senttran[trnIndex].type == wrdIndex + 2 )
+            {
+               // The source and destination sent_nodes for this transition,
+               // and next transition in linked list.
+               src = senttran[trnIndex].src;
+               dst = senttran[trnIndex].dst;
+               next = senttran[trnIndex].next;
+               // Insert the new transition after this senttran
+               try
+               {
+                  create_tran( src, dst, newWordIndex + 2, next );
+               }
+               catch( char* exc )
+               {
+                  m_parseFail = true;
+               }
+               if( m_parseFail )
+                  return ErrFail;
+               
+               // Connect the original senttran to the new senttran to fix up
+               // the linked list. Note that senttran indices are one-based in
+               // the senttran next field.
+               newTranIndex = senttran_idx - 1;
+               senttran[trnIndex].next = newTranIndex + 1;
+            }
+         }
+      }
+   }
+   
+   // Finished adding new multiple pronunciation words successfully.
+   return ErrNone;
+}
+
+
+/*----------------------------------------------------------------
+ LookupBasePronunciation
+
+ This function looks up pronunciations for base "words" in the grammar.  A word
+ may be a simple character string, such as "Marilyn", or it may be a
+ character string with a suffix "+N" indicating that this is one of several
+ pronunciations desired.  A base word does not have "+N" in the word.
+ The function uses class member variables to determine how to interpret the
+ word and puts the pronunciation for the word in aPron.  The reason for
+ distinguishing between base words and multi-pronunciation words is that the
+ lookup of rule pronunciations is faster if the pronunciation of the base
+ word is looked up followed immediately by all multi-pronunciations of the
+ same word.
+
+ ----------------------------------------------------------------*/
+CTIesrFlex::Errors CTIesrFlex::LookupBasePronunciation( const char* aWord, char* aPron )
+{
+   char* plusChr;
+   char wrd[MAX_WORDLEN];
+   CTIesrDict::Errors dictError;
+   
+   // Modifiable copy of word
+   strcpy( wrd, aWord );
+   
+   // Is this a multi-pronunciation word?  If plusChr is NULL, this indicates
+   // this is the base word, and not a multi-pronunciation additional word.
+   // If this is a multi-pronunciation word, then this call is in error.
+   plusChr = strrchr( wrd, '+' );
+   if( plusChr )
+   {
+      return ErrNotBase;
+   }
+   
+   
+   // Get the desired pronunciation.  These should not cause an error, since
+   // the count of dictionary words was done when the extra
+   // multi-pronunciation words were put in the senttran transitions.  So
+   // there should not be a request for an instance of the word not in the
+   // dictionary.
+   
+   // User wants rule pronunciation for base word
+   if( m_maxPronunciations == 0 || m_bIncludeRulePron )
+   {
+      dictError = m_dict->GetPronEntry( wrd, 0, aPron );
+   }
+   
+   // User wants first dictionary pronunciation for base word
+   else
+   {
+      dictError = m_dict->GetPronEntry( wrd, 1, aPron );
+      
+      // TIesrFlex may want the first dictionary pronunciation,
+      // but no dictionary pronunciation exists.  This is not an
+      // error, just have to use rule pronunciation.
+      if( dictError == CTIesrDict::ErrNotInDictionary )
+         dictError = CTIesrDict::ErrNone;
+   }
+   
+   // This is the base word.  No "+N" suffix implies multiCount=0.
+   // The next N for this base word, if it exists, should be N=1.
+   m_multiCount = 0;
+   
+   
+   return (dictError == CTIesrDict::ErrNone)  ?  ErrNone : ErrDict;
+}
+
+
+/*----------------------------------------------------------------
+ LookupMultiPronunciation
+
+ ----------------------------------------------------------------*/
+CTIesrFlex::Errors CTIesrFlex::LookupMultiPronunciation( const char* aWord,
+const char* aMultiWord,
+char* aPron )
+{
+   char* plusChr;
+   int multiCount;
+   char wrd[MAX_WORDLEN];
+   CTIesrDict::Errors dictError;
+   
+   // Modifiable copy of multiword
+   strcpy( wrd, aMultiWord );
+   
+   // If looking up a multi-word pronunciation, then this must be the
+   // next pronunciation in order of the presently used base word.
+   plusChr = strrchr( wrd, '+' );
+   if( plusChr )
+   {
+      // Determine which multi-pronunciation word this is
+      multiCount = atoi( plusChr+1 );
+      
+      // Change wrd so it is a pointer to the base word string only
+      *plusChr = '\0';
+      
+      // Ensure this multiword matches the base word.  If it does not, then
+      // There is no error, but the words don't match, so no word should be
+      // returned.
+      if( strcmp( wrd, aWord) != 0 )
+      {
+         return ErrNoMatch;
+      }
+      
+      // Ensure this is the next word in multi-word order
+      if( multiCount != m_multiCount + 1 )
+         return ErrFail;
+   }
+   else
+   {
+      // Word does not have "+N", and therefore is not multipronunciation
+      // word.  Something is wrong.
+      return ErrFail;
+   }
+   
+   
+   // If this is a multi-pronunciation word but only single pronunciations are
+   // desired, then something is wrong.  This should not happen.
+   if( m_maxPronunciations <= 1 )
+   {
+      aPron[0] = 0;
+      return ErrFail;
+   }
+   
+   
+   // Get the next desired dictionary pronunciation in order.  These should not cause
+   // an error, since the count of dictionary words was done when the extra
+   // multi-pronunciation words were put in the senttran transitions.  So
+   // there should not be a request for an instance of the word not in the
+   // dictionary.
+   dictError = m_dict->GetNextEntry( aPron );
+   
+   // Successfully looked up next sequential multiword for base word
+   if( dictError == CTIesrDict::ErrNone )
+      m_multiCount++;
+   
+   
+   return (dictError == CTIesrDict::ErrNone)  ?  ErrNone : ErrDict;
+}
+
+
+/*----------------------------------------------------------------
+ ExpandArray
+
+ Expand the size of an array of items which may be either structures
+ or simple types. This function may also be called to do the initial
+ allocation.  aArray is a pointer to the present allocation.
+ aItemSize is the size of an item in the array.  aNumAlloc is the
+ number by which the array should be increased, and aNumInArray is a
+ pointer to a counter that holds the present number of items.
+ ----------------------------------------------------------------*/
+void* CTIesrFlex::ExpandArray( void* aArray, int aItemSize, int aNumAlloc, int* aNumInArray )
+{
+   void* newArray;
+   int newNumInArray;
+   
+   // Number of array objects to allocate
+   newNumInArray = aNumAlloc + *aNumInArray;
+   
+   // Check if this is the first allocation
+   if( *aNumInArray == 0 )
+   {
+      newArray = malloc( aItemSize*newNumInArray );
+   }
+   else
+   {
+      newArray = realloc( aArray, aItemSize*newNumInArray );
+   }
+   
+   // If allocation was unsuccessful, throw a memory error
+   if( !newArray )
+      throw "Memory Allocation Error";
+   
+   // Allocation was successfull, so update number of objects in array,
+   // and provide a pointer to the newly allocated array.
+   *aNumInArray = newNumInArray;
+   return newArray;
+}
+
+
+/*----------------------------------------------------------------
+ FreeGrammarData
+
+ This function frees all grammar data array structures used during
+ creation of the grammar.  It is a private convenience function to the
+ class.
+ ----------------------------------------------------------------*/
+void CTIesrFlex::FreeGrammarData(void)
+{
+   // Delete any preexisting grammar text copy
+   delete [] cfg;
+   cfg = NULL;
+   
+   // Free any preexisting parse word tokens and token array data
+   if( token )
+   {
+      for( int tok = 0; tok < token_idx; tok++ )
+         free( token[tok] );
+      
+      free( token );
+      token = NULL;
+      token_idx = 0;
+      m_tokenMax = 0;
+   }
+   
+   // Free any preexisting rule structures
+   if( rule )
+   {
+      free( rule );
+      rule = NULL;
+      rule_idx = 0;
+      m_ruleMax = 0;
+   }
+   
+   // Free any preexisting node structures
+   if( node )
+   {
+      free( node );
+      node = NULL;
+      m_nodeMax = 0;
+      node_idx = 0;
+   }
+   
+   // Free any preexisting dependency structures
+   if( depend )
+   {
+      free( depend );
+      depend = NULL;
+      depend_idx = 0;
+      m_dependMax = 0;
+   }
+   
+   // Free any preexisting sentnode structures
+   if( sentnode )
+   {
+      // Free any existing array of next nodes
+      int snode;
+      for( snode = 0; snode < sentnode_idx; snode++ )
+      {
+         if( sentnode[snode].next )
+         {
+            free( sentnode[snode].next );
+         }
+      }
+      
+      // Free all the sentnodes
+      free( sentnode );
+      sentnode = NULL;
+      sentnode_idx = 0;
+      m_sentnodeMax = 0;
+   }
+   
+   // Free any preexisting senttran structures
+   if( senttran )
+   {
+      free( senttran );
+      senttran = NULL;
+      senttran_idx = 0;
+      m_senttranMax = 0;
+   }
+   
+   // Free any preexisting words
+   if( word )
+   {
+      free( word );
+      word = NULL;
+      word_idx = 0;
+      m_wordMax = 0;
+   }
+   
+   // Free any hmm entry array
+   if( hmm )
+   {
+      free( hmm );
+      hmm = NULL;
+      hmm_idx = 0;
+      m_hmmMax = 0;
+   }
+   
+   // Free any symbol structure array
+   if( sym )
+   {
+      // Free any existing array of next symbols in the sym structure
+      int idxsym;
+      for( idxsym = 0; idxsym < sym_idx; idxsym++ )
+      {
+         if( sym[idxsym].next )
+         {
+            free( sym[idxsym].next );
+         }
+      }
+      
+      // Free all sym structures
+      free( sym );
+      sym = NULL;
+      sym_idx = 0;
+      m_symMax = 0;
+   }
+   
+   // Free stop symbol list
+   if( stop_next )
+   {
+      free( stop_next );
+      n_stop_next = 0;
+      m_stopMax = 0;
+   }
+}
+
+
+/*----------------------------------------------------------------
+ AddNext
+
+ Add integers to the end of an integer list, expanding the list
+ size if necessary.
+ ----------------------------------------------------------------*/
+void CTIesrFlex::AddNext( int **apList, int *apNumUsed, int* apNumMax,
+int aNumToAdd, int* aAddList )
+{
+   int idxAdd;
+   
+   int numUsed = *apNumUsed;
+   int numMax = *apNumMax;
+   int *aList = *apList;
+   
+   
+   // Initial allocation if called when the list is empty
+   // if aList is NULL numUsed should be zero.
+   if( aList == NULL )
+   {
+      // Allocate NEXT_ALLOC more integers to the list
+      // This will throw an exception if the expansion fails.
+      *apList =  reinterpret_cast<int*>
+      ( ExpandArray( reinterpret_cast<void*>(*apList),
+      sizeof(int), NEXT_ALLOC, apNumMax ) );
+      
+      *apNumUsed = 0;
+      
+      aList = *apList;
+      numMax = *apNumMax;
+      numUsed = 0;
+   }
+   
+   
+   // Add new integers to the list, expanding the list as necessary
+   for( idxAdd = 0; idxAdd < aNumToAdd; idxAdd++ )
+   {
+      
+      if( numUsed >= numMax )
+      {
+         // Allocate NEXT_ALLOC more integers to the list
+         // This will throw an exception if the expansion fails.
+         *apList =  reinterpret_cast<int*>
+         ( ExpandArray( reinterpret_cast<void*>(*apList),
+         sizeof(int), NEXT_ALLOC, apNumMax ) );
+         
+         aList = *apList;
+         numMax = *apNumMax;
+      }
+      
+      aList[numUsed] = *aAddList++;
+      numUsed++;
+   }
+   
+   *apNumUsed = numUsed;
+}
+
+
+//This function makes in the means from the compressed mean files and populates the mean_base array
+// this function has also the additional task of allocating space for the mean_base array
+//
+//-----------------------------------------------------------------------------------------------------------
+int CTIesrFlex::makemean(char * dirname)
+{
+   short * mean_centr=NULL , * error_codebook =NULL, *dummy_mean=NULL ;
+   unsigned short * mean_assoc=NULL, * enc_errors=NULL;
+   unsigned int nEntries=0; //number of clusters,number of means
+   unsigned short err_encoding_levels=0, tempp=0, nClust=0, nMean=0, nbits=4;
+   FILE  *fp;
+   size_t elementSize;
+   int vectorSize;
+   char fname[FILENAME_MAX];
+   
+   //read the mean centroids*****************************************
+   
+   // Determine sizes of input and output vectors
+   elementSize =   sizeof( short );
+   vectorSize = elementSize * m_inputFeatDim;
+   
+   // Open the mean file and get number of clusters
+   strcpy(fname, dirname);
+   strcat(fname, "cls_centr.bin");
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&nClust, sizeof(short), 1, fp);
+   fread(&tempp, sizeof(short), 1, fp);
+   // Allocate space to hold the centroids vectors
+   mean_centr =(short *) malloc( nClust * vectorSize );
+   if( !mean_centr )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   // Read in the vector data, stepping over unused dimensions
+   size_t nRead = fread( mean_centr, vectorSize, nClust, fp );
+   
+   fclose( fp );
+   fp = NULL;
+   
+   if( nRead != nClust )
+   {
+      free(mean_centr);
+      return FAIL;
+   }
+   
+   // mean cluster reading ends here ************************************************
+   //mean assocaition reading starts here*******************************************
+   
+   
+   
+   // Open the ROM2cls.bin file and get the assocaitions
+   strcpy(fname, dirname);
+   strcat(fname, "ROM2cls.bin");
+   fp = fopen(fname, "rb");
+   if ( fp == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&nMean, sizeof(short), 1, fp);
+   fread(&tempp, sizeof(short), 1, fp);
+   // Allocate space to hold the centroids vectors
+   mean_assoc =(unsigned short *) malloc( nMean * sizeof(short) );
+   if( !mean_assoc )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   
+   // Read in the vector data, stepping over unused dimensions
+   nRead = fread( mean_assoc, sizeof(short), nMean, fp );
+   
+   fclose(fp);
+   fp = NULL;
+   
+   if( nRead != nMean )
+   {
+      free(mean_centr);
+      free(mean_assoc);
+      return FAIL;
+   }
+   //****************************** reading of mean association ends here
+   //***************************read error_codebook
+   
+   // first entry in the n levels and the total number of entries is nlevels*ndimensio
+   
+   // Determine sizes of input and output vectors
+   elementSize =   sizeof( short );
+   
+   // Open the mean file and get number of clusters
+   FILE *fp1 ;
+   strcpy(fname, dirname);
+   strcat(fname, "fxerrcb.bin");
+   fp1 = fopen(fname, "rb");
+   if ( fp1 == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&err_encoding_levels, sizeof(short), 1, fp1);
+   
+   // Allocate space to hold the centroids vectors
+   error_codebook =(short *) malloc( err_encoding_levels * elementSize * m_inputFeatDim );
+   if( !error_codebook )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+   //set encoding level info here
+   if (err_encoding_levels == 16)
+      nbits = 4;
+   if (err_encoding_levels == 256 )
+      nbits = 8;
+   
+   
+   // Read in the vector data, stepping over unused dimensions
+   nRead = fread( error_codebook, elementSize, err_encoding_levels*m_inputFeatDim, fp1 );
+   fclose( fp1 );
+   fp1 = NULL;
+   
+   if( nRead !=(unsigned int) err_encoding_levels*m_inputFeatDim )
+   {
+      free(mean_centr);
+      free(mean_assoc);
+      free(error_codebook);
+      return FAIL;
+   }
+   //***********************error_codebook reading ends here
+   //***********************read the encoded errors now :)
+   
+   // Determine sizes of input and output vectors
+   elementSize =   sizeof( short );
+   
+   // Open the mean file and get number of clusters
+   strcpy(fname, dirname);
+   strcat(fname, "fxenc.bin");
+   fp1 = fopen(fname, "rb");
+   if ( fp1 == NULL )
+   {
+      return FAIL;
+   }
+   
+   fread(&nEntries, sizeof(int), 1, fp1);
+   
+   // Allocate space to hold the centroids vectors
+   enc_errors =(unsigned short *) malloc( nEntries * elementSize );
+   if( !enc_errors )
+   {
+      fclose(fp1);
+      return FAIL;
+   }
+   
+   // Read in the vector data, stepping over unused dimensions
+   nRead = fread( enc_errors , elementSize , nEntries, fp1 );
+   
+   fclose( fp1 );
+   fp1 = NULL;
+   
+   if( nRead != nEntries )
+   {
+      free(mean_centr);
+      free(mean_assoc);
+      free(error_codebook);
+      free(enc_errors);
+      return FAIL;
+   }
+   //***********************all file reading concludes here *****************************
+   //allocate space for the mean vectors and the associated vectors
+   if( mean_base != NULL )
+   {
+      free( mean_base );
+   }
+   
+   if( mean_idx_aug )
+      free( mean_idx_aug );
+   
+   m_bInputByteMeans = false;
+   
+   // Determine sizes of input and output vectors
+   elementSize = m_bInputByteMeans ? sizeof( unsigned char ) :
+      sizeof( short );
+      
+      vectorSize = elementSize * m_inputFeatDim;
+      
+      // Allocate space to hold the mean vectors
+      mean_base = malloc( nMean * vectorSize );
+      if( !mean_base )
+      {
+         free(mean_centr);
+         free(mean_assoc);
+         free(error_codebook);
+         free(enc_errors);
+         return FAIL;
+      }
+      
+      //assign the dummy mean the address of mean base
+      dummy_mean = (short *)mean_base;
+      //here goes in the mean generation routine
+      unsigned int mean_centr_idx, mean_centr_offset, mean_cb_index=0, error_enc_count=0, error_enc_index, error_temp, prev_error_idx=0;
+      unsigned short error_cb_offset;
+      short temp;
+      for(unsigned int mean_vector_count=0; mean_vector_count < nMean; mean_vector_count++)
+      {
+         //read in the cluster centroid mean
+         mean_centr_idx =(int)mean_assoc[mean_vector_count];
+         for(int dimension_count=0; dimension_count < m_inputFeatDim; dimension_count++)
+         {
+            //calculate the index of the encoded error array
+            error_enc_index = (int)error_enc_count/nbits;
+            if(error_enc_count == 0)
+            {
+               error_temp = enc_errors[error_enc_index];
+            }
+            if(error_enc_index > prev_error_idx)
+            {
+               //if the index has been incremented
+               error_temp = enc_errors[error_enc_index];
+               prev_error_idx = error_enc_index;
+            }
+            
+            //read in the relevant bits into error_cb_offset this will now contain a number between 0-15
+            if(nbits == 4)
+               error_cb_offset =(unsigned short) (0x000f&error_temp);
+            else
+               error_cb_offset =(unsigned short) (0x00ff&error_temp);
+            
+            //shift the bits so that the next number can be read
+            error_temp =(error_temp >> nbits);
+            
+            //calculate the dimension of the mean cluster centroid to be read
+            mean_centr_offset = m_inputFeatDim*mean_centr_idx + dimension_count;
+            //calculate the entry  of the entry from the error codebook to be read
+            error_cb_offset = dimension_count*err_encoding_levels +(int)error_cb_offset;
+            //add the error and the man centroid to obtain the error
+            temp = error_codebook[error_cb_offset] + mean_centr[mean_centr_offset];
+            
+            dummy_mean[mean_cb_index++] =   temp;
+            //increment the counter
+            error_enc_count++;
+         }
+      }
+      
+      m_numMeans = nMean;
+      
+      // Allocate space to track usage of mean vectors
+      mean_idx = (int*)malloc( nMean *sizeof(int) );
+      mean_idx_aug = (int*)malloc( nMean * sizeof(int) );
+      if( !mean_idx || !mean_idx_aug )
+      {
+         return FAIL;
+      }
+      
+      free(error_codebook);
+      free(mean_centr);
+      free(mean_assoc);
+      free(enc_errors);
+      return OK;
+}
+
+
diff --git a/TIesrFlex/src/TIesrFlex.h b/TIesrFlex/src/TIesrFlex.h
new file mode 100644 (file)
index 0000000..2a7af0d
--- /dev/null
@@ -0,0 +1,879 @@
+/*=======================================================================
+ TIesrFlex.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header defines the user interface to the TIesrFlex API which
+ creates grammar network and HMM model binary files corresponding to
+ an input grammar.  The network and HMM files are placed in a user
+ specified directory.  This API uses the TIesrDict API to determine
+ how to pronounce a word.  If the word is not in the dictionary, the
+ pronunciation defined by the TIesrDT API is used.
+
+ All words defined to TIesrFlex by the input grammar string must be spelled
+ using alphabetic characters a-z and A-Z.  For example, use  "ONE" not "1",
+ or "PERCENT" not "%".
+
+ The sequence of usage of this API is to first instantiate an
+ instance of the TIesrFlex object.
+
+ Then call the LoadLanguage method to setup the dictionary for a
+ language and load the HMM model information that will be used to
+ create the HMM model set and network for a grammar to be recognized.
+
+ After this loading is done, call ParseGrammar with the cfg grammar
+ string that defines the grammar to be recognized.  The cfg grammar
+ string has stringent requirements, which are documented elsewhere,
+ and ensure that the grammar string actually defines a finite length
+ regular grammar.
+
+ After parsing the grammar, call OutputGrammar to have TIesrFlex
+ determine and output TIesr format HMM models and associated
+ parameters files, a TIesr grammar network file, and a word list.
+ This can be output to a user selected directory.  During output, the
+ user may select byte or word mean and variance outputs for HMMs, if
+ the original HMM data loaded was in word format.
+
+======================================================================*/
+
+#ifndef _TIESRFLEX_H
+#define _TIESRFLEX_H
+
+#if defined (WIN32) || defined (WINCE)
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the TIESRFLEX_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// TIESRFLEX_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+
+#ifdef TIESRFLEX_EXPORTS
+#define TIESRFLEX_API __declspec(dllexport)
+#else
+#define TIESRFLEX_API __declspec(dllimport)
+#endif
+
+#else
+#define TIESRFLEX_API
+#endif
+
+
+#include <cstdio>
+
+// The CTIesrFlex class contains a CTIesrDict pointer
+#include <TIesrDict.h>
+
+
+// tiesr_config belongs to another API and really should not be included in TIesrFlex
+// #include <tiesr_config.h>
+
+// These defines specify how TIesrFlex was built
+
+// Used to include code only used for debugging
+// #defined TIESRFLEXDEBUG
+
+
+// Use a compact representation of mfcc's
+#define COMPACT
+
+// Offline VQ classes for VQ JAC supported as part of the model set
+#define OFFLINE_CLS
+
+// Network optimization is not enabled at this time
+// #define USE_NET_OPTIMIZATION
+
+//----------------------------------------------------------------
+// CTIesrFlex
+//
+// The TIesrFlex API class
+//
+class TIESRFLEX_API CTIesrFlex
+{
+   public:
+      
+      // Enumeration of errors returned by the API
+      enum Errors
+      {
+         ErrNone,
+         ErrFail,
+         ErrDict,
+         ErrMemory,
+         ErrSize,
+         ErrType,
+         ErrNoMatch,
+         ErrNotBase,
+         ErrNoOptimize
+      };
+
+      
+   public:
+
+      // Public access to the CGrammar object
+      
+      /*  Default constructor */
+      CTIesrFlex(void);
+      
+      /* Default destructor */
+      ~CTIesrFlex(void);
+      
+
+      /*----------------------------------------------------------------
+       LoadLanguage
+      
+       This function loads all of the information from an input
+       directory structure that allows TIesrFlex to create a grammar
+       network and model set to recognize a grammar.  The base
+       directory is at direct/language, which contains the decision
+       trees.  The dictionary should be located at
+       direct/language/dict_ident, and the HMM model information at
+       direct/language/hmm_ident. The user may set little_endian to
+       true in order to output model information in little endian
+       format. Set addClosure to zero if closure phones (bcl, dcl, gcl,
+       kcl, pcl, tcl) are not to be automatically added in the dictionary.
+       ----------------------------------------------------------------*/
+      Errors LoadLanguage( const char *direct, const char *language,
+      const char *dict_ident, const char *hmm_ident,
+      const int lit_end, const int addClosure );
+      
+   
+      /*----------------------------------------------------------------
+       Parse Grammar
+      
+       Parse a grammar and create the information in order to create HMM
+       models.  This function creates a grammar network and a list of all of
+       the needed HMMs for the grammar.  The user may specify multiple
+       pronunciation options. aMaxPronunciations is the maximum number of
+       pronunciations for a word that are allowed.  If this is set to one,
+       then the first dictionary pronunciation will be used if available,
+       otherwise the default rule pronunciation will be used as the single
+       pronunciation, regardless of the setting of aIncludeRulePron.  If
+       aMaxPronunciations is greater than one, then multiple pronunciations
+       for a word are allowed, and if aIncludeRulePron is non-zero, then the
+       default rule pronunciation will be the first pronunciation used.  As
+       a special case, if aMaxPronunciations is set to zero, then only the
+       the default rule pronunciation is used, regardless of the value of
+       aIncludeRulePron.  If aAutoSilence is non-zero, then TIesrFlex will
+       insert optional silence between each word, and at the grammar beginning
+       and ending.  If aAutoSilence is zero, then no silence model is automatically
+       added.
+       
+       The user may manually insert silence using the special words
+       "_SIL*" where * represents a sequence of alphabetic characters, - , or _.
+       (Note: case is important for this special word! It must be "_SIL*", 
+       not "_Sil*" or "_sil*", etc. )  Multiple silence words can be defined,
+       such as "_SIL_A" or _SIL_B".  These will all be interpreted as the
+       _SIL word.  This can be advantageous in tagging when different phrases
+       are recognized.
+       ----------------------------------------------------------------*/
+      Errors ParseGrammar( const char * cfg_string,
+      unsigned int aMaxPronunciations = 1,
+      int aIncludeRulePron = 0,
+      int aAutoSilence = 1 );
+      
+      /*----------------------------------------------------------------
+       DownloadGrammar
+      
+       This function is now just a placeholder for downloading a grammar
+       to a DSP for recognition.  It is not used at this time.
+       ----------------------------------------------------------------*/
+      Errors DownloadGrammar();
+   
+
+      /*----------------------------------------------------------------
+       OutputGrammar
+
+       Output HMMs and grammar network to a set of files in a directory.
+       You may choose to output byte HMM mean or variance vectors, if the
+       loaded HMM data contained short word mean and variance data.
+       ----------------------------------------------------------------*/
+      Errors OutputGrammar( char *aDirName,
+              int aByteMeans=1, int aByteVars=1, int aOptimize = 0  );
+
+
+      enum ErrorCodes { OK, FAIL };
+      enum ExceptionCodes { STATUS_FAIL_PARSE = 0xE0000001 };
+
+
+   private:
+
+
+      // The one and only special "word" for placing the silence model
+      // manually within the grammar.
+      static char const *const SIL;
+
+
+      // Private constants used in the processing of a grammar within
+      // the TIesrFlex class.  It would be better to be able to
+      // specify and allocate sizes dynamically.
+
+
+      // Increased values to expand capabilities for SIND
+
+      // Now implemented to dynamically allocate TOKEN_ALLOC char* pointers
+      // at a time.  Tokens are no longer kept in a static array of words,
+      // but are dynamically stored by malloc within yylex.
+      //static const int MAX_TOKEN = 1024;
+      static const int TOKEN_ALLOC = 20;
+
+      // Maximum nodes in the grammar
+      // static const int  MAX_NODE = 1024;
+      // Now implemented to dynamically allocate NODE_ALLOC node structures
+      // at a time
+      static int const NODE_ALLOC = 20;
+
+      // Maximum number of rules in the grammar
+      // static const int  MAX_RULE =  128;
+      // Now implemented to dynamically allocate RULE_ALLOC rule structures
+      // at a time
+      static const int RULE_ALLOC = 5;
+
+      // Now implemented to dynamically allocate SENTNODE_ALLOC
+      // Sentnode structures at a time.  Each Sentnode structure has
+      // an array that specifies which Sentnodes the Sentnode may next
+      // transition to.  This is also dynamically allocated now by
+      // expanding the array by SENTNODENEXT_ALLOC entries at a time.
+      // static const int MAX_SENTNODE = 1024;
+      static const int SENTNODE_ALLOC = 20;
+      static const int SENTNODENEXT_ALLOC = 10;
+
+      // Now implemented to dynamically allocate WORD_ALLOC word array elements
+      // at a time.
+      // static const int MAX_WORD = 1024;
+      static const int WORD_ALLOC = 20;
+
+      // Maximum number of characters in a word, including +N and \0
+      static const int MAX_WORDLEN = 32;
+
+      typedef char Word_t[MAX_WORDLEN];
+
+      // Now implemented to dynamically allocate SENTTRAN_ALLOC structures
+      // at a time.
+      // static const int MAX_SENTTRAN = 1024;
+      static const int SENTTRAN_ALLOC = 20;
+
+      // Now implemented to dynamically allocate SENTTRAN_ALLOC structures
+      // at a time.
+      // static const int MAX_DEPEND = 32;
+      static const int DEPEND_ALLOC = 10;
+
+      // Now implemented to dynamically allocate HMM_ALLOC structures
+      // at a time.
+      // static const int MAX_HMM = 4096;
+      static int const HMM_ALLOC = 50;
+
+      // context-expanded HMM
+      // static const int MAX_SYM = 1024;
+      // static const int MAX_SYM = 5000;
+      // Now implemented to dynamically allocate SYM_ALLOC structures
+      // at a time.
+      static int const SYM_ALLOC = 200;
+
+      // Next lists withing Sentnode and Symbol structures are now
+      // dynamically allocated
+      // static const int  MAX_NEXT = 256;
+      static int const NEXT_ALLOC = 5;
+            
+      // string lengths - no longer used
+      // static const int MAX_STR = 256;
+
+      // specific code value used in grammar parsing
+      static const int MCODE = 65534;
+
+      // used for tree processing
+      // static const int MAX_PHONE = 100;
+
+      // Maximum number of phones in a word + 1 (for number of phones) 
+      static const int MAX_PRON = 32;
+
+      // Treenode structure no longer used
+      // static const int MAX_TREENODE = 270;
+
+      // used for gtm clustering
+      // static const int  MAX_STATE = 10;
+
+      // Now dynamic allocation makes these parameters not necessary
+      // static const int  MAX_MEAN = 10000; //32767;  depends on modal, actually 7000 is enough
+      // static const int  MAX_VAR = 10000; //32767;  actually 500 is enough
+      // static const int  MAX_TRAN = 1024;
+      // static const int  MAX_CLUSTER = 10000; //16384; 7000 is enough
+
+
+      // Private structures utilized within the TIesrFlex class
+      // internal functions.
+
+      typedef char Pron_t[MAX_PRON];
+
+      typedef struct gnod
+      {
+         char   *name;
+         int    next;
+         int    paranext;
+         int    flag;
+      } Gnode;
+
+      
+      typedef struct grul
+      {
+         char  *name;
+         int   node;
+      } Grule;
+      
+      
+      typedef struct snttrn
+      {
+         int   src;
+         int   dst;
+         int   type;
+         int   next;
+      } Senttran;
+
+
+      typedef struct sntnd
+      {
+         int    node;              /* Grammar node index corresponding to this Sentnode */
+         int    tran;              /* 1 based, 0 means NULL */
+         int    stop;              /* stop node? */
+         int    flag;              /* to support GMHMM net format */
+         int    n_next;
+         int    *next;
+         int    nextMax;
+      } Sentnode;
+
+
+      typedef struct symnd
+      {
+         int   hmm;               /* sym map to hmm, many to one */
+         int   word;              /* word end sym has a word index, otherwise MCODE */
+         int   n_next;            /* # of sym that follows this sym */
+         int   *next;
+         int   nextMax;
+      } Symnode;
+
+
+      typedef struct hmmtb
+      {            /* hmm's center, left, right monophone index */
+         int   c;
+         int   l;
+         int   r;
+      } Hmmtbl;
+      
+
+      typedef struct dpnd
+      {
+         int   referenced;
+         int   referencing;
+      } Depend;
+
+
+      // Treenode structure no longer used.  Decision tree parsing now
+      // is done directly using encoded tree data in memory.
+      // These structures are used within the question list processing
+      // to develop the triphones.  Eventually, they should be moved
+      // to a separate question tree processing class.
+      /*
+      typedef struct tree_node
+      {
+           int   qs_frame;
+           struct tree_node *yes;
+           struct tree_node *no;
+      } Treenode;
+      */
+
+      /* model structure.  Model indices are zero based */
+      typedef struct model_node
+      {
+         int c;      /* center model */
+         int l;      /* left model */
+         int r;      /* right model */
+         int s;      /* state index, 0 1 2 3 ... */
+      } Modelnode;
+
+   
+   private:
+
+      // Private TIesrFlex implementing functions 
+
+
+      // Dynamic structure array allocation support for parsing
+      void* ExpandArray( void* aArray, int aItemSize, int aNumAlloc, int* aNumInArray );
+
+      // file input - for device, data would be in ROM.
+      // we would just want to get pointers to data
+      int read_config( char *fname );
+      int read_scale( char *fname );
+      int read_sil( char *fname );
+      int read_gconst( char *fname );
+      int read_var( char *fname );
+      int read_mean( char *fname );
+      int read_fxcloff( char *fname );
+      int read_fxclust( char *fname );
+      int read_weight(char *fname); // incorporate  VQbased weight quantization method
+      int read_fxtroff( char *fname );
+      int read_fxtran( char *fname );
+      int read_treetbl( char *fname );
+      int read_tree( char *fname );
+      int read_qstbl( char *fname );
+      int read_qs( char *fname );
+      //************************************************************************
+      //added to facilitate mean quantization
+      int makemean(char * dirname);
+   
+      //********************************************************************
+      // If codebook data loaded to memory, this will remove allocation
+      void free_codebook();
+
+      // priviate functions to implement grammar/model creation
+
+      // initialize a grammar parse
+      void init();
+   
+      // The yacc parser - I actually used GNU 'bison' to derive the C code
+      int yyparse();
+      void __yy_memcpy (char *to, char *from, unsigned int count);
+
+      //int yylex(int *yylval);
+      int yylex(long *yylval);
+
+      void yyerror(const char *msg);
+      int yywrap();
+      
+      // support functions
+      int output_int16( FILE *fp, int i32 );
+      int output_sym( FILE * fp, int hmm_code, int word_code, int n_next, int *next );
+      int download_gtm();
+      int download_hmm2phone();
+      int download_net();
+      void process_grammar();
+      void check_one_start_rule();
+      void check_cyclic_grammar();
+      void check_unreferenced();
+      void create_dependency_list();
+      void create_hmm();
+      void add_hmm_entry(int c, int l, int r);
+      int find_hmm_idx(int c, int l, int r);
+      void expand_sym_net(int  n_next, int  *next, char *buf, int  phone_or_word);
+      void construct_sym_name(char *buf, int sym_code, int phone_or_word );
+      int is_end_sym( int sym_code );
+      void create_sym_net( int aSentNode );
+      int create_sym(int hmm_code, int word_code, int n_next, int *next);
+
+#ifdef TIESRFLEXDEBUG
+      void expand_fsa2(int aSentNode, char *buf);
+      void expand( int aNode, char *buf);
+#endif
+
+      void create_all_trans( int aNode );
+      void connect_all_trans();
+      void expand_all_trans( int aNode );
+      void skip_empty_node( int src, int aNode );
+      void create_tran(int src, int dst, int type, int next);
+      int find_word_idx( char *s );
+      int find_sentnode_idx( int aNode );
+      void check_parallel_node( int aNode );
+      void not_in_sentnode_list( int aNode );
+      void create_word_list( int aNode );
+      void add_word( const char *s );
+      void create_sentnode_list( int aNode );
+      void traverse_and_add_sentnode( int aNode );
+      void add_sentnode( int aNode );
+      int substitute_nonterm( int aNode, int aRule );
+      int referenced(char *name, int aNode );
+      int referenced_sub(char *name, int aNode );
+      int referencing( int idx );
+      void replace_old_with_new( int aOldNode, int aNewNode );
+      int create_rule( char *nonterm, int aNode );
+      int duplicate_node_net( int aNode );
+      int duplicate_node_net_copy( int aNode );
+      void clear_sentnode_visit_flag();
+      void clear_visit_flag();
+
+      // Clear visit flags for a node network starting at aNode
+      void ClearNodeNetFlags( int aNode );
+
+      void attach_at_para_end( int aNode1, int aNode2 );
+      void attach_at_para_end_tree( int aNode1, int aNode2 );
+      void attach_at_end( int aNode1, int aNode2 );
+      void attach_at_end_sub( int aNode1, int aNode2 );
+      int create_node(char *name, int aNextNode, int aParaNextNode, int flag);
+      int process_optional( int aNode );
+      int output_gtm( char *dirname );
+      int output_hmm2phone( char *dirname );
+      int output_net( char *dirname, char* filename );
+      int process_one_cluster( int idx);
+      int find_idx_idx( int *list, int *n_list, int max, int idx, int *new_idx);
+      int process_one_hmm( int n_state, int idx, short *cluster );
+
+      /*
+       No longer used, since tree parsing occurs directly using encoded
+       decision tree data loaded in memory.
+       int classify( Treenode *node, Modelnode *model, int *phnidx );
+       int create_tree_node( int is_leaf, int value, Treenode **pptnode );
+       int build_tree( Treenode **pptnode );
+       */
+
+      int get_cluster_idx( int c, int l, int r, int s, int gender, int *index );
+      int yes_to_question( Modelnode const* model, int qs );
+      void demand( int condition, char *msg );
+      // functions to convert from 16-bit to 8-bit features
+      int model_bit_16_to_8( char *source_dir, char *dest_dir, short endien, short add_mean_vec, 
+                            int aByteMeans, int aByteVars);
+      short load_n_mfcc( char *fname );
+      short * load_16( char *fname, short n_mfcc, short *nbr);
+      void add_mean(short *vec, int n_mfcc, int nbr);
+      int output_obs(short obs[], short size, int n_dim, int n_mfcc, short max_scale[], char fname[]);
+      void calc_max(short mu[], int nbr, int n_dim, int n_mfcc, short max_mu[]);
+      void scale_max(short max_mu[], int n_mfcc, int n_dim);
+      int write_vec(short *vec, short nbr, FILE *fp);
+      int output_word( short value, FILE *fp );
+      void vector_packing(short v_in[], unsigned short v_out[], short max_scale[], short D);
+      short nbr_coding(short o_mu, short max_mu, int prt);
+      int save_scales(char *fname, short scale[], short n_dim);
+
+      // Handling for byte/word feature outputs
+      int load_scales(char *fname, short scale[], short n_dim);
+      int output_feature_vector( FILE* fp, void *aFeatures, 
+                                unsigned int aIndex, int aByteFeatureVector );
+      int output_config( const char* aDirName, short aByteMeans, short aByteVars );
+
+
+      // Functions for implementing multiple pronunciations
+
+      // This function adds multiple pronunciations to the fsa2 grammar
+      // network created by yyparse and process_grammar.  The multiple
+      // pronunciations are determined by the dictionary.  Class member
+      // variables define if the default rule pronunciation is a valid
+      // pronunciation, and specify the maximum number of pronunciations
+      // allowed for a word.
+      Errors AddMultiplePronunciations( );
+
+
+      // This function looks up the pronunciation of the first, that is,
+      // the base word, for each word in the grammar.  A
+      // word may be a simple character string, or it may be a character
+      // string with a suffix "+N" indicating that this is one of several
+      // multiple pronunciations desired.  A base word will not have the
+      // "+N" suffix. The function uses class member variables to determine
+      // how to interpret the word and puts the pronunciation for the word in aPron.
+      // The reason for distinguishing between base words and multi-pronunciation
+      // words is that the lookup of pronunciations is faster if the
+      // pronunciation of the base word is looked up followed immediately
+      // by looking up pronunciations of all multi-pronunciations of the same word.
+      Errors LookupBasePronunciation( const char* aWord, char* aPron );
+
+
+      // This function looks up the pronunciation of multi-pronunciation
+      // words following the lookup of the base word pronunciation. This function
+      // must only be called after calling LookupBasePronunciation for the base
+      // word.   Multipronunciation words for a base word consist of the 
+      // character string for the base word with an additional suffix
+      // string "+N" indicating that this is one of several
+      // multiple pronunciations for the base word.  This function should be
+      // called for each N in order, following the lookup of the base pronunciation
+      // word.  If the multi-word does not match the base word, this function
+      // returns with a status indicating the mismatch.  Also, if the "+N" is out
+      // of order, this function will return status indicating the lack of order.
+      Errors LookupMultiPronunciation( const char* aWord, const char* aMultiWord, char* aPron );
+
+
+      // Helper function that frees data structures created during parse and model output.
+      void FreeGrammarData( void );
+
+      // Helper function that adds integers to an integer list
+      void AddNext( int **aList, int *aNumUsed, int *aNumMax, int aNumToAdd, int* aAddList );
+
+
+      // New functions for processing the acoustic decision trees.
+      // These functions implement processing the decision tree
+      // directly without constructing a tree structure in memory.
+      int ParseTree( Modelnode const* aModel, short const* aTopTreeNode, 
+                    int* aClusterIndex );
+
+      short const* SkipToNoNode( short const* aYesTreeNode );
+
+      short const* DescendQuestionNode( short const* aQuestionNode );
+
+
+      // WCE compatibility functions
+      int myisalpha( int c);
+      void rewind( FILE *fp );
+
+#ifdef OFFLINE_CLS
+      short LoadVQHMM(const char* dirname);
+      short SaveVQHMM(const char* dirname);
+      void  FreeVQHMM();
+#endif
+  
+   private:
+
+      // class variables
+
+      unsigned int m_parseFail;
+   
+      // TIesrDict object pointer used to determine phonetic
+      // pronunciation of words in grammar.  The CTIesrFlex class
+      // contains a CTIesrDict class via this pointer.
+      CTIesrDict *m_dict;
+
+      // Output format should be little endian
+      int little_endian;
+
+      // Number of monophones in dictionary
+      int n_phone;
+   
+   
+      // Variables defining configuration of input acoustic decision
+      // tree and HMM information.  This should be normally obtained 
+      // from the fxconfig.bin file.
+
+      // Flag, input data is monophone with no acoustic decision trees
+      int m_bInputMonophone;
+
+      // Number of total features (static + delta + acc)
+      int m_inputFeatDim;
+
+      // Number of static features
+      int m_inputStaticDim;
+
+      // Flag, input feature mean elements are in bytes
+      int m_bInputByteMeans;
+
+      // Flag, input feature inverse variance elements are in bytes
+      int m_bInputByteVars;
+      
+      //Flag, input weight vectros are in bytes
+      int m_bInputByteWgts;
+
+          //Flag, the type of vector configureation that is used
+      int m_bInputWeightConfig;
+
+          //flag ,enable byte packing mode in fxclust.cb
+          //the wt_index and the number of mixtures
+      int m_bPackWtNmix;
+      
+      // Flag, input mean vectors are mean normalized and needs mean added
+      int m_bInputCMN;
+   
+      // Flag, data is in little endian format
+      int m_bInputLittleEndian;
+
+      // Number of "genders" or hmm model sets in data
+      int m_inputSets;
+
+      // Flag, gender-dependent transitions
+      int m_bInputGDTrans;
+   
+      // Flag, gender-dependent trees
+      int m_bInputGDTrees;
+      
+
+
+      // Context sensitive phonetic HMM database information
+      // Would be pointers to locations in Flash in embedded device
+      // Loaded from files in this implementation.
+      char * qs_base;
+      int * qs_offset;
+      short * tree_base;
+      int * treetbl_base;
+
+      short * tran_base;
+      int * tranoffset_base;
+      int m_numTrans;
+      int m_maxStates;
+
+      short * weight_base;
+      int m_numWeights;
+      short m_lengthWtVec;
+      
+      void * mean_base;
+      int   m_numMeans;
+        
+      void * var_base;
+      int  m_numVars;
+
+      short * gconst_base;
+
+      short * scale_base;
+
+      short * cluster_base;
+
+      int * clusteroffset_base;
+      int m_numClusters;
+
+      short sil_n_state;
+      short * sil_hmm;
+      
+      // variables and static constant tables for grammar yy parsing
+      // The grammar parser is derived from yacc and lex source code
+      // and is used within the CGrammar class.
+      
+      char * cfg_char;
+      char * cfg;
+     
+      static const short yycheck[];
+      static const short yytable[];
+      static const short yypgoto[];
+      static const short yydefgoto[];
+      static const short yydefact[];
+      static const short yyr2[];
+      static const short yyr1[];
+      static const char yytranslate[];
+      static const short yypact[];
+   
+   
+      // variables for grammar creation
+      int hmm_idx;
+      int sym_idx;
+      int word_idx;
+      int depend_idx_save;
+      int depend_idx;
+      int senttran_idx;
+      int sentnode_idx;
+      int rule_idx;
+      int node_idx;
+      int n_stop_next;
+      
+      // Statically allocated array variables for grammar creation.
+      // Could we create these on heap for duration of parsing,
+      // then delete all except those necessary to download the
+      // grammar?  It would be nice to keep parsed grammar around,
+      // so it could be reloaded without parsing again, if desired.
+      char start_name[ MAX_WORDLEN ];
+
+      // Dynamically allocate words now.
+      Word_t *word;
+      int m_wordMax;
+
+      
+      // Token is now an array that dynamically keeps track of the 
+      // tokens that need to be freed
+      char** token;
+      int token_idx;
+      int m_tokenMax;
+
+      // Dynamically allocate stop_next array now
+      int *stop_next;
+      int m_stopMax;
+  
+      // Dynamically allocate nodes now.
+      // Gnode node[MAX_NODE];
+      Gnode *node;
+      int m_nodeMax;
+
+      // Dynamically allocate rules now.
+      // Grule rule[MAX_RULE];
+      Grule *rule;
+      int m_ruleMax;
+
+      // Dynamically allocate sentnodes now.
+      Sentnode *sentnode;
+      int m_sentnodeMax;
+
+      // Dynamically allocate senttran now.
+      Senttran *senttran;
+      int m_senttranMax;
+
+      // Dynamically allocate dependencies now
+      Depend *depend;
+      int m_dependMax;
+
+      // Dynamically allocated HMM table entries
+      Hmmtbl *hmm;
+      int m_hmmMax;
+
+      // Dynamically allocated Symbols which are grammar context-expanded HMMs
+      Symnode *sym;
+      int m_symMax;
+
+      // These are global variables that are used in output_gtm and
+      // its related functions.  At some time in the future, these
+      // variables should be dynamically created within output_gtm,
+      // and deleted after use.  There is no reason to keep them
+      // around when not outputting a grammar.
+
+      // Now managed by dynamic allocation
+      // int   mean_idx[ MAX_MEAN ];
+      int   *mean_idx;
+      int   mean_idx_cnt;
+      int   *mean_idx_aug;
+
+      // Now managed by dynamic allocation
+      // int   var_idx[ MAX_VAR ];
+      // int   *var_idx;
+      int   var_idx_cnt;
+      int   *var_idx_aug;
+
+
+      // Now managed by dynamic allocation
+      // int   cluster_idx[ MAX_CLUSTER ];
+      // Now cluster_idx not used
+      // int   *cluster_idx;
+      // int   cluster_offset[ MAX_CLUSTER ];
+      int  *cluster_offset;
+      int   cluster_idx_cnt;
+      int  *cluster_idx_aug;
+
+      // Now managed by dynamic allocation
+      // tran_idx array is not used
+      // int   tran_idx[ MAX_TRAN ];
+      // int   *tran_idx;
+      // int   tran_offset[ MAX_TRAN ];
+      int   *tran_offset;
+      int   tran_idx_cnt;
+      int   *tran_idx_aug;
+
+      int   net_size;
+
+
+#ifdef OFFLINE_CLS
+      /* vector-quantized mean vector information */
+      short *pROM2Cls; /* pointer to ROM to cluster mapping table */
+      short vq_n_cs; /* number of clusters */
+      short vq_nbr_dim; /* dimension of centroid */
+      short *vq_centroid; /* centroid */
+#endif
+
+      FILE  *fp_hmm;
+      FILE  *fp_mean;
+      FILE  *fp_var;
+      FILE  *fp_tran;
+      FILE  *fp_pdf;
+      FILE  *fp_mixture;
+      FILE  *fp_gconst;
+
+      // These are global variables associated with processing
+      // output_gtm that are part of the tree processing.  
+
+      // Treenode structure not used any longer, since parsing of the 
+      // tree is performed directly on the encoded tree in memory.
+      // tree structure
+      // Treenode tree[ MAX_TREENODE ];
+
+      // short count converted into short pointer
+      // short *tree_offset;
+      // int   cur_node;
+
+      // Variable to hold autosilence option;
+      int m_bAutoSilence;
+
+      // Variables that define multiple pronunciation options that are in effect
+      int m_bIncludeRulePron;
+      unsigned int m_maxPronunciations;
+
+      // word_idx prior to adding multiple pronunciations
+      int m_baseWordIndex;
+
+      // Variable to verify sequence of next multi-pronunciation word
+      int m_multiCount;
+
+      // Pointer to struct that holds pronunciations
+      Pron_t* m_wordProns;
+
+};
+
+
+#endif // _TIESRFLEX_H
diff --git a/TIesrFlex/src/TIesrFlexLocal.h b/TIesrFlex/src/TIesrFlexLocal.h
new file mode 100644 (file)
index 0000000..9566c02
--- /dev/null
@@ -0,0 +1,134 @@
+/*=======================================================================
+ TIesrFlexLocal.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+ This header contains a few constants used in TIesrFlex class that
+ are not used to declare structure sizes of member variables.
+
+======================================================================*/
+
+/*----------------------------------------------------------------
+  TIesrFlexLocal.h
+
+  This header contains a few constants used in TIesrFlex class that
+  are not used to declare structure sizes of member variables.
+
+  ----------------------------------------------------------------*/
+#ifndef _TIESRFLEXLOCAL_H
+#define _TIESRFLEXLOCAL_H
+
+
+//--------------------------------
+// Defined function macros 
+//
+#define   MAX(a,b)  ((a) > (b) ? (a): (b))
+#define   MIN(a,b)  ((a) < (b) ? (a): (b))
+#define long2short(x) (short)(MIN(MAX(x, -32768),32767)) /* clip */
+
+
+
+//--------------------------------
+//  Constants
+
+// Mean vector to add
+static short mean_bias[] = {14951, -2789, -811, 1563, -3013, -1346, 973, -884, 355, -496}; 
+
+// The prefix representing special silence words, used to
+// manually insert silence words within the grammar.
+char const *const CTIesrFlex::SIL = "_SIL";
+
+
+//--------------------------------
+// These are the arrays for executing parsing of the ascii input string
+// according to the parser.
+
+// yy parser token number defines needed
+static const int       START  = 257;
+static const int       NAME   = 258;
+static const int       ARROW  = 259;
+static const int       LPRN   = 260;
+static const int       RPRN   = 261;
+static const int       RBKT   = 262;
+static const int       LBKT   = 263;
+static const int       VBAR   = 264;
+static const int       PERIOD = 265;
+
+
+// yy parser  static table variables
+const char CTIesrFlex::yytranslate[] = {     0,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
+7,     8,     9,    10,    11
+};
+
+const short CTIesrFlex::yyr1[] = {     0,
+12,    12,    13,    13,    14,    15,    15,    15,    16,    16,
+17,    17
+};
+
+const short CTIesrFlex::yyr2[] = {     0,
+5,     6,     1,     2,     4,     1,     3,     3,     1,     2,
+1,     3
+};
+
+const short CTIesrFlex::yydefact[] = {     0,
+0,     0,     0,     0,     1,     0,     2,     3,     0,     4,
+6,     0,     0,     9,    11,     0,     0,     0,    10,     0,
+5,     7,     8,    12,     0,     0,     0
+};
+
+const short CTIesrFlex::yydefgoto[] = {    25,
+7,     8,    14,    15,    16
+};
+
+const short CTIesrFlex::yypact[] = {     4,
+-2,     9,    10,     5,    14,    15,    14,-32768,    -3,-32768,
+-32768,    -3,    -3,-32768,    -3,     1,    -5,     0,-32768,    -3,
+-32768,-32768,-32768,    -3,    19,    21,-32768
+};
+
+const short CTIesrFlex::yypgoto[] = {-32768,
+-32768,    16,   -15,     6,     2
+};
+
+const short CTIesrFlex::yytable[] = {    19,
+11,    22,    12,     2,    20,    13,     1,    23,    19,    20,
+20,    21,     3,    17,    18,     5,     4,     6,    26,     9,
+27,     0,    10,     0,     0,    24
+};
+
+const short CTIesrFlex::yycheck[] = {    15,
+4,     7,     6,     6,    10,     9,     3,     8,    24,    10,
+10,    11,     4,    12,    13,    11,     7,     4,     0,     5,
+0,    -1,     7,    -1,    -1,    20
+};
+
+
+#endif // _TIESRFLEXLOCAL_H
diff --git a/TIesrFlex/src/TestTIesrFlex.cpp b/TIesrFlex/src/TestTIesrFlex.cpp
new file mode 100755 (executable)
index 0000000..ff26a56
--- /dev/null
@@ -0,0 +1,121 @@
+/*=======================================================================
+ TestTIesrFlex.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ Code to test TIesrFlex.
+
+ TestTIesrFlex grammar_string output_dir modelset_dir language [ max_pron include_rule auto_silence little_endian byte_mean byte_var addClosure]
+
+======================================================================*/
+
+#include <TIesrFlex.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+// Prototype for getGrammar
+char* getGrammar( char* aString );
+
+
+// Main program
+int main( int argc, char** argv )
+{
+   CTIesrFlex *flex = new CTIesrFlex();
+   CTIesrFlex::Errors error;
+   
+   int littleEndian = 0;
+   int addClosure = 1;
+
+   if (argc != 5 && argc != 11 && argc != 12 )
+      printf( "Invalid argument set\n" );
+
+   if( argc >= 9 )
+   {
+      littleEndian = atoi( argv[8] );
+   }
+
+   if( argc >= 12)
+   {
+       addClosure = atoi( argv[11] );
+   }
+   // Obtain the grammar string.  The argument may be a string or file name
+   char *gram = getGrammar( (char*)argv[1]);
+
+   printf( "Loading language, grammar, and model data\n");
+   error = flex->LoadLanguage( argv[3], argv[4], "Dict", "Models", littleEndian,
+           addClosure );
+   if( error != CTIesrFlex::ErrNone )
+   {
+       printf( "LoadLanguage error\n");
+       delete( flex );
+       exit(1);
+   }
+
+   printf( "Parsing input grammar\n");
+   if( argc < 8 )
+      error = flex->ParseGrammar( gram );
+   else
+      error = flex->ParseGrammar( gram, atoi(argv[5]), atoi(argv[6]), atoi(argv[7]) );
+
+   if( error != CTIesrFlex::ErrNone )
+   {
+      printf( "Grammar parse error\n" );
+      delete( flex );
+      exit(1);
+   }
+
+   /* Output means and variances in byte or short, no optimization */
+   printf( "Writing out binary grammar network and model files\n");
+   error = flex->OutputGrammar( argv[2], atoi(argv[9]), atoi(argv[10]), 0 );
+   if( error != CTIesrFlex::ErrNone )
+   {
+      printf( "Grammar output error\n" );
+      delete( flex );
+      exit(1);
+   }
+
+   printf( "Grammar network and model files output successfully\n");
+   delete( flex );
+
+   exit(0);
+}
+
+
+/*-----------------------------------------------------------------------------------------------
+ * getGrammar
+ *
+ *This function returns the grammar string.  The input argument may be the string, or a filename
+ *of a file containing the string.  If it is a filename, then this function reads the file and
+ *obtains the string.
+ *---------------------------------------------------------------------------------------------*/
+char* getGrammar( char* aString )
+{
+    FILE *fp;
+    
+    // Try to open the string as a filename, if it fails then assume the 
+    // aString is the grammar string
+    fp = fopen( aString, "r");
+    if( fp == NULL )
+        return ( aString );
+    
+    // Grammar is in a file
+    fseek( fp, 0, SEEK_END );
+    long fLen = ftell( fp );
+    rewind( fp );
+    
+    // Allocate space for grammar string
+    char* gram = (char*)malloc( (fLen+2)*sizeof(char));
+    if( gram == NULL )
+    {
+        fclose(fp);
+        return gram;
+    }
+    
+    // Read string
+    fread( gram, sizeof(char), fLen, fp );
+    fclose(fp);
+    gram[fLen] = '\n';
+    return ( gram );
+    
+}
diff --git a/TIesrSI/ReadMe.txt b/TIesrSI/ReadMe.txt
new file mode 100644 (file)
index 0000000..e1aef25
--- /dev/null
@@ -0,0 +1,57 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+----------------
+
+
+The TIesrSI API is the top-level API that an application designer uses to
+perform speech recognition. It requires that the TIesrFlex API has already been
+used to create a binary grammar network and acoustic model file set. The TIesrSI
+API uses the TIesrEnginecore, TIesrEngineSI, and TIesrFA APIs.
+
+Using the testtiesrsi Program
+-----------------------------
+
+The testtiesrsi program exercises the TIesrSI API. The source of the testtiesrsi
+program provides an illustration of how the TIesrSI API can be used to recognize
+speech. The detailed description of the user API functions supplied by the
+TIesrSI API is found in the TIesrSI_User.h header file. THe command line for the
+program is:
+
+testtiesrsi mem_size grm_dir jac_file sbc_file aud_dev capture_file
+
+mem_size: Working memory size in 2-byte shorts for the recognizer search engine
+grm_dir:  Directory holding binary grammar and model file set from TIesrFlex
+jac_file: Recognizer state file to use. Will be created if it does not exist.
+sbc_file: A binary phone tree file. (Supplied with model data)
+aud_dev:  Audio device, or file, to be used as the audio source
+
+An example of running the testtiesrsi program from the top-level distribution
+directory on a Linux OS is shown below. This program recognizes the grammar and
+model file set created using TIesrFlex. The default example supplied with the
+TIesr distribution recognizes the word "yes", or "no", or "maybe". Successful
+use of the testtiesrsi program requires that you provide speech and say one of
+the three words. To use testtiesrsi, start the program, wait for it to prompt
+for you to speak, and then say one of the words "yes", or "no", or "maybe". 
+
+
+Dist/LinuxReleaseGnu/bin/testtiesrsi \
+    200000 \
+    Data/GramDir \
+    Data/testtiesrsi_linuxgnu.jac \
+    Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin \
+    plughw:0,0 \
+    Data/AudioDir/capture.raw
+
+
+For example, if the word "maybe" is spoken after the "Speak now..." prompt, the
+output will be:
+
+Creating TIesrSI recognizer
+Opening TIesrSI recognizer
+Starting TIesrSI recognizer
+Speak now...
+Stopping TIesrSI recognizer
+Recognized: maybe
+Closing TIesrSI recognizer
+Destroying TIesrSI recognizer
diff --git a/TIesrSI/TIesrSIso/.dep.inc b/TIesrSI/TIesrSIso/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrSI/TIesrSIso/Makefile b/TIesrSI/TIesrSIso/Makefile
new file mode 100755 (executable)
index 0000000..6e57532
--- /dev/null
@@ -0,0 +1,118 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+       if [ ${CONF} == LinuxDebugGnu -o \
+       ${CONF} == LinuxReleaseGnu -o \
+       ${CONF} == ArmLinuxDebugGnueabi -o \
+       ${CONF} == ArmLinuxReleaseGnueabi ]; \
+       then cd ../../Dist/${CONF}/lib; \
+       rm -f libTIesrSI.so; \
+       ln -s libTIesrSI.so.1 libTIesrSI.so; \
+       fi
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrSI/TIesrSIso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrSI/TIesrSIso/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..d08fcae
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lpthread ../../TIesrEngine/TIesrEngineSIso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineSI.so.1 ../../TIesrFA/TIesrFA_ALSAso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFA_ALSA.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrSI.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrSI.so.1: ../../TIesrEngine/TIesrEngineSIso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineSI.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrSI.so.1: ../../TIesrFA/TIesrFA_ALSAso/../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFA_ALSA.so.1
+
+../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrSI.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrSI.so.1 -Wl,--version-script=../resource/TIesrSIso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrSI.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrSI.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -DLINUX -I../../TIesrEngine/src -I../../TIesrFA/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o ../src/TIesrSI.c
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi
+       cd ../../TIesrFA/TIesrFA_ALSAso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrSI.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean
+       cd ../../TIesrFA/TIesrFA_ALSAso && ${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TIesrSIso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrSI/TIesrSIso/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..3a41d06
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lpthread ../../TIesrEngine/TIesrEngineSIso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineSI.so.1 ../../TIesrFA/TIesrFA_ALSAso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFA_ALSA.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrSI.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrSI.so.1: ../../TIesrEngine/TIesrEngineSIso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineSI.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrSI.so.1: ../../TIesrFA/TIesrFA_ALSAso/../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFA_ALSA.so.1
+
+../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrSI.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrSI.so.1 -Wl,--version-script=../resource/TIesrSIso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrSI.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrSI.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -DLINUX -I../../TIesrEngine/src -I../../TIesrFA/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o ../src/TIesrSI.c
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi
+       cd ../../TIesrFA/TIesrFA_ALSAso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrSI.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean
+       cd ../../TIesrFA/TIesrFA_ALSAso && ${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TIesrSIso/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrSI/TIesrSIso/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..1ebd5f2
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lpthread ../../TIesrEngine/TIesrEngineSIso/../../Dist/LinuxDebugGnu/lib/libTIesrEngineSI.so.1 ../../TIesrFA/TIesrFA_ALSAso/../../Dist/LinuxDebugGnu/lib/libTIesrFA_ALSA.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/lib/libTIesrSI.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrSI.so.1: ../../TIesrEngine/TIesrEngineSIso/../../Dist/LinuxDebugGnu/lib/libTIesrEngineSI.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrSI.so.1: ../../TIesrFA/TIesrFA_ALSAso/../../Dist/LinuxDebugGnu/lib/libTIesrFA_ALSA.so.1
+
+../../Dist/LinuxDebugGnu/lib/libTIesrSI.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrSI.so.1 -Wl,--version-script=../resource/TIesrSIso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrSI.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrSI.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -DLINUX -I../../TIesrEngine/src -I../../TIesrFA/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o ../src/TIesrSI.c
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu
+       cd ../../TIesrFA/TIesrFA_ALSAso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/lib/libTIesrSI.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu clean
+       cd ../../TIesrFA/TIesrFA_ALSAso && ${MAKE}  -f Makefile CONF=LinuxDebugGnu clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TIesrSIso/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrSI/TIesrSIso/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..05d8618
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lpthread ../../TIesrEngine/TIesrEngineSIso/../../Dist/LinuxReleaseGnu/lib/libTIesrEngineSI.so.1 ../../TIesrFA/TIesrFA_ALSAso/../../Dist/LinuxReleaseGnu/lib/libTIesrFA_ALSA.so.1
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/lib/libTIesrSI.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrSI.so.1: ../../TIesrEngine/TIesrEngineSIso/../../Dist/LinuxReleaseGnu/lib/libTIesrEngineSI.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrSI.so.1: ../../TIesrFA/TIesrFA_ALSAso/../../Dist/LinuxReleaseGnu/lib/libTIesrFA_ALSA.so.1
+
+../../Dist/LinuxReleaseGnu/lib/libTIesrSI.so.1: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/lib
+       ${LINK.c} -Wl,-znow,-zdefs -Wl,-h,libTIesrSI.so.1 -Wl,--version-script=../resource/TIesrSIso.ver -shared -o ../../Dist/${CND_CONF}/lib/libTIesrSI.so.1 -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrSI.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -DLINUX -I../../TIesrEngine/src -I../../TIesrFA/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o ../src/TIesrSI.c
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu
+       cd ../../TIesrFA/TIesrFA_ALSAso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/lib/libTIesrSI.so.1
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean
+       cd ../../TIesrFA/TIesrFA_ALSAso && ${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TIesrSIso/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrSI/TIesrSIso/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..46a094c
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=../../TIesrEngine/TIesrEngineSIso/../../Dist/WindowsDebugMinGW/libTIesrEngineSI.dll ../../TIesrFA/TIesrFAWinso/../../Dist/WindowsDebugMinGW/libTIesrFAWin.dll
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/libTIesrSI.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrSI.dll: ../../TIesrEngine/TIesrEngineSIso/../../Dist/WindowsDebugMinGW/libTIesrEngineSI.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrSI.dll: ../../TIesrFA/TIesrFAWinso/../../Dist/WindowsDebugMinGW/libTIesrFAWin.dll
+
+../../Dist/WindowsDebugMinGW/libTIesrSI.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.c} -shared -o ../../Dist/${CND_CONF}/libTIesrSI.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrSI.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -DTIESRSI_EXPORTS -DWIN32 -I../../TIesrEngine/src -I../../TIesrFA/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o ../src/TIesrSI.c
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW
+       cd ../../TIesrFA/TIesrFAWinso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/libTIesrSI.dll
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean
+       cd ../../TIesrFA/TIesrFAWinso && ${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TIesrSIso/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrSI/TIesrSIso/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..f8977ef
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=../../TIesrEngine/TIesrEngineSIso/../../Dist/WindowsReleaseMinGW/libTIesrEngineSI.dll ../../TIesrFA/TIesrFAWinso/../../Dist/WindowsReleaseMinGW/libTIesrFAWin.dll
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/libTIesrSI.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrSI.dll: ../../TIesrEngine/TIesrEngineSIso/../../Dist/WindowsReleaseMinGW/libTIesrEngineSI.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrSI.dll: ../../TIesrFA/TIesrFAWinso/../../Dist/WindowsReleaseMinGW/libTIesrFAWin.dll
+
+../../Dist/WindowsReleaseMinGW/libTIesrSI.dll: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.c} -shared -o ../../Dist/${CND_CONF}/libTIesrSI.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TIesrSI.c 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -DTIESRSI_EXPORTS -DWIN32 -I../../TIesrEngine/src -I../../TIesrFA/src -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TIesrSI.o ../src/TIesrSI.c
+
+# Subprojects
+.build-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW
+       cd ../../TIesrFA/TIesrFAWinso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW
+
+# Clean Targets
+.clean-conf: ${CLEAN_SUBPROJECTS}
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/libTIesrSI.dll
+
+# Subprojects
+.clean-subprojects:
+       cd ../../TIesrEngine/TIesrEngineSIso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean
+       cd ../../TIesrFA/TIesrFAWinso && ${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TIesrSIso/nbproject/Makefile-impl.mk b/TIesrSI/TIesrSIso/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..775d764
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TIesrSIso
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrSI/TIesrSIso/nbproject/Makefile-variables.mk b/TIesrSI/TIesrSIso/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..0d45e7a
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=libTIesrSI.dll
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/libTIesrSI.dll
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=libTIesrSIso.so.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/libTIesrSIso.so.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=libTIesrSI.dll
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/libTIesrSI.dll
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=libTIesrSIso.so.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/libTIesrSIso.so.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib
+CND_ARTIFACT_NAME_LinuxDebugGnu=libTIesrSI.so.1
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/lib/libTIesrSI.so.1
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=libTIesrSIso.so.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/libTIesrSIso.so.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib
+CND_ARTIFACT_NAME_LinuxReleaseGnu=libTIesrSI.so.1
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/lib/libTIesrSI.so.1
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=libTIesrSIso.so.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/libTIesrSIso.so.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=libTIesrSI.so.1
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrSI.so.1
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=libTIesrSIso.so.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrSIso.so.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=libTIesrSI.so.1
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrSI.so.1
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=libTIesrSIso.so.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/libTIesrSIso.so.tar
diff --git a/TIesrSI/TIesrSIso/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrSI/TIesrSIso/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..1ed2d7e
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrSI.so.1
+OUTPUT_BASENAME=libTIesrSI.so.1
+PACKAGE_TOP_DIR=libTIesrSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TIesrSIso/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrSI/TIesrSIso/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..1affb04
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrSI.so.1
+OUTPUT_BASENAME=libTIesrSI.so.1
+PACKAGE_TOP_DIR=libTIesrSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TIesrSIso/nbproject/Package-LinuxDebugGnu.bash b/TIesrSI/TIesrSIso/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..d1d92ab
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrSI.so.1
+OUTPUT_BASENAME=libTIesrSI.so.1
+PACKAGE_TOP_DIR=libTIesrSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TIesrSIso/nbproject/Package-LinuxReleaseGnu.bash b/TIesrSI/TIesrSIso/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..8a31050
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/lib/libTIesrSI.so.1
+OUTPUT_BASENAME=libTIesrSI.so.1
+PACKAGE_TOP_DIR=libTIesrSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TIesrSIso/nbproject/Package-WindowsDebugMinGW.bash b/TIesrSI/TIesrSIso/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..3cfa693
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrSI.dll
+OUTPUT_BASENAME=libTIesrSI.dll
+PACKAGE_TOP_DIR=libTIesrSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TIesrSIso/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrSI/TIesrSIso/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..e9412cd
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/libTIesrSI.dll
+OUTPUT_BASENAME=libTIesrSI.dll
+PACKAGE_TOP_DIR=libTIesrSIso.so/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libTIesrSIso.so/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libTIesrSIso.so.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TIesrSIso/nbproject/configurations.xml b/TIesrSI/TIesrSIso/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..d171faf
--- /dev/null
@@ -0,0 +1,434 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrSI.h</itemPath>
+      <itemPath>../src/TIesrSI_User.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+      <itemPath>/speech/release/OpenSource/TIesr/trunk/TIesrSI/resource/TIesrSIso.ver</itemPath>
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TIesrSI.c</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRSI_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRSI_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrSI.dll</output>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrEngine/TIesrEngineSIso"
+                            CT="2"
+                            CN="WindowsDebugMinGW"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrEngine/TIesrEngineSIso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean"
+                            OP="../../Dist/WindowsDebugMinGW/libTIesrEngineSI.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrFA/TIesrFAWinso"
+                            CT="2"
+                            CN="WindowsDebugMinGW"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrFA/TIesrFAWinso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsDebugMinGW clean"
+                            OP="../../Dist/WindowsDebugMinGW/libTIesrFAWin.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRSI_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>TIESRSI_EXPORTS</Elem>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/libTIesrSI.dll</output>
+          <linkerLibItems>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrEngine/TIesrEngineSIso"
+                            CT="2"
+                            CN="WindowsReleaseMinGW"
+                            AC="true"
+                            BL="true"
+                            WD="../../TIesrEngine/TIesrEngineSIso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean"
+                            OP="../../Dist/WindowsReleaseMinGW/libTIesrEngineSI.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrFA/TIesrFAWinso"
+                            CT="2"
+                            CN="WindowsReleaseMinGW"
+                            AC="true"
+                            BL="true"
+                            WD="../../TIesrFA/TIesrFAWinso"
+                            BC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW"
+                            CC="${MAKE}  -f Makefile CONF=WindowsReleaseMinGW clean"
+                            OP="../../Dist/WindowsReleaseMinGW/libTIesrFAWin.dll">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrSI.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibStdlibItem>PosixThreads</linkerLibStdlibItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrEngine/TIesrEngineSIso"
+                            CT="2"
+                            CN="LinuxDebugGnu"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrEngine/TIesrEngineSIso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxDebugGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxDebugGnu clean"
+                            OP="../../Dist/LinuxDebugGnu/lib/libTIesrEngineSI.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrFA/TIesrFA_ALSAso"
+                            CT="2"
+                            CN="LinuxDebugGnu"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrFA/TIesrFA_ALSAso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxDebugGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxDebugGnu clean"
+                            OP="../../Dist/LinuxDebugGnu/lib/libTIesrFA_ALSA.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrSI.so.1 -Wl,--version-script=../resource/TIesrSIso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrSI.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibStdlibItem>PosixThreads</linkerLibStdlibItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrEngine/TIesrEngineSIso"
+                            CT="2"
+                            CN="LinuxReleaseGnu"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrEngine/TIesrEngineSIso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean"
+                            OP="../../Dist/LinuxReleaseGnu/lib/libTIesrEngineSI.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrFA/TIesrFA_ALSAso"
+                            CT="2"
+                            CN="LinuxReleaseGnu"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrFA/TIesrFA_ALSAso"
+                            BC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu"
+                            CC="${MAKE}  -f Makefile CONF=LinuxReleaseGnu clean"
+                            OP="../../Dist/LinuxReleaseGnu/lib/libTIesrFA_ALSA.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrSI.so.1 -Wl,--version-script=../resource/TIesrSIso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrSI.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibStdlibItem>PosixThreads</linkerLibStdlibItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrEngine/TIesrEngineSIso"
+                            CT="2"
+                            CN="ArmLinuxDebugGnueabi"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrEngine/TIesrEngineSIso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean"
+                            OP="../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrEngineSI.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrFA/TIesrFA_ALSAso"
+                            CT="2"
+                            CN="ArmLinuxDebugGnueabi"
+                            AC="false"
+                            BL="true"
+                            WD="../../TIesrFA/TIesrFA_ALSAso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxDebugGnueabi clean"
+                            OP="../../Dist/ArmLinuxDebugGnueabi/lib/libTIesrFA_ALSA.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrSI.so.1 -Wl,--version-script=../resource/TIesrSIso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>../../TIesrEngine/src</pElem>
+            <pElem>../../TIesrFA/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/lib/libTIesrSI.so.1</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibStdlibItem>PosixThreads</linkerLibStdlibItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrEngine/TIesrEngineSIso"
+                            CT="2"
+                            CN="ArmLinuxReleaseGnueabi"
+                            AC="true"
+                            BL="true"
+                            WD="../../TIesrEngine/TIesrEngineSIso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean"
+                            OP="../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrEngineSI.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+            <linkerLibProjectItem>
+              <makeArtifact PL="../../TIesrFA/TIesrFA_ALSAso"
+                            CT="2"
+                            CN="ArmLinuxReleaseGnueabi"
+                            AC="true"
+                            BL="true"
+                            WD="../../TIesrFA/TIesrFA_ALSAso"
+                            BC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi"
+                            CC="${MAKE}  -f Makefile CONF=ArmLinuxReleaseGnueabi clean"
+                            OP="../../Dist/ArmLinuxReleaseGnueabi/lib/libTIesrFA_ALSA.so.1">
+              </makeArtifact>
+            </linkerLibProjectItem>
+          </linkerLibItems>
+          <commandLine>-Wl,-znow,-zdefs -Wl,-h,libTIesrSI.so.1 -Wl,--version-script=../resource/TIesrSIso.ver</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrSI/TIesrSIso/nbproject/private/configurations.xml b/TIesrSI/TIesrSIso/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..a1af2a8
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="2">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrSI/TIesrSIso/nbproject/private/private.properties b/TIesrSI/TIesrSIso/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrSI/TIesrSIso/nbproject/private/private.xml b/TIesrSI/TIesrSIso/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrSI/TIesrSIso/nbproject/project.properties b/TIesrSI/TIesrSIso/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrSI/TIesrSIso/nbproject/project.xml b/TIesrSI/TIesrSIso/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..6de24bc
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>TIesrSIso</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions>c</c-extensions>
+            <cpp-extensions/>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects>
+                <make-dep-project>../../TIesrFA/TIesrFAWinso</make-dep-project>
+                <make-dep-project>../../TIesrEngine/TIesrEngineSIso</make-dep-project>
+                <make-dep-project>../../TIesrFA/TIesrFA_ALSAso</make-dep-project>
+            </make-dep-projects>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesrSI/TestTIesrSI/.dep.inc b/TIesrSI/TestTIesrSI/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesrSI/TestTIesrSI/Makefile b/TIesrSI/TestTIesrSI/Makefile
new file mode 100755 (executable)
index 0000000..524ba36
--- /dev/null
@@ -0,0 +1,111 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesrSI/TestTIesrSI/nbproject/Makefile-ArmLinuxDebugGnueabi.mk b/TIesrSI/TestTIesrSI/nbproject/Makefile-ArmLinuxDebugGnueabi.mk
new file mode 100644 (file)
index 0000000..c08f872
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Tools/ARM/lib -lTIesrSI
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxDebugGnueabi.mk ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrsi
+
+../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrsi: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxDebugGnueabi/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrsi ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrSI.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DLINUX -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o ../src/TestTIesrSI.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxDebugGnueabi
+       ${RM} ../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrsi
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TestTIesrSI/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk b/TIesrSI/TestTIesrSI/nbproject/Makefile-ArmLinuxReleaseGnueabi.mk
new file mode 100644 (file)
index 0000000..323a250
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=arm-none-linux-gnueabi-gcc
+CCC=arm-none-linux-gnueabi-g++
+CXX=arm-none-linux-gnueabi-g++
+FC=
+AS=arm-none-linux-gnueabi-as
+
+# Macros
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Tools/ARM/lib -lTIesrSI
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-ArmLinuxReleaseGnueabi.mk ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrsi
+
+../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrsi: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/ArmLinuxReleaseGnueabi/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrsi ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrSI.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DLINUX -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o ../src/TestTIesrSI.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/ArmLinuxReleaseGnueabi
+       ${RM} ../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrsi
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TestTIesrSI/nbproject/Makefile-LinuxDebugGnu.mk b/TIesrSI/TestTIesrSI/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..2f3b552
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrSI
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/bin/testtiesrsi
+
+../../Dist/LinuxDebugGnu/bin/testtiesrsi: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrsi ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrSI.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DLINUX -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o ../src/TestTIesrSI.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/bin/testtiesrsi
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TestTIesrSI/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesrSI/TestTIesrSI/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..6ffcad0
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v
+CXXFLAGS=-v
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrSI
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/bin/testtiesrsi
+
+../../Dist/LinuxReleaseGnu/bin/testtiesrsi: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/bin
+       ${LINK.cc} -v -o ../../Dist/${CND_CONF}/bin/testtiesrsi ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrSI.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DLINUX -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o ../src/TestTIesrSI.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/bin/testtiesrsi
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TestTIesrSI/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesrSI/TestTIesrSI/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..fa04c45
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF} -lTIesrSI
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/testtiesrsi.exe
+
+../../Dist/WindowsDebugMinGW/testtiesrsi.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.cc} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrsi.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrSI.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -g -Wall -DWIN32 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o ../src/TestTIesrSI.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/testtiesrsi.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TestTIesrSI/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesrSI/TestTIesrSI/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..dbfdc78
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=-v -mno-cygwin
+CXXFLAGS=-v -mno-cygwin
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF} -lTIesrSI
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/testtiesrsi.exe
+
+../../Dist/WindowsReleaseMinGW/testtiesrsi.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.cc} -v -mno-cygwin -o ../../Dist/${CND_CONF}/testtiesrsi.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o: nbproject/Makefile-${CND_CONF}.mk ../src/TestTIesrSI.cpp 
+       ${MKDIR} -p ${OBJECTDIR}/_ext/_DOTDOT/src
+       ${RM} $@.d
+       $(COMPILE.cc) -O2 -Wall -DWIN32 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/_DOTDOT/src/TestTIesrSI.o ../src/TestTIesrSI.cpp
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/testtiesrsi.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesrSI/TestTIesrSI/nbproject/Makefile-impl.mk b/TIesrSI/TestTIesrSI/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..4439d89
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=TestTIesrSI
+
+# Active Configuration
+DEFAULTCONF=WindowsDebugMinGW
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=WindowsDebugMinGW WindowsReleaseMinGW LinuxDebugGnu LinuxReleaseGnu ArmLinuxDebugGnueabi ArmLinuxReleaseGnueabi 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesrSI/TestTIesrSI/nbproject/Makefile-variables.mk b/TIesrSI/TestTIesrSI/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..0bc2fac
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=testtiesrsi.exe
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/testtiesrsi.exe
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=testtiesrsi.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/testtiesrsi.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=testtiesrsi.exe
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/testtiesrsi.exe
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=testtiesrsi.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/testtiesrsi.tar
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin
+CND_ARTIFACT_NAME_LinuxDebugGnu=testtiesrsi
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin/testtiesrsi
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=testtiesrsi.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/testtiesrsi.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin
+CND_ARTIFACT_NAME_LinuxReleaseGnu=testtiesrsi
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin/testtiesrsi
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=testtiesrsi.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/testtiesrsi.tar
+# ArmLinuxDebugGnueabi configuration
+CND_PLATFORM_ArmLinuxDebugGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxDebugGnueabi=testtiesrsi
+CND_ARTIFACT_PATH_ArmLinuxDebugGnueabi=../../Dist/ArmLinuxDebugGnueabi/bin/testtiesrsi
+CND_PACKAGE_DIR_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxDebugGnueabi=testtiesrsi.tar
+CND_PACKAGE_PATH_ArmLinuxDebugGnueabi=dist/ArmLinuxDebugGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrsi.tar
+# ArmLinuxReleaseGnueabi configuration
+CND_PLATFORM_ArmLinuxReleaseGnueabi=arm-none-linux-gnueabi-Linux-x86
+CND_ARTIFACT_DIR_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin
+CND_ARTIFACT_NAME_ArmLinuxReleaseGnueabi=testtiesrsi
+CND_ARTIFACT_PATH_ArmLinuxReleaseGnueabi=../../Dist/ArmLinuxReleaseGnueabi/bin/testtiesrsi
+CND_PACKAGE_DIR_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package
+CND_PACKAGE_NAME_ArmLinuxReleaseGnueabi=testtiesrsi.tar
+CND_PACKAGE_PATH_ArmLinuxReleaseGnueabi=dist/ArmLinuxReleaseGnueabi/arm-none-linux-gnueabi-Linux-x86/package/testtiesrsi.tar
diff --git a/TIesrSI/TestTIesrSI/nbproject/Package-ArmLinuxDebugGnueabi.bash b/TIesrSI/TestTIesrSI/nbproject/Package-ArmLinuxDebugGnueabi.bash
new file mode 100644 (file)
index 0000000..04b8d26
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxDebugGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrsi
+OUTPUT_BASENAME=testtiesrsi
+PACKAGE_TOP_DIR=testtiesrsi/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrsi/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TestTIesrSI/nbproject/Package-ArmLinuxReleaseGnueabi.bash b/TIesrSI/TestTIesrSI/nbproject/Package-ArmLinuxReleaseGnueabi.bash
new file mode 100644 (file)
index 0000000..4e87a58
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=arm-none-linux-gnueabi-Linux-x86
+CND_CONF=ArmLinuxReleaseGnueabi
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrsi
+OUTPUT_BASENAME=testtiesrsi
+PACKAGE_TOP_DIR=testtiesrsi/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrsi/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TestTIesrSI/nbproject/Package-LinuxDebugGnu.bash b/TIesrSI/TestTIesrSI/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..2afecea
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrsi
+OUTPUT_BASENAME=testtiesrsi
+PACKAGE_TOP_DIR=testtiesrsi/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrsi/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TestTIesrSI/nbproject/Package-LinuxReleaseGnu.bash b/TIesrSI/TestTIesrSI/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..73ed858
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/testtiesrsi
+OUTPUT_BASENAME=testtiesrsi
+PACKAGE_TOP_DIR=testtiesrsi/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrsi/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TestTIesrSI/nbproject/Package-WindowsDebugMinGW.bash b/TIesrSI/TestTIesrSI/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..e2fe347
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrsi.exe
+OUTPUT_BASENAME=testtiesrsi.exe
+PACKAGE_TOP_DIR=testtiesrsi/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrsi/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TestTIesrSI/nbproject/Package-WindowsReleaseMinGW.bash b/TIesrSI/TestTIesrSI/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..1ae0a48
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/testtiesrsi.exe
+OUTPUT_BASENAME=testtiesrsi.exe
+PACKAGE_TOP_DIR=testtiesrsi/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/testtiesrsi/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testtiesrsi.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesrSI/TestTIesrSI/nbproject/configurations.xml b/TIesrSI/TestTIesrSI/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..df8ff6c
--- /dev/null
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>../src/TestTIesrSI.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>../src/TestTIesrSI.cpp</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrsi.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrSI</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <preprocessorList>
+            <Elem>WIN32</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/testtiesrsi.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrSI</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrsi</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrSI</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrsi</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrSI</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrsi</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+            <pElem>${CND_BASEDIR}/../../Tools/ARM/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrSI</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>arm-none-linux-gnueabi|Unknown</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <preprocessorList>
+            <Elem>LINUX</Elem>
+          </preprocessorList>
+          <warningLevel>2</warningLevel>
+        </ccTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/testtiesrsi</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+            <pElem>${CND_BASEDIR}/../../Tools/ARM/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrSI</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrSI/TestTIesrSI/nbproject/private/configurations.xml b/TIesrSI/TestTIesrSI/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..c2ecc50
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>2</defaultConf>
+  <confs>
+    <conf name="WindowsDebugMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>200000 ../../Data/GramDir  ../../Data/testtiesrsi_win.jac ../../Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin WINMM ../../Data/AudioDir/capture.raw</args>
+        <rundir></rundir>
+        <buildfirst>false</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+        <profileOnRun>false</profileOnRun>
+      </gizmo_options>
+      <runprofile version="5">
+        <args>200000 ../../Data/GramDir  ../../Data/testtiesrsi_win.jac ../../Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin WINMM ../../Data/AudioDir/capture.raw</args>
+        <rundir></rundir>
+        <buildfirst>false</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxDebugGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>200000 ../../Data/GramDir  ../../Data/testtiesrsi_linuxgnu.jac ../../Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin plughw:0,0 ../../Data/AudioDir/capture.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>200000 ../../Data/GramDir  ../../Data/testtiesrsi_linuxgnu.jac ../../Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin plughw:0,0 ../../Data/AudioDir/capture.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxDebugGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>200000 ../../Data/GramDir  ../../Data/testtiesrsi.jac ../../Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin plughw:0,0 ../../Data/AudioDir/capture.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="ArmLinuxReleaseGnueabi" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>200000 ../../Data/GramDir  ../../Data/testtiesrsi.jac ../../Data/OffDT_GenDict_PhbVR_LE_MQ/English/hlrtree.bin plughw:0,0 ../../Data/AudioDir/capture.raw</args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesrSI/TestTIesrSI/nbproject/private/private.properties b/TIesrSI/TestTIesrSI/nbproject/private/private.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrSI/TestTIesrSI/nbproject/private/private.xml b/TIesrSI/TestTIesrSI/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesrSI/TestTIesrSI/nbproject/project.properties b/TIesrSI/TestTIesrSI/nbproject/project.properties
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/TIesrSI/TestTIesrSI/nbproject/project.xml b/TIesrSI/TestTIesrSI/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..8037167
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://www.netbeans.org/ns/project/1">\r
+    <type>org.netbeans.modules.cnd.makeproject</type>\r
+    <configuration>\r
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">\r
+            <name>TestTIesrSI</name>\r
+            <make-project-type>0</make-project-type>\r
+            <c-extensions/>\r
+            <cpp-extensions>cpp</cpp-extensions>\r
+            <header-extensions>h</header-extensions>\r
+            <sourceEncoding>UTF-8</sourceEncoding>\r
+            <make-dep-projects/>\r
+        </data>\r
+    </configuration>\r
+</project>\r
diff --git a/TIesrSI/resource/TIesrSIso.ver b/TIesrSI/resource/TIesrSIso.ver
new file mode 100644 (file)
index 0000000..23c48a5
--- /dev/null
@@ -0,0 +1,23 @@
+TXN_1.1 {  
+       global:
+               # TIesrSI.o
+               TIesrSI_close;
+               TIesrSI_confidence;
+               TIesrSI_create;
+               TIesrSI_destroy;
+               TIesrSI_frmcount;
+               TIesrSI_getparams;
+               TIesrSI_nbcount;
+               TIesrSI_open;
+               TIesrSI_score;
+               TIesrSI_setparams;
+               TIesrSI_start;
+               TIesrSI_status;
+               TIesrSI_stop;
+               TIesrSI_volume;
+               TIesrSI_wdcount;
+               TIesrSI_word;
+   
+        local: 
+                * ;
+};
\ No newline at end of file
diff --git a/TIesrSI/src/TIesrSI.c b/TIesrSI/src/TIesrSI.c
new file mode 100755 (executable)
index 0000000..0f01501
--- /dev/null
@@ -0,0 +1,1582 @@
+/*=======================================================================
+ TIesrSI.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This source contains the code necessary to implement the TIesrSI API
+ as defined in TIesrSI_User.h, running the recognition as a
+ separate thread.  TIesrSI utilizes the TIesrFA API for audio input
+ and the TIesr Engine SI API for recognition.
+
+======================================================================*/
+
+/* Windows OS specific includes */
+#if defined (WIN32) || defined (WINCE)
+#include <windows.h>
+#endif
+
+/* Standard C operations */
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(LINUX)
+#include <errno.h>
+#endif
+
+/* 
+This contains the TIesrFA API and TIesr Engine SI API headers,
+as well as the TIesrSI_User header.
+*/
+#include "TIesrSI.h"
+
+/* Posix compliant implementation of some C Run-time library functions */
+#if defined (WIN32) || defined (WINCE)
+#define strdup  _strdup
+#endif
+
+
+#if defined( WIN32 ) || defined( WINCE )
+/* Define entry point for the TIesrSI API DLL */
+BOOL APIENTRY DllMain( HANDLE hModule, 
+                      DWORD  ul_reason_for_call, 
+                      LPVOID lpReserved
+                      )
+{
+   switch (ul_reason_for_call)
+   {
+   case DLL_PROCESS_ATTACH:
+   case DLL_THREAD_ATTACH:
+   case DLL_THREAD_DETACH:
+   case DLL_PROCESS_DETACH:
+      break;
+   }
+   return TRUE;
+}
+#endif
+
+
+
+/*----------------------------------------------------------------
+TIesrSI_create
+
+This function creates and initializes an instance of the TIesrSI recognizer,
+which is encapsulated in the TIesrSI_Object.
+----------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_create( TIesrSI_t* aPtrToTIesrSI )
+{
+   TIesrSI_t aTIesrSI;
+
+   /* Allocate memory for the TIesr object */
+   *aPtrToTIesrSI = (TIesrSI_Object_t*)malloc( sizeof(TIesrSI_Object_t) );
+   if( *aPtrToTIesrSI == NULL )
+   {
+      return TIesrSIErrNoMemory;
+   }
+   else
+   {
+      aTIesrSI = *aPtrToTIesrSI;
+   }
+
+#if defined (TIESRSI_DEBUG_LOG)
+   aTIesrSI->threadfp = NULL;
+
+   aTIesrSI->logfp = fopen(LOGFILE, "w" );
+   if( aTIesrSI->logfp == NULL )
+      return TIesrSIErrFail;
+
+   fprintf( aTIesrSI->logfp, "SICreate\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+
+   /* Set status tracking variables, just in case TIesrSI_status is called
+   immediately after TIesrSI_create. */
+   aTIesrSI->audiostatus = TIesrFAErrNone;
+   aTIesrSI->recostatus = eTIesrEngineSuccess;
+   aTIesrSI->jacstatus = eTIesrEngineJACSuccess;
+
+
+   /* Open the TIesr engine, which provides pointers to engine functions */
+   TIesrEngineOpen( &(aTIesrSI->engine) );
+
+
+   /* heap allocated objects are initialized here to ensure no misuse. */
+   aTIesrSI->srchmemory = NULL;
+   aTIesrSI->framedata = NULL;
+   aTIesrSI->devicename = NULL;
+   aTIesrSI->jacfile = NULL;
+   aTIesrSI->sbcfile = NULL;
+   aTIesrSI->audiofp = NULL;
+
+
+
+#if defined (WIN32) || defined (WINCE)
+   /* Windows synchronization objects initialized to NULL for bookkeeping */
+   aTIesrSI->threadid = NULL;
+   aTIesrSI->recomutex = NULL;
+   aTIesrSI->startevent = NULL;
+#endif
+
+   /* Default settings just to be safe */
+   aTIesrSI->startok = FALSE;
+   aTIesrSI->stopreco = FALSE;
+
+
+   /* Recognizer created ok, now in closed state */
+   aTIesrSI->state = TIesrSIStateClosed;
+
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SICreate success\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_open
+
+This function opens the recognizer instance.  Opening a recognizer instance
+consists of allocating memory resources for the recognizer search, loading
+the grammar, doing JAC initialization, storing the callback functions,
+and initializing an audio device.
+-----------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_open( TIesrSI_t aTIesrSI,
+                             const char* aAudioDevice,
+                             const char* aGrammarDir,
+                             const char* aJACFile,
+                             const char* aSBCFile,
+                             const unsigned int aMemorySize,
+                             TIesrSI_Callback_t speakCallback,
+                             TIesrSI_Callback_t doneCallback,
+                             void* const cbData )
+{
+   TIesrEngineStatusType engStatus;
+   TIesrEngineJACStatusType jacStatus;
+
+   TIesrFA_Error_t faError;
+
+
+   /* Recognizer must be in closed state */
+   if( aTIesrSI->state != TIesrSIStateClosed )
+   {
+      return TIesrSIErrState;
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIOpen\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+
+   /* Set callback functions */
+   aTIesrSI->speakcb = speakCallback;
+   aTIesrSI->donecb = doneCallback;
+   aTIesrSI->cbdata = cbData;
+
+
+   /* Set default audio parameters */
+   aTIesrSI->samplerate = SAMPLE_RATE;
+   aTIesrSI->circularframes = CIRCULAR_FRAMES;
+   aTIesrSI->audioreadrate = AUDIO_READ_RATE;
+   aTIesrSI->audioframes = AUDIO_FRAMES;
+   aTIesrSI->audiopriority = AUDIO_PRIORITY;
+
+
+   /* Set status tracking variables */
+   aTIesrSI->audiostatus = TIesrFAErrNone;
+   aTIesrSI->recostatus = eTIesrEngineSuccess;
+   aTIesrSI->jacstatus = eTIesrEngineJACSuccess;
+
+   /* Set default conditions of variables */
+   aTIesrSI->startok = FALSE;
+   aTIesrSI->stopreco = FALSE;
+
+
+   /* Allocate search memory */
+   aTIesrSI->srchmemory = (TIesr_t)malloc( aMemorySize*sizeof(short) );
+   if( aTIesrSI->srchmemory == NULL )
+   {
+      return TIesrSIErrNoMemory;
+   }
+
+
+   /* Allocate frame data memory */
+   aTIesrSI->framedata = (short*)malloc( FRAME_LEN*sizeof(short) );
+   if( aTIesrSI->framedata == NULL )
+   {
+      TIesrSIL_freeopen( aTIesrSI );
+      return TIesrSIErrFail;
+   }
+
+
+   /* Save a copy of the audio device name */
+   aTIesrSI->devicename = strdup( aAudioDevice );
+   if( aTIesrSI->devicename == NULL )
+   {
+      TIesrSIL_freeopen( aTIesrSI );
+      return TIesrSIErrFail;
+   }
+
+
+   /* Save a copy of the JAC file name */
+   if( ! aJACFile )
+   {
+      TIesrSIL_freeopen( aTIesrSI );
+      return TIesrSIErrFail;
+   }
+
+   aTIesrSI->jacfile = strdup( aJACFile );
+   if( aTIesrSI->jacfile == NULL )
+   {
+      TIesrSIL_freeopen( aTIesrSI );
+      return TIesrSIErrFail;
+   }
+
+
+   /* Save a copy of the SBC file name, if used */
+   if( aSBCFile != NULL )
+   {
+      aTIesrSI->sbcfile = strdup( aSBCFile );
+      if( aTIesrSI->sbcfile == NULL )
+      {
+         TIesrSIL_freeopen( aTIesrSI );
+         return TIesrSIErrFail;
+      }
+   }
+
+
+   /* Save a copy of the Grammar directory name */
+   if( ! aGrammarDir )
+   {
+      TIesrSIL_freeopen( aTIesrSI );
+      return TIesrSIErrFail;
+   }
+
+   aTIesrSI->grammardir = strdup( aGrammarDir );
+   if( aTIesrSI->grammardir == NULL )
+   {
+      TIesrSIL_freeopen( aTIesrSI );
+      return TIesrSIErrFail;
+   }
+
+
+   /* Open the recognizer engine */
+   engStatus = (aTIesrSI->engine).OpenASR( (char*)aGrammarDir, 
+      (int)aMemorySize, 
+      aTIesrSI->srchmemory ); 
+
+   if( engStatus != eTIesrEngineSuccess )
+   {
+      TIesrSIL_freeopen( aTIesrSI );
+      aTIesrSI->recostatus = engStatus;
+      return TIesrSIErrReco;
+   }
+
+
+   /* Initialize an audio channel */
+   faError = TIesrFA_init( &aTIesrSI->audiodevice,
+      aTIesrSI->samplerate,
+      TIesrFALinear,
+      FRAME_LEN,
+      aTIesrSI->circularframes,
+      aTIesrSI->audioframes,
+      aTIesrSI->audioreadrate,
+      aTIesrSI->devicename,
+      aTIesrSI->audiopriority );
+
+   if( faError != TIesrFAErrNone )
+   {
+      /* Close the successfully opened TIesr Engine instance */
+      (aTIesrSI->engine).CloseASR( aTIesrSI->srchmemory );
+
+      TIesrSIL_freeopen( aTIesrSI );
+
+      aTIesrSI->audiostatus = faError;
+      return TIesrSIErrAudio;
+   }
+
+
+   /* Load the JAC channel */
+   jacStatus = (aTIesrSI->engine).JAC_load( aTIesrSI->jacfile, aTIesrSI->srchmemory,
+      aTIesrSI->grammardir, aTIesrSI->sbcfile );
+
+   if( jacStatus != eTIesrEngineJACSuccess )
+   {
+      /* Destroy the successfully initialized audio channel */
+      faError = TIesrFA_destroy( &aTIesrSI->audiodevice );
+      aTIesrSI->audiostatus = faError;
+
+      /* Close the successfully opened TIesr Engine instance */
+      (aTIesrSI->engine).CloseASR( aTIesrSI->srchmemory );
+
+      TIesrSIL_freeopen( aTIesrSI );
+
+      aTIesrSI->jacstatus = jacStatus;
+      return TIesrSIErrJAC;
+   }
+
+
+   /* Successfully opened the recognizer and audio channel */
+   aTIesrSI->state = TIesrSIStateOpen;
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIOpen success\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSIL_freeopen
+
+Free objects allocated during TIesrSI_open.  This is a convenience function.
+--------------------------------*/
+TIesrSIL_Error_t TIesrSIL_freeopen( TIesrSI_t aTIesrSI )
+{
+   if(  aTIesrSI->devicename != NULL )
+   {
+      free( aTIesrSI->devicename);
+      aTIesrSI->devicename = NULL;
+   }
+
+   if( aTIesrSI->srchmemory != NULL )
+   {
+      free( aTIesrSI->srchmemory );
+      aTIesrSI->srchmemory = NULL;
+   }
+
+   if(  aTIesrSI->framedata != NULL )
+   {
+      free( aTIesrSI->framedata );
+      aTIesrSI->framedata = NULL;
+   }
+
+   if(  aTIesrSI->jacfile != NULL )
+   {
+      free( aTIesrSI->jacfile);
+      aTIesrSI->jacfile = NULL;
+   }
+
+   if(  aTIesrSI->sbcfile != NULL )
+   {
+      free( aTIesrSI->sbcfile);
+      aTIesrSI->sbcfile = NULL;
+   }
+
+   if(  aTIesrSI->grammardir != NULL )
+   {
+      free( aTIesrSI->grammardir);
+      aTIesrSI->grammardir = NULL;
+   }
+
+   return TIesrSILErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_getparams
+
+Get recognizer parameter settings that are now in use.  This returns a 
+structure that can be used to modify and set parameters.  This function
+is commonly used to initialize parameter object with defaults.
+-----------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_getparams( TIesrSI_t aTIesrSI, TIesrSI_Params_t* aParams )
+{
+
+   if( aTIesrSI->state != TIesrSIStateOpen )
+   {
+      return TIesrSIErrState;
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIGetparams\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   /* Recognizer settings */
+   (aTIesrSI->engine).GetTIesrPrune( aTIesrSI->srchmemory, &aParams->pruneFactor );
+
+   // This will be implemented when TwoPass research is complete
+   // (aTIesrSI->engine).GetTIesrTwoPass( aTIesrSI->srchmemory, &aParams->useTwoPass ); 
+
+   (aTIesrSI->engine).GetTIesrTransiWeight( aTIesrSI->srchmemory, &aParams->transiWeight );
+
+   (aTIesrSI->engine).GetTIesrSAD( aTIesrSI->srchmemory, 
+      &aParams->sadDelta,
+      &aParams->sadMinDb,
+      &aParams->sadBeginFrames,
+      &aParams->sadEndFrames,
+      &aParams->sadNoiseFloor );
+
+   (aTIesrSI->engine).GetTIesrJAC( aTIesrSI->srchmemory,
+      &aParams->jacRate,
+      &aParams->jacLikelihood,
+      &aParams->jacSegmentSize,
+      &aParams->jacSmoothCoef,
+      &aParams->jacDiscountFactor,
+      &aParams->jacDeweightFactor,
+      &aParams->jacSVAForgetFactor );
+
+
+   (aTIesrSI->engine).GetTIesrSBC( aTIesrSI->srchmemory,
+      &aParams->sbcForgetFactor );
+
+   (aTIesrSI->engine).GetTIesrVolRange( aTIesrSI->srchmemory, 
+      &aParams->lowVolume, 
+      &aParams->highVolume );
+
+   (aTIesrSI->engine).GetTIesrGaussSelection( 
+      aTIesrSI->srchmemory, 
+      &aParams->gselPctCoreClusters, 
+      &aParams->gselPctInterClusters );
+
+   (aTIesrSI->engine).GetTIesrOnlineReferenceModel( 
+      &aParams->ormRefFrames,
+      &aParams->ormNoiseLevelThreshold,
+      &aParams->ormLowNoiseLLRThreshold,
+      &aParams->ormHiNoiseLLRThreshold,
+      &aParams->ormEOSLowLLRFrames,
+      &aParams->ormEOSPctLLRThreshold,
+      &aParams->ormEOSDelayFrames,
+      &aParams->ormEOSFrmsAfterPeak, 
+      aTIesrSI->srchmemory );
+
+   (aTIesrSI->engine).GetTIesrNoiseSubtraction( 
+      &aParams->ssAlpha,
+      &aParams->ssBeta,
+      aTIesrSI->srchmemory );
+
+   (aTIesrSI->engine).GetTIesrConfidenceAdaptation( 
+      &aParams->cnfAdaptThreshold,
+      &aParams->cnfNbestThreshold, 
+      aTIesrSI->srchmemory );
+
+   (aTIesrSI->engine).getRealTimeGuardTh( 
+      &aParams->realTimeFrameThreshold,
+      aTIesrSI->srchmemory );
+
+   (aTIesrSI->engine).getGetRealTGuard( 
+      &aParams->realTimeGuard,
+      aTIesrSI->srchmemory );
+
+   (aTIesrSI->engine).GetTIesrNBest(
+      aTIesrSI->srchmemory, 
+      &aParams->bNBest);
+
+
+   /* Audio device settings */
+   aParams->sampleRate = aTIesrSI->samplerate;
+   aParams->circularFrames = aTIesrSI->circularframes;
+   aParams->audioReadRate = aTIesrSI->audioreadrate;
+   aParams->audioFrames = aTIesrSI->audioframes;
+   aParams->audioPriority = aTIesrSI->audiopriority;
+
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIGetparams success\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_setparams
+
+Set the recognizer parameter settings that are to be used from the parameter structure.
+--------------------------------*/
+TIesrSI_Error_t TIesrSI_setparams( TIesrSI_t aTIesrSI, const TIesrSI_Params_t* aParams )
+{
+   TIesrFA_Error_t faError;
+
+   if( aTIesrSI->state != TIesrSIStateOpen )
+   {
+      return TIesrSIErrState;
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SISetparams\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   /* Set TIesr recognizer settings */
+   (aTIesrSI->engine).SetTIesrPrune( aTIesrSI->srchmemory, aParams->pruneFactor );
+
+   // This will be implemented when TwoPass pass research is complete
+   // (aTIesrSI->engine).SetTIesrTwoPass( aTIesrSI->srchmemory, aParams->useTwoPass ); 
+
+   (aTIesrSI->engine).SetTIesrTransiWeight( aTIesrSI->srchmemory, aParams->transiWeight );
+
+   (aTIesrSI->engine).SetTIesrSAD( aTIesrSI->srchmemory, 
+      aParams->sadDelta,
+      aParams->sadMinDb,
+      aParams->sadBeginFrames,
+      aParams->sadEndFrames,
+      aParams->sadNoiseFloor );
+
+
+   (aTIesrSI->engine).SetTIesrJAC( aTIesrSI->srchmemory,
+      aParams->jacRate,
+      aParams->jacLikelihood,
+      aParams->jacSegmentSize,
+      aParams->jacSmoothCoef,
+      aParams->jacDiscountFactor,
+      aParams->jacDeweightFactor,
+      aParams->jacSVAForgetFactor );
+
+
+   (aTIesrSI->engine).SetTIesrSBC( aTIesrSI->srchmemory,
+      aParams->sbcForgetFactor );
+
+
+   (aTIesrSI->engine).SetTIesrVolRange( aTIesrSI->srchmemory, 
+      aParams->lowVolume, 
+      aParams->highVolume );
+
+   (aTIesrSI->engine).SetTIesrGaussSelection( 
+      aTIesrSI->srchmemory, 
+      aParams->gselPctCoreClusters, 
+      aParams->gselPctInterClusters );
+
+
+   (aTIesrSI->engine).SetTIesrOnlineReferenceModel( 
+      aParams->ormRefFrames,
+      aParams->ormNoiseLevelThreshold,
+      aParams->ormLowNoiseLLRThreshold,
+      aParams->ormHiNoiseLLRThreshold,
+      aParams->ormEOSLowLLRFrames,
+      aParams->ormEOSPctLLRThreshold,
+      aParams->ormEOSDelayFrames,
+      aParams->ormEOSFrmsAfterPeak,
+      aTIesrSI->srchmemory );
+
+
+   (aTIesrSI->engine).SetTIesrNoiseSubtraction( 
+      aParams->ssAlpha,
+      aParams->ssBeta,
+      aTIesrSI->srchmemory );
+
+
+   (aTIesrSI->engine).SetTIesrConfidenceAdaptation( 
+      aParams->cnfAdaptThreshold,
+      aParams->cnfNbestThreshold, 
+      aTIesrSI->srchmemory );
+
+   (aTIesrSI->engine).setRealTimeGuardTh( 
+      aParams->realTimeFrameThreshold,
+      aTIesrSI->srchmemory );
+
+   (aTIesrSI->engine).setGetRealTGuard( 
+      aParams->realTimeGuard,
+      aTIesrSI->srchmemory );
+
+   (aTIesrSI->engine).SetTIesrNBest(
+      aTIesrSI->srchmemory, 
+      aParams->bNBest);
+
+    /* Determine if the audio channel needs to be re-initialized with new parameters */
+    if( aParams->sampleRate != aTIesrSI->samplerate ||
+            aParams->circularFrames != aTIesrSI->circularframes ||
+            aParams->audioFrames != aTIesrSI->audioframes ||
+            aParams->audioPriority != aTIesrSI->audiopriority ||
+            aParams->audioReadRate != aTIesrSI->audioreadrate )
+    {
+        faError = TIesrFA_destroy( &aTIesrSI->audiodevice );
+        aTIesrSI->audiostatus = faError;
+        if( faError != TIesrFAErrNone )
+        {
+            return TIesrSIErrAudio;
+        }
+
+        aTIesrSI->samplerate = aParams->sampleRate;
+        aTIesrSI->circularframes = aParams->circularFrames;
+        aTIesrSI->audioreadrate = aParams->audioReadRate;
+        aTIesrSI->audioframes = aParams->audioFrames;
+        aTIesrSI->audiopriority = aParams->audioPriority;
+
+
+        faError = TIesrFA_init( &aTIesrSI->audiodevice,
+                aTIesrSI->samplerate,
+                TIesrFALinear,
+                FRAME_LEN,
+                aTIesrSI->circularframes,
+                aTIesrSI->audioframes,
+                aTIesrSI->audioreadrate,
+                aTIesrSI->devicename,
+                aTIesrSI->audiopriority );
+
+        aTIesrSI->audiostatus = faError;
+        if( faError != TIesrFAErrNone )
+        {
+            return TIesrSIErrAudio;
+        }
+    }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SISetparams success\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_start
+
+This function starts speech recognition of an utterance.  It first makes a
+connection with the audio channel, and then starts a recognition thread
+which starts collecting and processing the audio data through the TIesr
+Engine.
+-------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_start( TIesrSI_t aTIesrSI, int aPriority, char* aCaptureFile )
+{
+   TIesrSIL_Error_t silError;
+
+#if defined (LINUX)
+    int result;
+    int threadresult;
+    pthread_attr_t attr;
+    struct sched_param sparam;
+    void *threadError;
+
+#elif defined (WIN32) || defined (WINCE)
+
+#endif
+
+
+   if( aTIesrSI->state != TIesrSIStateOpen )
+   {
+      return TIesrSIErrState;
+   }
+
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIStart\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+
+#ifdef TIESRSI_DEBUG_LOG
+   aTIesrSI->threadfp = fopen( THREADFILE, "w" );
+   if( aTIesrSI->threadfp == NULL )
+      return TIesrSIErrFail;
+#endif
+
+
+   /* If the audio file name exists, try to open it for writing
+   audio data */
+   if( aCaptureFile )
+   {
+      aTIesrSI->audiofp = fopen( aCaptureFile, "wb" );
+      if( !aTIesrSI->audiofp )
+      {
+
+#ifdef TIESRSI_DEBUG_LOG
+         if( aTIesrSI->threadfp )
+         {
+            fclose(aTIesrSI->threadfp );
+            aTIesrSI->threadfp = NULL;
+         }
+#endif          
+
+         return TIesrSIErrCapture;
+      }
+   }
+   else
+   { 
+      aTIesrSI->audiofp = NULL;
+   }
+
+
+   /* Initialize the sync objects used with the recognizer */
+   silError = TIesrSIL_initsync( aTIesrSI );
+   if( silError != TIesrSILErrNone )
+   {
+      if( aTIesrSI->audiofp )
+      {
+         fclose( aTIesrSI->audiofp );
+         aTIesrSI->audiofp = NULL;
+      }
+
+#if defined (TIESRSI_DEBUG_LOG)
+      if( aTIesrSI->threadfp )
+      {
+         fclose( aTIesrSI->threadfp );
+         aTIesrSI->threadfp = NULL;
+      }
+#endif
+
+      return TIesrSIErrFail;
+   }
+
+
+   /* Reset variables for the recognition */
+   aTIesrSI->startok = FALSE;
+   aTIesrSI->stopreco = FALSE;
+
+
+   /* Start the recognition thread running */
+
+#if defined (LINUX)
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIStart create thread\n" );
+#endif
+   /* Set thread attributes - the requested priority is the only changed attribute */
+   result = pthread_attr_init(&attr);
+   result = pthread_attr_getschedparam( &attr, &sparam );
+   sparam.sched_priority = aPriority;
+   result = pthread_attr_setschedparam( &attr, &sparam );
+
+
+   /* Start the recognition thread */
+   threadresult = pthread_create( &(aTIesrSI->threadid), &attr,
+      TIesrSIL_thread, (void *) aTIesrSI );
+
+   result = pthread_attr_destroy(&attr);
+
+   /* Check if the thread was created ok */
+   if( threadresult != 0 )
+   {
+      TIesrSIL_resetsync( aTIesrSI );
+
+      if( aTIesrSI->audiofp )
+      {
+         fclose( aTIesrSI->audiofp );
+         aTIesrSI->audiofp = NULL;
+      }
+
+#if defined (TIESRSI_DEBUG_LOG)
+      if( aTIesrSI->threadfp )
+      {
+         fclose( aTIesrSI->threadfp );
+         aTIesrSI->threadfp = NULL;
+      }
+#endif
+
+      return TIesrSIErrThread;
+   }
+
+#elif defined (WIN32) || defined (WINCE)
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIStart create thread\n" );
+#endif
+
+   aTIesrSI->threadid = CreateThread( NULL, 0,
+           (LPTHREAD_START_ROUTINE)TIesrSIL_thread, aTIesrSI,
+      CREATE_SUSPENDED, NULL );
+   if( aTIesrSI->threadid == NULL )
+   {
+      TIesrSIL_resetsync( aTIesrSI );
+
+      /* Close audio capture file and log file if open */
+      if( aTIesrSI->audiofp )
+      {
+         fclose( aTIesrSI->audiofp );
+         aTIesrSI->audiofp = NULL;
+      }
+#if defined (TIESRSI_DEBUG_LOG)
+      if( aTIesrSI->threadfp )
+      {
+         fclose( aTIesrSI->threadfp );
+         aTIesrSI->logfp = NULL;
+      }
+#endif
+
+      return TIesrSIErrThread;
+   }
+
+   SetThreadPriority( aTIesrSI->threadid, aPriority );
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIStart run thread\n" );
+   fflush( aTIesrSI->logfp );
+#endif   
+   
+   ResumeThread( aTIesrSI->threadid );
+
+#endif
+
+   /* The thread was created ok.  Wait for it to signal that it has started. */
+#if defined (LINUX)
+   result = sem_wait( &(aTIesrSI->startsemaphore) );
+#elif defined (WIN32) || defined (WINCE)
+   WaitForSingleObject( aTIesrSI->startevent, INFINITE );
+#endif
+
+   /* If the recognition thread did not start ok, then wait for the thread to 
+   terminate, and then notify the application that it failed */
+   if( ! aTIesrSI->startok )
+   {
+#if defined (LINUX)
+      pthread_join( aTIesrSI->threadid, &threadError );
+#elif defined (WIN32) || defined (WINCE)
+      WaitForSingleObject( aTIesrSI->threadid, INFINITE );
+      CloseHandle( aTIesrSI->threadid );
+      aTIesrSI->threadid = NULL;
+#endif
+      TIesrSIL_resetsync( aTIesrSI );
+
+      /* Close audio capture file and log file if open */
+      if( aTIesrSI->audiofp )
+      {
+         fclose( aTIesrSI->audiofp );
+         aTIesrSI->audiofp = NULL;
+      }
+
+#if defined (TIESRSI_DEBUG_LOG)
+      if( aTIesrSI->threadfp )
+      {
+         fclose( aTIesrSI->threadfp );
+         aTIesrSI->threadfp = NULL;
+      }
+#endif
+
+      return TIesrSIErrThread;
+   }
+
+   /* The recognizer started ok, and a recognition thread started ok */
+   aTIesrSI->state = TIesrSIStateRunning;
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIStart success\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSIL_initsync
+
+Initialize synchronization objects for the TIesrSI instance.
+--------------------------------*/
+TIesrSIL_Error_t TIesrSIL_initsync( TIesrSI_t aTIesrSI )
+{
+
+#if defined (LINUX)
+   int error;
+
+   error = pthread_mutex_init( &(aTIesrSI->recomutex), NULL );
+   if( error )
+   {
+      return TIesrSILErrFail;
+   }
+
+   error = sem_init( &(aTIesrSI->startsemaphore), 0, 0 );   
+   if( error )
+   {
+      error = pthread_mutex_destroy( &(aTIesrSI->recomutex) );
+
+      return TIesrSILErrFail;
+   }
+
+#elif defined (WIN32) || defined (WINCE)
+
+   aTIesrSI->recomutex = CreateMutex( NULL, FALSE, NULL );
+   if( aTIesrSI->recomutex == NULL )
+      return TIesrSILErrFail;
+
+   aTIesrSI->startevent = CreateEvent( NULL, FALSE, FALSE, NULL );
+   if( aTIesrSI->startevent == NULL )
+   {
+      CloseHandle( aTIesrSI->recomutex );
+      aTIesrSI->recomutex = NULL;
+      return TIesrSILErrFail;
+   }
+
+#endif
+
+   return TIesrSILErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSIL_resetsync
+
+Reset the synchronization objects for the TIesrSI instance.
+--------------------------------*/
+static TIesrSIL_Error_t TIesrSIL_resetsync( TIesrSI_t aTIesrSI )
+{
+   TIesrSIL_Error_t silError = TIesrSILErrNone;
+
+#if defined (LINUX)
+
+   int error = 0;
+
+   error = pthread_mutex_destroy( &(aTIesrSI->recomutex) );
+   if( error )
+   {
+      silError = TIesrSILErrFail;
+   }
+
+   error = sem_destroy( &(aTIesrSI->startsemaphore) );   
+   if( error != 0 )
+   {
+      silError = TIesrSILErrFail;
+   }
+
+#elif defined (WIN32) || defined (WINCE)
+   if( ! CloseHandle( aTIesrSI->recomutex ) )
+   {
+      silError = TIesrSILErrFail;
+   }
+
+   if( ! CloseHandle( aTIesrSI->startevent ) )
+   {
+      silError = TIesrSILErrFail;
+   }
+
+#endif
+
+
+   return silError;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSIL_thread
+
+This is the TIesr recognition thread function that is started by
+a call to TIesrSI_start.
+--------------------------------*/
+#if defined (LINUX)
+void* TIesrSIL_thread( void* aArg )
+#elif defined (WIN32) || defined (WINCE)
+DWORD TIesrSIL_thread( LPVOID aArg )
+#endif
+{
+   TIesrFA_Error_t faError;
+   TIesrFA_Error_t faStopError;
+   TIesrFA_Error_t faCloseError;
+   TIesrEngineStatusType engStatus;
+   TIesrEngineJACStatusType jacStatus;
+   TIesrSI_Error_t siError;
+
+   TIesrSI_t aTIesrSI = (TIesrSI_t)aArg;
+
+   unsigned int framesQueued;
+
+   int recoEnded = FALSE;
+   int startCalled = FALSE;
+
+
+#ifdef TIESRSI_DEBUG_LOG
+   int frame = 0;
+   fprintf( aTIesrSI->threadfp, "SIThread\n" );
+   fflush( aTIesrSI->threadfp );
+#endif
+
+
+   /* Ensure that initially flag set to indicate thread did not start ok */
+   aTIesrSI->startok = FALSE;
+
+
+   /* Open the search engine, which prepares it for recognition. On failure
+   inform the start function via the start semaphore and exit the thread. */
+   engStatus = (aTIesrSI->engine).OpenSearchEngine( aTIesrSI->srchmemory );
+   aTIesrSI->recostatus = engStatus;
+   if( engStatus != eTIesrEngineSuccess )
+   {
+#if defined (LINUX)
+      sem_post( &aTIesrSI->startsemaphore );
+      return (void*)TIesrSILErrReco;
+#elif defined (WIN32) || defined (WINCE)
+      SetEvent( aTIesrSI->startevent );
+      return TIesrSILErrReco;
+#endif
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->threadfp, "SIThread opening FA\n" );
+   fflush( aTIesrSI->threadfp );
+#endif
+
+   /* Open an audio channel which connects to the audio device.  On failure
+   inform the start function via the start semaphore and exit the thread. */
+   faError = TIesrFA_open( &aTIesrSI->audiodevice );
+   aTIesrSI->audiostatus = faError;
+   if( faError != TIesrFAErrNone )
+   {
+#if defined (LINUX)
+      sem_post( &aTIesrSI->startsemaphore );
+      return (void*)TIesrSILErrAudio;
+#elif defined (WIN32) || defined (WINCE)
+      SetEvent( aTIesrSI->startevent );
+      return TIesrSILErrAudio;
+#endif
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->threadfp, "SIThread starting FA\n" );
+   fflush( aTIesrSI->threadfp );
+#endif
+
+   /* Start collection of audio samples into the circular frame buffer. On
+   failure, close the audio channel, inform the start function via the
+   start semaphore and exit the thread. */
+   faError = TIesrFA_start( &aTIesrSI->audiodevice );
+   aTIesrSI->audiostatus = faError;
+   if( faError != TIesrFAErrNone )
+   {
+      faCloseError = TIesrFA_close( &aTIesrSI->audiodevice );
+#if defined (LINUX)
+      sem_post( &aTIesrSI->startsemaphore );
+      return (void*)TIesrSILErrAudio;
+#elif defined (WIN32) || defined (WINCE)
+      SetEvent( aTIesrSI->startevent );
+      return TIesrSILErrAudio;
+#endif
+   }
+
+
+   /* Audio collection has started successfully, and the recognizer engine is
+   opened succesfully.  Notify the start function that recognition started
+   successfully. */
+   aTIesrSI->startok = TRUE;
+#if defined (LINUX)
+   sem_post( &aTIesrSI->startsemaphore );
+#elif defined (WIN32) || defined (WINCE)
+   SetEvent( aTIesrSI->startevent );
+#endif
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->threadfp, "SIThread start loop\n" );
+   fflush( aTIesrSI->threadfp );
+#endif
+
+   /* Get the first frame of data, blocking until it is received */
+   faError = TIesrFA_getframe( &aTIesrSI->audiodevice, (unsigned char*)aTIesrSI->framedata, 
+      BLOCKING, &framesQueued );
+
+
+   /* Enter a processing loop processing frames of data until recognition complete,
+   a request to terminate recognition, or failure */
+   while( faError == TIesrFAErrNone && !aTIesrSI->stopreco )
+   {
+      /* If user wants to save audio data, write to a file */
+      if( aTIesrSI->audiofp )
+      {
+         fwrite( (void*)aTIesrSI->framedata, sizeof(short),
+            FRAME_LEN, aTIesrSI->audiofp );
+      }
+
+#if defined (TIESRSI_DEBUG_LOG)
+      /* If debug logging, capture number of frames queued */
+      if( aTIesrSI->threadfp )
+      {
+         fprintf( aTIesrSI->threadfp, "Queued: %d\n", framesQueued );
+         fflush( aTIesrSI->threadfp );
+      }
+#endif
+
+#ifdef TIESRSI_DEBUG_LOG
+      fprintf( aTIesrSI->threadfp, "SIThread calling engine %d\n", frame );
+      fflush( aTIesrSI->threadfp );
+#endif
+
+      /* Process the frame of data in the TIesr Engine */
+      engStatus = (aTIesrSI->engine).CallSearchEngine( aTIesrSI->framedata,
+         aTIesrSI->srchmemory, framesQueued );
+
+#ifdef TIESRSI_DEBUG_LOG
+      fprintf( aTIesrSI->threadfp, "SIThread engine done %d %d\n", frame, engStatus );
+      fflush( aTIesrSI->threadfp );
+#endif
+      aTIesrSI->recostatus = engStatus;
+
+      /* Catch recognition engine error and exit loop immediately */
+      if( engStatus != eTIesrEngineSuccess )
+      {
+         break;
+      }
+
+      /* If LIVEMODE defined in tieser_config.h then when the utterance end is detected
+      the recognizer should stop processing frames of data */
+
+#ifdef LIVEMODE
+
+      recoEnded = (aTIesrSI->engine).SpeechEnded( aTIesrSI->srchmemory );
+      if( recoEnded )
+      {  
+         /* Can't print in an API.  Protect this with a debug define macro.
+         printf("reco ended \n"); */
+         break;
+      }
+
+#endif
+
+
+      /* Determine if speech started early or if the JAC has completed one pass */
+      if( !startCalled && aTIesrSI->speakcb != NULL &&
+         (  (aTIesrSI->engine).GetCycleCount( aTIesrSI->srchmemory ) > 0  || 
+         (aTIesrSI->engine).SpeechDetected( aTIesrSI->srchmemory ) ) )
+      {
+         startCalled = TRUE;
+
+         if( (aTIesrSI->engine).GetCycleCount( aTIesrSI->srchmemory ) > 0 )
+         {
+            (aTIesrSI->speakcb)(aTIesrSI->cbdata, TIesrSIErrNone );
+         }
+         else
+         {
+            (aTIesrSI->speakcb)(aTIesrSI->cbdata, TIesrSIErrSpeechEarly );
+         }
+      }   
+
+      /* Get next frame of data */
+      faError = TIesrFA_getframe( &aTIesrSI->audiodevice, 
+         (unsigned char*)aTIesrSI->framedata, BLOCKING,
+         &framesQueued );
+
+      /* If input is from a file, then recognition should stop if end of file
+      condition returned */
+      if ( faError == TIesrFAErrEOF )
+      { 
+         recoEnded = 1; 
+         break;
+      }
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->threadfp, "SIThread exit loop\n" );
+   fflush( aTIesrSI->threadfp );
+#endif
+
+   /* The loop has been exited. Stop data collection and disconnect from the channel.
+   Determine audio status at end of recognition */
+   faStopError = TIesrFA_stop( &aTIesrSI->audiodevice );   
+   faCloseError = TIesrFA_close( &aTIesrSI->audiodevice );
+   if( faError != TIesrFAErrNone && faError != TIesrFAErrEOF )
+      aTIesrSI->audiostatus = faError;
+   else if( faStopError != TIesrFAErrNone )
+      aTIesrSI->audiostatus = faStopError;
+   else if( faCloseError != TIesrFAErrNone )
+      aTIesrSI->audiostatus = faCloseError;
+   else
+      aTIesrSI->audiostatus = faError;
+
+
+   /* Close the search engine, which among other things does a backtrace
+   for the recognition result and sets volume status */
+   if( recoEnded )
+   {
+      engStatus = (aTIesrSI->engine).CloseSearchEngine( engStatus, 
+         aTIesrSI->srchmemory );
+
+      aTIesrSI->recostatus = engStatus;
+   }
+
+   /* If recognition ended successfully, and user is not trying to shut down
+   the recognizer, do JAC update */
+
+   /*  Now recommend doing JAC update all the time, since
+   modifications to JAC ensure all means updated if speech starts.  Thus there
+   is not a need to check if at least one JAC cycle completed.
+
+   if( recoEnded && engStatus == eTIesrEngineSuccess && !aTIesrSI->stopreco &&
+   (aTIesrSI->engine).GetCycleCount( aTIesrSI->srchmemory ) > 0 )
+   */
+   if( recoEnded && engStatus == eTIesrEngineSuccess && !aTIesrSI->stopreco )        
+   {
+      jacStatus = (aTIesrSI->engine).JAC_update( aTIesrSI->srchmemory );
+
+      aTIesrSI->jacstatus = jacStatus;
+   }
+
+   /* Notify the application of recognition thread completion */
+   if( aTIesrSI->donecb != NULL )
+   {
+      if( ( aTIesrSI->audiostatus != TIesrFAErrNone && 
+         aTIesrSI->audiostatus != TIesrFAErrEOF ) &&
+         ( aTIesrSI->recostatus != eTIesrEngineSuccess || 
+         ( (aTIesrSI->jacstatus != eTIesrEngineJACSuccess) && 
+         (aTIesrSI->jacstatus != eTIesrEngineJACNoAlignment ) ) ) )
+         siError = TIesrSIErrBoth;
+      else if( aTIesrSI->audiostatus != TIesrFAErrNone && 
+         aTIesrSI->audiostatus != TIesrFAErrEOF )
+         siError = TIesrSIErrAudio;
+      else if( aTIesrSI->recostatus != eTIesrEngineSuccess ||
+         ( (aTIesrSI->jacstatus != eTIesrEngineJACSuccess) && 
+         (aTIesrSI->jacstatus != eTIesrEngineJACNoAlignment ) ))
+         siError = TIesrSIErrReco;
+      else
+         siError = TIesrSIErrNone;
+
+      (aTIesrSI->donecb)( aTIesrSI->cbdata, siError );
+   }
+
+   /* Can't print in an API.  Protect this with a debug macro
+   if( aTIesrSI->recostatus ==  eTIesrEngineBeamCellOverflow)  printf ("---BEAM OVER FLOW\n"); */
+
+   /* Terminate the thread after a recognition process. */
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->threadfp, "SIThread ended\n" );
+   fflush( aTIesrSI->threadfp );
+#endif
+
+#if defined (LINUX)
+   return (void*)TIesrSILErrNone;
+#elif defined (WIN32) || defined (WINCE)
+   return TIesrSILErrNone;
+#endif
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_stop
+
+This function stops recognition.  It may stop recognition in the middle
+of the task, or after the recognition is complete and has signaled it
+is done by calling the callback function.  This function ensures that
+the threads have shut down appropriately.
+---------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_stop( TIesrSI_t aTIesrSI )
+{
+#if defined(LINUX)
+   TIesrSIL_Error_t threadError;
+   void* threadReturn;
+#endif
+
+   /* Check state to ensure a recognizer thread is running */
+   if( aTIesrSI->state != TIesrSIStateRunning )
+   {
+      return TIesrSIErrState;
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIStop\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   /* Set flag to force the recognizer thread to terminate, if that has
+   not happened already due to normal end of recognition.  */
+   aTIesrSI->stopreco = TRUE;
+
+
+   /* Wait for the recognizer thread to stop */
+#if defined (LINUX)
+   pthread_join( aTIesrSI->threadid, &threadReturn );
+   threadError = (TIesrSIL_Error_t)threadReturn;
+#elif defined (WIN32) || defined (WINCE)
+   WaitForSingleObject( aTIesrSI->threadid, INFINITE );
+   CloseHandle( aTIesrSI->threadid );
+   aTIesrSI->threadid = NULL;
+#endif
+
+   /* Reset sync objects since they are no longer needed for the thread */
+   TIesrSIL_resetsync( aTIesrSI );
+
+
+   /* If the user wanted audio capture, close the capture file */
+   if( aTIesrSI->audiofp )
+   {
+      fclose( aTIesrSI->audiofp );
+      aTIesrSI->audiofp = NULL;
+   }
+
+#if defined (TIESRSI_DEBUG_LOG)
+   if( aTIesrSI->threadfp )
+   {
+      fclose( aTIesrSI->threadfp );
+      aTIesrSI->threadfp = NULL;
+   }
+#endif
+
+   /* Recognizer has successfully stopped running */
+   aTIesrSI->state = TIesrSIStateOpen;
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIStop success\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+   return TIesrSIErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrSI_nbcount
+
+Get the number of hypothesis recognized.  This assumes that a valid recognition
+result has completed.
+------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_nbcount( TIesrSI_t aTIesrSI, short* aNumHyp) 
+{
+   if( aTIesrSI->state != TIesrSIStateOpen )
+   {
+      return TIesrSIErrState;
+   }
+
+   *aNumHyp = (aTIesrSI->engine).GetNumNbests(aTIesrSI->srchmemory );
+
+   return TIesrSIErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrSI_wdcount
+
+Get the number of words recognized.  This assumes that a valid recognition
+result has completed.
+------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_wdcount( TIesrSI_t aTIesrSI, unsigned short* aNumWords ,
+                                short iHypIdx)
+{
+   if( aTIesrSI->state != TIesrSIStateOpen )
+   {
+      return TIesrSIErrState;
+   }
+
+   *aNumWords = (aTIesrSI->engine).GetAnswerCount( aTIesrSI->srchmemory, iHypIdx);
+
+   return TIesrSIErrNone;
+}
+
+/*----------------------------------------------------------------
+TIesrSI_word
+
+Get a pointer to a word that was recognized during the last recognition.
+This assumes a valid recognition result has completed.
+------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_word( TIesrSI_t aTIesrSI, unsigned short aWordNum, 
+                             const char** aWord , short iHypIdx)
+{
+   short numHyp;
+   unsigned short numWords;
+
+   if( aTIesrSI->state != TIesrSIStateOpen )
+   {
+      return TIesrSIErrState;
+   }
+
+
+   numHyp = (aTIesrSI->engine).GetNumNbests(aTIesrSI->srchmemory );
+   if( iHypIdx < 0 || iHypIdx >= numHyp )
+   {
+      *aWord = NULL;
+      return TIesrSIErrFail;
+   }
+
+   numWords = (aTIesrSI->engine).GetAnswerCount( aTIesrSI->srchmemory , iHypIdx);
+   if( aWordNum >= numWords )
+   {
+      *aWord = NULL;
+      return TIesrSIErrFail;
+   }
+
+
+   *aWord = (aTIesrSI->engine).GetAnswerWord( aWordNum, aTIesrSI->srchmemory , iHypIdx);
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_status
+
+This function is normally not used.  It can provide additional
+information in case one of the TIesrSI_* functions returns an error
+status.  It returns a status integer values for the audio channel, the
+recognizer engine, and the jac adaptation processing that may provide
+help in diagnosis.  These values are set, even by the recognizer
+thread, but are not protected by any synchronization object.  They are
+best obtained when the recognizer is not running.
+-------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_status( TIesrSI_t aTIesrSI, int* aRecoStatus, 
+                               int* aAudioStatus, int* aJacStatus )
+{
+   *aRecoStatus = (int)aTIesrSI->recostatus;
+   *aAudioStatus = (int)aTIesrSI->audiostatus;
+   *aJacStatus = (int)aTIesrSI->jacstatus;
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_score
+
+This function provides the likelihood score information for the result of the
+last recognition operation.  This function is normally not necessary for
+a voice-enabled application.  However, the likelihood score can indicate whether
+the input speech matched the models well or not.  Larger values of score indicate
+better likelihood.
+------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_score( TIesrSI_t aTIesrSI, long* aScore )
+{
+   *aScore = (aTIesrSI->engine).GetTotalScore( aTIesrSI->srchmemory );
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_frmcount
+
+This function provides the number of frames that the last speech recogntion
+result consumed, excluding the portion of the input signal not determined to
+be speech.  This function is normally not necessary for a voice-enabled
+application.  However, it may be helpful for diagnosing some problems.
+----------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_frmcount( TIesrSI_t aTIesrSI, short* aNumFrames )
+{
+   *aNumFrames = (aTIesrSI->engine).GetFrameCount( aTIesrSI->srchmemory );
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_volume
+
+This function returns the volume corresponding to the last speech
+recognition result.  It is a crude measure that just indicates
+volume was too low, high, or ok, by returning 0,1, or 2
+respectively.  The crude measure is presently based on the absolute
+maximum sample value in the speech utterance signal.
+----------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_volume( TIesrSI_t aTIesrSI, short* aVolume )
+{
+   *aVolume = (aTIesrSI->engine).GetVolumeStatus( aTIesrSI->srchmemory );
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_confidence
+
+This function returns the confidence corresponding to the last
+speech recognition result.  This is a measure of likelihood that the
+recognition was correct.
+----------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_confidence(  TIesrSI_t aTIesrSI, short* aConfidence )
+{
+   *aConfidence = (aTIesrSI->engine).GetConfidenceScore( aTIesrSI->srchmemory );
+
+   return TIesrSIErrNone;
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_close
+
+This function closes the recognizer and deallocates any objects that were
+allocated when opened.  It also closes the JAC processing, storing a channel
+estimate.
+------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_close( TIesrSI_t aTIesrSI )
+{
+   TIesrFA_Error_t faError;
+   TIesrEngineJACStatusType jacStatus;
+
+   if( aTIesrSI->state != TIesrSIStateOpen )
+   {
+      return TIesrSIErrState;
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIClose\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   /* Save JAC  estimate and close the recognizer. */
+   jacStatus = (aTIesrSI->engine).JAC_save(aTIesrSI->jacfile, aTIesrSI->srchmemory );
+
+   aTIesrSI->jacstatus = jacStatus;
+
+   (aTIesrSI->engine).CloseASR( aTIesrSI->srchmemory );
+
+   /* Destroy the audio channel resources */
+   faError = TIesrFA_destroy( &aTIesrSI->audiodevice );
+
+   aTIesrSI->audiostatus = faError;
+
+
+   /* Free resources allocated during open */
+   TIesrSIL_freeopen( aTIesrSI );
+
+   /* State is now closed, regardless of failures */
+   aTIesrSI->state = TIesrSIStateClosed;
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIClose end %d\n", faError );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   if( faError != TIesrFAErrNone && jacStatus != eTIesrEngineJACSuccess )
+      return TIesrSIErrBoth;
+   else if(  faError != TIesrFAErrNone )
+      return TIesrSIErrAudio;
+   else if( jacStatus != eTIesrEngineJACSuccess )
+      return TIesrSIErrJAC;
+   else
+   {
+      return TIesrSIErrNone;
+   }
+}
+
+
+/*----------------------------------------------------------------
+TIesrSI_destroy
+
+This function destroys the TIesrSI object specified in the argument.  This
+completely destroys the instance of the recognizer.  This completely removes
+the TIesrSI object that was created with TIesrSI_create, and frees all
+resources that were allocated internally.  This must be called as the last
+part of using a recognizer instance to ensure that all allocated resources
+have been deallocated and no leakage occurs.  After this function is called
+the pointer is no longer valid, and should be set to NULL.
+-------------------------------------------------------------------*/
+TIESRSI_API
+TIesrSI_Error_t TIesrSI_destroy( TIesrSI_t aTIesrSI )
+{
+
+   if( aTIesrSI->state != TIesrSIStateClosed )
+   {
+      return TIesrSIErrState;
+   }
+
+#ifdef TIESRSI_DEBUG_LOG
+   fprintf( aTIesrSI->logfp, "SIDestroy\n" );
+   fflush( aTIesrSI->logfp );
+#endif
+
+   /* Close the engine instance */
+   TIesrEngineClose( &(aTIesrSI->engine) );
+
+#ifdef TIESRSI_DEBUG_LOG
+   if( aTIesrSI->logfp )
+      fclose( aTIesrSI->logfp );
+    
+   if( aTIesrSI->threadfp )
+      fclose( aTIesrSI->threadfp );
+#endif
+
+   /* deallocate the TIesrSI instance */
+   free( aTIesrSI );
+
+   return TIesrSIErrNone;
+}
diff --git a/TIesrSI/src/TIesrSI.h b/TIesrSI/src/TIesrSI.h
new file mode 100755 (executable)
index 0000000..25dc178
--- /dev/null
@@ -0,0 +1,236 @@
+/*=======================================================================
+ TIesrSI.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This file defines the functions and data structures that are internal to
+ the TIesrSI API that the user does not need access to.
+
+======================================================================*/
+
+#ifndef _TIESRSI_H
+#define _TIESRSI_H
+
+/* Standard IO for various file outputs */
+#include <stdio.h>
+
+/* The TIesr Engine API for SI recognition with live audio */
+#include <tiesr_engine_api_sireco.h>
+
+/* The TIesr frame audio capture API */
+#include <TIesrFA_User.h>
+
+/* The TIesrSI User API */
+#include "TIesrSI_User.h"
+
+/* Multi-threading support APIs */
+#if defined (LINUX)
+#include <pthread.h>
+#include <semaphore.h>
+#elif defined (WIN32) || defined (WINCE)
+#endif
+
+
+/* Debug logging flag.  This results in output debug logging to files
+   for each thread. This line should normally be commented out in order
+   to build a version of TIESRSI that does not do debug logging. Debug
+   logging is not an option that the user sees within the API. */
+
+/* #define TIESRSI_DEBUG_LOG */
+
+#ifdef TIESRSI_DEBUG_LOG
+
+#if defined (WINCE)
+
+#if ( _WIN32_WCE >= 0x500 )
+/* Log file locations for WindowsMobile 5.0 Smartphone */
+  #define LOGFILE "\\Application Data\\TIesr\\SIlog.txt"
+  #define THREADFILE "\\Application Data\\TIesr\\SIthread.txt"
+#else
+/* Log file locations for WindowsMobile 2003SE Smartphone */
+#define LOGFILE "\\Storage\\Application Data\\TIesr\\SIlog.txt"
+#define THREADFILE "\\Storage\\Application Data\\TIesr\\SIthread.txt"
+#endif
+
+#else
+/* Define location of log files for other platforms. */
+#endif
+
+#endif
+
+
+/* Audio default constants */
+
+
+/* Blocking flag for audio */
+#define BLOCKING 1
+
+
+/* Sample rate in Hz */
+#define SAMPLE_RATE 8000
+
+#if defined (LINUX)
+
+/* Number of frames of data in circular buffer to maintain real time */
+#define CIRCULAR_FRAMES 100
+/* Time between audio device read attempts (if needed) in microseconds */
+#define AUDIO_READ_RATE 20000
+/* Number of audio device read rate frames of data in audio device buffer */
+#define AUDIO_FRAMES 10
+/* Audio priority of the frame audio thread */
+#define  AUDIO_PRIORITY 20
+
+#elif defined (WIN32) || defined (WINCE)
+
+/* Number of frames of data in circular buffer to maintain real time */
+#define CIRCULAR_FRAMES 500
+/* Number of audio buffers holding data read from the audio device */
+#define AUDIO_FRAMES 10
+/* Audio priority of the frame audio thread */
+#define  AUDIO_PRIORITY  THREAD_PRIORITY_ABOVE_NORMAL
+/* For Windows TIesrFA this is the number of frames of audio data that
+each audio buffer returned from the audio device driver will hold */
+#define AUDIO_READ_RATE 2
+
+#endif
+
+
+/* Define TRUE/FALSE */
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+/*--------------------------------*/
+/* Type definition of error types for local functions */
+typedef enum TIesrSIL_Errors
+{
+  TIesrSILErrNone,
+  TIesrSILErrFail,
+  TIesrSILErrAudio,
+  TIesrSILErrReco
+} TIesrSIL_Error_t;
+
+
+/*--------------------------------*/
+/*
+  Type definition of the allowable states of the TIesrSI recognizer.
+*/
+typedef enum TIesrSIL_State
+{
+  TIesrSIStateClosed,
+  TIesrSIStateOpen,
+  TIesrSIStateRunning
+}TIesrSIL_State_t;
+
+
+/*--------------------------------*/
+/* 
+   Type definition of the TIesrSI_Object which is a structure that
+   holds all information and data necessary to encapsulate an instance
+   of the TIesrSI recognizer.
+*/
+
+typedef struct TIesrSI_Object
+{
+      /* The TIesrSI recognizer engine */
+      TIesrEngineSIRECOType engine;
+      TIesr_t srchmemory;
+      short* framedata;
+      char* jacfile;      
+      char* sbcfile;
+      char* grammardir;
+      TIesrEngineStatusType recostatus;
+      TIesrEngineJACStatusType jacstatus;
+
+    /* The audio channel and its parameters */
+    TIesrFA_t audiodevice;
+    unsigned int samplerate;
+    unsigned int circularframes;
+    unsigned int audioreadrate;
+    unsigned int audioframes;
+    int audiopriority;
+    char* devicename;
+    TIesrFA_Error_t audiostatus;
+
+
+      /* TIesrSI API recognizer parameters */
+      int state; /* State of the recognizer */
+
+
+      /* audio output file pointer, allowing capture of 
+      audio sent to recognizer. */
+      FILE* audiofp;
+     
+
+      /* log output file pointer, allowing capture of
+        debug logging data */
+#if defined (TIESRSI_DEBUG_LOG)
+      FILE* logfp;
+      FILE* threadfp;
+#endif
+
+#if defined (LINUX)
+      /* Recognizer thread while running recognition */
+      pthread_t threadid; 
+      
+      /* Recognizer mutex protecting shared variables */
+      pthread_mutex_t recomutex; 
+      
+      /* Semaphore to detect recognizer started */ 
+      sem_t startsemaphore; 
+
+      /* Flag indicating recognizer thread started ok */
+      int startok;
+
+      /* Flag to indicate a request to stop recognition thread */
+      int stopreco;
+#elif defined (WIN32) || defined (WINCE)
+      /* Recognizer thread while running recognition */
+      HANDLE threadid; 
+      
+      /* Recognizer mutex protecting shared variables */
+      HANDLE recomutex; 
+      
+      /* Event to detect recognizer started */ 
+      HANDLE startevent; 
+
+      /* Flag indicating recognizer thread started ok */
+      int startok;
+
+      /* Flag to indicate a request to stop recognition thread */
+      int stopreco;
+
+#endif
+  
+      /* Callback functions to generate recognition results */
+      TIesrSI_Callback_t speakcb;
+      TIesrSI_Callback_t donecb;
+      void* cbdata;
+  
+      /* Recognizer variables */
+
+
+} TIesrSI_Object_t;
+
+
+/*--------------------------------*/
+/* Local function prototypes */
+static TIesrSIL_Error_t TIesrSIL_freeopen( TIesrSI_t aTIesrSI );
+
+static TIesrSIL_Error_t TIesrSIL_initsync( TIesrSI_t aTIesrSI );
+
+static TIesrSIL_Error_t TIesrSIL_resetsync( TIesrSI_t aTIesrSI );
+
+#if defined (LINUX)
+static void* TIesrSIL_thread( void* aTIesrSI );
+#elif defined (WIN32) || defined (WINCE)
+static DWORD TIesrSIL_thread( LPVOID aTIesrSI );
+#endif
+
+#endif /* _TIESRSI_H */
diff --git a/TIesrSI/src/TIesrSI_User.h b/TIesrSI/src/TIesrSI_User.h
new file mode 100644 (file)
index 0000000..42d4fa0
--- /dev/null
@@ -0,0 +1,440 @@
+/*=======================================================================
+ TIesrSI_User.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+   This header defines the interface that implements a TIesr Speaker Independent
+  speech recognition API.  Application designers may use libraries that
+  implement this API to voice enable their applications.  The API presents a
+  simple and clean set of C functions that utilize the TIesrEngine API as the
+  basis for the speech recognizer, and TIesrFA API as the frame audio data
+  collection interface, without the application designer required to know the
+  intricate details of these two APIs.  Note that the TIesrSI API runs the
+  speech recognizer and the audio collection in two separate threads apart from
+  the TIesrSI API.
+
+  Prior to using the TIesrSI API to do speech recognition, the user must
+  prepare a grammar and model set that describes the utterances to be
+  recognized.  The grammar and models are placed in a known directory.  The
+  TIesrFlex API is available for creating the grammar and model set.
+
+======================================================================*/
+
+
+#ifndef _TIESRSI_USER_H
+#define _TIESRSI_USER_H
+
+
+#if defined (WIN32) || defined (WINCE)
+
+// The following ifdef block is the standard way of creating macros which make exporting 
+// from a DLL simpler. All files within this DLL are compiled with the TIESRSI_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see 
+// TIESRSI_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef TIESRSI_EXPORTS
+#define TIESRSI_API __declspec(dllexport)
+#else
+#define TIESRSI_API __declspec(dllimport)
+#endif
+
+#else
+#define TIESRSI_API 
+
+#endif
+
+/*---------------------------------------------------------------- 
+   TIesrSI_Errors is an enumeration that defines the status values
+   associated with operations provided by functions of the TIesrSI
+   API.  A brief description of the errors is as follows:
+
+   TIesrSIErrNone = No error, operation completed successfully.
+
+   TIesrSIErrFail = The function failed to complete successfully.
+
+   TIesrSIErrNoMemory = The function could not complete, out of memory.
+
+   TIesrSIErrState = Attempt to do something out of sequence, for example,
+   trying to open an already open recognizer.
+
+   TIesrSIErrReco = The recognizer reported a failure during processing.
+
+   TIesrSIErrAudio = The audio channel reported a collection failure.
+
+   TIesrSIErrBoth = Both of recognizer and audio reported failures.
+
+   TIesrSIErrSpeechEarly = Speech occurred prior to completion of adaptation
+   to the present noise environment.
+
+   TIesrSIErrThread = The recognizer thread could not start successfully.
+
+   TIesrSIErrCapture = The recognizer failed to open file or capture audio data.
+------------------------------------------------------------------------*/
+typedef enum TIesrSI_Errors
+{
+   TIesrSIErrNone,
+   TIesrSIErrFail,
+   TIesrSIErrNoMemory,
+   TIesrSIErrState,
+   TIesrSIErrReco,
+   TIesrSIErrJAC,
+   TIesrSIErrAudio,
+   TIesrSIErrBoth,
+   TIesrSIErrSpeechEarly,
+   TIesrSIErrThread,
+   TIesrSIErrCapture
+} TIesrSI_Error_t;
+
+
+/*------------------------------------------------------------------------- 
+   The TIesrSI_Object defines and contains all data that comprise an instance
+   of the TIesrSI recognizer.  A pointer to this object is defined as
+   TIesrSI_t.  The application designer will only interact with the recognizer
+   through the pointer to the object, and will never operate directly on the
+   contents of the TIesrSI_Object.
+---------------------------------------------------------------------------*/
+typedef struct TIesrSI_Object* TIesrSI_t;
+
+
+/*-------------------------------------------------------------------------
+  TIesrSI provides results by calling two callback functions.  One function is
+  called when the recognizer has been started, has performed adaptation to the
+  present noise environment, and is ready for the user to start speaking. The
+  second function is called when the recognizer has completed an attempt to
+  recognize an utterance. Both functions are called from the recognizer thread
+  which is running outside of the main application thread.  These functions
+  must execute quickly to maintain real time, and should normally just signal
+  events that have occurred that should be processed within the main
+  application thread in some kind of event loop processing.  A pointer
+  argument is specified by the application to be used as an argument of
+  the callback function.  TIesrSI also supplies an error value, indicating
+  status of the recognizer when the callback function is called.
+
+  NOTE: The callback functions must not call any TIesrSI_* functions, since
+  the callback functions are called outside of the main thread context. 
+
+  See TIesrSI_open.
+----------------------------------------------------------------------------*/
+typedef void (*TIesrSI_Callback_t)( void* aAppArgument, TIesrSI_Error_t aError );
+
+
+/*---------------------------------------------------------------------------  
+    The TIesrSI_Parameters object defines the parameters that may be set for the
+    TIesrEngine, once it is opened.  During opening, default values of these
+    parameters are set. Once the TIesr recognizer is opened, this object may
+    be used to set values that tailor the recognizer to a specific recognition
+    task.  These are advanced settings that can be used to improve performance
+    of the recognizer and adjust between processing time and processing
+    accuracy.  Consult documentation for detailed description before setting each
+    of these parameters.
+-----------------------------------------------------------------------------*/
+typedef struct TIesrSI_Parameters
+{
+      /* TIesr parameters */
+      short pruneFactor;
+      short transiWeight;
+
+      short sadDelta;
+      short sadMinDb;
+      short sadBeginFrames;
+      short sadEndFrames;
+      short sadNoiseFloor;
+
+      short jacRate;
+      short jacLikelihood;
+      short jacSegmentSize;
+      short jacSmoothCoef;
+      short jacDiscountFactor;
+      short jacDeweightFactor;
+      short jacSVAForgetFactor;
+      short sbcForgetFactor;
+
+      unsigned short lowVolume;
+      unsigned short highVolume;
+
+      unsigned short gselPctCoreClusters;
+      unsigned short gselPctInterClusters;
+
+      short ormRefFrames;
+      short ormNoiseLevelThreshold;
+      short ormLowNoiseLLRThreshold;
+      short ormHiNoiseLLRThreshold;
+      short ormEOSLowLLRFrames;
+      unsigned short ormEOSPctLLRThreshold;
+      short ormEOSDelayFrames;
+      short ormEOSFrmsAfterPeak;
+
+      unsigned short ssAlpha;
+      short ssBeta;
+      
+      short cnfAdaptThreshold;
+      short cnfNbestThreshold;
+
+      short realTimeFrameThreshold;
+      short realTimeGuard;
+
+      /*audio channel parameters */
+      int sampleRate;
+      int circularFrames;
+      int audioReadRate;
+      int audioFrames;
+      int audioPriority;
+
+      short bNBest; 
+  
+      short useTwoPass; 
+
+} TIesrSI_Params_t;
+
+    
+
+/*----------------------------------------------------------------
+  The functional interface to TIesrSI is given below
+----------------------------------------------------------------*/
+
+/*
+  Do this in order for the interface to work with C and C++.  The
+  TIesrSI API is compiled in C, so if used with C++ the function
+  names must not include the signature.
+*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*------------------------------------------------------------------- 
+   TIesrSI_create creates an instance of the recognizer and initializes
+   internal parameters necessary for operation of the recognizer.  It
+   places a pointer of type TIesrSI_t to the newly created TIesrSI_Object
+   in the location specified by aPtrToTIesrSI.
+---------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_create( TIesrSI_t* aPtrToTIesrSI );
+
+
+/*----------------------------------------------------------------------
+  TIesrSI_open opens the recognizer and prepares it for recognition by loading
+  the grammar used for the recognition. It specifies the name of the audio
+  channel to open and it also specifies the location of the JAC channel
+  compensation file that will be used for adjusting to varying channel
+  conditions.  If this file does not exist, it will be created.
+
+  A filename for the SBC tree definition file is specified, and must exist
+  and have the appropriate phone tree definitions that match the acoustic
+  model set in use.
+
+  The application also specifies how much memory (in short values) to allow the
+  recognizer to allocate for recognition.  This memory is allocated on the
+  heap, and will be deallocated when the recognizer is closed.
+
+  Two callback functions are specified, along with a pointer to data to be
+  used as an argument in the callback.  The recognizer also returns an
+  error value to indicate state of the recognizer when the function is
+  called. These functions are both called outside the main application thread
+  in the recognizer thread, and so should complete very quickly in order to
+  maintain real time processing.  They should not call any TIesrSI_* function.
+
+  The aSpeakCallback function is called when the recognizer is ready for the speaker
+  to speak.  The error value may indicate that the speaker is already speaking too
+  early, which may reduce recognizer performance.  There is no guarantee that
+  this function will ever be called, since there may be a failure in recognition,
+  or the application may stop the recognizer before it is ready for speech.
+
+  The second function, aDoneCallback, is called when recognition is complete.
+  If specified, it is guaranteed to be called once recognition starts successfully.
+  The error value will indicate whether recognition successfully completed or
+  completed with some error. 
+
+  If a function pointer is NULL, then the function will not be called.
+-------------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_open( TIesrSI_t aTIesrSI,
+                                     const char* aAudioDevice,
+                                     const char* aGrammarDir,
+                                     const char* aJACFile,
+                                     const char* aSBCFile,
+                                     const unsigned int aMemorySize,
+                                     TIesrSI_Callback_t aSpeakCallback,
+                                     TIesrSI_Callback_t aDoneCallback,
+                                     void* const aCbData );
+
+
+/*----------------------------------------------------------------------- 
+   Once the recognizer is open, the application can set several parameters
+   that affect the operation of the recognizer, as described by the
+   TIesrSI_Parameters object.  These parameters all are initialized with default
+   values when the recognizer is opened, but may be changed after opening.  
+   Parameters can not be changed while the recognizer is performing a recognition
+   task. Below are the functions for setting the recognizer parameters.
+--------------------------------------------------------------------------*/
+        
+    /* Fill a TIesrSI_Parameters object with the values presently in use in
+    the recognizer */
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_getparams( TIesrSI_t aTIesrSI,  
+        TIesrSI_Params_t* aParams );
+
+
+    /* Set the parameters for the recognizer to the values contained in the
+    TIesrSI_Parameters object. */
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_setparams( TIesrSI_t aTIesrSI, 
+        const TIesrSI_Params_t* aParams );
+
+
+/*------------------------------------------------------------------------ 
+   Start a TIesrSI recognition.  This will start audio data collection
+   (usually in a separate high priority thread in order to maintain real time)
+   and will start recognition in a another separate thread.  The application
+   can set the priority for the recognition thread, but this should normally
+   be set to the same priority as the main thread or lower, so that it runs at
+   the same priority or lower than the application. That way it will not
+   interfere with real-time interaction with the user.
+
+   A capture file name may be specified.  If the parameter is not NULL, then the
+   audio used for recognition will be written to the capture file.
+
+   NOTE: Each successful call of TIesrSI_start must be accompanied by a single
+   call to TIesrSI_stop, either before recognition is complete to stop
+   recognition early, or after recognition is completed.
+-------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_start( TIesrSI_t aTIesrSI, const int aPriority,
+        char* aCaptureFile );
+
+
+/*--------------------------------------------------------------------------
+  Stop a TIesrSI recognition.  This function stops a recognition task.  This
+  may be called before the recognizer has had time to complete the recognition
+  task, or after the recognizer has completed recognition.  
+
+  NOTE: This function must be called once for each successful call to
+  TIesrSI_start.  It must be called prior to getting recognition results.
+
+  This function ensures that the audio data collection and recognition threads
+  have completed.  Since the recognizer is running in a separate thread,
+  recognition may complete normally before this function is completed.
+  However, it is guaranteed that when this function returns that the
+  recognizer and audio data collection threads have terminated.  It is the
+  responsibility of the application designer to correctly handle any callback
+  functions that the recognizer might make prior to termination of the
+  recognition thread.  Once the recognizer has stopped, it may be started
+  again simply by another call to TIesrSI_start.
+---------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_stop( TIesrSI_t aTIesrSI );
+
+
+/*----------------------------------------------------------------
+TIesrSI_nbcount
+
+Get the number of hypothesis recognized.  This assumes that a valid recognition
+result has completed. 
+------------------------------------------------------------------*/
+  TIESRSI_API
+  TIesrSI_Error_t TIesrSI_nbcount( TIesrSI_t aTIesrSI, short* aNumHyp) ;
+
+/*-----------------------------------------------------------------------
+  Get the number of words that were recognized during the last recognition.
+  This must be called after a a successful recognition has taken place, as
+  indicated by the aDoneCallback function, and after TIesrSI_stop is called.
+--------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_wdcount( TIesrSI_t aTIesrSI, 
+        unsigned short* aNumWords , short iHypIdx);
+
+/*-------------------------------------------------------------------------
+  Get a pointer to a word that was recognized during the last recognition.
+  This must be called after a a successful recognition has taken place, as
+  indicated by the aDoneCallback function, and after TIesrSI_stop is called.
+  Word indices outside of the actual number of words recognized will
+  return a NULL pointer.
+--------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_word( TIesrSI_t aTIesrSI, unsigned short aWordNum, 
+        const char** aWord , short iHypIdx);
+
+/*--------------------------------------------------------------------------- 
+   Get the likelihood score information for the result of the last recognition
+   operation.  The likelihood score can indicate whether the input speech
+   matched the models well or not.
+------------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_score( TIesrSI_t aTIesrSI, long* aScore );
+
+
+/*-------------------------------------------------------------------------- 
+   Get the number of audio frames that the recognizer processed to arrive at
+   the last recognition result.  This function may be helpful to diagnose
+   recognition problems.  It is generally not necessary for enabling
+   applications.
+----------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_frmcount( TIesrSI_t aTIesrSI, short* aNumFrames );
+
+
+/*----------------------------------------------------------------
+  Get the volume status of the last recognized utterance.  This indicates whether
+  the volume was too low, high or ok.  At the present time it is a crude measure
+  based on maximum absolute signal value.
+----------------------------------------------------------------*/
+   TIESRSI_API
+   TIesrSI_Error_t TIesrSI_volume( TIesrSI_t aTIesrSI, short* aVolumeStatus );
+
+
+/*----------------------------------------------------------------
+  Get the confidence measure of the last recognized utterance  This is a measure
+  that indicates how confident the measure of the last utterance is.
+----------------------------------------------------------------*/
+   TIESRSI_API
+   TIesrSI_Error_t TIesrSI_confidence( TIesrSI_t aTIesrSI, short* aConfidence );
+
+
+/*--------------------------------------------------------------------------
+   Get detailed status information for the result of the last
+   recognition operation.  This status consists of three integers. The
+   first specifies detailed recognition engine status, the second the
+   detailed status of audio collection, and the last the detailed
+   status of environment adaptation.  Normally, this function is not
+   called, but may be useful during debugging of an application to
+   determine the cause of recognition failures.  This function can be called
+   after any other TIesrSI API function except TIesrSI_destroy, to get
+   detailed status of the result of the TIesrSI API function call.
+   ----------------------------------------------------------------------------*/
+
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_status( TIesrSI_t aTIesrSI, 
+        int* aRecoStatus, int* aAudioStatus, int* aJacStatus );
+
+
+/*---------------------------------------------------------------------------
+  Close the TIesrSI recognizer.  This will deallocate any resources that 
+  were created when the recognizer was opened.  The recognizer can then
+  be opened again, for example, with a new grammar dependent on the particular
+  state of the application.
+-----------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_close( TIesrSI_t aTIesrSI );
+
+
+/*--------------------------------------------------------------------------- 
+   Destruct the instance of the recognizer.  This completely removes the 
+   TIesrSI object that was created with TIesrSI_create, and frees all resources
+   that were allocated internally.  This must be called as the last part of
+   using a recognizer instance to ensure that all allocated resources have
+   been deallocated and no leakage occurs.
+-----------------------------------------------------------------------------*/
+    TIESRSI_API
+        TIesrSI_Error_t TIesrSI_destroy( TIesrSI_t aTIesrSI );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _TIESRSI_USER_H */
diff --git a/TIesrSI/src/TestTIesrSI.cpp b/TIesrSI/src/TestTIesrSI.cpp
new file mode 100755 (executable)
index 0000000..1e5c74e
--- /dev/null
@@ -0,0 +1,472 @@
+/*=======================================================================
+ TestTIestSI.cpp
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ This file implements a utility that runs TIesrSI recognition
+ from the command line.  It prompts for an utterance, recognizes it,
+ and outputs the recognized phrase.  All output is to stdout.
+ The command line is:
+
+ TestTIesrSI Mem GramDir JacFile HLRFile device [Filename]
+
+ Mem = Working membory size in 16-bit elements
+ GramDir = Grammar and model directory where models created by TIesrFlex exist
+ JACFile = JAC file location where dynamic noise/channel adaptation data placed
+ HLRFile = HLR phonetic tree file location
+ device =  ALSA audio PCM device to open. May also be a file name containing
+           raw audio as input to be recognized.
+ [Filename] = Optional file name containing output recorded audio data.
+
+======================================================================*/
+
+/* C run-time usage */
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+// Include the app macros, constants and structures
+#include "TestTIesrSI.h"
+
+/*--------------------------------*/
+int main(int argc, char** argv) {
+
+    /* recognition object and error */
+    Reco_t reco;
+    RecoError_t recoError;
+
+    // The recognition semaphores for TIesrSI Callbacks
+#if defined (LINUX )
+    sem_t start_semaphore;
+    sem_t done_semaphore;
+#elif defined ( WIN32 )
+#endif
+
+    // The TIesrSI recognizer instance variable.  It will hold a
+    // TIesrSI recognizer instance.
+    TIesrSI_t tiesrSI;
+    TIesrSI_Error_t siError;
+
+
+    /* speech data input file list variables */
+
+    /* Initialization of reco structure with command line arguments */
+    if (argc != 6 && argc != 7 ) {
+        printf("Invalid argument count\n");
+        return 1;
+    }
+
+    reco.memorySize = atoi(argv[1]);
+    reco.grammarDir = argv[2];
+    reco.jacFile = argv[3];
+    reco.sbcFile = argv[4];
+    reco.audioDevice = argv[5];
+    
+    if( argc == 7 )
+        reco.captureFile = argv[6];
+    else
+        reco.captureFile = NULL;
+
+
+
+    /* Initialize app recognizer state */
+    reco.state = IDLE;
+    reco.tiesrIsOpen = FALSE;
+
+
+#if defined ( LINUX )
+    /* Initialize the recognition TIesr callback semaphores */
+    reco.start_semaphore = &start_semaphore;
+    sem_init(reco.start_semaphore, 0, 0);
+
+    reco.done_semaphore = &done_semaphore;
+    sem_init(reco.done_semaphore, 0, 0);
+
+#elif defined ( WIN32 )
+    reco.start_event = CreateEvent(NULL, FALSE, FALSE, NULL );
+    reco.done_event = CreateEvent( NULL, FALSE, FALSE, NULL );
+#endif
+
+
+    /* Create a TIesrSI recognizer instance */
+    printf("Creating TIesrSI recognizer\n");
+    siError = TIesrSI_create(&tiesrSI);
+    if (siError != TIesrSIErrNone) {
+        printf("TIesrSI create error %d\n", siError);
+        return 1;
+    }
+    reco.tiesrSI = tiesrSI;
+
+
+    /* Open the recognizer instance */
+    printf("Opening TIesrSI recognizer\n");
+    recoError = OpenTIesr(&reco);
+    if (recoError != RecoErrNone) {
+        printf("Could not open TIesr\n");
+        TIesrSI_destroy(tiesrSI);
+        exit(recoError);
+    }
+
+
+    /* Start TIesr recognition.  TIesrSI will start recognition in a
+    new thread. */
+    printf("Starting TIesrSI recognizer\n");
+    recoError = StartTIesr(&reco);
+    if (recoError != RecoErrNone) {
+        printf("Could not start TIesr\n");
+        CloseTIesr(&reco);
+        TIesrSI_destroy(tiesrSI);
+        exit(recoError);
+    }
+
+    /* Wait for recognizer to be ready to receive speech.  The TIesrSI
+     recognizer will call the SpeakCallback function to signal this
+     semaphore when ready. Normally you would do other processing during this
+     time and the callback would signal an event when the recognizer is ready. */
+#if defined ( LINUX )
+    sem_wait(reco.start_semaphore);
+#elif defined ( WIN32 )
+    WaitForSingleObject(reco.start_event, INFINITE );
+#endif
+
+    if (reco.speakResult != TIesrSIErrNone) {
+        printf("Recognizer not ready - spoke too early?\n");
+        StopTIesr(&reco);
+        CloseTIesr(&reco);
+        TIesrSI_destroy(tiesrSI);
+        exit(reco.speakResult);
+    }
+
+    /* Prompt user for speech */
+    printf("Speak now...\n");
+
+
+    /* Wait for recognition to complete.  TIesrSI will call DoneCallback to
+     set the semaphore when recognition is complete.  Normally you would do
+     processing at this time, and the callback would signal an event
+     when complete. */
+#if defined ( LINUX )
+    sem_wait(reco.done_semaphore);
+#elif defined ( WIN32 )
+    WaitForSingleObject(reco.done_event, INFINITE );
+#endif
+
+
+
+    /* Stop the recognizer (this also formalizes recognition results
+    // within TIesrSI ) */
+    printf("Stopping TIesrSI recognizer\n");
+    recoError = StopTIesr(&reco);
+    if (recoError != RecoErrNone) {
+        printf("Recognizer stop failure\n");
+        CloseTIesr(&reco);
+        TIesrSI_destroy(tiesrSI);
+        exit(recoError);
+    }
+
+
+    // Check recognition result, and if a recognition result is available
+    // output the result.
+    if (reco.doneResult != TIesrSIErrNone) {
+        printf("Recognition failed with error %d\n", reco.doneResult);
+
+        int recoStatus, audioStatus, jacStatus;
+        TIesrSI_status( reco.tiesrSI, &recoStatus, &audioStatus, &jacStatus );
+        printf( "Reco: %d  Audio: %d JAC: %d\n", recoStatus, audioStatus, jacStatus );
+
+    } else {
+        OutputResult(reco.tiesrSI);
+    }
+
+    /* Close the recognizer on this file */
+    printf("Closing TIesrSI recognizer\n");
+    recoError = CloseTIesr(&reco);
+    if (recoError != RecoErrNone) {
+        printf("Failed to close TIesr recognizer\n");
+        exit(recoError);
+    }
+
+    /* Destroy the recognizer instance */
+    printf("Destroying TIesrSI recognizer\n");
+    siError = TIesrSI_destroy(reco.tiesrSI);
+
+    /* destroy the semaphore */
+#if defined ( LINUX )
+    sem_destroy(reco.start_semaphore);
+    sem_destroy(reco.done_semaphore);
+#elif defined ( WIN32 )
+    CloseHandle(reco.start_event);
+    CloseHandle(reco.done_event);
+#endif
+
+    if (siError != TIesrSIErrNone)
+          return siError;
+
+    return TIesrSIErrNone;
+}
+
+/*----------------------------------------------------------------*/
+void OutputResult(TIesrSI_t aTIesrSI) {
+    TIesrSI_Error_t siError;
+    unsigned short numWords;
+    unsigned short wd;
+    char const *word;
+    short confidence;
+
+    /* Number of words in best answer */
+    siError = TIesrSI_wdcount(aTIesrSI, &numWords, 0);
+
+    if (numWords == 0) {
+        printf("No recognition result - no words recognized\n");
+        return;
+    }
+
+    /* Output all words of recognized answer except _SIL */
+    printf("Recognized: ");
+    for (wd = 0; wd < numWords; wd++) {
+        siError = TIesrSI_word(aTIesrSI, wd, &word, 0);
+        if (siError != TIesrSIErrNone)
+            printf("*** ");
+        else if (strcmp(word, "_SIL"))
+            printf("%s ", word);
+    }
+    printf("\n");
+
+    /* Get confidence measure - only valid for "large" grammars now */
+    /*
+    siError = TIesrSI_confidence( aTIesrSI, &confidence );
+    if( siError != TIesrSIErrNone )
+        printf( "Could not get confidence measure\n");
+    else
+        printf( "Confidence: %d\n", confidence );
+        */
+}
+
+/*----------------------------------------------------------------
+  SpeakCallback
+  This is the callback function sent to TIesrSI that it will call
+  when it is ready for speech. This is a simple function that just
+  stores the status returned in the callback.
+  ---------------------------------------------------------------*/
+void SpeakCallback(void* aArg, TIesrSI_Error_t aError) {
+    Reco_t* reco = (Reco_t*) aArg;
+
+    // Just store the status of the callback
+    reco->speakResult = aError;
+#if defined ( LINUX )
+    sem_post(reco->start_semaphore);
+#elif defined ( WIN32 )
+    SetEvent(reco->start_event);
+#endif
+}
+
+/*----------------------------------------------------------------
+ DoneCallback
+
+ This is the callback function that TIesrSI will call when it has
+ completed recognition, either because of an error condition, or
+ because the recognizer has completed.
+ -----------------------------------------------------------------*/
+void DoneCallback(void* aArg, TIesrSI_Error_t aError) {
+    Reco_t* reco = (Reco_t*) aArg;
+
+    // Save recognition status of the callback
+    reco->doneResult = aError;
+
+    // Notify the main thread that the recognition has completed
+#if defined ( LINUX )
+    sem_post(reco->done_semaphore);
+#elif defined ( WIN32 )
+    SetEvent(reco->done_event);
+#endif
+}
+
+/*----------------------------------------------------------------
+ OpenTIesr
+
+ This app function is a thin wrapper over the TIesrSI open function
+ call that opens the TIesrSI recognizer to recognize a given file
+ with a created grammar network and model set.  It also sets any
+ custom recognizer parameters that may be tested.
+ ------------------------------------------------------------------*/
+RecoError_t OpenTIesr(Reco_t* reco) {
+    TIesrSI_Error_t siError;
+    TIesrSI_Params_t siParams;
+    int recoStatus;
+    int audioStatus;
+    int jacStatus;
+
+    if (reco->tiesrIsOpen) {
+        return RecoErrOpen;
+    }
+
+
+    // Open TIesrSI connected to an input speech data file
+    siError = TIesrSI_open(reco->tiesrSI,
+            reco->audioDevice,
+            reco->grammarDir,
+            reco->jacFile,
+            reco->sbcFile,
+            reco->memorySize,
+            SpeakCallback,
+            DoneCallback,
+            (void*) reco);
+
+    if (siError != TIesrSIErrNone) {
+        printf("Failed to open TIesr\n");
+        siError = TIesrSI_status(reco->tiesrSI, &recoStatus, &audioStatus, &jacStatus);
+        printf("Reco/audio status: %d %d %d\n", recoStatus, audioStatus, jacStatus);
+        return RecoErrFail;
+    }
+    reco->tiesrIsOpen = TRUE;
+
+    // Update the parameters to those desired.  Parameters will be specified
+    // by the STL lab
+    siError = TIesrSI_getparams(reco->tiesrSI, &siParams);
+    if (siError != TIesrSIErrNone) {
+        printf("Failed to get TIesr parameters\n");
+        siError = TIesrSI_status(reco->tiesrSI, &recoStatus, &audioStatus, &jacStatus);
+        printf("Reco/audio status: %d %d %d\n", recoStatus, audioStatus, jacStatus);
+    }
+
+    siParams.circularFrames = CIRCULAR_FRAMES;
+    siParams.audioReadRate = AUDIO_READ_RATE;
+    siParams.audioFrames = AUDIO_FRAMES;
+    siParams.jacRate = JAC_RATE;
+    siParams.pruneFactor = PRUNE_FACTOR;
+    siParams.transiWeight = TRANSI_WEIGHT;
+    siParams.sadEndFrames = SAD_END_FRAMES;
+    siParams.audioPriority = AUDIO_PRIORITY;
+
+    // Testing only
+    //siParams.pruneFactor = -5;
+    //siParams.jacRate = 80;
+    //siParams.transiWeight = 0;
+
+    //siParams.ormLowNoiseLLRThreshold = 200;
+    //siParams.ormHiNoiseLLRThreshold = 100;
+    //siParams.cnfAdaptThreshold = -20;
+    //siParams.realTimeFrameThreshold = 100;
+    //siParams.bNBest = 0;
+
+    siError = TIesrSI_setparams(reco->tiesrSI, &siParams);
+    if (siError != TIesrSIErrNone) {
+        printf("Failed to set TIesr parameters\n");
+        siError = TIesrSI_status(reco->tiesrSI, &recoStatus, &audioStatus, &jacStatus);
+        printf("Reco/audio status: %d %d %d\n", recoStatus, audioStatus, jacStatus);
+    }
+
+    return RecoErrNone;
+}
+
+/*----------------------------------------------------------------
+  StartTIesr
+  This function is a thin wrapper over the TIesr start function call
+  to start the TIesrSI recognizer in a new thread. It just ensures
+  that the recognizer state is maintained.
+  -----------------------------------------------------------------*/
+RecoError_t StartTIesr(Reco_t * reco) {
+    TIesrSI_Error_t siError;
+    int recoStatus;
+    int audioStatus;
+    int jacStatus;
+
+    if (!reco->tiesrIsOpen) {
+        return RecoErrClosed;
+    }
+
+
+    if (reco->state == RECOGNIZING) {
+        return RecoErrRecognizing;
+    }
+
+
+    // Start the recognizer. Successful completion of
+    // this function call means a new TIesrSI thread is running.
+    siError = TIesrSI_start(reco->tiesrSI, 0, reco->captureFile );
+    if (siError == TIesrSIErrNone) {
+        reco->state = RECOGNIZING;
+        return RecoErrNone;
+    } else {
+        printf("Failed to start TIesr\n");
+        siError = TIesrSI_status(reco->tiesrSI, &recoStatus, &audioStatus, &jacStatus);
+        printf("Reco/audio status: %d %d %d\n", recoStatus, audioStatus, jacStatus);
+        return RecoErrFail;
+    }
+}
+
+/*----------------------------------------------------------------
+ StopTIesr
+
+ This is a thin wrapper app function over the TIesrSI stop function
+ call.  Stopping the recognizer must be done if the recognizer
+ started successfully.  This is true even if the recognizer notifies
+ the app of a recognition error via the callback status.  This function
+ also maintains the app recognizer state.
+ ------------------------------------------------------------------*/
+RecoError_t StopTIesr(Reco_t * reco) {
+    TIesrSI_Error_t siError;
+    int recoStatus;
+    int audioStatus;
+    int jacStatus;
+
+    if (!reco->tiesrIsOpen) {
+        return RecoErrClosed;
+    }
+
+
+    if (reco->state == IDLE) {
+        return RecoErrIdle;
+    }
+
+
+    siError = TIesrSI_stop(reco->tiesrSI);
+    if (siError == TIesrSIErrNone) {
+        reco->state = IDLE;
+        return RecoErrNone;
+    } else {
+        printf("Failed to stop TIesr\n");
+        siError = TIesrSI_status(reco->tiesrSI, &recoStatus, &audioStatus, &jacStatus);
+        printf("Reco/audio status: %d %d %d\n", recoStatus, audioStatus, jacStatus);
+        return RecoErrFail;
+    }
+}
+
+/*----------------------------------------------------------------
+ CloseTIesr
+
+ This function is a thin wrapper over the TIesrSI close function
+ call.  It maintains the recognizer state.
+ ----------------------------------------------------------------*/
+RecoError_t CloseTIesr(Reco_t * reco) {
+    TIesrSI_Error_t siError;
+    int recoStatus;
+    int audioStatus;
+    int jacStatus;
+
+    if (!reco->tiesrIsOpen) {
+        return RecoErrClosed;
+    }
+
+    if (reco->state == RECOGNIZING) {
+        return RecoErrRecognizing;
+    }
+
+    siError = TIesrSI_close(reco->tiesrSI);
+    if (siError == TIesrSIErrNone) {
+        reco->tiesrIsOpen = FALSE;
+        return RecoErrNone;
+    } else {
+        printf("Failed to close TIesr\n");
+        siError = TIesrSI_status(reco->tiesrSI, &recoStatus, &audioStatus, &jacStatus);
+        printf("Reco/audio status: %d %d %d\n", recoStatus, audioStatus, jacStatus);
+        return RecoErrFail;
+    }
+}
+
+
+
+
diff --git a/TIesrSI/src/TestTIesrSI.h b/TIesrSI/src/TestTIesrSI.h
new file mode 100755 (executable)
index 0000000..4150d1d
--- /dev/null
@@ -0,0 +1,154 @@
+/*=======================================================================
+ TestTIesrSI.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+ Include file for building an application to do speech
+ recognition using the TIesr SI API. This is a simple command line
+ app that runs recognition of an utterance and outputs the words
+ recognized.
+
+ The macros, structures, and declarations in this header are
+ for the convenience in building the application.
+
+======================================================================*/
+
+/*----------------------------------------------------------------
+
+ ----------------------------------------------------------------*/
+
+#ifndef _TIesrReco_H
+#define _TIesrReco_H
+
+// Windows headers
+#if defined (WIN32)
+#include <windows.h>
+#endif
+
+// The TIesr SI top level APIs for grammar network and model creation
+// and speech recognition
+#include "TIesrSI_User.h"
+
+// For synchronization with multi-threaded speech recognition APIs
+#if defined (LINUX)
+#include <semaphore.h>
+#elif defined (WIN32)
+#endif
+
+/*--------------------------------
+  Overall constants
+  --------------------------------*/
+
+#ifndef TRUE
+static const int TRUE = 1;
+#endif
+
+#ifndef FALSE
+static const int FALSE = 0;
+#endif
+
+static const int MAX_LINE = 1000;
+static const int MAX_FILE = 2000;
+
+
+/*--------------------------------
+  Definition of flags for Gaussian output types.
+  The ones used must agree with the TIesrEngine build configuration!
+  --------------------------------*/
+static const int BYTEMEANS = 1;
+static const int SHORTMEANS = 0;
+
+static const int BYTEVARS = 1;
+static const int SHORTVARS = 0;
+
+
+/*--------------------------------
+ Parameters used within the file recognition program to 
+ setup the TIesrSI recognizer.
+ --------------------------------*/
+#if defined (LINUX)
+static const int CIRCULAR_FRAMES = 500;
+static const int AUDIO_FRAMES = 10;
+static const int AUDIO_READ_RATE = 20000;
+static const int JAC_RATE = 400;
+static const int PRUNE_FACTOR = -5;
+static const int TRANSI_WEIGHT = 2;
+static const int SAD_END_FRAMES = 80;
+static const int AUDIO_PRIORITY = 20;
+#elif defined (WIN32)
+static const int CIRCULAR_FRAMES = 500;
+static const int AUDIO_FRAMES = 40;
+static const int AUDIO_READ_RATE = 2;
+static const int JAC_RATE = 400;
+static const int PRUNE_FACTOR = -5;
+static const int TRANSI_WEIGHT = 2;
+static const int SAD_END_FRAMES = 80;
+static const int AUDIO_PRIORITY = THREAD_PRIORITY_ABOVE_NORMAL;
+#endif
+
+/*--------------------------------
+  The reco app information.  An enum defining the response errors,
+  and a structure holding the reco information.
+  --------------------------------*/
+typedef enum RecoErrors
+{
+   RecoErrNone,
+   RecoErrFail,
+   RecoErrNoGrammar,
+   RecoErrOpen,
+   RecoErrClosed,
+   RecoErrRecognizing,
+   RecoErrIdle
+} RecoError_t;
+
+typedef enum RecoState
+{
+   IDLE,
+   RECOGNIZING,
+} RecoState_t;
+
+typedef struct Reco {
+    int memorySize;
+    char* audioDevice;
+    char* jacFile;
+    char* sbcFile;
+    char *grammarDir;
+    char *captureFile;
+
+    RecoState_t state;
+    int tiesrIsOpen;
+
+    TIesrSI_t tiesrSI;
+    TIesrSI_Error_t speakResult;
+    TIesrSI_Error_t doneResult;
+
+#if defined ( LINUX )
+    sem_t* start_semaphore;
+    sem_t* done_semaphore;
+#elif defined( WIN32 )
+    HANDLE start_event;
+    HANDLE done_event;
+#endif
+
+} Reco_t;      
+
+
+/*----------------------------------------------------------------
+  The functions that make up the reco utility
+  ---------------------------------------------------------------*/
+
+/* Callbacks for TIesrSI */
+void SpeakCallback( void* aArg, TIesrSI_Error_t aError );
+void DoneCallback( void* aArg, TIesrSI_Error_t aError );
+
+/* The functions making up the app */
+RecoError_t OpenTIesr( Reco_t* reco );
+RecoError_t StartTIesr( Reco_t* reco );
+void OutputResult( TIesrSI_t aTIesrSI );
+RecoError_t StopTIesr( Reco_t* reco );
+RecoError_t CloseTIesr( Reco_t* reco );
+
+
+#endif /* _TIesrReco_H */
+
diff --git a/TIesr_Tools/Example/Data/AUDIO.tar.gz b/TIesr_Tools/Example/Data/AUDIO.tar.gz
new file mode 100644 (file)
index 0000000..6e65582
Binary files /dev/null and b/TIesr_Tools/Example/Data/AUDIO.tar.gz differ
diff --git a/TIesr_Tools/Example/Data/Fphones.mlf b/TIesr_Tools/Example/Data/Fphones.mlf
new file mode 100644 (file)
index 0000000..313b939
--- /dev/null
@@ -0,0 +1,101 @@
+#!MLF!#
+"*/f1_no.lab"
+sil
+n
+ow
+sil
+.
+"*/f1_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/f1_yes.lab"
+sil
+y
+eh
+s
+sil
+.
+"*/f2_no.lab"
+sil
+n
+ow
+sil
+.
+"*/f2_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/f2_yes.lab"
+sil
+y
+eh
+s
+sil
+.
+"*/f3_no.lab"
+sil
+n
+ow
+sil
+.
+"*/f3_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/f3_yes.lab"
+sil
+y
+eh
+s
+sil
+.
+"*/f4_no.lab"
+sil
+n
+ow
+sil
+.
+"*/f4_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/f4_yes.lab"
+sil
+y
+eh
+s
+sil
+.
+"*/f5_no.lab"
+sil
+n
+ow
+sil
+.
+"*/f5_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/f5_yes.lab"
+sil
+y
+eh
+s
+sil
+.
diff --git a/TIesr_Tools/Example/Data/HMMPROTO/global.mmf b/TIesr_Tools/Example/Data/HMMPROTO/global.mmf
new file mode 100644 (file)
index 0000000..f6b8757
--- /dev/null
@@ -0,0 +1,21 @@
+~o
+<STREAMINFO> 1 20
+<VECSIZE> 20<nullD><DiagC><USER_D> 
+~h "global"
+<BeginHMM>
+ <NumStates> 3
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 3
+  0.000e+0    5.000e-1    5.000e-1
+  0.000e+0    5.000e-1    5.000e-1 
+  0.000e+0    0.000e+0    0.000e+0
+<EndHMM>
diff --git a/TIesr_Tools/Example/Data/HMMPROTO/phones.mmf b/TIesr_Tools/Example/Data/HMMPROTO/phones.mmf
new file mode 100644 (file)
index 0000000..f9db38a
--- /dev/null
@@ -0,0 +1,306 @@
+~o
+<STREAMINFO> 1 20
+<VECSIZE> 20<nullD><DiagC><USER_D> 
+~h "sil"
+<BeginHMM>
+ <NumStates> 5
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 3 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 4 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 5
+  0.000e+0    5.000e-1    5.000e-1    0.000e+0    0.000e+0
+  0.000e+0    3.000e-1    4.000e-1    3.000e-1    0.000e+0
+  0.000e+0    0.000e+0    3.000e-1    4.000e-1    3.000e-1
+  0.000e+0    0.000e+0    0.000e+0    4.000e-1    6.000e-1
+  0.000e+0    0.000e+0    0.000e+0    0.000e+0    0.000e+0
+ <EndHMM>
+
+~h "eh"
+<BeginHMM>
+ <NumStates> 5
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 3 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 4 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 5
+  0.000e+0    5.000e-1    5.000e-1    0.000e+0    0.000e+0
+  0.000e+0    3.000e-1    4.000e-1    3.000e-1    0.000e+0
+  0.000e+0    0.000e+0    3.000e-1    4.000e-1    3.000e-1
+  0.000e+0    0.000e+0    0.000e+0    4.000e-1    6.000e-1
+  0.000e+0    0.000e+0    0.000e+0    0.000e+0    0.000e+0
+ <EndHMM>
+
+~h "ey"
+<BeginHMM>
+ <NumStates> 5
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 3 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 4 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 5
+  0.000e+0    5.000e-1    5.000e-1    0.000e+0    0.000e+0
+  0.000e+0    3.000e-1    4.000e-1    3.000e-1    0.000e+0
+  0.000e+0    0.000e+0    3.000e-1    4.000e-1    3.000e-1
+  0.000e+0    0.000e+0    0.000e+0    4.000e-1    6.000e-1
+  0.000e+0    0.000e+0    0.000e+0    0.000e+0    0.000e+0
+ <EndHMM>
+
+~h "k"
+<BeginHMM>
+ <NumStates> 5
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 3 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 4 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 5
+  0.000e+0    5.000e-1    5.000e-1    0.000e+0    0.000e+0
+  0.000e+0    3.000e-1    4.000e-1    3.000e-1    0.000e+0
+  0.000e+0    0.000e+0    3.000e-1    4.000e-1    3.000e-1
+  0.000e+0    0.000e+0    0.000e+0    4.000e-1    6.000e-1
+  0.000e+0    0.000e+0    0.000e+0    0.000e+0    0.000e+0
+ <EndHMM>
+
+~h "n"
+<BeginHMM>
+ <NumStates> 5
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 3 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 4 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 5
+  0.000e+0    5.000e-1    5.000e-1    0.000e+0    0.000e+0
+  0.000e+0    3.000e-1    4.000e-1    3.000e-1    0.000e+0
+  0.000e+0    0.000e+0    3.000e-1    4.000e-1    3.000e-1
+  0.000e+0    0.000e+0    0.000e+0    4.000e-1    6.000e-1
+  0.000e+0    0.000e+0    0.000e+0    0.000e+0    0.000e+0
+ <EndHMM>
+
+~h "ow"
+<BeginHMM>
+ <NumStates> 5
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 3 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 4 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 5
+  0.000e+0    5.000e-1    5.000e-1    0.000e+0    0.000e+0
+  0.000e+0    3.000e-1    4.000e-1    3.000e-1    0.000e+0
+  0.000e+0    0.000e+0    3.000e-1    4.000e-1    3.000e-1
+  0.000e+0    0.000e+0    0.000e+0    4.000e-1    6.000e-1
+  0.000e+0    0.000e+0    0.000e+0    0.000e+0    0.000e+0
+ <EndHMM>
+
+~h "s"
+<BeginHMM>
+ <NumStates> 5
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 3 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 4 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 5
+  0.000e+0    5.000e-1    5.000e-1    0.000e+0    0.000e+0
+  0.000e+0    3.000e-1    4.000e-1    3.000e-1    0.000e+0
+  0.000e+0    0.000e+0    3.000e-1    4.000e-1    3.000e-1
+  0.000e+0    0.000e+0    0.000e+0    4.000e-1    6.000e-1
+  0.000e+0    0.000e+0    0.000e+0    0.000e+0    0.000e+0
+ <EndHMM>
+
+~h "y"
+<BeginHMM>
+ <NumStates> 5
+  <State> 2 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+   <Variance> 20
+    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 3 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+  <State> 4 <NumMixes> 1   
+   <Mixture> 1 1.0
+    <Mean> 20
+     0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 0.0
+    <Variance> 20
+     1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
+1.0 1.0
+
+ <TransP> 5
+  0.000e+0    5.000e-1    5.000e-1    0.000e+0    0.000e+0
+  0.000e+0    3.000e-1    4.000e-1    3.000e-1    0.000e+0
+  0.000e+0    0.000e+0    3.000e-1    4.000e-1    3.000e-1
+  0.000e+0    0.000e+0    0.000e+0    4.000e-1    6.000e-1
+  0.000e+0    0.000e+0    0.000e+0    0.000e+0    0.000e+0
+ <EndHMM>
diff --git a/TIesr_Tools/Example/Data/Mphones.mlf b/TIesr_Tools/Example/Data/Mphones.mlf
new file mode 100644 (file)
index 0000000..26e0f55
--- /dev/null
@@ -0,0 +1,101 @@
+#!MLF!#
+"*/m1_no.lab"
+sil
+n
+ow
+sil
+.
+"*/m1_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/m1_yes.lab"
+sil
+y
+eh
+s
+sil
+.
+"*/m2_no.lab"
+sil
+n
+ow
+sil
+.
+"*/m2_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/m2_yes.lab"
+sil
+y
+eh
+s
+sil
+.
+"*/m3_no.lab"
+sil
+n
+ow
+sil
+.
+"*/m3_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/m3_yes.lab"
+sil
+y
+eh
+s
+sil
+.
+"*/m4_no.lab"
+sil
+n
+ow
+sil
+.
+"*/m4_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/m4_yes.lab"
+sil
+y
+eh
+s
+sil
+.
+"*/m5_no.lab"
+sil
+n
+ow
+sil
+.
+"*/m5_okay.lab"
+sil
+ow
+k
+ey
+sil
+.
+"*/m5_yes.lab"
+sil
+y
+eh
+s
+sil
+.
diff --git a/TIesr_Tools/Example/Data/Segmented_phones.mlf b/TIesr_Tools/Example/Data/Segmented_phones.mlf
new file mode 100644 (file)
index 0000000..b9c7d05
--- /dev/null
@@ -0,0 +1,201 @@
+#!MLF!#
+"*/f1_no.lab"
+0 7830000 sil
+7830000 8305000 n
+8305000 11320000 ow
+11320000 20980000 sil
+.
+"*/f1_okay.lab"
+0 8020000  sil
+8020000 8880000 ow
+8880000 10120000 k
+10120000 12160000 ey
+12160000 21320000 sil
+.
+"*/f1_yes.lab"
+0 8000000 sil
+8000000 9000000 y
+9000000 9800000 eh
+9800000 12100000 s
+12100000 21200000 sil
+.
+"*/f2_no.lab"
+0 4740000 sil
+4740000 5360000 n
+5360000 8560000 ow
+8560000 16180000 sil
+.
+"*/f2_okay.lab"
+0 3780000 sil
+3780000 5040000 ow
+5040000 6480000 k
+6480000 9320000 ey
+9320000 16800000 sil
+.
+"*/f2_yes.lab"
+0 7260000 sil
+7260000 7960000 y
+7960000 9260000 eh
+9260000 11660000 s
+11660000 18880000 sil
+.
+"*/f3_no.lab"
+0 7200000 sil
+7200000 8480000 n
+8480000 12080000 ow
+12080000 20280000 sil
+.
+"*/f3_okay.lab"
+0 5800000 sil
+5800000 7180000 ow
+7180000 8760000 k
+8760000 12000000 ey
+12000000 20460000 sil
+.
+"*/f3_yes.lab"
+0 7940000 sil
+7940000 8740000 y
+8740000 10320000 eh
+10320000 10920000 s
+10920000 20560000 sil
+.
+"*/f4_no.lab"
+0 8340000 sil
+8340000 9280000 n
+9280000 12460000 ow
+12460000 20520000 sil
+.
+"*/f4_okay.lab"
+0 8440000 sil
+8440000 9160000 ow
+9160000 9900000 k
+9900000 12560000 ey
+12560000 19600000 sil
+.
+"*/f4_yes.lab"
+0 8100000 sil
+8100000 9160000 y
+9160000 10520000 eh
+10520000 13320000 s
+13320000 20920000 sil
+.
+"*/f5_no.lab"
+0 7700000 sil
+7700000 9140000 n
+9140000 12620000 ow
+12620000 20060000 sil
+.
+"*/f5_okay.lab"
+0 8400000 sil
+8400000 9520000 ow
+9520000 10500000 k
+10500000 13700000 ey
+13700000 22420000 sil
+.
+"*/f5_yes.lab"
+0 8120000 sil
+8120000 8980000 y
+8980000 10840000 eh
+10840000 13900000 s
+13900000 19940000 sil
+.
+"*/m1_no.lab"
+0 7680000 sil
+7680000 8340000 n
+8340000 10900000 ow
+10900000 18400000 sil
+.
+"*/m1_okay.lab"
+0 7980000 sil
+7980000 9120000 ow
+9120000 10140000 k
+10140000 12900000 ey
+12900000 20340000 sil
+.
+"*/m1_yes.lab"
+0 7460000 sil
+7460000 8480000 y
+8480000 10340000 eh
+10340000 12820000 s
+12820000 19920000 sil
+.
+"*/m2_no.lab"
+0 8260000 sil
+8260000 8860000 n
+8860000 11600000 ow
+11600000 19120000 sil
+.
+"*/m2_okay.lab"
+0 8040000 sil
+8040000 8860000 ow
+8860000 9240000 k
+9240000 12220000 ey
+12220000 19460000 sil
+.
+"*/m2_yes.lab"
+0 7980000 sil
+7980000 8600000 y
+8600000 9660000 eh
+9660000 12400000 s
+12400000 20100000 sil
+.
+"*/m3_no.lab"
+0 5200000 sil
+5200000 5920000 n
+5920000 7820000 ow
+7820000 13020000 sil
+.
+"*/m3_okay.lab"
+0 4940000 sil
+4940000 6000000 ow
+6000000 6760000 k
+6760000 8620000 ey
+8620000 13440000 sil
+.
+"*/m3_yes.lab"
+0 4840000 sil
+4840000 5660000 y
+5660000 7000000 eh
+7000000 8600000 s
+8600000 13240000 sil
+.
+"*/m4_no.lab"
+0 7900000 sil
+7900000 8680000 n
+8680000 12060000 ow
+12060000 19960000 sil
+.
+"*/m4_okay.lab"
+0 8120000 sil
+8120000 9200000 ow
+9200000 10260000 k
+10260000 12800000 ey
+12800000 20940000 sil
+.
+"*/m4_yes.lab"
+0 7760000 sil
+7760000 9140000 y
+9140000 10440000 eh
+10440000 12780000 s
+12780000 19660000 sil
+.
+"*/m5_no.lab"
+0 7660000 sil
+7660000 8140000 n
+8140000 10820000 ow
+10820000 18420000 sil
+.
+"*/m5_okay.lab"
+0 6620000 sil
+6620000 7600000 ow
+7600000 9560000 k
+9560000 13400000 ey
+13400000 20440000 sil
+.
+"*/m5_yes.lab"
+0 7500000 sil
+7500000 9040000 y
+9040000 10560000 eh
+10560000 12860000 s
+12860000 20580000 sil
+.
diff --git a/TIesr_Tools/Example/Data/Words.mlf b/TIesr_Tools/Example/Data/Words.mlf
new file mode 100644 (file)
index 0000000..1ccd173
--- /dev/null
@@ -0,0 +1,91 @@
+#!MLF!#
+"*/f1_no.lab"
+NO
+.
+"*/f1_okay.lab"
+OKAY
+.
+"*/f1_yes.lab"
+YES
+.
+"*/f2_no.lab"
+NO
+.
+"*/f2_okay.lab"
+OKAY
+.
+"*/f2_yes.lab"
+YES
+.
+"*/f3_no.lab"
+NO
+.
+"*/f3_okay.lab"
+OKAY
+.
+"*/f3_yes.lab"
+YES
+.
+"*/f4_no.lab"
+NO
+.
+"*/f4_okay.lab"
+OKAY
+.
+"*/f4_yes.lab"
+YES
+.
+"*/f5_no.lab"
+NO
+.
+"*/f5_okay.lab"
+OKAY
+.
+"*/f5_yes.lab"
+YES
+.
+"*/m1_no.lab"
+NO
+.
+"*/m1_okay.lab"
+OKAY
+.
+"*/m1_yes.lab"
+YES
+.
+"*/m2_no.lab"
+NO
+.
+"*/m2_okay.lab"
+OKAY
+.
+"*/m2_yes.lab"
+YES
+.
+"*/m3_no.lab"
+NO
+.
+"*/m3_okay.lab"
+OKAY
+.
+"*/m3_yes.lab"
+YES
+.
+"*/m4_no.lab"
+NO
+.
+"*/m4_okay.lab"
+OKAY
+.
+"*/m4_yes.lab"
+YES
+.
+"*/m5_no.lab"
+NO
+.
+"*/m5_okay.lab"
+OKAY
+.
+"*/m5_yes.lab"
+YES
+.
diff --git a/TIesr_Tools/Example/NaturalOrder.cnf b/TIesr_Tools/Example/NaturalOrder.cnf
new file mode 100644 (file)
index 0000000..8f2d933
--- /dev/null
@@ -0,0 +1,2 @@
+NATURALREADORDER = T
+NATURALWRITEORDER = T
diff --git a/TIesr_Tools/Example/ReadMe.txt b/TIesr_Tools/Example/ReadMe.txt
new file mode 100644 (file)
index 0000000..6055f89
--- /dev/null
@@ -0,0 +1,765 @@
+Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ALL RIGHTS RESERVED
+
+
+Introduction
+============
+This directory contains files and sub-directories that illustrate the use of the
+TIesr tools to create a new set of data files for use with the TIesr speech
+recognizer. The example uses the tools in the TIesr_Tools directory, and follows
+the discussion provided in the Documentation/TIesr_Tools.txt file. Since this is
+a tutorial example, it is not intended to produce a data set that provides very
+good performance, but rather a data set that will work with the TIesr recognizer
+and illustrates the concepts of data file creation. Comments in this document
+will make mention of areas where additional steps could be taken to refine
+performance for a real-life task.
+
+It is assumed that all of the external and TIesr tools mentioned in the
+TIesr_Tools.txt document have been obtained and built, so that all tools are
+available. 
+
+Many steps use the HTK tools. These tools are often case-sensitive, input text
+files usually require a newline at the end of the last line, and any directory
+names as output arguments appearing on the command line must already exist.
+Having the wrong case, omitting the newline, or specifying a non-existant
+directory name will cause the tool to appear to fail, so you must use care when
+running the HTK tools.
+
+It would be possible to combine many of the steps described below into
+higher-level script files. However, the TIesr tools allow the user the
+flexibility to influence the data file creation process at every step. The
+purpose of this example is to understand each of the steps in preparing the data
+files, so each step is explained and possible modifications to processing are
+mentioned.
+
+This example provides commands as they would be entered on a Linux OS
+development system. Appropriate adjustments must be made for other systems.
+Step 1: Data Preparation
+========================
+For this tutorial example, assume that the vocabulary of a simple language
+contains the three words:
+
+NO
+OKAY
+YES
+
+Step 1a: Preparing a pronunciation dictionary
+---------------------------------------------
+We construct a text file dictionary that explains the pronunciation of the words
+in terms of phonetic sounds. For this example, assume a nominal pronunciation as
+in English. The dictionary is found in the file words.dic and it consists of the
+three entries:
+NO   n ow
+OKAY ow k ey
+YES  y eh s
+
+Here we enter the words in upper case and the phones in lower case for easy
+distinction, although this is not necessary. Enter the words in the dictionary
+alphabetically, since this is important for some of the tools to work correctly.
+The dictionary defines a set of monophones ( eh, ey, k, n ow, s, y ) that make
+up the phonetic sounds in the language. Normally there would be many more words
+in the language, so that the number of monophones would be much fewer than the
+number of words in the dictionary. In a real-life situation, the text dictionary
+should be made up of a large set of common words in the language; enough words
+to be able to estimate spelling-to-pronunciation rules.
+
+Step 1b: Preparing the speech database
+--------------------------------------
+The next step prepares the speech database files for use in training HMMs for
+models. For this example, the Data directory contains the raw recordings of five
+females and five males saying each word. The files are stored in the gzipped tar
+file Data/AUDIO.tar.gz. Unzip these files to the Data directory. Each file has
+the .raw file extension. These files contain acoustic data sampled at 8kHz. Each
+sample is a signed 16-bit number stored in little-endian format. The file names
+indicate the gender, speaker number, and word. It is a good idea to provide
+descriptive directory and file names for the speech database directories and
+files so that one can search and create lists of speech files easily.
+
+
+Step 2: Building Pronunciation Decision Tree Data Files
+=======================================================
+Pronunciation decision trees allow one to determine the pronunciation of words
+from their spelling. For this example, suppose the word OKNO may exist in the
+vocabulary, but is not included in the dictionary or speech database. We want to
+be able to determine the phonetic pronunciation of this word. This is the
+purpose of the decision tree data.
+
+Step 2a: Constructing a letter-to-phone dictionary
+--------------------------------------------------
+In this step we construct our best guess of the mapping between letters and
+monophones. Suppose in our example, we don't really know if the letter A or
+the letter Y in the word OKAY should map to the monophone ey. In addition, we
+allow each letter to possibly be silent. Since the letter Y may be pronounced
+using the phone "ey" or "y", this is included in the mapping. Additionally, we
+guess that the letter E may be pronounced as "eh" or "ey". This yields the file
+ltp.map which contains:
+
+A: ey .8, _sil .2
+E: eh .6, ey .2, _sil .2
+K: k .8, _sil .2
+N: n .8, _sil .2
+O: ow .8, _sil .2
+S: s .8, _sil .2
+Y: y .6, ey .2, _sil .2
+
+The exact probabilities and mappings is not all that important, since training
+will establish the most likely resulting mappings for each word in the
+dictionary. However, it is important that the mapping in ltp.map be flexible
+enough to cover the words in the dictionary. For a real-life vocabulary this
+usually requires that each letter map to many different phones, combinations
+of phones known as pseudophones, or silence. To enter a combination of phones
+as a pseudophone, just enter several phones separated by spaces prior to the
+phone probability.
+
+To train the dictionary that performs a one-to-one mapping of letters to
+monophones, create a directory, here named workdir, and a file that specifies
+that the HTK tools used within the perl script should read and write in natural
+machine endianness, as in the file NaturalOrder.cnf, then run the TIesr tool:
+
+mkdir workdir
+htk_ttp_map.pl -C NaturalOrder.cnf \
+  -d words.dic \
+  -l ltp.map \
+  -w workdir -n 4 -t 3 \
+  -o words_ltp.dic
+
+This produces the words_ltp.dic file. The directory workdir contains quite a few
+files and directories generated during training of the words_ltp.dic dictionary,
+and can get quite large. Usually there is no need to examine the detailed
+maximum-likelihood training letter-to-phone training results, but it is in
+workdir if you wish to see it. You will probably want to delete the contents of
+the directory. The words_ltp.dic file contains:
+
+"NO"                 n ow
+"OKAY"               ow k ey _
+"YES"                y eh s
+
+This maps each letter of a word to either a monophone, or a null symbol (_).
+Thus in our simple case, the mapping chose to associate the letter A, not the
+letter Y, with the monophone "ey" in the word OKAY.
+
+In a real-world letter-to-phone dictionary output there may be mappings from a
+letter to a pseudophone consisting of more than one phone if the ltp.map file
+contains a sequence of phones that can map to a letter. In real-world mapping
+results, you may also notice phone mappings that include "*", indicating failure
+to successfully create a dictionary entry for that word. This is due to a
+letter-to-phone map file that does not contain a mapping that can explain the
+word, or the -n option to htk_ttp_map.pl does not specify a large enough
+sequence of null outputs for a sequence of letters. For large vocabularies you
+will likely want to modify the letter-to-phone map file and iterate running the
+htk_ttp_map.pl tool until you are satisfied with the letter-to-phone dictionary.
+
+A small number of words may not successfully be mapped in the letter-to-phone
+dictionary, and this is usually not a problem. This is often due to foreign
+words that have pronunciations that are quite different than what would be
+determined using pronunciation rules normally associated with a language.
+
+When you are satisfied with the letter_to_phone dictionary, remove any remaining
+entries that did not map successfully that contain the "*" character.
+
+Step 2b: Creating the DTPM files
+--------------------------------
+
+First we remove any existing directories and files in the work directory.
+
+rm -rf workdir/*
+
+Next, we create the labels for all of the phones and pseudophones used in the
+ltp.dic file. This requires a list of all of the phones and pseudophones in the
+words_ltp.dic file. You can use the HTK tool HDMan to generate this list, or
+generate the list manually. For this example, the HDMan tool is used to show how
+to make the listing in the file pseudophone.list. The list of phones and
+pseudophones created by HDMan is sorted in alphabetic order in the
+pseudophone.list file. While a sorted list is not absolutely necessary, it is
+recommended since eventually the order of phones will be important. Keeping the
+phone order sorted will remove the possibility of an error due to ordering.
+
+HDMan -n temp.list /dev/null words_ltp.dic 
+sort temp.list >pseudophone.list
+rm temp.list
+
+After creating the pseudophone.list file we edit it to assign labels to phones
+and pseudophones. We assign each phone or pseudophone a label of "VOICED",
+"UNVOICED", or "SHORT_PAUSE" for the "_". The final pseudophone.list file
+contains:
+
+_   SHORT_PAUSE
+eh  VOICED
+ey  VOICED
+k   UNVOICED
+n   VOICED
+ow  VOICED
+s   UNVOICED
+y   VOICED
+
+
+Next, we create the training data for the decision trees using the
+ttp_dict_tree_data.pl tool. For our example we run the tool with options set to
+comply with the parameters that the TIesrDT API is presently set to use by
+specifying the pseudophone.list file and the option -pL 4. The
+ttp_dict_tree_data.pl tool provides options that can create a flexible set of
+parameters for pronunciation decision tree training. While the TIesrDT API can
+be modified to accommodate a different sets of parameters, this requires
+modification of the TIesrDT API code.
+
+mkdir Data/Lang
+ttp_dict_tree_data.pl -d words_ltp.dic -p pseudophone.list -pL 4 \
+                      -o Data/Lang -w workdir
+
+
+The output of this tool are three of the desired support files in the Data/Lang
+directory, and data files to be used for training the pronunciation decision
+trees in the workdir directory.
+
+
+Now the decision trees can be trained using the train_trees.pl tool. Here the
+confidence factor is set to 25, which will produce smaller but perhaps less
+accurate trees. You can modify the confidence factor between 1 and 99 to
+determine the trade-off between size of trees and accuracy of pronunciation
+prediction. For this example the decision trees degenerate into using a single
+phone for each letter.
+
+train_trees.pl -D workdir  -CF 25 
+
+This results in a set of trained decision tree files in workdir.
+
+The final step in creating decision trees is to compress the data into binary
+files. This uses the odtcompress.pl tool.
+
+odtcompress.pl -D workdir -o Data/Lang -CF 25 
+
+This results in the decision tree data files *.olmdtpm placed in Data/Lang. At
+this time you can remove the files in workdir
+
+rm workdir/*
+
+If you wish, you can test the decision tree files using the testtiesrdt program
+supplied with the release. Remember that in our simple example, the only
+letters that exist are A,E,K,N,O,S,Y.  For example, to see what the decision
+trees provide for the pronunciation of the made-up word OKNO that was discussed
+earlier we can run:
+
+echo OKNO >xtemp.txt ; testtiesrdt Data/Lang xtemp.txt 1; rm xtemp.txt
+
+This yields the output showing how to pronounce the word:
+
+OKNO:  ow k n ow
+
+You can try other made-up words as well to see how the decision trees perform.
+In real-world training of decision trees, there will be some cases in which
+the pronunciation is not deduced correctly from the spelling since the decision
+trees usually will not be able to classify all pronunciations correctly.
+
+Step 3: Building the Compressed Binary Dictionary Files
+=======================================================
+The dictionary files hold pronunciations for a set of vocabulary words. The
+purpose of the dictionary files is to override pronunciations that the decision
+trees produce, and to add entries of words that have multiple pronunciations.
+
+The dictionary files are by convention usually held in a directory named Dict
+under the decision trees, so for the example we create the directory
+Data/Lang/Dict.
+
+In this example we start with the dictionary prepared in Step 1a, in words.dic.
+Suppose that we want to add an additional new word, KES, which is normally
+pronounced as "k eh s" but may also be pronounced occasionally as "k ey s". We
+edit a copy of the words.dic dictionary to add the pronunciations, remembering
+to sort the dictionary in word alphabetical order. If there are multiple
+pronunciations for a word in the dictionary, the preferred pronunciation should
+come first. The new dictionary in allwords.dic contains:
+
+KES  k eh s
+KES  k ey s
+NO   n ow
+OKAY ow k ey
+YES  y eh s
+
+Next we create a list of the phones in the dictionary in alphabetical order,
+again using the HDMan tool and putting the list in Lang/Dict/phone.lis:
+
+mkdir Data/Lang/Dict
+HDMan -n temp.list /dev/null allwords.dic
+sort temp.list >Data/Lang/Dict/phone.lis; rm temp.list
+
+Finally, we create the compressed binary dictionary using the dictproc tool.
+The compressed dictionary contains only the differences between the decision
+tree rule pronunciation and the actual pronunciation in the prepared text
+dictionary. 
+
+dictproc allwords.dic Data/Lang/Dict/phone.lis Data/Lang/Dict/dict.bin \
+         little_endian 0 Data/Lang
+         
+This creates the Data/Lang/Dict/dict.bin binary dictionary.
+
+If you wish you can test the new dictionary just created using the testtiesrdict
+program, again keeping in mind that in our simple example, the only letters that
+exist are A,E,K,N,O,S,Y. Testtiesrdict can be run in an interactive mode, so
+you can try any number of words. Note that when you enter a dictionary word,
+the dictionary pronunciation is output, but other made-up words use the
+decision trees to obtain a pronunciation. For example if we interactively run
+testiesrdict as follows and input the words "KES" and "YES" we obtain:
+
+testtiesrdict . Data/Lang Dict 0 2 0
+
+Number of phones used: 7
+eh
+ey
+k
+n
+ow
+s
+y
+
+Enter Name: KES
+KES has 2 entries in dictionary
+Rule:  KES ---> k eh s
+Dict(1) for KES:  k eh s
+Dict(2) for KES:  k ey s
+Used now: k eh s
+
+Enter Name: YES
+YES has 1 entries in dictionary
+Rule:  YES ---> eh s
+Dict(1) for YES:  y eh s
+Used now: y eh s
+
+From the output we see that the pronunciations from the dictionary for the word
+"KES" both appear, as well as noting that the decision tree rule matches the
+first pronunciation. For the word "YES", the decision tree rule does not match
+the dictionary, but the dictionary pronunciation is available and corrects the
+decision tree rule.
+
+Step 4: Building the Acoustic Model Data Files
+==============================================
+This step is the most involved and has a large number of variations, since it
+requires training HMMs for each of the phones using the HTK tools. Much research
+is still being done on better ways to train HMMs for phonetic models. In this
+example we present the steps needed to create a basic set of HMMs for TIesr and
+and comment where some of the possible variations could be made.
+
+Step 4a: Convert raw data to HTK format
+---------------------------------------
+This step converts the raw data files into an HTK-compatible binary format file
+containing feature vector data that is compatible with the TIesr recognizer.
+The sample_to_htk.pl tool performs the conversion from the 16-bit/sample 8kHz
+sample rate data.
+ for file in Data/*.raw; do sample_to_htk.pl -l 0.5 -o Data $file; done
+
+This will convert all of the *.raw files to *.htk files in the Data directory.
+For future use, we create a file that lists all of the *.htk files:
+
+ls -1 Data/*.htk > Data/HTK_files.list
+
+Step 4b: HTK training - Create label files for each utterance
+-------------------------------------------------------------
+Following the HTK documentation, we create label files for each of the
+utterances in the *.htk files. Rather than create a separate label file for each
+utterance, we create a master label file (MLF) holding the utterance for each
+file. For a small set of data such as our example, this can be done by hand. For
+a large speech database for a language, this would usually require developing
+a script file to generate the MLF. The MLF for the example is located in
+Data/Words.mlf. This file defines the words spoken in each utterance file.
+
+Next we create a new MLF file containing the phones spoken in each file. HTK
+provides the HLEd tool that can generate the MLF file. At the same time, we add
+the "sil" model at the beginning and end of each utterance to account for
+leading and trailing silence in the utterances. We create a label editing
+command file in phones.led that contains the following:
+
+EX
+IS sil sil
+
+Here EX is the command to expand from words to phones according to the
+pronunciation dictionary, and the IS command puts the "sil" model at the
+beginning and end of each utterance. In a large vocabulary task or a task in
+which multiple words are in an utterance, an additional model, or the sil model
+must be included between words to model possible inter-word silence during
+training. HTK documentation calls the additional model the "sp" phone model.
+Consult the HTK documentation for methods of modeling inter-word silence.
+
+Run HLEd as follows:
+
+HLEd -d words.dic -l '*' -i Data/Phones.mlf phones.led  Data/Words.mlf
+
+HTK training tools provide several different methods to create the initial HMMs.
+They can be initialized without any detailed acoustic information, or they can
+be initialized with acoustic data specified by time segment information in the
+label files. For our example, we start by providing time segments for each of
+the phones in the acoustic files. We do this by making a copy of the
+Data/Phones.mlf file in Data/Segmented_phones.mlf and editing the file to
+specify time segments of each phone found by inspection of the data in each
+file. This can be a very laborious process, so for large language databases one
+can either use HTK to start training HMMs without any time-segmented data, or
+provide time segments for a very small portion of the database. Sometimes large
+databases provide phonetic time segmentation for some of the utterances, in
+which case a script could be written to generate the segmented MLF file.
+
+Step 4c: HTK training - Constructing initial HMMs for each phone
+----------------------------------------------------------------
+First, we create a simple HTK configuration file, UserDelta.cnf so that the
+delta feature parameters will be dynamically calculated from the
+features in the Data/*.htk database files.
+
+We create an HTK Master Model File (MMF) containing prototype HMMs for each of
+the phones and the sil model in Data/HMMPROTO/phones.mmf. The actual values of
+the HMM state distribution means and variances is not important, just the vector
+size and number of means and variances, since training will update these. Each
+HMM has three emitting states, with a single Gaussian distribution for each
+state.
+
+In addition we create a second MMF containing a single global prototype HMM for
+the purpose of determining the global mean and variance of all of the training
+data. This is used as a means to create a vFloors MMF to limit the variance
+estimate of all of the phone HMMs since we have so little training data. The
+global HMM is at Data/HMMPROTO/global.mmf. The global HMM will only be used to
+determine the global variance floor in the vFloors MMF. The global mean,
+variance, and the vFloors MMF are determined using the HTK HCompV tool.
+
+mkdir Data/HMM0
+HCompV -C UserDelta.cnf -f 0.01 -m -H Data/HMMPROTO/global.mmf -M Data/HMM0 \
+       -S Data/HTK_files.list global
+
+Having obtained a lower floor on the estimate of variances in vFloors, we
+may now initialize the means and variances of each of the HMMs given the
+segmented database file audio data using the HTK HInit tool. This creates a
+separate MMF file for each phone HMM.
+
+for hmm in sil eh ey k n ow s y;
+ do HInit -C UserDelta.cnf -H Data/HMMPROTO/phones.mmf -H Data/HMM0/vFloors \
+          -I Data/Segmented_phones.mlf -l $hmm -S Data/HTK_files.list \
+          -u mv -M Data/HMM0 $hmm
+    mv Data/HMM0/phones.mmf Data/HMM0/${hmm}.mmf
+ done
+Following the initialization, we can do an initial isolated phone Baum-Welch
+re-estimation of the means and variances of HMM model parameters for each phone.
+
+mkdir Data/HMM1
+for hmm in sil eh ey k n ow s y; \
+ do HRest -C UserDelta.cnf -H Data/HMM0/${hmm}.mmf -H Data/HMM0/vFloors \
+          -I Data/Segmented_phones.mlf -l $hmm -S Data/HTK_files.list \
+          -u mv -M Data/HMM1 $hmm
+ done
+
+We can now use the HTK HHEd tool to combine all phones into one combined MMF
+file for ease in future processing. This requires a list of all phones, which we
+obtain using the HLEd tool. 
+
+HLEd -n Data/Phones.list -i /dev/null /dev/null Data/Phones.mlf
+
+HHEd -H Data/HMM1/sil.mmf -H Data/HMM1/eh.mmf -H Data/HMM1/ey.mmf \
+     -H Data/HMM1/k.mmf -H Data/HMM1/n.mmf -H Data/HMM1/ow.mmf \
+     -H Data/HMM1/s.mmf -H Data/HMM1/y.mmf -H Data/HMM1/vFloors \
+     -w Data/HMM1/phones.mmf /dev/null Data/Phones.list
+
+Finally, we use the HTK HERest tool to train all parameters of the HMMs using
+embedded training to enable cross-phone context to influence the HMM parameters.
+Each time HERest is run, a single pass of training occurs, so it should be run
+multiple passes. The number of passes must be determined by trial. Here
+for illustration we use two passes. Three passes are often used. 
+
+mkdir Data/HMM2
+HERest -C UserDelta.cnf -H Data/HMM1/phones.mmf -I Data/Phones.mlf \
+       -S Data/HTK_files.list -M Data/HMM2 Data/Phones.list
+       
+mkdir Data/HMM3
+HERest -C UserDelta.cnf -H Data/HMM2/phones.mmf -I Data/Phones.mlf \
+       -S Data/HTK_files.list -M Data/HMM3 Data/Phones.list
+     
+Step 4d: Training HMMs for separate sets (genders)
+--------------------------------------------------
+We now have the trained HMMs for all of the phones and the silence model. We
+could stop here, but TIesr allows for multiple HMM sets based on certain common
+characteristics. In this step we split the phone models into two separate sets
+of phone models, one for females, and one for males. This has been shown to
+often provide better recognition performance. Other sets are possible, such as
+models for children, or models for various accents, etc.
+
+We first need to create two sets of HMMs that are gender-dependent in a new MMF
+file. We do this by using the HHEd command to duplicate the original phone HMMs
+into two separate gender-dependent sets. However, since we have so little
+training data, the HMM transition matrices and the variance vectors for each HMM
+state will be shared between genders; that is, the transition matrices and
+variances will be gender-independent. This is an illustration of being able to
+tie HMM parameters so that they are shared between models. Further, we will use
+a single gender-indpendent silence model, sil. The file make_fm.hed contains the
+command DP to create two duplicate sets of the original HMMs, and TI commands to
+tie the transition matrices corresponding to the gender-dependent phones and
+variance vectors.
+
+mkdir Data/HMM4
+HHEd -H Data/HMM3/phones.mmf -w Data/HMM4/phones_fm.mmf make_fm.hed \
+     Data/Phones.list
+
+Next we need to modify the MLF file that contains the pronunciation of each
+utterance. This is most easily done by splitting the MLF file Data/Phones.mlf
+into two separate MLF files, one for females in Data/Fphones.mlf and one
+for males in Data/Mphones.mlf, and then using the HLEd tool to mark the
+phone labels, except the sil model, to make them gender-dependent:
+
+HLEd  -l '*'  -i Data/Phones_f.mlf phones_f.led Data/Fphones.mlf 
+HLEd  -l '*' -i Data/Phones_m.mlf phones_m.led Data/Mphones.mlf
+
+Then make a list of all of the gender-dependent phones:
+
+HLEd  -n Data/Phones_fm.list -i /dev/null /dev/null Data/Phones_f.mlf \
+      Data/Phones_m.mlf
+
+Now again use the HTK HERest tool to train all of the parameters of the
+gender-dependent HMM sets. Several passes of training should be performed.
+Notice that since the MLF files for female and male utterances specifically
+require the gender-dependent models, we can run training for female and male
+utterances in the same HERest training pass.
+
+mkdir Data/HMM5
+HERest -C UserDelta.cnf -H Data/HMM4/phones_fm.mmf \
+       -I Data/Phones_f.mlf -I Data/Phones_m.mlf \
+       -S Data/HTK_files.list -M Data/HMM5 Data/Phones_fm.list
+       
+mkdir Data/HMM6
+HERest -C UserDelta.cnf -H Data/HMM5/phones_fm.mmf \
+       -I Data/Phones_f.mlf -I Data/Phones_m.mlf \
+       -S Data/HTK_files.list -M Data/HMM6 Data/Phones_fm.list
+
+Step 4e: Training HMMs for triphone context
+-------------------------------------------
+We now have the trained gender-dependent HMM sets for all of the phones and the
+common silence model. Again, we could stop here, but TIesr allows for phones
+that are context dependent. For example, for word "yes" spoken by a
+female, we could replace the gender-dependent phone eh:f with it's context
+dependent phone y-eh:f+s, which indicates a phone eh:f in the context of a
+leading y phone and a trailing s phone. There is an issue of what should be
+done for context-dependent phone models at word boundaries. Here we will create
+within-word context triphones, which do not cross word boundaries. The word
+boundary is denoted by "sp" in the triphone name. So for example the
+within-word triphone sequence for the female word "yes" is:
+
+sp-y:f+eh   y-eh:f+s  eh-s:f+sp
+
+We again start by creating the MLF files with triphone model context using the
+HLEd tool to generate the gender-independent triphone HMM labels, and sed to
+provide the gender-dependent tags. HLEd is also used to create a
+gender-dependent triphone list.
+
+HLEd -l '*' -i temp.mlf triphones.led Data/Fphones.mlf;
+  cat temp.mlf | sed 's/\+/:f+/' >Data/Triphones_f.mlf; rm temp.mlf
+  
+HLEd -l '*' -i temp.mlf triphones.led Data/Mphones.mlf;
+  cat temp.mlf | sed 's/\+/:m+/' >Data/Triphones_m.mlf; rm temp.mlf
+HLEd -n Data/Triphones_fm.list -i /dev/null /dev/null Data/Triphones_f.mlf \
+     Data/Triphones_m.mlf
+
+
+Next we create the context-dependent triphone HMM models using HHEd, by a
+command that creates cloned versions of the gender-dependent monophone sets
+with triphone names.
+
+mkdir Data/HMM7
+HHEd -H Data/HMM6/phones_fm.mmf -w Data/HMM7/triphones_fm.mmf \
+     make_triphones_fm.hed Data/Phones_fm.list
+
+
+Finally, we again train these triphones multiple passes with HERest.
+
+mkdir Data/HMM8
+HERest -C UserDelta.cnf -H Data/HMM7/triphones_fm.mmf \
+       -I Data/Triphones_f.mlf -I Data/Triphones_m.mlf \
+       -S Data/HTK_files.list -M Data/HMM8 Data/Triphones_fm.list
+       
+mkdir Data/HMM9
+HERest -C UserDelta.cnf -H Data/HMM8/triphones_fm.mmf \
+       -I Data/Triphones_f.mlf -I Data/Triphones_m.mlf \
+       -S Data/HTK_files.list -M Data/HMM9 Data/Triphones_fm.list
+
+mkdir Data/HMM10
+HERest -C UserDelta.cnf -H Data/HMM9/triphones_fm.mmf \
+       -I Data/Triphones_f.mlf -I Data/Triphones_m.mlf \
+       -s Data/HMM9/hmm9.stats \
+       -S Data/HTK_files.list -M Data/HMM10 Data/Triphones_fm.list
+
+Step 4f: Creating acoustic decision trees for triphones
+-------------------------------------------------------
+We have now trained the gender-dependent triphone models. However, once triphone
+models are created, there is a problem with unseen triphones. Using the example
+above in Step 3, Building the Compressed Binary Dictionary Files, the new word
+"kes" is introduced. The trained triphone HMMs do contain the triphone HMMs
+necessary to model this new word. For example, the triphones needed for the word
+"kes" for females are:
+
+sp-k:f+eh  k-eh:f+s  eh-s:f+sp
+
+and these triphones are not in the trained data. In order to develop these
+models from the trained triphones we need to find a way to map the existing
+model parameters to the unseen triphones. This is the purpose of the acoustic
+decision trees. To create the acoustic decision trees, we first must define a
+set of questions that can be used to categorize the trained triphones and
+cluster the information. Consult the HTK Book for detailed information on
+creating lists of questions and using HHEd to cluster the triphones. 
+
+This example is only illustrative of the steps necessary to create the acoustic
+decision cluster trees. Since this example has so few words and training
+utterances, very little can be accomplished by clustering. The only
+gender-dependent phones that have more than one triphone context are ow:f and
+ow:m (the contexts are: n-ow:f+sp and sp-ow:f+k for females, and n-ow:m+sp and
+sp-ow:m+k for males). In this example, the questions and commands used for
+clustering the trained triphones are found in make_cluster_triphone_fm.hed. The
+questions and parameters used for clustering thresholds in this file should not
+be considered as typical, since this is a limited example. Normally there would
+be a large number of questions, and experimentation would need to be performed
+to adjust the parameters for the level of clustering desired.
+
+We use the HHEd tool to cluster the gender-dependent triphone state
+distributions. Clustering requires a statistics file of state occupation from
+prior HERest training. Notice that in the above training the last HERest pass
+contained the -s option to generate the statistics file. During that HERest
+training pass, the statistics file generated is for the input model set, not the
+output model set, hence the statistics are for the HMMs found in the directory
+Data/HMM9. When the HHEd tool performs clustering, it outputs a log file that
+shows the results of clustering for each gender-dependent to the file
+make_cluster_triphones_fm.log, and the file containing the trees is in
+Data/Cluster_triphones_fm.trees. The commands to cluster the triphone states
+are:
+
+mkdir Data/HMM11
+HHEd -H Data/HMM9/triphones_fm.mmf -w Data/HMM11/triphones_fm.mmf \
+     make_cluster_triphones_fm.hed Data/Triphones_fm.list \
+     > make_cluster_triphones_fm.log
+    
+Examination of the log file and the Data/Cluster_triphones_fm.trees file shows
+that the third states of the triphones n-ow:f+sp and sp-ow:f+k are clustered
+into a single shared state. The same is true for fourth states. The second
+states are split into two different distributions by a decision tree. The
+triphones n-ow:m+sp and sp-ow:m+k are clustered similarly.
+
+After the clustering is performed, several passes of training should be run.
+
+mkdir Data/HMM12
+HERest -C UserDelta.cnf -H Data/HMM11/triphones_fm.mmf \
+       -I Data/Triphones_f.mlf -I Data/Triphones_m.mlf \
+       -S Data/HTK_files.list -M Data/HMM12 Data/Triphones_fm.list
+
+mkdir Data/HMM13
+HERest -C UserDelta.cnf -H Data/HMM12/triphones_fm.mmf \
+       -I Data/Triphones_f.mlf -I Data/Triphones_m.mlf \
+       -S Data/HTK_files.list -M Data/HMM13 Data/Triphones_fm.list
+
+Step 4g: Converting HTK data to TIesr-compatible acoustic data files
+---------------------------------------------------------------------
+We have now completed training of gender-dependent triphones and performed
+clustering. This completes the HMM training. Now the trained HMM data needs to
+be put in a compressed binary TIesr-compatible format, as described in the
+TIesr documentation file Data_Training.txt.
+
+We first compress the data in the MMF file, creating a set of files in the
+Data/Lang/Models directory:
+
+htk_mmf_to_tiesr.pl -H Data/HMM13/triphones_fm.mmf -g ':m,:f' -sb \
+                    -le -d Data/Lang/Models
+
+
+Then compress the decision tree data:
+
+htk_trees_to_tiesr.pl -T Data/Cluster_triphones_fm.trees -C Data/Lang/Models \
+                      -g ':m,:f' -le -d Data/Lang/Models
+
+
+Step 5: Creating the Hierarchical Linear Regression phone cluster tree file
+============================================================================
+This step uses the results of monophone training to determine a linear
+regression tree for the HMM monophone models.
+
+We first use the htk_model_compare.pl tool to measure the similarity of
+monophone models. It is important to list the monophones in the same order as
+specified in the Data/Lang/Models/monophone.list and Data/Lang/Dict/phone.lis,
+and with the silence phone added to the head of this list.
+
+echo sil >workdir/temp.list; cat Data/Lang/Dict/phone.lis >>workdir/temp.list
+htk_model_compare.pl -H Data/HMM3/phones.mmf  -l workdir/temp.list \
+                      -s -o workdir/model_compare.txt -w workdir
+
+Then use the cluster_models.pl tool to create the phone cluster tree file. This
+file should be put in the same directory as the pronunciation decision trees.
+cluster_models.pl -r workdir/model_compare.txt -o Data/Lang/hlrtree.bin -le
+rm workdir/*
+
+
+Step 6: Creating the Gaussian cluster files
+===========================================
+Since there are so few Gaussian vectors in this example, Gaussian clustering
+will not provide significant speed-up. The TIesr recognizer does require the
+clustering information, so this step is illustrative only. Gaussian clustering
+requires the Gaussian mean vectors in 16-bit integer format, so if in a
+real-world training byte means and variances were created by
+htk_mmf_to_tiesr.pl, then it would have to be run again to generate 16-bit means
+and variances in another temporary directory.
+
+In this example there are only 47 mean vectors in the triphone models, so we
+cluster these into 20 clusters for illustrative purposes. Real-world
+full-language triphone modeling typically uses 128 clusters.
+
+cd Data/Lang/Models
+gaussiancluster . xtempmean.txt xtempvar.txt xinfo.txt 20 1
+cd -
+
+
+Step 7: Testing the data files
+==============================
+All data files needed for TIesr are now created in the Data/Lang directory and
+its Dict and Model sub-directories. As mentioned above, some of the files in
+the Data/Lang/Model directory are listing files for information purposes only,
+and are not used by TIesr. The list of files in Data/Lang/Models needed by TIesr
+is:
+
+ROM2cls.bin
+_qs.bin
+_qstbl.bin
+_tree.bin
+_treetbl.bin
+cls_centr.bin
+fxclust.cb
+fxclust.off
+fxconfig.bin
+fxgconst.cb
+fxmean.cb
+fxsil.hmm
+fxtran.cb
+fxtran.off
+fxvar.cb
+monophone.list
+
+All other files may be removed.
+
+It is possible to run a quick test of the TIesr recognizer using the original
+audio files, and by voice. First, create a file that defines a simple grammar to
+recognize single instances of the words KES, NO, OKAY, and YES. The grammar file
+is at Test.grm.
+
+Use the testtiesrflex program to generate the acoustic model and grammar
+network files for the test grammar in the workdir directory:
+
+testtiesrflex Test.grm workdir  Data Lang 2 0 1 1 0 0 0
+
+Now, run the testtiesrsi program to recognize each of the original audio files
+used for creating the data files:
+
+for file in Data/*.raw
+  do 
+  echo ' '
+  echo $file
+  testtiesrsi 200000 workdir workdir/test.jac Data/Lang/hlrtree.bin $file
+done
+
+If you wish, and  you have an active audio device connected to your development
+platform, you can run a live test. For a Linux development platform with ALSA
+support, run the testtiesrsi program as:
+
+testtiesrsi 200000 workdir workdir/test.jac Data/Lang/hlrtree.bin plughw:0,0
+
+Other platforms should substitute the proper audio channel device. For Windows
+platforms, you can just use some arbitrary non-file name.
diff --git a/TIesr_Tools/Example/Test.grm b/TIesr_Tools/Example/Test.grm
new file mode 100644 (file)
index 0000000..41f6b17
--- /dev/null
@@ -0,0 +1,3 @@
+start(_Test).
+
+_Test ---> KES | NO | OKAY | YES.
diff --git a/TIesr_Tools/Example/UserDelta.cnf b/TIesr_Tools/Example/UserDelta.cnf
new file mode 100644 (file)
index 0000000..9edc602
--- /dev/null
@@ -0,0 +1,2 @@
+TARGETKIND = USER_D
+DELTAWINDOW = 2
diff --git a/TIesr_Tools/Example/allwords.dic b/TIesr_Tools/Example/allwords.dic
new file mode 100644 (file)
index 0000000..b763ec5
--- /dev/null
@@ -0,0 +1,5 @@
+KES  k eh s
+KES  k ey s
+NO   n ow
+OKAY ow k ey
+YES  y eh s
diff --git a/TIesr_Tools/Example/ltp.map b/TIesr_Tools/Example/ltp.map
new file mode 100644 (file)
index 0000000..7828b4b
--- /dev/null
@@ -0,0 +1,7 @@
+A: ey .8, _sil .2
+E: eh .6, ey .2, _sil .2
+K: k .8, _sil .2
+N: n .8, _sil .2
+O: ow .8, _sil .2
+S: s .8, _sil .2
+Y: y .6, ey .2, _sil .2
diff --git a/TIesr_Tools/Example/make_cluster_triphones_fm.hed b/TIesr_Tools/Example/make_cluster_triphones_fm.hed
new file mode 100644 (file)
index 0000000..11e8cf3
--- /dev/null
@@ -0,0 +1,155 @@
+TR 1
+
+QS  "L_Boundary:f"     { sp-*:f+* }
+QS  "R_Boundary:f"     { *:f+sp }
+
+QS  "L_Voiced:f"        { eh-*:f+*, ey-*:f+*, n-*:f+*, ow-*:f+*, y-*:f+* }
+QS  "R_Voiced:f"        { *:f+eh, *:f+ey, *:f+n, *:f+ow, *:f+y }
+
+QS  "L_Vowel:f"         { eh-*:f+*, ey-*:f+*, ow-*:f+* }
+QS  "R_Vowel:f"         { *:f+eh, *:f+ey, *:f+ow }
+
+QS  "L_Vglide:f"        { eh-*:f+*, ey-*:f+*, ow-*:f+*, y-*:f+* }
+QS  "R_Vglide:f"        { *:f+eh, *:f+ey, *:f+ow, *:f+y }
+
+QS  "L_Glide:f"         { ey-*:f+*, ow-*:f+*, y-*:f+* }
+QS  "R_Glide:f"         { *:f+ey, *:f+ow, *:f+y }
+
+QS  "L_EVowel:f"        { eh-*:f+*, ey-*:f+* }
+QS  "R_EVowel:f"        { *:f+eh, *:f+ey }
+
+QS  "L_Low:f"           { ow-*:f+*, n-*:f+* }
+QS  "R_Low:f"           { *:f+ow, *:f+n }
+
+QS  "R_eh:f"           { *:f+eh }
+QS  "L_eh:f"           { eh-*:f+* }
+
+QS  "R_ey:f"           { *:f+ey }
+QS  "L_ey:f"           { ey-*:f+* }
+
+QS  "R_k:f"            { *:f+k }
+QS  "L_k:f"            { k-*:f+* }
+
+QS  "R_n:f"            { *:f+n }
+QS  "L_n:f"            { n-*:f+* }
+
+QS  "R_ow:f"           { *:f+ow }
+QS  "L_ow:f"           { ow-*:f+* }
+
+QS  "R_s:f"            { *:f+s }
+QS  "L_s:f"            { s-*:f+* }
+
+QS  "R_y:f"            { *:f+y }
+QS  "L_y:f"            { y-*:f+* }
+
+
+
+QS  "L_Boundary:m"     { sp-*:m+* }
+QS  "R_Boundary:m"     { *:m+sp }
+
+QS  "L_Voiced:m"        { eh-*:m+*, ey-*:m+*, n-*:m+*, ow-*:m+*, y-*:m+* }
+QS  "R_Voiced:m"        { *:m+eh, *:m+ey, *:m+n, *:m+ow, *:m+y }
+
+QS  "L_Vowel:m"         { eh-*:m+*, ey-*:m+*, ow-*:m+* }
+QS  "R_Vowel:m"         { *:m+eh, *:m+ey, *:m+ow }
+
+QS  "L_Vglide:m"        { eh-*:m+*, ey-*:m+*, ow-*:m+*, y-*:m+* }
+QS  "R_Vglide:m"        { *:m+eh, *:m+ey, *:m+ow, *:m+y }
+
+QS  "L_Glide:m"         { ey-*:m+*, ow-*:m+*, y-*:m+* }
+QS  "R_Glide:m"         { *:m+ey, *:m+ow, *:m+y }
+
+QS  "L_EVowel:m"        { eh-*:m+*, ey-*:m+* }
+QS  "R_EVowel:m"        { *:m+eh, *:m+ey }
+
+QS  "L_Low:m"           { ow-*:m+*, n-*:m+* }
+QS  "R_Low:m"           { *:m+ow, *:m+n }
+
+QS  "R_eh:m"           { *:m+eh }
+QS  "L_eh:m"           { eh-*:m+* }
+
+QS  "R_ey:m"           { *:m+ey }
+QS  "L_ey:m"           { ey-*:m+* }
+
+QS  "R_k:m"            { *:m+k }
+QS  "L_k:m"            { k-*:m+* }
+
+QS  "R_n:m"            { *:m+n }
+QS  "L_n:m"            { n-*:m+* }
+
+QS  "R_ow:m"           { *:m+ow }
+QS  "L_ow:m"           { ow-*:m+* }
+
+QS  "R_s:m"            { *:m+s }
+QS  "L_s:m"            { s-*:m+* }
+
+QS  "R_y:m"            { *:m+y }
+QS  "L_y:m"            { y-*:m+* }
+
+
+TR 2
+
+RO 2.0 Data/HMM9/hmm9.stats
+
+TR 2
+
+
+TB 50.0 eh:f_s2_  { *-eh:f+*.state[2] }
+TB 50.0 eh:f_s3_  { *-eh:f+*.state[3] }
+TB 50.0 eh:f_s4_  { *-eh:f+*.state[4] }
+
+TB 50.0 ey:f_s2_  { *-ey:f+*.state[2] }
+TB 50.0 ey:f_s3_  { *-ey:f+*.state[3] }
+TB 50.0 ey:f_s4_  { *-ey:f+*.state[4] }
+
+TB 50.0 k:f_s2_  { *-k:f+*.state[2] }
+TB 50.0 k:f_s3_  { *-k:f+*.state[3] }
+TB 50.0 k:f_s4_  { *-k:f+*.state[4] }
+
+TB 50.0 n:f_s2_  { *-n:f+*.state[2] }
+TB 50.0 n:f_s3_  { *-n:f+*.state[3] }
+TB 50.0 n:f_s4_  { *-n:f+*.state[4] }
+
+TB 50.0 ow:f_s2_  { *-ow:f+*.state[2] }
+TB 50.0 ow:f_s3_  { *-ow:f+*.state[3] }
+TB 50.0 ow:f_s4_  { *-ow:f+*.state[4] }
+
+TB 50.0 s:f_s2_  { *-s:f+*.state[2] }
+TB 50.0 s:f_s3_  { *-s:f+*.state[3] }
+TB 50.0 s:f_s4_  { *-s:f+*.state[4] }
+
+TB 50.0 y:f_s2_  { *-y:f+*.state[2] }
+TB 50.0 y:f_s3_  { *-y:f+*.state[3] }
+TB 50.0 y:f_s4_  { *-y:f+*.state[4] }
+
+TB 50.0 eh:m_s2_  { *-eh:m+*.state[2] }
+TB 50.0 eh:m_s3_  { *-eh:m+*.state[3] }
+TB 50.0 eh:m_s4_  { *-eh:m+*.state[4] }
+
+TB 50.0 ey:m_s2_  { *-ey:m+*.state[2] }
+TB 50.0 ey:m_s3_  { *-ey:m+*.state[3] }
+TB 50.0 ey:m_s4_  { *-ey:m+*.state[4] }
+
+TB 50.0 k:m_s2_  { *-k:m+*.state[2] }
+TB 50.0 k:m_s3_  { *-k:m+*.state[3] }
+TB 50.0 k:m_s4_  { *-k:m+*.state[4] }
+
+TB 50.0 n:m_s2_  { *-n:m+*.state[2] }
+TB 50.0 n:m_s3_  { *-n:m+*.state[3] }
+TB 50.0 n:m_s4_  { *-n:m+*.state[4] }
+
+TB 50.0 ow:m_s2_  { *-ow:m+*.state[2] }
+TB 50.0 ow:m_s3_  { *-ow:m+*.state[3] }
+TB 50.0 ow:m_s4_  { *-ow:m+*.state[4] }
+
+TB 50.0 s:m_s2_  { *-s:m+*.state[2] }
+TB 50.0 s:m_s3_  { *-s:m+*.state[3] }
+TB 50.0 s:m_s4_  { *-s:m+*.state[4] }
+
+TB 50.0 y:m_s2_  { *-y:m+*.state[2] }
+TB 50.0 y:m_s3_  { *-y:m+*.state[3] }
+TB 50.0 y:m_s4_  { *-y:m+*.state[4] }
+
+TR 1
+
+ST Data/Cluster_triphones_fm.trees
diff --git a/TIesr_Tools/Example/make_fm.hed b/TIesr_Tools/Example/make_fm.hed
new file mode 100644 (file)
index 0000000..038c9a7
--- /dev/null
@@ -0,0 +1,38 @@
+DP "" 2 :f :m
+
+TI T_sil {sil*.transP}
+TI T_eh {eh:*.transP}
+TI T_ey {ey:*.transP}
+TI T_k {k:*.transP}
+TI T_n {n:*.transP}
+TI T_ow {ow:*.transP}
+TI T_s {s:*.transP}
+TI T_y {y:*.transP}
+
+TI var_eh_s2 { eh:*.state[2].mix[1].cov }
+TI var_eh_s3 { eh:*.state[3].mix[1].cov }
+TI var_eh_s4 { eh:*.state[4].mix[1].cov }
+
+TI var_ey_s2 { ey:*.state[2].mix[1].cov }
+TI var_ey_s3 { ey:*.state[3].mix[1].cov }
+TI var_ey_s4 { ey:*.state[4].mix[1].cov }
+
+TI var_k_s2 { k:*.state[2].mix[1].cov }
+TI var_k_s3 { k:*.state[3].mix[1].cov }
+TI var_k_s4 { k:*.state[4].mix[1].cov }
+
+TI var_n_s2 { n:*.state[2].mix[1].cov }
+TI var_n_s3 { n:*.state[3].mix[1].cov }
+TI var_n_s4 { n:*.state[4].mix[1].cov }
+
+TI var_ow_s2 { ow:*.state[2].mix[1].cov }
+TI var_ow_s3 { ow:*.state[3].mix[1].cov }
+TI var_ow_s4 { ow:*.state[4].mix[1].cov }
+
+TI var_s_s2 { s:*.state[2].mix[1].cov }
+TI var_s_s3 { s:*.state[3].mix[1].cov }
+TI var_s_s4 { s:*.state[4].mix[1].cov }
+
+TI var_y_s2 { y:*.state[2].mix[1].cov }
+TI var_y_s3 { y:*.state[3].mix[1].cov }
+TI var_y_s4 { y:*.state[4].mix[1].cov }
diff --git a/TIesr_Tools/Example/make_triphones_fm.hed b/TIesr_Tools/Example/make_triphones_fm.hed
new file mode 100644 (file)
index 0000000..c15780c
--- /dev/null
@@ -0,0 +1 @@
+CL Data/Triphones_fm.list
diff --git a/TIesr_Tools/Example/phones.led b/TIesr_Tools/Example/phones.led
new file mode 100644 (file)
index 0000000..5d78c46
--- /dev/null
@@ -0,0 +1,2 @@
+EX
+IS sil sil
diff --git a/TIesr_Tools/Example/phones_f.led b/TIesr_Tools/Example/phones_f.led
new file mode 100644 (file)
index 0000000..f476be4
--- /dev/null
@@ -0,0 +1,7 @@
+RE eh:f  eh
+RE ey:f  ey
+RE k:f   k
+RE n:f   n
+RE ow:f  ow
+RE s:f   s
+RE y:f   y
diff --git a/TIesr_Tools/Example/phones_m.led b/TIesr_Tools/Example/phones_m.led
new file mode 100644 (file)
index 0000000..3c16bc7
--- /dev/null
@@ -0,0 +1,7 @@
+RE eh:m  eh
+RE ey:m  ey
+RE k:m   k
+RE n:m   n
+RE ow:m  ow
+RE s:m   s
+RE y:m   y
diff --git a/TIesr_Tools/Example/triphones.led b/TIesr_Tools/Example/triphones.led
new file mode 100644 (file)
index 0000000..f6ce69c
--- /dev/null
@@ -0,0 +1,3 @@
+RE sp sil
+TC
+RE sil sp
diff --git a/TIesr_Tools/Example/words.dic b/TIesr_Tools/Example/words.dic
new file mode 100644 (file)
index 0000000..9a734c4
--- /dev/null
@@ -0,0 +1,3 @@
+NO   n ow
+OKAY ow k ey
+YES  y eh s
diff --git a/TIesr_Tools/GaussianCluster/.dep.inc b/TIesr_Tools/GaussianCluster/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesr_Tools/GaussianCluster/Makefile b/TIesr_Tools/GaussianCluster/Makefile
new file mode 100644 (file)
index 0000000..90d4e44
--- /dev/null
@@ -0,0 +1,112 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+#
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Makefile-LinuxDebugGnu.mk b/TIesr_Tools/GaussianCluster/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..b00bc77
--- /dev/null
@@ -0,0 +1,85 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/src/ClusterUtil.o \
+       ${OBJECTDIR}/src/GaussianCluster.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lm
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/bin/gaussiancluster
+
+../../Dist/LinuxDebugGnu/bin/gaussiancluster: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/bin
+       ${LINK.c} -v -o ../../Dist/${CND_CONF}/bin/gaussiancluster ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/src/ClusterUtil.o: nbproject/Makefile-${CND_CONF}.mk src/ClusterUtil.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/ClusterUtil.o src/ClusterUtil.c
+
+${OBJECTDIR}/src/GaussianCluster.o: nbproject/Makefile-${CND_CONF}.mk src/GaussianCluster.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/GaussianCluster.o src/GaussianCluster.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/bin/gaussiancluster
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesr_Tools/GaussianCluster/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..c0315cc
--- /dev/null
@@ -0,0 +1,85 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/src/ClusterUtil.o \
+       ${OBJECTDIR}/src/GaussianCluster.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lm
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/bin/gaussiancluster
+
+../../Dist/LinuxReleaseGnu/bin/gaussiancluster: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/bin
+       ${LINK.c} -v -o ../../Dist/${CND_CONF}/bin/gaussiancluster ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/src/ClusterUtil.o: nbproject/Makefile-${CND_CONF}.mk src/ClusterUtil.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/ClusterUtil.o src/ClusterUtil.c
+
+${OBJECTDIR}/src/GaussianCluster.o: nbproject/Makefile-${CND_CONF}.mk src/GaussianCluster.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/GaussianCluster.o src/GaussianCluster.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/bin/gaussiancluster
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesr_Tools/GaussianCluster/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..244a1af
--- /dev/null
@@ -0,0 +1,85 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/src/ClusterUtil.o \
+       ${OBJECTDIR}/src/GaussianCluster.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lm
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/gaussiancluster.exe
+
+../../Dist/WindowsDebugMinGW/gaussiancluster.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.c} -v -mno-cygwin -o ../../Dist/${CND_CONF}/gaussiancluster.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/src/ClusterUtil.o: nbproject/Makefile-${CND_CONF}.mk src/ClusterUtil.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/ClusterUtil.o src/ClusterUtil.c
+
+${OBJECTDIR}/src/GaussianCluster.o: nbproject/Makefile-${CND_CONF}.mk src/GaussianCluster.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/GaussianCluster.o src/GaussianCluster.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/gaussiancluster.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesr_Tools/GaussianCluster/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..b93d4ff
--- /dev/null
@@ -0,0 +1,85 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/src/ClusterUtil.o \
+       ${OBJECTDIR}/src/GaussianCluster.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/gaussiancluster.exe
+
+../../Dist/WindowsReleaseMinGW/gaussiancluster.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.c} -v -mno-cygwin -o ../../Dist/${CND_CONF}/gaussiancluster.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/src/ClusterUtil.o: nbproject/Makefile-${CND_CONF}.mk src/ClusterUtil.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/ClusterUtil.o src/ClusterUtil.c
+
+${OBJECTDIR}/src/GaussianCluster.o: nbproject/Makefile-${CND_CONF}.mk src/GaussianCluster.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/GaussianCluster.o src/GaussianCluster.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/gaussiancluster.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Makefile-impl.mk b/TIesr_Tools/GaussianCluster/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..6c6d9a8
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=GaussianCluster
+
+# Active Configuration
+DEFAULTCONF=LinuxDebugGnu
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=LinuxDebugGnu LinuxReleaseGnu WindowsDebugMinGW WindowsReleaseMinGW 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Makefile-variables.mk b/TIesr_Tools/GaussianCluster/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..0f6fede
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin
+CND_ARTIFACT_NAME_LinuxDebugGnu=gaussiancluster
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin/gaussiancluster
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=gaussiancluster.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/gaussiancluster.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin
+CND_ARTIFACT_NAME_LinuxReleaseGnu=gaussiancluster
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin/gaussiancluster
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=gaussiancluster.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/gaussiancluster.tar
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=gaussiancluster.exe
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/gaussiancluster.exe
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=gaussiancluster.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/gaussiancluster.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=gaussiancluster.exe
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/gaussiancluster.exe
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=gaussiancluster.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/gaussiancluster.tar
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Package-LinuxDebugGnu.bash b/TIesr_Tools/GaussianCluster/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..9220c4e
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/gaussiancluster
+OUTPUT_BASENAME=gaussiancluster
+PACKAGE_TOP_DIR=gaussiancluster/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/gaussiancluster/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/gaussiancluster.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/gaussiancluster.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Package-LinuxReleaseGnu.bash b/TIesr_Tools/GaussianCluster/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..036106d
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/gaussiancluster
+OUTPUT_BASENAME=gaussiancluster
+PACKAGE_TOP_DIR=gaussiancluster/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/gaussiancluster/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/gaussiancluster.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/gaussiancluster.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Package-WindowsDebugMinGW.bash b/TIesr_Tools/GaussianCluster/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..58423fc
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/gaussiancluster.exe
+OUTPUT_BASENAME=gaussiancluster.exe
+PACKAGE_TOP_DIR=gaussiancluster/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/gaussiancluster/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/gaussiancluster.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/gaussiancluster.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesr_Tools/GaussianCluster/nbproject/Package-WindowsReleaseMinGW.bash b/TIesr_Tools/GaussianCluster/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..233a4cd
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/gaussiancluster.exe
+OUTPUT_BASENAME=gaussiancluster.exe
+PACKAGE_TOP_DIR=gaussiancluster/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/gaussiancluster/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/gaussiancluster.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/gaussiancluster.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesr_Tools/GaussianCluster/nbproject/configurations.xml b/TIesr_Tools/GaussianCluster/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..430217f
--- /dev/null
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>src/ClusterUtil.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>src/ClusterUtil.c</itemPath>
+      <itemPath>src/GaussianCluster.c</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="LinuxDebugGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/gaussiancluster</output>
+          <linkerLibItems>
+            <linkerLibStdlibItem>Mathematics</linkerLibStdlibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/gaussiancluster</output>
+          <linkerLibItems>
+            <linkerLibStdlibItem>Mathematics</linkerLibStdlibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsDebugMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/gaussiancluster.exe</output>
+          <linkerLibItems>
+            <linkerLibStdlibItem>Mathematics</linkerLibStdlibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/gaussiancluster.exe</output>
+          <linkerLibItems>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesr_Tools/GaussianCluster/nbproject/private/configurations.xml b/TIesr_Tools/GaussianCluster/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..8c8d9d1
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>0</defaultConf>
+  <confs>
+    <conf name="LinuxDebugGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>/speech/release/OpenSource/TIesrSVN/trunk/TIesr_Tools/xxxtmp  xxxSavedMeans xxxSavedGlobalVar xxxSavedAux 128 1</args>
+        <rundir>/speech/release/OpenSource/TIesrSVN/trunk/TIesr_Tools/xxxtmp</rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args>/speech/release/OpenSource/TIesrSVN/trunk/TIesr_Tools/xxxtmp  xxxSavedMeans xxxSavedGlobalVar xxxSavedAux 128 0</args>
+        <rundir>/speech/release/OpenSource/TIesrSVN/trunk/TIesr_Tools/GaussianCluster/.</rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsDebugMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesr_Tools/GaussianCluster/nbproject/private/private.properties b/TIesr_Tools/GaussianCluster/nbproject/private/private.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/TIesr_Tools/GaussianCluster/nbproject/private/private.xml b/TIesr_Tools/GaussianCluster/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesr_Tools/GaussianCluster/nbproject/project.properties b/TIesr_Tools/GaussianCluster/nbproject/project.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/TIesr_Tools/GaussianCluster/nbproject/project.xml b/TIesr_Tools/GaussianCluster/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..f900f6e
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>GaussianCluster</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions>c</c-extensions>
+            <cpp-extensions/>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesr_Tools/GaussianCluster/src/ClusterUtil.c b/TIesr_Tools/GaussianCluster/src/ClusterUtil.c
new file mode 100755 (executable)
index 0000000..8992b36
--- /dev/null
@@ -0,0 +1,350 @@
+/*=======================================================================
+ ClusterUtil.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+#include "ClusterUtil.h"
+
+/*-------------------------- Create Vectors ------------------------------*/
+
+extern double delta;
+extern struct cluster Cluster[300];
+
+
+
+Vector CreateVector(int dim)
+{
+   Vector v;
+   v = (double *)calloc(dim, sizeof(double));
+   return (v);
+}
+
+/*--------------------------- Free Vectors -------------------------------*/
+void FreeVector(Vector v)
+{
+   free(v);
+}
+
+/*------------------------- Create Matrices ------------------------------*/
+Matrix CreateMatrix(int n_row, int n_col)
+{
+   Matrix m;
+   int i;
+   m = (double **)calloc(n_row, sizeof(double *));
+   for (i = 0; i < n_row; i++)
+      m[i] = CreateVector(n_col);
+   return (m);
+}
+
+/*-------------------------- Free Matrices -------------------------------*/
+void FreeMatrix(Matrix m, int n_row)
+{
+   int i;
+   for (i = 0; i < n_row; i++)
+      FreeVector(m[i]);
+   free(m);
+}
+
+/*-------------------------- Create Tensors ------------------------------*/
+Tensor CreateTensor(int dim_x, int dim_y, int dim_z)
+{
+   Tensor t;
+   int i;
+   t = (double ***)calloc(dim_x, sizeof(double **));
+   for (i = 0; i < dim_x; i++) {
+      t[i] = CreateMatrix(dim_y, dim_z);
+   }
+   return (t);
+}
+
+/*--------------------------- Free Tensors -------------------------------*/
+void FreeTensor(Tensor t, int dim_x, int dim_y)
+{
+   int i;
+   for (i = 0; i < dim_x; i++) {
+      FreeMatrix(t[i], dim_y);
+   }
+   free(t);
+}
+
+/* --------------------- Zero Vector/Matrix/Tensor -----------------------*/
+void ZeroVector(Vector v, int dim) {
+   int i;
+   for (i=0; i<dim; i++)
+      v[i] = 0.0;
+}
+
+void ZeroMatrix(Matrix m, int dim_x, int dim_y) {
+   int i, j;
+   for (i=0; i<dim_x; i++)
+      for (j=0; j<dim_y; j++)
+        m[i][j] = 0.0;
+}
+
+void ZeroTensor(Tensor t, int dim_x, int dim_y, int dim_z) {
+   int i, j, k;
+   for (i=0; i<dim_x; i++)
+      for (j=0; j<dim_y; j++)
+        for (k=0; k<dim_z; k++)
+           t[i][j][k] = 0.0;
+}
+
+/*--------------------------- Gauss Elimination --------------------------*/
+void GaussEliminate(double **A, int dim, int *perm, int *sign) {
+   double *s;    /* scale vector */
+   int i, j, k, imax, li, lk;
+   double r, rmax, smax, xmult, temp;
+
+   *sign = 1;
+   s = CreateVector(dim);
+   /* initialize perm[], s[] */
+   for (i=0; i<dim; i++) {
+      perm[i] = i;
+      smax = 0.0;
+      for (j=0; j<dim; j++) {
+        if ((temp = fabs(A[i][j])) > smax) {
+           smax = temp;
+        }
+      }
+      if (smax == 0.0) {
+        printf("ERROR! Matrix is Singular!\n");
+        exit (-1);
+      }
+      s[i] = smax;
+      /*printf("%d %f\n", perm[i], s[i]);*/
+   } /* end initialization */
+
+   for (k=0; k<dim-1; k++) {  /* index of Gauss Elimination procedure */
+      rmax = 0.0;
+      for (i=k; i<dim; i++) { /* choose pivot */
+        /*printf("start choosing pivot\n");*/
+        li = perm[i]; /*printf("li=%d", li);*/
+        r = fabs(A[li][k]/s[li]);
+        if (r > rmax) {
+           rmax = r;
+           j = i;    /* j indicates the pivot row */
+        }
+        if (rmax == 0.0) {
+           printf("\nERROR! rmax=0.0,Matrix is Singular!\n");
+           exit (-1);
+        }
+      } /* end choosing pivot */
+      imax = perm[j];
+      perm[j] = perm[k];    /* interchange perm[j] & perm[k] */
+      perm[k] = imax;
+      if (((j-k)%2) == 1)
+        *sign = -(*sign);
+
+      for (i=k+1; i<dim; i++) { /* for row i below row k */
+        lk = perm[k];
+        li = perm[i];
+        xmult = A[li][k]/A[lk][k];
+        A[li][k] = xmult;   /* store xmult in A[li][k] */
+        for (j=k+1; j<dim; j++) {  /* for columns in the right-side of k */
+           A[li][j] = A[li][j] - xmult*A[lk][j];
+        }
+      } /* end elimination for row i */
+   } /* end Gauss elimination */
+} /* end of Gauss_eliminate */
+
+/*------------------------- Solve Linear Equation ------------------------*/
+void LinearSolve(double **A, int dim, int *perm, double *b, double *x) {
+   int i, j, k, li, lk, ln;
+   double sum;
+
+   /* forward elimination of b[] */
+   for (k=0; k<dim-1; k++) {
+      lk = perm[k];
+      for (i=k+1; i<dim; i++) { /* for the rows below k */
+        li = perm[i];
+        b[li] = b[li] - A[li][k]*b[lk];
+      }
+   }
+
+   /* backward substraction */
+   ln = perm[dim-1];
+   x[dim-1] = b[ln]/A[ln][dim-1];
+
+   for (i=dim-2; i>=0; i--) {
+      li = perm[i];
+      sum = b[li];
+      for (j=i+1; j<dim; j++) {
+        sum = sum - A[li][j]*x[j];
+      }
+      x[i] = sum/A[li][i];
+   }
+}
+
+/*---------------------------- Invert Matrix -----------------------------*/
+double Invert(double **C, double **C_inv, int dim) {
+   double **A;
+   double col[100], x[100], xx;
+   double log_det;
+   int sign;
+   int i, j, perm[100];
+   int li;
+
+   A = CreateMatrix(dim, dim);
+   for (i=0; i<dim; i++)    /* make a copy of C */
+      for (j=0; j<dim; j++)
+        A[i][j] = C[i][j];
+
+   GaussEliminate(A, dim, perm, &sign);
+   for (j=0; j<dim; j++) {
+      for (i=0; i<dim; i++) { /* reset col[] */
+        col[i] = 0.0;
+      }
+      col[j] = 1.0;
+      LinearSolve(A, dim, perm, col, x);   /* A*col'=col, solve column by column*/
+      for (i=0; i<dim; i++) {
+        C_inv[i][j] = x[i];
+      }
+   }
+
+   log_det = 0.0;  /* calculate log(det(C)) */
+   for (i=0; i<dim; i++) {
+      li = perm[i];
+      xx = A[li][i];
+      if (xx < 0.0)
+        sign = -sign;
+      log_det += log(fabs(xx));
+   }
+
+   FreeMatrix(A, dim);
+   return log_det;
+}
+
+/*-------------------------- Calculate bj(ot) ----------------------------*/
+double CalStateLikeli(int LogKey, Vector data, vector *mean, vector *var, int M, Vector C)
+{
+   int m, i;
+   double tmp1, tmp2, mix_likeli;
+   double sum = 0.0;
+   double state_likeli = MinProb;
+
+   for (m=0; m < M; m++) {
+      tmp1 = (-1.0)*mean[m][0];
+      for (i=1; i<=FeaDim; i++) {
+        tmp2 = data[i-1] - mean[m][i];   /* o-mu */
+        tmp1 = tmp1 - (tmp2*tmp2)*var[m][i];
+      }
+      mix_likeli = exp((0.5)*tmp1);
+      if (mix_likeli <= 0.0)
+        mix_likeli = 1e-30;
+      sum += C[m]*mix_likeli;
+   } /* end loop for mixture component */
+   state_likeli = log(sum);
+   if (LogKey == 0)
+      return (sum);
+   else
+      return (state_likeli);
+}
+
+/*-------------------------- Calculate bjk(ot) ---------------------------*/
+double CalMixLikeli(int LogKey, Vector data, vector mean, vector var)
+{
+   int i;
+   double tmp1, tmp2;
+   double sum = 0.0;
+   double mix_likeli = MinProb;
+
+   tmp1 = (-1.0) * mean[0];
+   for (i=1; i<=FeaDim; i++) {
+      tmp2 = data[i-1] - mean[i];
+      tmp1 = tmp1 - (tmp2*tmp2)*var[i];
+   }
+   sum = exp((0.5)*tmp1);
+   if (sum <= 0.0)
+      sum = 1e-30;
+   mix_likeli = log(sum);
+   if (LogKey == 0)
+      return (sum);
+   else
+      return (mix_likeli);
+}
+double CalEucleanDistance(Vector mean1, Vector mean2, int dim)
+{
+  int i;
+   double distance = 0.0;
+   double diff = 0.0;
+   double term = 0.0;
+
+   for (i=0; i<dim; i++) {
+      diff = mean1[i] - mean2[i];
+      term = diff * diff;
+      distance += term;
+   }
+
+   return (distance);
+}
+double CalWeightEucleanDistance(Vector mean1, Vector invvar1, Vector mean2, int dim)
+{
+  int i;
+   double distance = 0.0;
+   double diff = 0.0;
+   double term = 0.0;
+
+   for (i=0; i<dim; i++) {
+      diff = mean1[i] - mean2[i];
+      term = diff * diff;
+      term =term/ invvar1[i];
+      distance += term;
+   }
+
+   return (distance);
+}
+double CalDivergence(Vector mean1, Vector sigma1, Vector mean2, Vector sigma2, int dim)
+{
+   int i;
+   double divergence = 0.0;
+   double diff = 0.0;
+   double delta_kmi2 = 0.0;
+   double term = 0.0;
+
+   for (i=0; i<dim; i++) {
+      diff = mean1[i] - mean2[i];
+      delta_kmi2 = diff * diff;
+      term = ((sigma1[i]+delta_kmi2)/sigma2[i])+((sigma2[i]+delta_kmi2)/sigma1[i]);
+      divergence += term;
+   }
+
+   return (divergence);
+}
+
+double CalBhattaDistance(Vector mean1, Vector sigma1, Vector mean2, Vector sigma2, int dim)
+{
+   int i;
+   double distance = 0.0;
+   double diff = 0.0;
+   double log_det_sigma1 = 0.0;
+   double log_det_sigma2 = 0.0;
+   double log_det_sigma1plus2 = 0.0;
+   double term1 = 0.0;
+   double term2 = 0.0;
+
+   for (i=0; i<dim; i++) {
+      diff = mean1[i] - mean2[i];
+
+
+
+      term1 += diff * diff * (1.0)/(0.5*(sigma1[i]+sigma2[i]));
+   }
+   term1 *= (1.0)/(8.0);
+
+   for (i=0; i<dim; i++) {
+      log_det_sigma1 += log(sigma1[i]);
+      log_det_sigma2 += log(sigma2[i]);
+      log_det_sigma1plus2 += log(((sigma1[i]+sigma2[i])/2.0));
+   }
+   term2 = (0.5) * (log_det_sigma1plus2 - (0.5)*log_det_sigma1 - (0.5)*log_det_sigma2);
+
+   distance = term1 + term2;
+   return (distance);
+}
+
+void Abort(char *message) {
+   fprintf(stderr, "\n%s\n", message);
+   exit(-1);
+}  
diff --git a/TIesr_Tools/GaussianCluster/src/ClusterUtil.h b/TIesr_Tools/GaussianCluster/src/ClusterUtil.h
new file mode 100755 (executable)
index 0000000..a962fb2
--- /dev/null
@@ -0,0 +1,164 @@
+/*=======================================================================
+ ClusterUtil.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+#ifndef CLUSTERUTIL_H
+#define CLUSTERUTIL_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+
+
+
+
+/* Macro functions */
+#define swap16(x) x = ((x << 8 & 0xff00) | (x >> 8 & 0xff))
+
+#define SQUARE(A)   ((A)*(A))
+
+#define MIN(a,b)  ((a) < (b) ? (a): (b))
+
+#define MAX(a,b)  ((a) > (b) ? (a): (b))
+
+#define LONG2SHORT(x) (short)(MIN(MAX(x, -32768),32767))
+
+
+/* Q point constants */
+#define Q11 2048
+#define Q9 512
+
+/* Logical constants */
+#define FALSE 0
+#define TRUE 1
+#define OK 1
+#define FAIL 0
+
+/* symbolic constants related to features */
+#define FeaDim 20         /* dimension of feature vector */
+#define MAX_DIM_MFCC16 32
+
+/* Global mfcc mean bias applied if input means are CMN */
+static const short mean_bias[] = {14951, -2789, -811, 1563, -3013, -1346, 973, -884, 355, -496, 0, 0, 0, 0, 0, 0};
+
+/* symbolic constants related to models - Maximum sizes allowed */
+#define StateNum 10          /* number of states per model */
+#define MaxMixNum 10         /* maximum number of mixtures per state */
+#define VectorSize 32        /* dimension of mean and covariance */
+#define N_dim 32
+
+
+/* symbolic constants for prob calculation */
+#define MaxProb  1.0e32
+#define MinProb  -1.0e32
+#define LSMALL   -0.5e10      /* log values < LSMALL are set to LZERO */
+#define LZERO    -1.0e10       /* ~log(0) */
+#define MaxHMM 7000
+#define MaxCluster 1000
+#define MaxGaussian 20000
+
+/* Output binary versions of clustered data */
+#define Binary_OUTPUT
+
+
+/*
+ * #define MLLR_FLAG 0
+ * #define MAP_FLAG 0
+ */
+
+/*---------------------- global data setting -----------------------------*/
+typedef double vector[N_dim];   /* define "vector", mean[0] for GConst */
+typedef double *Vector;
+typedef double **Matrix;
+typedef double ***Tensor;
+typedef double LogDouble;  /* just to signal that the value is from log */
+
+struct HMM_struct {    /* for reading-in HTK model    */
+   int phone_ID;
+   int state_no;
+   int  phone_name;
+   int mix_no[StateNum];
+   double mixweight[StateNum][MaxMixNum];
+   int cluster[StateNum][MaxMixNum];
+   double mean[StateNum][MaxMixNum][VectorSize];
+   double var[StateNum][MaxMixNum][VectorSize];
+   double transP[StateNum][StateNum];
+   double Gconst[StateNum][MaxMixNum];
+};
+
+
+struct gaussian {
+   int phone_name;
+   int state_no,mix_no,pdf_id;
+   double mean[FeaDim];
+   double var[FeaDim];
+   int pseudo;
+};
+
+
+struct cluster{
+       int reference;
+       int *pdf_member;
+       int pdf_no;
+       double MeanCentroid[FeaDim];
+    double VarCentroid[FeaDim];
+};
+
+
+struct Node {
+    double MeanCentroid[FeaDim];
+    double VarCentroid[FeaDim];
+};
+
+
+void WriteNewModel(char *new_path,struct HMM_struct *triphone );
+void FreeClusterMemberTable(int clu);
+int Min(double *D, int cs);
+int Max_clu(int cs);
+void copyHMM2Gauss(struct HMM_struct *triphone);
+void ComputeCentroid( int clu_index);
+void Initial_codebook(int cs);
+void CodebookVQ(int cs, int TotalGauss);
+void CodebookClassify(int cs,double del);
+int VQ(int size,double del, short bSwap);
+int Classify(int size,struct HMM_struct *monophone,double del);
+void ComputeCentroidClassify( struct HMM_struct *monophone);
+void Abort(char *message);
+void AllocateClusterMemberTableClassify(int clu, int number);
+Matrix CreateMatrix(int n_row, int n_col);
+void AllocateMemSentence(void);
+Vector CreateVector(int dim);
+void ZeroVector(Vector v, int dim);
+void ZeroMatrix(Matrix m, int dim_x, int dim_y);
+void ZeroTensor(Tensor t, int dim_x, int dim_y, int dim_z);
+void GaussEliminate(double **A, int dim, int *perm, int *sign);
+void LinearSolve(double **A, int dim, int *perm, double *b, double *x);
+double Invert(double **C, double **C_inv, int dim);
+double CalStateLikeli(int LogKey, Vector data, vector *mean, vector *var, int M, Vector C);
+double CalMixLikeli(int LogKey, Vector data, vector mean, vector var);
+double CalEucleanDistance(Vector mean1, Vector mean2, int dim);
+double CalDivergence(Vector mean1, Vector sigma1, Vector mean2, Vector sigma2, int dim);
+double CalBhattaDistance(Vector mean1, Vector sigma1, Vector mean2, Vector sigma2, int dim);
+void FreeVector(Vector v);
+void FreeMatrix(Matrix m, int n_row);
+Tensor CreateTensor(int dim_x, int dim_y, int dim_z);
+void FreeTensor(Tensor t, int dim_x, int dim_y);
+extern void FreeTensor(Tensor t, int dim_x, int dim_y);
+extern void FreeVector(Vector v);
+extern void FreeMatrix(Matrix m, int n_row);
+void AllocateClusterMemberTable(int clu, int number);
+double pow_Yu(double base, int cs);
+int ceil_Yu(double input);
+int * Ranking(double *D, int cs, int pick);
+int Layer_no(int base,int pdfs);
+double CalWeightEucleanDistance(Vector mean1, Vector invvar1, Vector mean2, int dim);
+void ComputeWeightCentroid( int clu_index);
+void Writecluster1(int cs, short bSwap);
+// void Writecluster2(int cs);
+
+#endif
diff --git a/TIesr_Tools/GaussianCluster/src/GaussianCluster.c b/TIesr_Tools/GaussianCluster/src/GaussianCluster.c
new file mode 100755 (executable)
index 0000000..6f9b41b
--- /dev/null
@@ -0,0 +1,1333 @@
+/*=======================================================================
+ GaussianCluster.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+#include "ClusterUtil.h"
+
+/* Global variables */
+extern void FreeMatrix(Matrix m, int n_row);
+extern void FreeVector(Vector v);
+static double delta;
+struct HMM_struct triphone[MaxGaussian];
+struct cluster Cluster[MaxCluster];
+struct cluster ReferenceCluster[MaxGaussian];
+struct gaussian Gaussian[MaxGaussian]; 
+int TotalGauss;
+int TotalReference;
+int TotalCDHMM;
+int TotalCIHMM;
+
+unsigned int nMean = 0;
+unsigned int nVar = 0;
+void *mean_base = NULL;
+void *var_base = NULL;
+short *p_mu_base = NULL;
+short *p_var_base = NULL;
+short *scale_base = NULL; /* the first m_inputFeatDim is form mean scaling,
+                            the last m_inputFeatDim is for variance scaling*/
+long ave_cov[ MAX_DIM_MFCC16 ];
+float f_ave_cov[ MAX_DIM_MFCC16 ];
+
+struct{
+  int m_inputFeatDim ;
+
+      // Static feature vector dimensions
+  int m_inputStaticDim;
+
+  // Features are in 16-bit shorts
+  int m_bInputByteMeans;
+
+  int m_bInputByteVars;
+
+  // Features are CMN mean normalized, and need bias added.
+  // Bias is added as part of TIesrFlex converting means
+  // to bytes.
+  int m_bInputCMN;
+
+  // Features are not little endian
+  int m_bInputLittleEndian ;
+
+  // Male and female sets, denoted by :f and :m
+  int m_inputSets ;
+
+  // Monophone transitions are set ("gender") independent
+  int m_bInputGDTrans ;
+
+  // Acoustic decision trees are set ("gender") dependent
+  int m_bInputGDTrees;
+}st_config; 
+
+
+/*--------------------------------
+  read_config
+
+  This function reads the configuration file that defines the type of
+  information in the input fixed point tree and HMM files.
+  Originally, Yuhung assumed one exact format for the files.  Now
+  multiple types of files can be supported.  These file types allow
+  options for much more compact data storage.
+  --------------------------------*/
+int read_config( char *fname )
+{
+   FILE *fp;
+   size_t nread = 0;
+   
+   // Attempt to open the configuration file.  If it can't be opened,
+   // use defaults.
+   fp = fopen(fname, "rb");
+   if ( fp == NULL ) 
+   {
+     // Default assumptions made by Yuhung for input trees and HMMs
+     
+     // Feature vector dimensions
+     st_config.m_inputFeatDim = 20;
+     
+     // Static feature vector dimensions
+     st_config.m_inputStaticDim = 10;
+     
+     // Features are in 16-bit shorts
+     st_config.m_bInputByteMeans = FALSE;
+     
+     st_config.m_bInputByteVars = FALSE;
+     
+     // Features are CMN mean normalized, and need bias added.
+     // Bias is added as part of TIesrFlex converting means
+     // to bytes.
+     st_config.m_bInputCMN = TRUE;
+     
+     // Features are not little endian
+     st_config.m_bInputLittleEndian = FALSE;
+     
+     // Male and female sets, denoted by :f and :m
+     st_config.m_inputSets = 1;
+
+     // Monophone transitions are set ("gender") independent
+     st_config.m_bInputGDTrans = FALSE;
+     
+     // Acoustic decision trees are set ("gender") dependent
+     st_config.m_bInputGDTrees = TRUE;
+     
+     return OK;
+   }
+   
+
+   // Number of features in input mean and variance vectors
+   // This may include delta and accel. in addition to static
+   fread( &st_config.m_inputFeatDim, sizeof(int), 1, fp );
+
+   // Static feature dimensions in input mean and variance vectors
+   // This is only the number of static features.  If delta and acc 
+   // features are in the input, then delta and acc must also have
+   // this number of dimensions.
+   fread( &st_config.m_inputStaticDim, sizeof(int), 1, fp );
+
+   // Flag, input feature means are in bytes
+   fread( &st_config.m_bInputByteMeans, sizeof(int), 1, fp );
+
+   // Flag, input feature inverse variances are in bytes
+   fread( &st_config.m_bInputByteVars, sizeof(int), 1, fp );
+
+   // Flag, data is mean normalized and needs mean added
+   fread( &st_config.m_bInputCMN, sizeof(int), 1, fp );
+   
+   // Flag, data is in little endian format
+   fread( &st_config.m_bInputLittleEndian, sizeof(int), 1, fp );
+
+   // Number of "genders" or hmm model sets in data
+   fread( &st_config.m_inputSets, sizeof(int), 1, fp );
+
+   // Flag, gender-dependent transitions
+   fread( &st_config.m_bInputGDTrans, sizeof(int), 1, fp );
+   
+   // Flag, gender-dependent trees
+   nread = fread( &st_config.m_bInputGDTrees, sizeof(int), 1, fp );
+   
+   fclose( fp );
+
+   if( nread != 1 )
+   {
+      return FAIL;
+   }
+
+   if (st_config.m_bInputByteMeans){
+     printf(" -------------- GaussianCluster Error --------------\n");
+     printf(" Cluster resolution not acceptable using ByteMean as\n");
+     printf(" input for vector quantization.\n");
+     printf(" Must use short mean vectors as input.\n");
+     printf(" ----------------------------------------------------\n");
+     return FAIL;
+   }
+   return OK;
+}
+
+
+
+void DECODE_STDY(short tmp_sh, short *mu_static, short *mu_dynamic){
+    *mu_static  = (tmp_sh & 0xff00);
+    *mu_dynamic = (tmp_sh) << 8;
+}
+
+void vector_unpacking(const unsigned short v_in[], short v_out[], const short scale[], short D)
+{
+  short d;
+
+  for (d = 0; d < D ; d++) {
+    DECODE_STDY(v_in[d], &v_out[d], &v_out[d + D]);
+    v_out[d] >>= scale[d];
+    v_out[d+D] >>= scale[d+D];
+  }
+}
+
+void unpacking(short *base, unsigned short nbr, short n_mfcc,
+              FILE *fp, short scale[])
+{
+  int i;
+  unsigned short tmp_sh[ MAX_DIM_MFCC16 ];
+  short *vec;
+  short nread;
+  for (vec = base, i=0; i< nbr; i++, vec += n_mfcc * 2) {
+    nread = fread(tmp_sh, sizeof(short), n_mfcc, fp);
+    if( nread != n_mfcc )
+      return ; 
+    vector_unpacking(tmp_sh, vec, scale, n_mfcc);
+  }
+}
+
+int read_scale( char *fname )
+{
+   FILE *fp;
+   size_t nread = 0;
+   size_t scaleSize;
+
+
+   // The number of scales should be twice the number of features,
+   // since we are getting the scales for mean and variance.  The
+   // scales are in signed short.
+   scaleSize =  2 * st_config.m_inputFeatDim * sizeof(short);
+   scale_base = (short*) malloc( scaleSize );
+   if( scale_base == NULL )
+   {
+      return FAIL;
+   }
+      
+   fp = fopen(fname, "rb");
+   if ( fp == NULL ) 
+   {
+      return FAIL;
+   }
+
+   nread = fread( scale_base, sizeof(short), 2*st_config.m_inputFeatDim, fp );
+   fclose( fp );
+
+   if( nread != (size_t)(2*st_config.m_inputFeatDim) )
+   {
+      return FAIL;
+   }
+
+   return OK;
+}
+
+
+void add_mean(short * vec, int n_mfcc){
+  short d; 
+  short *pv = vec; 
+  long tmp; 
+  for (d=0; d<n_mfcc; d++) {
+    tmp = (long) pv[d] + (long) mean_bias[d];
+    pv[d] = LONG2SHORT(tmp);
+  }
+}
+
+int read_mean(char *fname)
+{
+   FILE  *fp;
+   size_t elementSize;
+   short vectorSize;
+   unsigned int nRead;
+   unsigned int i; 
+   short * mu8, *mu16; 
+
+   // if mean data exists, free it
+   if( mean_base != NULL )
+      free( mean_base );
+       
+   // Determine sizes of input and output vectors
+   elementSize = st_config.m_bInputByteMeans ? sizeof( unsigned char ) :
+      sizeof( short );
+   
+   vectorSize = elementSize * st_config.m_inputFeatDim;
+       
+   // Open the mean file and get number of mean vectors
+   fp = fopen(fname, "rb");
+   if ( fp == NULL ) 
+   {
+      return FAIL;
+   }
+       
+   fread(&nMean, sizeof(unsigned int), 1, fp);
+
+
+   // Allocate space to hold the mean vectors
+   mean_base = malloc( nMean * vectorSize );
+   if( !mean_base )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+       
+
+   // Read in the vector data, stepping over unused dimensions
+   nRead = fread( mean_base, vectorSize, nMean, fp );
+
+   fclose( fp );
+
+   if (st_config.m_bInputByteMeans){
+     p_mu_base = (short*)malloc( sizeof(short) * nMean * st_config.m_inputFeatDim ); 
+     mu8= (short*)mean_base; mu16 = p_mu_base; 
+     for (i=0;i<nMean;i++){
+       vector_unpacking((unsigned short*) mu8, mu16, scale_base, st_config.m_inputStaticDim); 
+       mu8 += st_config.m_inputStaticDim;
+       mu16 += st_config.m_inputFeatDim; 
+     }
+     
+     free(mean_base); 
+   }else p_mu_base = (short*) mean_base ; 
+
+   if (st_config.m_bInputCMN){
+     /* need add bias */
+     mu16 = p_mu_base ; 
+     for (i=0;i<nMean;i++){
+       add_mean(mu16, st_config.m_inputStaticDim);
+       mu16 += st_config.m_inputFeatDim ; 
+     }
+   }
+
+   return OK;
+}
+
+void convert_to_short_var()
+{
+  short *scale_var_base = &scale_base[st_config.m_inputFeatDim];
+  short *var8, *var16;
+  unsigned int i;
+
+  if (st_config.m_bInputByteVars){
+    p_var_base = (short*)malloc( sizeof(short) * 
+                                nVar * st_config.m_inputFeatDim ); 
+    var8= (short*)var_base; var16 = p_var_base; 
+    for (i=0;i<nVar;i++){
+      vector_unpacking((unsigned short*) var8, var16, scale_var_base, st_config.m_inputStaticDim); 
+      var8 += st_config.m_inputStaticDim;
+      var16 += st_config.m_inputFeatDim; 
+    }
+     
+    free(var_base); 
+   }else p_var_base = (short*) var_base ; 
+
+}
+
+void get_global_var()
+{
+  int i, j; 
+  short *inv = p_var_base; 
+
+  for (j=st_config.m_inputFeatDim-1;j>=0;j--) f_ave_cov[j] = 0;
+  for (i=0;i<nVar;i++){
+    for (j=st_config.m_inputFeatDim-1;j>=0;j--){
+      f_ave_cov[j] += Q9/((float)inv[j]); /* Q6 */
+    }
+    inv += st_config.m_inputFeatDim; 
+  }
+  for (j=st_config.m_inputFeatDim-1;j>=0;j--){
+    f_ave_cov[j] /= nVar; 
+  }
+
+}
+
+int read_var(char *fname)
+{
+   FILE  *fp;
+   size_t elementSize;
+   int vectorSize;
+
+   // if inverse variance data exists, free it
+   if( var_base != NULL )
+      free( var_base );
+
+   // Determine sizes of input and output vectors
+   elementSize = st_config.m_bInputByteVars ? sizeof( unsigned char ) :
+      sizeof( short );
+   
+   vectorSize = elementSize * st_config.m_inputFeatDim;
+       
+   // Open the mean file and get number of mean vectors
+   fp = fopen(fname, "rb");
+   if ( fp == NULL ) 
+   {
+      return FAIL;
+   }
+       
+   fread(&nVar, sizeof(unsigned int), 1, fp);
+
+
+   // Allocate space to hold the mean vectors
+   var_base = malloc( nVar * vectorSize );
+   if( !var_base )
+   {
+      fclose(fp);
+      return FAIL;
+   }
+       
+
+   // Read in the vector data, stepping over unused dimensions
+   size_t nRead = fread( var_base, vectorSize, nVar, fp );
+
+   fclose( fp );
+       
+   if( nRead != nVar )
+      return FAIL;
+
+   convert_to_short_var();
+   get_global_var();
+
+   return OK;
+}
+
+void save_var(char *fname)
+{
+  FILE *fp;
+  short i; 
+
+  fp = fopen(fname, "wt");
+  for(i=0;i<st_config.m_inputFeatDim;i++)
+    fprintf(fp, "%2.4f\n", f_ave_cov[i]);
+  fclose(fp);
+
+}
+
+int main(int argc,char *argv[]){
+  FILE *f_triphone,*f_monophone,*f_variance;
+  unsigned int i;
+  int j;
+  int temp,counter=0;
+  int phone_index_previous=0,state_index_previous=0,mixture_index_previous=0;
+  int phone_index_follow=0,state_index_follow=0,mixture_index_follow=0;
+  int Number_classes;
+  float gg;
+  char fname[256]; 
+  short bSwap = 0;
+  int islittleendian;
+
+  if(argc!=7)
+    {
+      printf("GaussianCluster Path SavedMeanFile SavedVarFile SavedInfo NumClusters LittleEndian\n");
+      printf(" Path          : Directory containing fixed point models and fxconfig.bin\n");
+      printf(" SavedMeanFile : saved ASCII Mean vectors in Q11 for training\n");
+      printf(" SavedVarFile  : saved ASCII variance vector in Q0\n");
+      printf(" SavedInfo     : saved auxiliary information - not currently used\n");
+      printf(" Num_clusters  : number of clusters, e.g., 128 \n");
+      printf(" LittleEndian  : 1/0 : 1 => output Little Endian, 0 => output Big Endian\n");
+      exit(-1);
+    }
+
+
+  /* determine endianness of the machine, and if byte swap on output needed. */
+  i = 0x1;
+  islittleendian =  *( (char*)&i ) == 0x1;
+  bSwap = islittleendian != atoi( argv[6]);
+
+  /* read the fixed-point configuration */
+  strcpy(fname, argv[1]);
+  strcat(fname, "/fxconfig.bin");
+  if (read_config(fname) == FAIL) exit(1); 
+
+  if (st_config.m_bInputLittleEndian != islittleendian ) {
+    printf("GaussianCluster: fixed point data and machine endianness conflict\n");
+    exit(1);
+  }
+
+  /* read the scaling vector */
+  strcpy(fname, argv[1]);
+  strcat(fname, "/scale.bin");
+  read_scale(fname);
+
+  /* read the fixed-point mean */
+  strcpy(fname, argv[1]);
+  strcat(fname, "/fxmean.cb");
+  if (read_mean(fname)){
+    /* the data is before TIesrFlex */
+    f_triphone = fopen(argv[2], "wt");
+    for (i=0;i<nMean;i++){
+      fprintf(f_triphone, "%d %d %d ", i, 0, 0);
+      for (j=0;j<st_config.m_inputFeatDim;j++) 
+       fprintf(f_triphone, "%d ", p_mu_base[i*st_config.m_inputFeatDim + j]); 
+      fprintf(f_triphone , "\n");
+    }
+    fclose(f_triphone);
+    
+    free(p_mu_base);
+  }else
+    return -1; 
+
+  /* read and write the fixed-point mean */
+  strcpy(fname, argv[1]);
+  strcat(fname, "/fxvar.cb");
+
+  if (read_var(fname)) {
+    /* save variance */
+    save_var(argv[3]);
+    free( p_var_base );
+    if (scale_base) free(scale_base);
+  }else
+    return -1; 
+
+  f_triphone=fopen(argv[2],"r");
+  if(f_triphone==NULL){
+    printf("GaussianCluster: Open f_triphone ERROR\n");
+    exit(-1);
+  }
+
+  /*  bSwap = atoi(argv[6]); */
+  f_variance=fopen(argv[3],"r");
+  if( f_variance == NULL ){
+      printf( "GaussianCluster: Open f_variance ERROR\n");
+      exit(-1);
+  }
+
+  Number_classes=atoi(argv[5]);
+
+  fscanf(f_triphone,"%d ",&phone_index_previous);
+  while (!feof(f_triphone)){
+    triphone[phone_index_previous].phone_name=phone_index_previous;
+    fscanf(f_triphone,"%d %d",&state_index_previous,&mixture_index_previous);
+    if (mixture_index_previous==0 && counter!=0)
+      triphone[phone_index_follow].mix_no[state_index_follow]=(mixture_index_follow+1);
+    if (mixture_index_previous==0 && state_index_previous==0 && counter!=0)
+      triphone[phone_index_follow].state_no=(state_index_follow+1);
+    for (i=0;i<st_config.m_inputFeatDim;i++)
+      {
+       fscanf(f_triphone,"%d ", &temp);                
+       triphone[phone_index_previous].mean[state_index_previous][mixture_index_previous][i]=(double)(temp)/Q11;
+       fscanf(f_variance,"%f ", &gg);
+       triphone[phone_index_previous].var[state_index_previous][mixture_index_previous][i]=gg;
+      }
+    rewind(f_variance);
+    counter++;
+    
+    phone_index_follow=phone_index_previous;
+    state_index_follow=state_index_previous;
+    mixture_index_follow=mixture_index_previous;
+    fscanf(f_triphone,"%d ",&phone_index_previous);
+  }
+  triphone[phone_index_follow].mix_no[state_index_follow]=(mixture_index_follow+1);
+  triphone[phone_index_follow].state_no=(state_index_follow+1);
+  TotalCDHMM=phone_index_follow+1;
+  TotalGauss=counter;
+  printf("%d Gaussians\n",TotalGauss);
+  fclose(f_variance);
+  fclose(f_triphone);
+  VQ(Number_classes,0, bSwap);
+
+  f_monophone = fopen(argv[2], "r");
+  if (f_monophone == NULL) {
+    printf("GaussianCluster: Open f_monophone ERROR\n");
+    exit(-1);
+  }
+  f_variance=fopen(argv[3],"r");
+  if (f_variance == NULL) {
+    printf("GaussianCluster: Open f_variance ERROR\n");
+    exit(-1);
+  }
+  counter=0;
+  fscanf(f_monophone,"%d ",&phone_index_previous);
+  while (!feof(f_monophone)){
+    triphone[phone_index_previous].phone_name=phone_index_previous;
+    fscanf(f_monophone,"%d %d",&state_index_previous,&mixture_index_previous);
+    if (mixture_index_previous==0 && counter!=0)
+      triphone[phone_index_follow].mix_no[state_index_follow]=(mixture_index_follow+1);
+    if (mixture_index_previous==0 && state_index_previous==0 && counter!=0)
+      triphone[phone_index_follow].state_no=(state_index_follow+1);
+    for (i=0;i<st_config.m_inputFeatDim;i++)
+      {
+       fscanf(f_monophone,"%d ", &temp);       
+       triphone[phone_index_previous].mean[state_index_previous][mixture_index_previous][i]=(double)(temp)/Q11;
+       fscanf(f_variance,"%f ", &gg);
+       triphone[phone_index_previous].var[state_index_previous][mixture_index_previous][i]=gg;
+       
+      }
+    rewind(f_variance);
+    counter++;
+    
+    phone_index_follow=phone_index_previous;
+    state_index_follow=state_index_previous;
+    mixture_index_follow=mixture_index_previous;
+    fscanf(f_monophone,"%d ",&phone_index_previous);
+  }
+  triphone[phone_index_follow].mix_no[state_index_follow]=(mixture_index_follow+1);
+  triphone[phone_index_follow].state_no=(state_index_follow+1);
+  TotalCIHMM=phone_index_follow+1;
+  TotalReference=counter;
+  printf("%d Gaussians\n",TotalReference);
+  Classify(Number_classes,triphone,0);
+  fclose(f_variance);
+  fclose(f_monophone);
+
+  exit(0);
+}
+
+void FreeClusterMemberTable(int clu)
+{
+   free(Cluster[clu].pdf_member);
+}
+
+
+int Min(double *D, int cs){
+  
+  int min_id,i;
+  double min;
+  
+  min=D[0];
+  min_id=0;
+  for(i=1;i<cs;i++){
+    
+    if(D[i]<min){
+      min=D[i];
+      min_id=i;
+    }
+    
+  }
+
+  return min_id;
+}
+
+int * Ranking(double *D, int cs, int pick){
+  int min_id,i,j;
+  double min;
+  int * rank;
+  rank=(int *)calloc(cs, sizeof(int));
+  min=D[0];
+  min_id=0;
+  for (j=0;j<pick;j++){
+    for(i=0;i<cs;i++){   
+      if(D[i]<min){
+       min=D[i];
+       D[i]=D[i]+MaxProb;
+       rank[j]=i;
+       min_id=i;
+      }
+    }
+  }
+  return rank;
+}
+
+double pow_Yu(double base, int cs){
+  
+  int i;
+  double result;
+  result=base;
+  if (cs==0)
+    result=1;
+  else{
+    for(i=1;i<cs;i++){
+      result=result*base;
+    }
+  }
+  return result;
+}
+
+int ceil_Yu(double input){
+  int ref;
+  double output;
+  ref=(int)(input);
+  if(ref<input)
+    output=ref+1;
+  else 
+    output=ref;
+  return (int)(output);
+}
+int Layer_no(int base,int pdfs){
+  int value,i;
+  value=1;
+  if (pdfs==1)
+         i=0;
+  else
+  {
+       for (i=1;i<100;i++)
+       { 
+               value=value*base;
+               if (value>=pdfs)
+               {
+                       break;
+               }
+  
+       }
+  }
+  return i;
+}
+
+int Max_clu(int cs){
+
+  int max_id,i;
+  double max;
+  max=Cluster[0].pdf_no;
+  max_id=0;
+  for(i=1;i<cs;i++){
+    if(Cluster[i].pdf_no>max){
+      max=Cluster[i].pdf_no;
+      max_id=i;
+    }
+  }
+  return max_id;
+}
+
+void copyHMM2Gauss(struct HMM_struct *triphone){
+
+  int model_index, state_index, mix_index;
+  int gaussian_index=0;
+  int i;
+  
+  printf("Copying Hmm to Gaussian...\n");
+  for (model_index=0; model_index<TotalCDHMM; model_index++) {
+    for (state_index=0; state_index<triphone[model_index].state_no; state_index++) {
+      for (mix_index=0; mix_index<triphone[model_index].mix_no[state_index]; mix_index++) {
+       Gaussian[gaussian_index].phone_name= triphone[model_index].phone_name;
+       Gaussian[gaussian_index].state_no = state_index;
+       Gaussian[gaussian_index].mix_no = mix_index;
+       Gaussian[gaussian_index].pdf_id = gaussian_index;
+       for (i=0; i<st_config.m_inputFeatDim; i++) {
+         Gaussian[gaussian_index].mean[i] = triphone[model_index].mean[state_index][mix_index][i];
+         Gaussian[gaussian_index].var[i] = triphone[model_index].var[state_index][mix_index][i]; 
+         
+       }
+       gaussian_index++;
+      }
+    } 
+  }
+  if (gaussian_index!=TotalGauss)
+    printf("GaussianCluster: Mismatched number of Gaussian mixtures\n");
+}
+void ComputeWeightCentroid( int clu_index){
+
+   int i,k,now_pdf;
+   Vector denom_acc;
+   Vector mean_numer_acc;
+   Vector var_numer_acc;
+   Vector tmpvector;
+   denom_acc = CreateVector(FeaDim); //Cluster[clu_index].pdf_no;
+   ZeroVector(denom_acc, FeaDim);
+   mean_numer_acc = CreateVector(FeaDim);
+   ZeroVector(mean_numer_acc, FeaDim);
+   var_numer_acc = CreateVector(FeaDim);
+   ZeroVector(var_numer_acc, FeaDim);
+   tmpvector = CreateVector(FeaDim);
+   for (i=0; i<Cluster[clu_index].pdf_no; i++){
+     now_pdf=Cluster[clu_index].pdf_member[i];
+     for (k=0; k<st_config.m_inputFeatDim; k++)
+       {
+        mean_numer_acc[k] +=Gaussian[now_pdf].mean[k] / pow(Gaussian[now_pdf].var[k],0.5);
+        denom_acc[k] += 1/pow(Gaussian[now_pdf].var[k],0.5); 
+        var_numer_acc[k] += (Gaussian[now_pdf].mean[k]*Gaussian[now_pdf].mean[k]/ Gaussian[now_pdf].var[k]);
+       }
+   }
+   
+   for (k=0; k<st_config.m_inputFeatDim; k++) {
+     Cluster[clu_index].MeanCentroid[k] = mean_numer_acc[k] / denom_acc[k];
+     tmpvector[k] = Cluster[clu_index].MeanCentroid[k]; 
+     Cluster[clu_index].VarCentroid[k] = 
+       (var_numer_acc[k]/ denom_acc[k]) - (tmpvector[k]*tmpvector[k]);
+   }
+   FreeVector(mean_numer_acc);
+   FreeVector(var_numer_acc);
+   FreeVector(tmpvector);
+   FreeVector(denom_acc);
+}
+
+void ComputeCentroid( int clu_index){
+
+   int i,k,now_pdf;
+   double denom_acc;
+   Vector mean_numer_acc, var_numer_acc;
+   Vector tmpvector;
+   denom_acc = Cluster[clu_index].pdf_no;
+   mean_numer_acc = CreateVector(st_config.m_inputFeatDim);
+   ZeroVector(mean_numer_acc, st_config.m_inputFeatDim);
+   var_numer_acc = CreateVector(st_config.m_inputFeatDim);
+   ZeroVector(var_numer_acc, st_config.m_inputFeatDim);
+   tmpvector = CreateVector(st_config.m_inputFeatDim);
+   for (i=0; i<Cluster[clu_index].pdf_no; i++){
+     now_pdf=Cluster[clu_index].pdf_member[i];
+     for (k=0; k<st_config.m_inputFeatDim; k++)
+       {
+        mean_numer_acc[k] +=Gaussian[now_pdf].mean[k];
+        
+        var_numer_acc[k] += (Gaussian[now_pdf].var[k] + Gaussian[now_pdf].mean[k]*Gaussian[now_pdf].mean[k]);
+       }
+   }
+  
+   for (k=0; k<st_config.m_inputFeatDim; k++) {
+     Cluster[clu_index].MeanCentroid[k] = mean_numer_acc[k] / denom_acc;
+     tmpvector[k] = mean_numer_acc[k] / denom_acc;
+     Cluster[clu_index].VarCentroid[k] = (var_numer_acc[k]/denom_acc ) - (tmpvector[k]*tmpvector[k]);
+   }
+   
+   FreeVector(mean_numer_acc);
+   FreeVector(var_numer_acc);
+   FreeVector(tmpvector);
+}
+
+static int
+vq_init_comp(const void*p1, const void* p2)
+{
+  double *f1 = (double*)p1, *f2 = (double*)p2; 
+  double fr1 = f1[1], fr2 = f2[1]; 
+  if (fr1 > fr2)
+      return 1;
+  else if ( fr1 == fr2 )
+      return 0;
+  else
+      return -1;
+ }
+
+static double* Init_cb_ave(){
+
+  double ave_mean[MAX_DIM_MFCC16 ];
+  short i, j; 
+  double *p_idx_dis; 
+
+  for(i=0;i<st_config.m_inputFeatDim;i++)
+    ave_mean[i] = 0;
+  
+  for (i=nMean-1;i>=0;i--){
+    for (j=st_config.m_inputFeatDim-1;j>=0;j--){
+      ave_mean[j] += Gaussian[i].mean[j]; 
+    }
+  }
+  for (j=st_config.m_inputFeatDim-1;j>=0;j--)
+    ave_mean[j] /= nMean; 
+
+  p_idx_dis  = (double*)malloc(sizeof(double)*2*nMean);
+  for (i=nMean-1;i>=0;i--){
+    p_idx_dis[2*i] = i;
+    p_idx_dis[2*i+1] = CalWeightEucleanDistance(Gaussian[i].mean,Gaussian[i].var, ave_mean, st_config.m_inputFeatDim);
+  }
+
+  qsort((void*)p_idx_dis, nMean, sizeof(double)*2, vq_init_comp);
+
+           return p_idx_dis;
+}
+  
+
+void Initial_codebook(int cs){
+  int  i,j, k;
+  Matrix select;
+  int *count;
+  int rat;
+  double * p_sorted_dist; 
+  select=CreateMatrix(cs,TotalGauss);
+  count=(int *)calloc(cs ,sizeof(int));
+   
+  p_sorted_dist = Init_cb_ave();
+
+  for(i=0;i<cs;i++)
+    count[i]=0;
+  
+  rat=(TotalGauss/cs) ;
+  if (rat * cs < TotalGauss) rat ++ ; 
+  k = 0;
+  for(i=0;i<cs;i++){
+    for(j=i*rat;j<(i*rat+rat) && j < TotalGauss;j++){
+      select[i][count[i]]=p_sorted_dist[2*k]; 
+      count[i]++;
+      k++;
+    }
+  }
+  free(p_sorted_dist);
+
+  for(i=0;i<cs;i++){
+    Cluster[i].pdf_no=count[i];
+    AllocateClusterMemberTable(i,Cluster[i].pdf_no);   
+    for(j=0;j<count[i];j++){
+      Cluster[i].pdf_member[j]=(int)(select[i][j]);
+    }
+  }
+       
+  
+
+  for(i=0;i<cs;i++)
+    ComputeCentroid(i);
+  printf("Complete Initialize Codebook \n");
+  FreeMatrix(select,cs);
+  free(count);
+  
+}      
+
+void SFB_Initial_codebook(int cs){
+  int  i,j;
+  Matrix select;
+  int *count;
+  int rat;
+  select=CreateMatrix(cs,TotalGauss);
+  count=(int *)calloc(cs ,sizeof(int));
+   
+  for(i=0;i<cs;i++)
+    count[i]=0;
+  
+  rat=(TotalGauss/cs);
+  for(i=0;i<cs;i++){
+    for(j=i*rat;j<(i*rat+rat);j++){
+      select[i][count[i]]=j;   
+      count[i]++;
+    }
+  }
+  
+
+  for(i=0;i<cs;i++){
+    Cluster[i].pdf_no=rat;
+    AllocateClusterMemberTable(i,Cluster[i].pdf_no);   
+    for(j=0;j<rat;j++){
+      Cluster[i].pdf_member[j]=(int)(select[i][j]);
+    }
+  }
+       
+  
+
+  for(i=0;i<cs;i++)
+    ComputeCentroid(i);
+  printf("Complete Initialize Codebook \n");
+  FreeMatrix(select,cs);
+  free(count);
+  
+}      
+
+void CodebookVQ(int cs, int No_Gaussian){
+  struct Node *node;       
+  int i,j,k,l,now_pdf,clu,nopdf_acc,maxclu,node_no,parent_id,flag;
+  int begin_node,end_node,layer;
+  double epsilon;
+  int *count,nopdf[1000];
+  double D, D_prime;
+  Matrix distance_table;
+  Matrix tmp;
+  count=(int *)calloc(cs, sizeof(int));
+  distance_table = CreateMatrix(No_Gaussian, cs);
+  tmp=CreateMatrix(cs,No_Gaussian );
+  D_prime = 0;
+  D = 0;
+  do {
+    D_prime = D;
+
+    /* If a cluster has Gaussians mapped to it, clear the mapping
+     * in preparation for finding the new mapping */
+    for (i=0; i<cs; i++){
+      if(Cluster[i].pdf_no!=0){
+       D = 0.0;
+       count[i]=0;
+       Cluster[i].pdf_no=0;
+       FreeClusterMemberTable(i);
+      }
+    }  
+
+    /* Calculate distance from all Gaussians to cluster centroids */
+    for (i=0; i<cs; i++) {
+      for (j=0; j<No_Gaussian; j++) { 
+       now_pdf = j;
+       distance_table[j][i]=CalWeightEucleanDistance(Gaussian[now_pdf].mean,Gaussian[now_pdf].var,Cluster[i].MeanCentroid,st_config.m_inputFeatDim);
+      }
+    }
+
+    /* Find the indices (mapping) of Gaussians that are closest to each
+     * cluster centroid, and accumulated distance from all Gaussians
+     *  to closest centroid. */
+    for (j=0; j<No_Gaussian; j++) {
+      clu=Min(distance_table[j],cs);
+      tmp[clu][count[clu]] = j;
+      count[clu]++;
+      Cluster[clu].pdf_no += 1;
+      D += distance_table[j][clu];
+    }
+    for (i=0; i<cs; i++) {
+      AllocateClusterMemberTable(i,Cluster[i].pdf_no);
+      for (j=0; j<Cluster[i].pdf_no; j++) {
+       Cluster[i].pdf_member[j] = (int)(tmp[i][j]);
+      }
+    }
+
+    /* Determine clusters that have no Gaussians mapped to them, and the total
+     * number of such clusters */
+    node_no=0;
+    nopdf_acc=0;
+    j=0;
+    for(i=0;i<cs;i++){
+      if(Cluster[i].pdf_no==0){
+       nopdf_acc++;
+       nopdf[j]=i;
+       j++;
+      }
+    }    
+
+
+    /* Determine cluster that has most Gaussians mapped to it */
+    maxclu=Max_clu(cs);
+    
+
+    /* If there are clusters with no Gaussians mapped to them, then reassign the
+     * centroid means and variances of these clusters to locations close to the
+     * mean and variance of the cluster that has most mapped Gaussians.
+     * Develop the new means and variances using a binary tree to perturb
+     * the mean and variance of the cluster that has most mapped Gaussians. */
+    if(nopdf_acc!=0){
+      /* Number of levels in the binary tree, and number of tree nodes so that
+         * bottom layer has enough leaf nodes with perturbed centroids to
+         * provide for the clusters with no mapped Gaussians */
+      layer=(int)(ceil((log10(nopdf_acc)/log10(2))));
+      for(l=0;l<=layer;l++)
+       node_no+=(int)(pow(2,l));
+
+      /* Construct array representing binary tree of perturbed centroid nodes */
+      node=(struct Node *)calloc(node_no,sizeof(struct Node ));
+      if(node==NULL){
+       printf("GaussianCluster: Allocate error in Node \n");
+       exit(-1);
+      }
+
+      /* Assign top node the centroid mean and variance corresponding to
+       * the cluster that has most Gaussians mapped to it.  */
+      for(k=0;k<st_config.m_inputFeatDim;k++){
+       node[0].MeanCentroid[k]=Cluster[maxclu].MeanCentroid[k];
+       node[0].VarCentroid[k]=Cluster[maxclu].VarCentroid[k];           
+      }
+
+      /* Perturb the top node centroid to produce tree of centroids */
+      epsilon = 0.05;
+      for(i=1;i<=layer;i++){
+       begin_node = (int)(pow(2, i))-1;
+       end_node = (int)(pow(2, i+1))-2;
+       for (j = begin_node; j <= end_node; j++){
+         
+         parent_id = ((j%2)==1) ? (j/2) : (j/2-1);
+         if((j%2)==0){
+           for(k=0;k<st_config.m_inputFeatDim;k++){
+             node[j].MeanCentroid[k]=node[parent_id].MeanCentroid[k] +
+                      epsilon * node[0].MeanCentroid[k];
+             node[j].VarCentroid[k]=node[parent_id].VarCentroid[k] +
+                      epsilon * node[0].VarCentroid[k];
+             //printf("%f:%f\n", node[0].MeanCentroid[k], node[0].VarCentroid[k]);
+             
+           }// k index   
+         }               
+         else{ 
+           for(k=0;k<st_config.m_inputFeatDim;k++){
+             node[j].MeanCentroid[k]=node[parent_id].MeanCentroid[k] -
+                      epsilon * node[0].MeanCentroid[k];;
+             node[j].VarCentroid[k]=node[parent_id].VarCentroid[k] -
+                      epsilon * node[0].MeanCentroid[k];
+           }//k index   
+         }
+       }  // j index
+
+        /* Reduce perturbation for next tree level */
+        epsilon /= 2;
+      } //i index
+      
+    }//if index
+
+
+    /* Assign perturbed centroids of leaves to clusters that had no Gaussians
+     * mapped to them */
+    if(nopdf_acc!=0){
+      begin_node = (int)(pow(2,layer))-1;
+      for(i=0;i<nopdf_acc;i++){
+       for(k=0;k<st_config.m_inputFeatDim;k++){
+         Cluster[nopdf[i]].MeanCentroid[k]=node[i+begin_node].MeanCentroid[k];
+         Cluster[nopdf[i]].VarCentroid[k]=node[i+begin_node].VarCentroid[k];
+       }
+      }
+    }
+    if (nopdf_acc!=0) free(node);
+
+    /* Calculate centroid for clusters that had Guassians mapped to them */
+    for (i=0; i<cs; i++){
+      flag=0;
+      for(j=0;j<nopdf_acc;j++){
+       if(nopdf[j]==i){
+         flag=1;
+         break;
+       }
+      }
+      if(flag!=1)
+       ComputeCentroid(i);
+         // ComputeWeightCentroid(i);
+
+    }
+
+    /* Output results of this clustering pass */
+    printf("Divided to %d set: \n",cs);
+    for (i=0; i<cs; i++) printf("<%d> ",Cluster[i].pdf_no);
+    printf("\nClassfication Result: [Distortion = %f]\n",D );   
+  }while (fabs(D -D_prime) > (delta * D_prime));
+
+  printf("Converged...\n");
+  FreeMatrix(distance_table, No_Gaussian);
+  FreeMatrix(tmp, cs);
+  free(count);
+}
+
+//......................................................................
+
+int VQ(int size,double del, short bSwap){
+  int codebook_size ;
+  codebook_size=size;
+  delta=del;
+  copyHMM2Gauss(triphone);
+  Initial_codebook(codebook_size);
+  printf("Performing  VQ...\n");
+  CodebookVQ(codebook_size,TotalGauss);
+
+  printf("VQ complete\n");
+  printf("Writing results for %d clusters...\n",codebook_size);
+  Writecluster1(codebook_size, bSwap);
+
+  return(1);
+}
+void Initial_Classy(int cs,struct HMM_struct *triphone){
+   ComputeCentroidClassify(triphone);
+}      
+
+void ComputeCentroidClassify( struct HMM_struct *triphone){
+
+   int k,now_pdf=0;
+   int model_index,state_index,mix_index;
+   for (model_index=0; model_index<TotalCIHMM; model_index++){
+      for (state_index=0; state_index<triphone[model_index].state_no; state_index++) {
+                 for (mix_index=0; mix_index<triphone[model_index].mix_no[state_index]; mix_index++) {
+                       for (k=0; k<st_config.m_inputFeatDim; k++) {
+                               ReferenceCluster[now_pdf].MeanCentroid[k] = triphone[model_index].mean[state_index][mix_index][k];
+                               ReferenceCluster[now_pdf].VarCentroid[k] = triphone[model_index].var[state_index][mix_index][k];
+                       }
+                  now_pdf++;
+                 }
+         }
+   }
+   
+       if (now_pdf!=TotalReference)
+       {
+               printf("GaussianCluster: Mismatched Monophone and Cluster numbers");
+               exit(-1);
+       }
+}
+void CodebookClassify(int cs,double del){
+ FILE *f_clu;
+#ifdef  Binary_OUTPUT
+ FILE *f_clu_b;
+ short Temp_s;
+ int TempMean;
+ short CentroidMean_s;
+ char name_CDHMM[100];
+ char name_CDHMMbin[100];
+#endif
+ int clu,d;
+ int i,j,now_pdf;
+ int *count;
+ double D, D_prime;
+ Matrix distance_table;
+ count=(int *)calloc(TotalReference, sizeof(int));
+ distance_table = CreateMatrix(cs,TotalReference);
+ D_prime = 1.0;
+ D = 0.0;
+
+ do {      
+   sprintf(name_CDHMM,"cls_centr_fromROM.list" );
+   f_clu=fopen(name_CDHMM,"w");
+#ifdef  Binary_OUTPUT
+   sprintf(name_CDHMMbin,"cls_centr_fromROM.bin");
+   f_clu_b=fopen(name_CDHMMbin,"wb");
+   Temp_s=(short)(cs);
+   // swap16(Temp_s);
+   fwrite(&Temp_s,sizeof(short),1,f_clu_b);
+   Temp_s=(short)(st_config.m_inputFeatDim);
+   // swap16(Temp_s);
+   fwrite(&Temp_s,sizeof(short),1,f_clu_b);
+#endif
+   D_prime = D;
+   for (i=0; i<TotalReference; i++){
+     if(ReferenceCluster[i].pdf_no!=0){
+       D = 0.0;
+       count[i]=0;
+       ReferenceCluster[i].pdf_no=0;
+     }
+   }
+   /* --- Compute Distance --- */    
+   for (i=0; i<TotalReference; i++) {
+     for (j=0; j<cs; j++) { 
+       now_pdf = i;
+       // distance_table[j][i] =  CalBhattaDistance(Gaussian[now_pdf].mean, Gaussian[now_pdf].var, Cluster[i].MeanCentroid, Cluster[i].VarCentroid,st_config.m_inputFeatDim);
+       distance_table[j][i] =  CalWeightEucleanDistance(Cluster[j].MeanCentroid,ReferenceCluster[now_pdf].VarCentroid, ReferenceCluster[now_pdf].MeanCentroid, st_config.m_inputFeatDim);
+     }
+   }
+   for (j=0; j<cs; j++) {
+     clu=Min(distance_table[j],TotalReference);
+     count[clu]++;
+     fprintf(f_clu,"%d \n",clu);
+#ifdef  Binary_OUTPUT
+     for (d=0;d<st_config.m_inputFeatDim;d++)  
+       {
+        TempMean=(int)(ReferenceCluster[clu].MeanCentroid[d]*2048);
+        CentroidMean_s=(short)(TempMean);
+        // swap16(CentroidMean_s);
+        fwrite(&CentroidMean_s,sizeof(short),1,f_clu_b);
+}
+     /*
+       clu_s=short(clu);
+       swap16(clu_s);
+       fwrite(&clu_s,sizeof(short),1,f_clu_b);
+     */
+#endif
+     ReferenceCluster[clu].pdf_no += 1;
+     D += distance_table[j][clu];
+   }
+   
+   printf("\nClassfication Result: [Distortion = %f]\n",D );  
+   fclose(f_clu);
+#ifdef  Binary_OUTPUT
+   fclose(f_clu_b);
+#endif
+ }while (fabs(D -D_prime) > (del * D_prime));
+ printf("Converged...\n");
+ FreeMatrix(distance_table, cs);
+ free(count);
+}
+
+void Writecluster1(int cs, short bSwap){
+
+  FILE *f_clu,*f_mean,*f_var;
+  char name_clu[100];
+  char name_mean[100];
+#ifdef  Binary_OUTPUT
+  FILE *f_clu_b,*f_mean_b,*f_var_b;
+  short clu_s;
+  int TempMean;
+  short Temp_s;
+  short CentroidMean_s;
+  char name_clu_bin[100];
+  char name_mean_bin[100];
+#endif
+  int i,j,d,now_pdf,k; 
+  int model_index,state_index,mix_index; 
+  float ClusterVar[FeaDim];
+  
+  sprintf(name_clu,"ROM2cls.list");
+  f_clu=fopen(name_clu,"w");
+  sprintf(name_mean,"cls_centr.list");
+  f_mean=fopen(name_mean,"w");
+  f_var=fopen("Centroid_VAR.list","w");
+#ifdef  Binary_OUTPUT
+  sprintf(name_clu_bin,"ROM2cls.bin");
+  f_clu_b=fopen(name_clu_bin,"wb");
+  sprintf(name_mean_bin,"cls_centr.bin");
+  f_mean_b=fopen(name_mean_bin,"wb");
+  f_var_b=fopen("Centroid_VAR.bin","wb");
+#ifdef  Binary_OUTPUT
+  Temp_s=(short)(cs);
+  if (bSwap) swap16(Temp_s);
+  fwrite(&Temp_s,sizeof(short),1,f_mean_b);
+  Temp_s=(short)(st_config.m_inputFeatDim);
+  if (bSwap) swap16(Temp_s);
+  fwrite(&Temp_s,sizeof(short),1,f_mean_b);
+  Temp_s=(short)(TotalCDHMM);
+  if (bSwap) swap16(Temp_s);
+  fwrite(&Temp_s,sizeof(short),1,f_clu_b);
+  Temp_s=(short)(cs);
+  if (bSwap) swap16(Temp_s);
+  fwrite(&Temp_s,sizeof(short),1,f_clu_b);
+#endif
+  
+  
+  
+#endif
+  printf("Preparing for classify\n");
+  for(i=0;i<cs;i++){
+    for (d=0;d<st_config.m_inputFeatDim;d++)  
+      {
+       fprintf(f_mean,"%f ",Cluster[i].MeanCentroid[d]);
+#ifdef  Binary_OUTPUT
+        TempMean=(int)(Cluster[i].MeanCentroid[d]*2048);
+       CentroidMean_s=(short)(TempMean);
+       if (bSwap) swap16(CentroidMean_s);
+       fwrite(&CentroidMean_s,sizeof(short),1,f_mean_b);
+#endif
+      }
+    fprintf(f_mean,"\n");
+    for(j=0;j<Cluster[i].pdf_no;j++){
+      now_pdf=Cluster[i].pdf_member[j];
+      triphone[Gaussian[now_pdf].phone_name].cluster[Gaussian[now_pdf].state_no][Gaussian[now_pdf].mix_no]=i;
+    }
+  }
+  for (model_index=0; model_index<TotalCDHMM; model_index++) {
+    for (state_index=0; state_index<triphone[model_index].state_no; state_index++) {
+      for (mix_index=0; mix_index<triphone[model_index].mix_no[state_index]; mix_index++) {
+       fprintf(f_clu,"%d\n",triphone[model_index].cluster[state_index][mix_index]);
+#ifdef  Binary_OUTPUT
+       clu_s=(short)(triphone[model_index].cluster[state_index][mix_index]);
+       if (bSwap) swap16(clu_s);
+       fwrite(&clu_s,sizeof(short),1,f_clu_b);
+#endif
+      }
+    }
+  }
+  for (k=0;k<st_config.m_inputFeatDim;k++)    ClusterVar[k]=0.0;
+  for (i=0;i<cs;i++)
+    {
+      
+      for (k=0;k<st_config.m_inputFeatDim;k++)
+       {
+         ClusterVar[k]=ClusterVar[k]+(float)(Cluster[i].VarCentroid[k])/cs;
+       }
+    }
+  for (k=0;k<st_config.m_inputFeatDim;k++) fprintf(f_var,"%f\n",ClusterVar[k]);
+  for (i=0;i<cs;i++)
+    {
+      
+      for (k=0;k<st_config.m_inputFeatDim;k++)
+       {
+         Cluster[i].VarCentroid[k]=ClusterVar[k];
+       }
+    }
+  fclose(f_clu);
+  fclose(f_mean);
+  fclose(f_var);
+#ifdef  Binary_OUTPUT
+  fclose(f_clu_b);
+  fclose(f_mean_b);
+  fclose(f_var_b);
+#endif
+}
+
+void AllocateClusterMemberTable(int clu, int number)
+{
+   Cluster[clu].pdf_member = (int *)calloc(number, sizeof(int));
+}
+
+void AllocateClusterMemberTableClassify(int clu, int number)
+{
+   ReferenceCluster[clu].pdf_member = (int *)calloc(number, sizeof(int));
+}
+
+
+//......................................................................
+
+int Classify(int size,struct HMM_struct *triphone,double del){
+  int codebook_size ;
+  codebook_size=size;
+  Initial_Classy(codebook_size,triphone);
+  printf("Performing  Classification...\n");
+  CodebookClassify(codebook_size,del);
+  printf("Classify complete\n");
+  return(1);
+}
diff --git a/TIesr_Tools/HTKdata.pm b/TIesr_Tools/HTKdata.pm
new file mode 100755 (executable)
index 0000000..70f7f02
--- /dev/null
@@ -0,0 +1,2792 @@
+#================================================================
+#  HTKdata.pm
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+       
+# This module contains functions to act on an HTK HMM dataset
+# in ascii MMF format.  The description of the  functions that
+# the user will call are provided below.
+
+# $hmms = HTKdata->new()
+# Creates a reference to a hash which will be filled to
+# contain all of the hmm's and each macro structure in the MMF.
+# Note that all components of an HMM are completely created as
+# macros.  Thus each mean vector will have its own macro name, etc.
+
+# The $hmms structure contains all HMM information in the MMF files.
+# The detail of the structure is:
+#
+# Global options:
+# $hmms->{HMMSETID} = $set_id_name
+# $hmms->{STREAMINFO}{SIZE} = $number_of_streams
+# $hmms->{STREAMINFO}{VECTOR} = [@width_of_each_stream]
+# $hmms->{DURKIND} = $kind_string
+# $hmms->{PARMKIND} = $kind_string
+
+# Regression class macros:
+# $hmms->{REGTREE}{$tree_name}{USAGE} = $usage_counter
+# $hmms->{REGTREE}{$tree_name}{LEAFS} = $number_of_leaf_nodes
+# $hmms->{REGTREE}{$tree_name}{NODE}[$node] = [@child nodes]
+# $hmms->{REGTREE}{$tree_name}{TNODE}[$node] = $num_mixes
+
+# Mean macros:
+# $hmms->{MEAN}{$mean_name}{USAGE} = $usage_counter
+# $hmms->{MEAN}{$mean_name}{TMFRCLASS} = $tmf_rclass_applied
+# $hmms->{MEAN}{$mean_name}{STREAM} = $stream_associated
+# $hmms->{MEAN}{$mean_name}{SIZE} = $param_vector_size
+# $hmms->{MEAN}{$mean_name}{VECTOR} = [@mean_vector]
+
+# Variance/covariance macros:
+# $hmms->{VARIANCE}{$var_name}{USAGE} = $usage_counter
+# $hmms->{VARIANCE}{$var_name}{TMFRCLASS} = $tmf_rclass_applied
+# $hmms->{VARIANCE}{$var_name}{STREAM} = $stream_associated
+# $hmms->{VARIANCE}{$var_name}{TYPE} = $type (v or i)
+# $hmms->{VARIANCE}{$var_name}{SIZE} = $param_vector_size
+# $hmms->{VARIANCE}{$var_name}{VECTOR} = [@cov_data] (may be var or cov)
+
+# Transition macros:
+# $hmms->{TRANSP}{$trans_name}{USAGE} = $usage_counter
+# $hmms->{TRANSP}{$trans_name}{SIZE} = $trans_state_size
+# $hmms->{TRANSP}{$trans_name}{MATRIX}[$row][$col]  = $trans_prob
+
+# Stream weights macros:
+# $hmms->{SWEIGHTS}{$weight_name}{USAGE} = $usage_counter
+# $hmms->{SWEIGHTS}{$weight_name}{SIZE} = $number_of_streams
+# $hmms-SWEIGHTS}{$weight_name}{VECTOR} = [ @stream_weights]
+
+# Mixture macros:
+# $hmms->{MIXPDF}{$mix_name}{USAGE} = $usage_counter
+# $hmms->{MIXPDF}{$mix_name}{STREAM} = $stream_associated
+# $hmms->{MIXPDF}{$mix_name}{RCLASS} = $regression_class
+# $hmms->{MIXPDF}{$mix_name}{MEAN} = $mean_macro_name
+# $hmms->{MIXPDF}{$mix_name}{VARIANCE} = $var_macro_name
+# $hmms->{MIXPDF}{$mix_name}{GCONST} = $gconst_value
+
+
+# State macros:
+# $hmms->{STATE}{$state_name}{USAGE} = $usage_counter
+# $hmms->{STATE}{$state_name}{SWEIGHTS} = $swgts_macro_name
+# $hmms->{STATE}{$state_name}{NUMMIXES} = [@num_mixes_per_stream]
+# $hmms->{STATE}{$state_name}{STREAMMIX}[$stream][$mixture]{PROB} = $prob
+# $hmms->{STATE}{$state_name}{STREAMMIX}[$stream][$mixture]{MIXPDF} = $mix_macro_name
+
+# HMM macros:
+# $hmms->{HMM}{$hmm_name}{NUMSTATES} = $number_of_states
+# $hmms->{HMM}{$hmm_name}{STATE}[$state] = $state_macro_name
+# $hmms->{HMM}{$hmm_name}{TRANSP} = $trans_macro_name
+
+# $hmms->parsemmf($filename, $regexp, @hmmnames );
+# Parses an mmf file and puts the parts of the HMMs in the $hmms hash
+# structure.  $filename is the name of the mmf.  $regexp defines a
+# regular expression used to determine which HMMs in the MMF will be loaded. HMM
+# names that match $regexp will be loaded.  @hmmnames is
+# an array of hmm names that will also be loaded. Names in 
+# the array will be loaded.  If both are undef or empty, all HMMs will be
+# loaded by default.
+
+# $hmms->checklist( @hmmnames )
+# This function checks to ensure that all hmms in a list have been loaded 
+# into the hmm object and dies if an hmm is missing.
+
+# $hmms->markusagehmm($opt)
+# This function marks which macro elements are needed by the set of
+# loaded HMMs by updating usage counters.  Since the HMMs are the last
+# things loaded, all mmf macros must be loaded, even though not
+# used by an hmm.  $opt is a string that contains macro identifier 
+# characters (smuvitw).  If any macro identifier character is specified,
+# then that item will not be output as a macro, but rather will be expanded
+# inline in the output, removing the macro and duplicating the data each
+# time it is used.  This is flagged by using a negative usage count.
+
+# $hmms->transformpdfs($tmf)
+# This function transforms all of the pdfs that will be used via a TMF structure
+# as defined in HTKtmf.pm.  It should be called after markusagehmm.  The MIXPDF
+# structures must have a valid RCLASS defined or the transformation will not
+# take place.
+
+# $hmms->compressedmmf( \*FH )
+# Output an mmf to the file handle which includes only the macros and data
+# necessary for the given HMM set and discards the other macros and data.
+# You must call markusagehmm first.
+
+# $hmms->mergehmms( $mrghfile )
+# This function merges multiple hmms.  The hmms must have the same
+# number of states.  Merging is performed by collecting all stream
+# mixtures for each model into a single larger stream mixture distribution. 
+# Note that if models share components via macros, these will remain
+# shared, though the number of mixtures will still increase.  Thus shared
+# variances will still be shared accordingly, etc.  Most likely the user
+# would not have shared means, etc.
+# The transition probability matrix is the average of all matrices.
+# Stream weights, if state specific, are those of the first model in the list.
+# If a model is not found for sharing, an informational message is output,
+# but this does not stop the merging.  The final HMM model name will be
+# that of the first HMM model in the list.  All other HMMs will be deleted
+# from $hmms.  $mrghfile is the name of a file that contains sets of hmms
+# to merge, where each line of the file contains a list of hmms to merge as
+# one set.
+
+# $hmms->mergestates( $mrgsfile )
+# This function merges multiple states.  Merging is performed by
+# collecting all stream mixtures for each state into the first state,
+# creating a larger stream mixture distribution.  Note that if states
+# share components via macros, these will remain shared, though the
+# number of mixtures will still increase.  Thus shared variances will
+# still be shared accordingly, etc.  Most likely the user would not
+# have shared means in the merged states. Stream weights, if state
+# specific, are those of the first state in the list.  If a state name
+# is not found for sharing, an informational message is output, but
+# this does not stop the merging.  The final states after merging will
+# be used to modify HMM model state names to reflect the reduced
+# number of states.  All states merged with the first state will be
+# deleted.  $mrgsfile is a file that contains sets of states to merge, where
+# all of the state macro names on each line of the file are merged as a set.
+
+# $hmms->mergevar( $mrgvfile )
+# This function merges multiple variances.  Merging is performed by
+# collecting all of the variances specified, and substituting the macro
+# name of the first variance for all of the remaining variance macro names.
+# The variance output will be the average for all variances.  $mrgvfile is
+# a file that contains sets of variance macros to merge, where each line
+# contains the macro names of variances to merge into a single variance.
+
+# $hmms->mergemean( $mrgmfile )
+# This function merges multiple mean vectors.  Merging is performed by
+# collecting all of the means specified, and substituting the macro
+# name of the first mean on each line for all of the remaining mean macro names.
+# The mean output will be the average for all means.  $mrgmfile is
+# a file that contains sets of mean macros to merge, where each line
+# contains the macro names of means to merge into a single mean.
+
+#----------------------------------------------------------------
+package HTKdata;
+
+use strict qw( vars refs );
+
+use HTKtmf;
+
+use Exporter ();
+
+@HTKdata::ISA = qw( Exporter );
+
+
+#================================================================
+#  new
+
+#  construct new hmm data structure
+
+#--------------------------------
+sub new
+{
+    my $class = shift;
+    my $this = {};
+    return bless $this, $class;
+}
+
+
+#================================================================
+#  parsemmf
+
+#  Parses an HTK HMM model file or MMF mmf into an htkdata structure
+#  for further processing.
+
+#--------------------------------
+sub parsemmf
+{
+    my ($this, $mmffil, $regexp, @hmmlist ) = @_;
+    my( $mname, $wname, $pname, $sname, $hname, %hmmhash );
+    my ( $lin, $tname, $vtype, $vname );
+    my ( $rname );
+
+    if( @hmmlist ) { @hmmhash{ @hmmlist } = ( 0 .. $#hmmlist ); }
+
+    open(MMF, "$mmffil" ) or die "Can not open $mmffil\n";
+    $lin = <MMF>;
+    while( $lin )
+    {
+       chomp($lin);
+
+       # ignore blank lines
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <MMF>;
+           next;
+       }
+
+       # global options macro
+       if ( $lin =~ /^\s*~o/ )
+       {
+           $lin = &parseopt( $this, \*MMF, $lin );
+       }
+           
+       # regression tree macro
+       elsif ( $lin =~ /^\s*~r/ )
+       {
+           ($rname) = $lin =~ /\"([^\"]+)\"/;
+           $lin = parsereg( $this, \*MMF, $lin, $rname );
+       }
+
+       # transition macro
+       elsif ( $lin =~ /^\s*~t/ )
+       {
+           ($tname) = $lin =~ /\"([^\"]+)\"/;
+           $lin = parsetrans( $this, \*MMF, $lin, $tname );
+       }
+
+       # mean macro
+       elsif ( $lin =~ /^\s*~u/ )
+       {
+           ($mname) = $lin =~ /\"([^\"]+)\"/;
+           $lin = parsemean( $this, \*MMF, $lin, $mname );
+       }
+
+       # variance/covariance macro
+       elsif ( $lin =~ /^\s*~[vi]/ )
+       {
+           ($vtype, $vname) = $lin =~ /^\s*~([vi])\s+\"([^\"]+)\"/;
+           $lin = parsecov( $this, \*MMF, $lin, $vtype, $vname );
+       }
+       
+       # stream weights macro
+       elsif ( $lin =~ /^\s*~w/ )
+       {
+           ($wname) = $lin =~ /\"([^\"]+)\"/;
+           $lin = parseswgt( $this, \*MMF, $lin, $wname );
+       }
+
+       # mixpdf component macro
+       elsif ( $lin =~ /^\s*~m/ )
+       {
+           ($pname) = $lin =~ /\"([^\"]+)\"/;
+           $lin = &parsemix( $this, \*MMF, $lin, $pname );
+       }
+
+       # state macro
+       elsif ( $lin =~ /^\s*~s/ )
+       {
+           ($sname) = $lin =~ /\"([^\"]+)\"/;
+           $lin = &parsestate( $this, \*MMF, $lin, $sname );
+       }
+           
+       # hmm macro
+       elsif ( $lin =~ /^\s*~h/ )
+       {
+           ($hname) = $lin =~ /\"([^\"]+)\"/;
+           if( ( $regexp && $hname =~ /$regexp/ ) ||
+               ( @hmmlist && exists $hmmhash{$hname} ) ||
+               ( ! $regexp && ! @hmmlist ) )
+           { 
+               $lin = parsehmm( $this, \*MMF, $lin, $hname );
+           }
+           else
+           {
+               #next line past hmm
+               while( $lin !~ /<ENDHMM>/i )
+               {
+                    $lin = <MMF>;
+               }
+               $lin = <MMF>;
+           }
+       }
+
+       # no macro recognized
+       else
+       {
+           $lin = <MMF>;
+       }
+    }
+    close( MMF );
+}
+
+
+#================================================================
+
+#  parseopt
+
+#  Parse options and load into the data structure.  Check multiple 
+#  mmf files for consistency.
+
+#--------------------------------
+sub parseopt
+{
+    my ( $this, $fh, $lin ) = @_;
+    my ( $var, $numstrm, @strmdata, @elem );
+    my ( $i, $data );
+
+  LINE:
+    while( $lin )
+    {
+       chomp($lin);
+       
+       # ignore line with only ~o or blank line
+       if( $lin =~ /^\s*(~o)?\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       @elem = split( /[\s<>]+/, $lin);
+       ($elem[0] ne '' ) or shift @elem;
+       shift @elem if( $elem[0] =~ /~o/ );
+       
+       while( @elem )
+       {
+           $var = $elem[0];
+
+           # streaminfo tag
+           if( $var =~ /STREAMINFO/i )
+           {
+               $numstrm = $elem[1];
+               @strmdata = @elem[ 2 .. 2+$numstrm-1 ];
+               
+               # consistency check, stream info size
+               die "Inconsistent stream info size\n" 
+                   if ( exists $this->{STREAMINFO}{SIZE} &&
+                        $numstrm != $this->{STREAMINFO}{SIZE} );
+
+               $this->{STREAMINFO}{SIZE} = $numstrm;
+
+               if( exists $this->{STREAMINFO}{VECTOR} )
+               {
+                   $i = 0;
+                   foreach $data ( @{ $this->{STREAMINFO}{VECTOR} } )
+                   {                   
+                       ( $data == $strmdata[$i] ) or 
+                           die "Inconsistent stream size\n";
+                       $i++;
+                   }
+               }
+               else
+               {
+                   $this->{STREAMINFO}->{VECTOR} = [@strmdata];
+               }
+
+               @elem =  @elem[$numstrm+2 .. $#elem];
+           }
+               
+           # vecsize tag
+           elsif( $var =~ /VECSIZE/i )
+           {
+               die "Inconsistent vecsize\n" 
+                   if (  exists $this->{VECSIZE} &&
+                         $this->{VECSIZE} != $elem[1] );
+
+               $this->{VECSIZE} = $elem[1];
+
+               @elem = @elem[2 ..$#elem];
+           }
+
+           elsif( $var =~ /HMMSETID/i )
+           {
+               die "Multiple different hmm sets\n"
+                   if ( exists $this->{HMMSETID} && 
+                        $this->{HMMSETID} ne $elem[1] );
+               $this->{HMMSETID} = $elem[1];
+               @elem =  @elem[ 2 .. $#elem ];
+           }
+
+           elsif( $var =~ /NULLD|POISSOND|GAMMAD|GEND/i  )
+           {
+               # define duration kind key
+               die "Inconsistent duration kinds\n"
+                   if( exists $this->{DURKIND} &&
+                       $this->{DURKIND} ne $var );
+               $this->{DURKIND} = $var;
+               shift @elem;
+           }
+
+           elsif( $var =~/DIAGC|INVDIAGC|FULLC|LLTC|XFORMC/i )
+           {
+               die "Inconsistent cov kind\n"
+                   if( exists $this->{COVKIND} && $this->{COVKIND} ne $var );
+               $this->{COVKIND} = $var;
+               shift @elem;
+           }
+
+           elsif( $var =~ /^(DISCRETE|LPC|LPCEPSTRA|MFCC|FBANK|MELSPEC|LPREFC|LPDELCEP|USER)/i )
+           {
+               die "Inconsistent parm kind\n"
+                   if( exists $this->{PARMKIND} && $this->{PARMKIND} ne $var );
+               $this->{PARMKIND} = $var;
+               shift @elem;
+           }
+
+           # not recognized tag
+           else
+           {
+               last LINE;
+           }
+       }
+
+       # get next line
+       $lin = <$fh>;
+    }
+
+    return $lin;
+}
+
+
+
+#================================================================
+
+#  parsereg
+
+#  Parse a regression tree structure
+
+#--------------------------------
+
+sub parsereg
+{
+    my ($this, $fh, $lin, $rname ) = @_;
+    my ( $startofparse, @elem );
+    my ( $numleafs );
+
+    $rname or die "No regression tree name\n";
+
+    if(  exists $this->{REGTREE}{$rname} )
+    {
+       die "Duplicate regression tree name $rname\n";
+    }
+
+    #initialize usage of regression tree macro
+    $this->{REGTREE}{$rname}{USAGE} = 0;
+
+    $startofparse = 1;
+
+    # get first line past macro header if on macro line
+    if( $lin =~ /^\s*~r/ )
+    {
+       $lin = <$fh>;
+    }
+
+  LINE:
+    while( $lin )
+    {
+
+       chomp($lin);
+
+       #ignore blank line
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       # get components on the line
+       @elem = split( /[\s<>]+/, $lin);
+       ( $elem[0] ne '' ) or shift @elem;
+       
+       while( @elem )
+       {
+           # reg tag parse and init
+           if( $startofparse )
+           {
+               die "Invalid regression line $lin\n" unless ( $elem[0] =~ /REGTREE/i );
+               $startofparse = 0;
+
+               $numleafs = $elem[1];
+               $this->{REGTREE}{$rname}{LEAFS} = $numleafs;
+
+               @elem = @elem[2 .. $#elem];
+               $lin = join( ' ', @elem);
+           }
+
+           # gather regression tree macro components
+           else
+           {
+               if( $elem[0] =~ /^NODE/i )
+               {
+                   die "Invalid regression node\n" unless ( $#elem == 3 );
+                   $this->{REGTREE}{$rname}{NODE}[ $elem[1] ] = [ @elem[2 .. $#elem] ];
+                   
+                   @elem = @elem[4 .. $#elem];
+               }
+
+               elsif( $elem[0] =~ /TNODE/i )
+               {
+                   die "Invalid regression terminal node\n" unless ( $#elem == 2 );
+
+                   # the original tree mixture counts may not be valid if loading or
+                   # outputting only a subset of the models
+                   # $this->{REGTREE}{$rname}{TNODE}[ $elem[1] ]  = $elem[2];
+
+                   # Keep a count of pdfs that cluster to this node when doing markusage
+                   $this->{REGTREE}{$rname}{TNODE}[ $elem[1] ]  = 0;
+
+                   @elem = @elem[3 .. $#elem];
+               }
+
+               else
+               {
+                   last LINE;
+               }
+           }
+       }
+
+       # get next line to process
+       $lin = <$fh>;
+    }
+
+    return $lin;
+}
+
+
+#================================================================
+
+#  parsemean
+
+#  Loads a mean vector macro into the hmmdata structure
+
+#--------------------------------
+sub parsemean
+{
+    my ( $this, $fh, $lin, $mname ) = @_;
+    my ( $startofparse, @elem, $nummean, @mnvec );
+
+    # mean vector name
+
+    $mname or die "No mean name\n";
+
+    if(  exists $this->{MEAN}->{$mname} )
+    {
+       die "Duplicate mean name $mname\n";
+    }
+       
+    # initialize usage of this mean macro
+    $this->{MEAN}->{$mname}->{USAGE} = 0;
+
+    $startofparse = 1;
+
+    # get first line past macro header if on macro line
+    if( $lin =~ /^\s*~u/ )
+    {
+        $lin = <$fh>;
+    }
+
+  LINE:
+    while( $lin )
+    {
+       chomp($lin);
+
+       # ignore blank lines
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       @elem = split( /[\s<>]+/, $lin);
+       ( $elem[0] ne '' ) or shift @elem;
+       
+       while( @elem )
+       {
+           # mean tag parse and init
+           if( $startofparse )
+           {
+               die "Invalid mean line $lin\n" unless ( $elem[0] =~ /MEAN/i );
+               $startofparse = 0;
+
+               $nummean = $elem[1];
+               $this->{MEAN}->{$mname}->{SIZE} = $nummean;
+               @mnvec = ();
+
+               @elem = @elem[2 .. $#elem];
+               $lin = join( ' ', @elem);
+           }
+
+           # gather mean vector
+           if( ! $startofparse )
+           {
+               if( $lin !~ /[~<>A-DF-Z]/i )
+               {
+                   push @mnvec, @elem;
+                  ( @mnvec <= $nummean ) or
+                      die "Invalid mean vector\n";
+                   @elem = ();
+               }
+               else
+               {
+                   last LINE;
+               }
+           }
+       }
+
+       # get next line to process
+       $lin = <$fh>;
+    }
+
+    # have read available input data, check and load
+    ( @mnvec == $nummean ) or die "Invalid mean vector length\n";
+    $this->{MEAN}->{$mname}->{VECTOR} = [@mnvec];
+
+    return $lin;
+}
+
+
+
+#================================================================
+
+#  parsecov
+
+#  Loads a variance/covariance macro into the hmmdata structure
+
+#--------------------------------
+sub parsecov
+{
+    my ( $this, $fh, $lin, $vtype, $vname ) = @_;
+    my ( $startofparse, @elem, $vsize, $numvar, @varvec );
+
+    $vname or die "No cov name\n";
+
+    if(  exists $this->{VARIANCE}->{$vname} )
+    {
+       die "Duplicate cov name $vname\n";
+    }
+
+    # initialize usage of this variance macro
+    $this->{VARIANCE}->{$vname}->{TYPE} = $vtype;
+    $this->{VARIANCE}->{$vname}->{USAGE} = 0;
+
+    $startofparse = 1;
+
+    # get first line past macro header if on macro line
+    if( $lin =~ /^\s*~[vi]/ )
+    {
+       $lin = <$fh>;
+    }
+
+  LINE:
+    while( $lin )
+    {
+       chomp($lin);
+
+       # ignore blank line
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       @elem = split( /[\s<>]+/, $lin);
+       ( $elem[0] ne '' ) or shift @elem;
+       
+       while( @elem )
+       {
+           # variance or invcovar tag and initialize
+           if( $startofparse )
+           {
+               ( $elem[0] =~ /VARIANCE|INVCOVAR/i ) or
+                   die "Invalid cov line $lin\n";
+
+               $startofparse = 0;
+               $vsize = $elem[1];
+               $this->{VARIANCE}->{$vname}->{SIZE} = $vsize;
+               $numvar = ( $vtype =~ /v/ ) ? $vsize : $vsize*($vsize+1)/2;
+               @varvec = ();
+
+               @elem = @elem[2 .. $#elem];
+               $lin = join ' ', @elem;
+           }
+
+           # input variance or covariance data into vector
+           if( ! $startofparse )
+           {
+               if( $lin !~ /[~<>A-DF-Z]/i )
+               {
+                   push @varvec, @elem;
+                   ( @varvec <= $numvar ) or
+                       die "Invalid variance vector\n";
+                   @elem = ();
+               }
+               else
+               {
+                   last LINE;
+               }
+           }
+       }
+
+       # get next line to process
+       $lin = <$fh>;
+    }
+
+
+    # have all available input data, check and load
+    ( @varvec == $numvar ) or die "Invalid variance vector length\n";
+    $this->{VARIANCE}->{$vname}->{VECTOR} = [@varvec];
+
+    return $lin;
+}
+
+
+#================================================================
+
+#  parsetrans
+
+#  Loads a trans array macro into the hmmdata structure
+
+#--------------------------------
+sub parsetrans
+{
+    my ($this, $fh, $lin, $tname ) = @_;
+    my ( $startofparse, @elem, $numtrans, @tmtx, @tvec );
+
+    $tname or die "No transition name\n";
+
+    if(  exists $this->{TRANSP}->{$tname} )
+    {
+       die "Duplicate trans name $tname\n";
+    }
+
+    #initialize usage of transp macro
+    $this->{TRANSP}->{$tname}->{USAGE} = 0;
+
+    $startofparse = 1;
+
+    # get first line past macro header if on macro line
+    if( $lin =~ /^\s*~t/ )
+    {
+       $lin = <$fh>;
+    }
+
+  LINE:
+    while( $lin )
+    {
+
+       chomp($lin);
+
+       #ignore blank line
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       @elem = split( /[\s<>]+/, $lin);
+       ( $elem[0] ne '' ) or shift @elem;
+       
+       while( @elem )
+       {
+           # transp tag and initialize matrix
+           if( $startofparse )
+           {
+               die "Invalid trans line $lin\n" unless 
+                   ( $elem[0] =~ /TRANSP/i );
+               $startofparse = 0;
+
+               $numtrans = $elem[1];
+               $this->{TRANSP}->{$tname}->{SIZE} = $numtrans;
+
+               @tmtx = ();
+               @tvec = ();
+               @elem = @elem[2 .. $#elem];
+               $lin = join ' ', @elem;
+           }
+
+           # read all rows of transp matrix
+           if( ! $startofparse )
+           {
+               if( $lin !~ /[~<>A-DF-Z]/i )
+               {
+                   push @tvec, @elem;
+                   ( @tvec <= $numtrans ) or die "Invalid trans row $tname\n";
+                   if( @tvec == $numtrans )
+                   {
+                       push @tmtx, [@tvec];
+                       @tvec = ();
+                   }
+                   @elem = ();
+               }
+               else
+               {
+                   last LINE;
+               }
+           }
+       }
+
+       # get next line to process
+       $lin = <$fh>;
+    }
+
+    # have all available data, check and load hmm structure
+    ( @tmtx == $numtrans ) or die "Invalid trans matrix size\n";
+    $this->{TRANSP}->{$tname}->{MATRIX} = [@tmtx];
+
+    return $lin;
+}
+
+
+#================================================================
+
+#  parsewgts
+
+#  Loads a stream weight vector macro into the hmmdata structure
+
+#--------------------------------
+sub parsewgts
+{
+    my ( $this, $fh, $lin, $wname ) = @_;
+    my ( $startofparse, @elem, $wsize, @wvec );
+
+    $wname or die "No weight name\n";
+
+    if(  exists $this->{SWEIGHTS}->{$wname} )
+    {
+       die "Duplicate weight name $wname\n";
+    }
+
+    # initialize usage of stream weight macro
+    $this->{SWEIGHTS}->{$wname}->{USAGE} = 0;
+
+    $startofparse = 1;
+
+    # get first line past macro header if on macro line
+    if( $lin =~ /^\s*~w/ )
+    {
+       $lin = <$fh>;
+    }
+
+  LINE:
+    while( $lin )
+    {
+
+       chomp($lin);
+
+       #ignore blank line
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       @elem = split( /[\s<>]+/, $lin);
+       ( $elem[0] ne '' ) or shift @elem;
+       
+       while( @elem )
+       {
+           if( $startofparse )
+           {
+               ( $elem[0] =~ /SWEIGHTS/i ) or
+                   die "Invalid wgts line $lin\n";
+               $wsize = $elem[1];
+               $this->{SWEIGHTS}->{$wname}->{SIZE} = $wsize;
+               $startofparse = 0;
+               @wvec = ();
+               @elem = @elem[2 .. $#elem];
+               $lin = join ' ', @elem;
+           }
+
+           if( ! $startofparse )
+           {
+               if( $lin !~ /[~<>A-DF-Z]/i )
+               {
+                   push @wvec, @elem;
+                   ( @wvec <= $wsize ) or
+                       die "Invalid sweight vector\n";
+                   @elem = ();
+               }
+               else
+               {
+                   last LINE;
+               }
+           }
+       }
+
+       # get next line to process
+       $lin = <$fh>;
+    }
+
+    # have data, check and load
+    ( @wvec == $wsize ) or die "Invalid sweight vector length\n";
+    $this->{SWEIGHTS}->{$wname}->{VECTOR} = [@wvec];
+
+    return $lin;
+}
+
+
+#================================================================
+
+#  parsemix
+
+#  Loads a mixture component pdf
+
+#--------------------------------
+sub parsemix
+{
+    my ( $this, $fh, $lin, $pname ) = @_;
+    my ( @elem, $macro, $mname, $vtype, $vname );
+    my ( $uniqct );
+
+    $pname or die "No mixture component name\n";
+
+    if(  exists $this->{MIXPDF}->{$pname} )
+    {
+       die "Duplicate mixture component name $pname\n";
+    }
+
+    # initialize usage of MIXPDF macro
+    $this->{MIXPDF}->{$pname}->{USAGE} = 0;
+
+    # get first line past macro header if on macro line
+    if( $lin =~ /^\s*~m/ )
+    {
+       $lin = <$fh>;
+    }
+
+  LINE:
+    while( $lin )
+    {
+
+       chomp($lin);
+       #ignore blank line
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       @elem = split( /[\s<>]+/, $lin);
+       ( $elem[0] ne '' ) or shift @elem;
+       
+       while( @elem )
+       {
+           # regression class tag
+           if( $elem[0] =~ /RCLASS/i )
+           {
+               $this->{MIXPDF}->{$pname}->{RCLASS} = $elem[1];
+               @elem = @elem[ 2 .. $#elem ];
+           }
+
+           # gconst tag
+           elsif( $elem[0] =~ /GCONST/i )
+           {
+               $this->{MIXPDF}->{$pname}->{GCONST} = $elem[1];
+               @elem = @elem[ 2 .. $#elem ];
+           }
+
+           # mean macro called in mixpdf
+           elsif( $elem[0] =~ /~u/ )
+           {
+               ($macro) = $elem[1] =~ /\"(.*)\"/;
+               $this->{MIXPDF}->{$pname}->{MEAN} = $macro;
+
+               @elem = @elem[ 2 .. $#elem ];
+           }
+
+           # variance macro called in mixpdf
+           elsif( $elem[0] =~ /~[vi]/ )
+           {
+               ($macro) = $elem[1] =~ /\"(.*)\"/;
+               $this->{MIXPDF}->{$pname}->{VARIANCE} = $macro;
+               
+               @elem = @elem[ 2 .. $#elem ];
+           }
+               
+           # mean defined in mixpdf, make a macro
+           elsif( $elem[0] =~ /MEAN/i )
+           {
+               $mname = "${pname}_MEAN";
+
+               # ensure the macro name is unique, since mean explicitly defined
+               $uniqct = 0;
+               while( exists $this->{MEAN}->{$mname} )
+               {
+                   $uniqct++;
+                   $mname = "${pname}_MEAN_D$uniqct";
+               }
+
+               $lin = parsemean( $this, $fh, $lin, $mname );
+               $this->{MIXPDF}->{$pname}->{MEAN} = $mname;
+               
+               @elem = split( /[\s<>]+/, $lin);
+               ( $elem[0] ne '' ) or shift @elem;
+           }
+
+           # variance defined in mixpdf, make a macro
+           elsif( $elem[0] =~ /VARIANCE|INVCOVAR/i )
+           {
+               $vtype = ( $elem[0] =~ /VARIANCE/i ) ? "v" : "i";
+               $vname = "${pname}_VARIANCE";
+
+               # ensure the macro name is unique, since variance explicitly defined
+               $uniqct = 0;
+               while(  exists $this->{VARIANCE}->{$vname} )
+               {
+                   $uniqct++;
+                   $vname = "${pname}_VARIANCE_D$uniqct";
+               }
+
+               $lin = parsecov( $this, $fh, $lin, $vtype, $vname );
+               $this->{MIXPDF}->{$pname}->{VARIANCE} = $vname;
+
+               @elem = split( /[\s<>]+/, $lin);
+               ( $elem[0] ne '' ) or shift @elem;
+
+           }           
+
+           # no element to parse
+           else
+           {
+               last LINE;
+           }
+
+       }
+
+       # get next line to process
+       $lin = <$fh>;
+    }
+
+    return $lin;
+}
+
+
+#================================================================
+
+#  parsestate
+
+#  Loads a state structure
+
+#--------------------------------
+sub parsestate
+{
+    my ( $this, $fh, $lin, $sname ) = @_;
+    my ( $stream, $nstream, $i, @nummix, $mixture, $mixprob );
+    my ( @elem, $wname, $pname );
+
+    $sname or die "No state name\n";
+
+    if(  exists $this->{STATE}->{$sname} )
+    {
+       die "Duplicate state name $sname\n";
+    }
+
+    # initialize this state macro usage
+    $this->{STATE}->{$sname}->{USAGE} = 0;
+
+
+    # get first line past macro header if on macro line
+    if( $lin =~ /^\s*~s/ )
+    {
+       $lin = <$fh>;
+    }
+
+    #default stream list element number (0 based)
+    $stream = 0;
+
+    # number of streams (1 based)
+    $nstream = $this->{STREAMINFO}->{SIZE};
+    unless( $nstream ) { $nstream = 1 };
+
+    #default of one mixture per stream
+    for( $i=0; $i< $nstream; $i++ ) {$nummix[$i] = 1;}
+
+    $this->{STATE}->{$sname}->{NUMMIXES} = [@nummix];
+
+    #default mixture number ( 0 based ) and prob
+    $mixture = 0;
+    $mixprob = 1;
+
+  LINE:
+    while( $lin )
+    {
+       chomp($lin);
+
+       #ignore blank line
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       @elem = split( /[\s<>]+/, $lin);
+       ( $elem[0] ne '' ) or shift @elem;
+       
+       while( @elem )
+       {
+           # nummixes tag
+           if( $elem[0] =~ /NUMMIXES/i )
+           {
+               @nummix = @elem[ 1 .. $nstream];
+               $this->{STATE}->{$sname}->{NUMMIXES} = [@nummix];
+
+               @elem = @elem[ $nstream+1 .. $#elem ];
+           }
+
+           # stream weights tag defined in state
+           elsif( $elem[0] =~ /SWEIGHTS/i )
+           {
+               $wname = "${sname}_SWEIGHTS";
+               $lin = parsewgts( $this, $fh, $lin, $wname );
+
+               $this->{STATE}->{$sname}->{SWEIGHTS} = $wname;
+               
+               @elem = split( /[\s<>]+/, $lin);
+               ( $elem[0] ne '' ) or shift @elem;
+           }
+
+           # stream weight macro called in state
+           elsif( $elem[0] =~ /~w/ )
+           {
+               ($wname) = $elem[1] =~ /\"(.*)\"/;
+               $this->{STATE}->{$sname}->{SWEIGHTS} = $wname;
+               
+               @elem = @elem[ 2 .. $#elem];
+           }               
+
+           #stream tag, number used when mixture defined
+           # initialize mixture counter to 0 for next mixture
+           elsif( $elem[0] =~ /^STREAM$/i )
+           {
+               $stream = $elem[1] - 1;
+               ($stream >=0 && $stream < $nstream ) or
+                   die "Invalid stream number\n";
+
+               $mixture = 0;
+               $mixprob = 1;
+
+               @elem = @elem[ 2 .. $#elem];
+           }
+           
+           #mixtures tag, number used when mixture defined (0 based)
+           elsif( $elem[0] =~ /^MIXTURE$/i )
+           {
+               $mixture = $elem[1] - 1;
+               ( $mixture >=0 && $mixture < $nummix[$stream] )
+                   or die "Invalid mixture number\n";
+               
+               $mixprob = $elem[2];
+                   
+               @elem = @elem[ 3 .. $#elem];
+           }               
+
+           #mixpdf macro defines mixpdf
+           elsif( $elem[0] =~ /~m/ )
+           {
+               ($pname) = $elem[1] =~ /\"(.*)\"/;
+               $this->{STATE}{$sname}{STREAMMIX}[$stream][$mixture]{MIXPDF} = 
+                   $pname;
+               $this->{STATE}{$sname}{STREAMMIX}[$stream][$mixture]{PROB} = 
+                   $mixprob;
+
+               @elem = @elem[ 2 .. $#elem];
+           }               
+           
+           #detection of start of mixture pdf component - parse it
+           elsif( $elem[0] =~ /~[uvi]/ ||
+               $elem[0] =~ /RCLASS|MEAN|VARIANCE|INVCOVAR|GCONST/i )
+           {
+               $pname = "${sname}_MIXPDF_" . ($stream+1) . "_" . ($mixture+1);
+               $lin = parsemix( $this, $fh, $lin, $pname );
+               
+               $this->{STATE}{$sname}{STREAMMIX}[$stream][$mixture]{MIXPDF} = 
+                   $pname;
+               $this->{STATE}{$sname}{STREAMMIX}[$stream][$mixture]{PROB} = 
+                   $mixprob;
+
+               @elem = split( /[\s<>]+/, $lin);
+               ( $elem[0] ne '' ) or shift @elem;
+           }
+
+           # no tag or macro for mixpdf
+           else
+           {
+               last LINE;
+           }
+       }
+    
+       # get next line to process
+       $lin = <$fh>;
+    }
+
+
+    # Check that all streams have the right number of mixtures;
+    for( $stream = 0; $stream < $nstream; $stream++ )
+    {
+       my $nmix = $this->{STATE}{$sname}{NUMMIXES}[$stream];
+       foreach my $mix ( 0 .. $nmix-1 )
+       {
+           unless( defined $this->{STATE}{$sname}{STREAMMIX}[$stream][$mix] )
+           {
+               print STDERR "Missing mixture for $sname, stream $stream, mix $mix\n";
+               last;
+           }
+       }
+    }
+
+    return $lin;
+}
+
+
+#================================================================
+
+#  parsehmm
+
+#  Loads an hmm structure
+
+#--------------------------------
+sub parsehmm
+{
+    my ( $this, $fh, $lin, $hname ) = @_;
+    my ( @elem, $sname, $state, $snum, $tname );
+    my ( $uniqct );
+
+    $hname or die "No hmm name\n";
+
+    if(  exists $this->{HMM}->{$hname} )
+    {
+       die "Duplicate hmm name $hname\n";
+    }
+    
+    # get first line past macro header if on macro line
+    if( $lin =~ /^\s*~h/ )
+    {
+       $lin = <$fh>;
+    }
+    
+    # check starting tag
+    ( $lin =~ /<BEGINHMM>$/i ) or die "Invalid hmm start\n";
+
+    $lin = <$fh>;
+    
+    
+  LINE:
+    while( $lin )
+    {
+       chomp($lin);
+
+       #ignore blank line
+       if( $lin =~ /^\s*$/ )
+       {
+           $lin = <$fh>;
+           next;
+       }
+
+       @elem = split( /[\s<>]+/, $lin);
+       ( $elem[0] ne '' ) or shift @elem;
+       
+       while( @elem )
+       {
+           # global options macro within hmm
+           if( $elem[0] =~ /~o/ )
+           {
+               $lin = parseopt( $this, $fh, $lin );
+
+               @elem = split( /[\s<>]+/, $lin);
+               ( $elem[0] ne '' ) or shift @elem;
+           }
+           
+           # number of states, including non-emitting start and end
+           elsif( $elem[0] =~ /NUMSTATES/i )
+           {
+               $this->{HMM}->{$hname}->{NUMSTATES} = $elem[1];
+
+               @elem = @elem[ 2 ..$#elem];
+           }
+           
+           # state number, converted to 0 based here for index
+           elsif( $elem[0] =~ /STATE/i )
+           {
+               # 0 based state list 
+               $state = $elem[1] - 2;
+               
+               @elem = @elem[ 2 ..$#elem];
+
+               # strip state from line if necessary 
+               # since state may appear with other elements
+               if( $#elem )
+               {
+                   $lin =~ s/\s*<STATE>\s+[0-9]+\s*//i;
+               }
+           }
+           
+           # state is defined by macro
+           elsif( $elem[0] =~ /~s/ )
+           {
+               ($sname) = $elem[1] =~ /\"(.*)\"/;
+               $this->{HMM}->{$hname}->{STATE}[$state] = $sname;
+
+               @elem = @elem[ 2 .. $#elem ];
+           }
+
+           # state is internally defined within hmm, make a macro
+           elsif( $elem[0] =~ /NUMMIXES|SWEIGHTS|STREAM|MIXTURE|RCLASS/i ||
+                  $elem[0] =~ /MEAN|VARIANCE|INVCOVAR|GCONST/i ||
+                  $elem[0] =~ /~[wmuvi]/ )
+           {
+               $snum = $state + 2;
+               $sname = "HMM_${hname}_STATE_${snum}";
+
+               # ensure sname unique, since explicitly defined
+               $uniqct = 0;
+               while( exists $this->{STATE}->{$sname} )
+               {
+                   $uniqct++;
+                   $sname = "HMM_${hname}_STATE_${snum}_D$uniqct";
+               }                   
+
+               $lin = parsestate( $this, $fh, $lin, $sname );
+               $this->{HMM}->{$hname}->{STATE}[$state] = $sname;
+
+               @elem = split( /[\s<>]+/, $lin);
+               ( $elem[0] ne '' ) or shift @elem;
+           }
+           
+           # transition matrix defined by macro
+           elsif( $elem[0] =~ /~t/ )
+           {
+               ($tname) = $elem[1] =~ /\"(.*)\"/;
+               $this->{HMM}->{$hname}->{TRANSP} = $tname;
+
+               @elem = @elem[ 2 .. $#elem ];
+           }
+
+           
+           # transition matrix defined internal to hmm, make a macro
+           elsif( $elem[0] =~ /TRANSP/i )
+           {
+               $tname = "HMM_${hname}_TRANSP";
+
+               # ensure name is unique, since trans explicitly defined
+               $uniqct = 0;
+               while( exists $this->{TRANSP}->{$tname} )
+               {
+                   $uniqct++;
+                   $tname = "HMM_${hname}_TRANSP_D$uniqct";
+               }
+
+               $lin = parsetrans( $this, $fh, $lin, $tname );
+               $this->{HMM}->{$hname}->{TRANSP} = $tname;
+
+               @elem = split( /[\s<>]+/, $lin);
+               ( $elem[0] ne '' ) or shift @elem;
+           }           
+
+           # end of hmm definition
+           elsif( $elem[0] =~ /ENDHMM/i )
+           {
+               # read past end of hmm
+               $lin = <$fh>;
+               last LINE;
+           }
+
+           # no hmm tag or macro
+           else
+           {
+               last LINE;
+           }
+       }
+       
+       # get next line to process
+       $lin = <$fh>;
+    }
+
+    return $lin;
+}
+
+#================================================================
+# checklist
+
+# Checks to ensure that all hmms in a list have been loaded.
+
+#-----------------------------
+sub checklist
+{
+    my ($this, @hmmlist ) = @_;
+    my(  $hname, $doabort );
+
+    if( @hmmlist ) 
+    { 
+       $doabort = 0;
+       foreach $hname ( @hmmlist )
+       {
+           if( ! exists $this->{HMM}{$hname} )
+           {
+               $doabort = 1;
+               print "HMM '$hname' not in mmf files\n";
+           }
+       }
+       exit 0 if $doabort;
+    }
+}
+
+#================================================================
+
+# markusagehmm
+
+# Marks the usage of all substructures of an hmm.  Also does checking
+# to see if the hmm structure is consistent.
+
+#--------------------------------
+
+sub markusagehmm
+{
+    my( $this, $mexpand ) = @_;
+    my( $hname, $tname, $sname, $wname, $mname, $vname, $pname );
+    my( $hmmref, $stateref, $streamref, $mixref, $pdfref );
+    my( $trnref );
+    my( $vref, $mref );
+    my( $streamct );
+    my( $regref, $rclass );
+
+
+    while( ($hname, $hmmref) = each %{ $this->{HMM} } )
+    {
+       #mark transition matrix as used
+       $tname = $hmmref->{TRANSP};
+       $trnref =  $this->{TRANSP}{$tname};
+
+       #check for consistency 
+       ( $hmmref->{NUMSTATES} == $trnref->{SIZE} ) or 
+           die "$hname has wrong transition size in $tname\n";
+
+       # mark transition as used
+
+#      ( $mexpand =~ /t/ ) ?  $this->{TRANSP}{$tname}{USAGE}-- :
+#          $this->{TRANSP}{$tname}{USAGE}++;
+
+       ( $mexpand =~ /t/ ) ?  $trnref->{USAGE}-- : $trnref->{USAGE}++;
+
+
+       #mark each state as used
+       foreach $sname ( @{ $hmmref->{STATE} } )
+       {
+           # mark state as used
+           $stateref = $this->{STATE}{$sname};
+
+           ( $mexpand =~ /s/ ) ?  $stateref->{USAGE}-- :  $stateref->{USAGE}++;
+
+           # mark state stream weights as used
+           if( exists $stateref->{SWEIGHTS} )
+           {
+               $wname = $stateref->{SWEIGHTS};
+               ( $mexpand =~ /w/ ) ?  $this->{SWEIGHTS}{$wname}{USAGE}-- :
+                   $this->{SWEIGHTS}{$wname}{USAGE}++;
+           }
+
+           # mark each mixpdf and its components as used
+           # associate a stream with each pdf, mean, and variance
+           $streamct = 0;
+           foreach $streamref ( @{ $stateref->{STREAMMIX} } )
+           {
+               foreach $mixref ( @{ $streamref } )
+               {
+                   $pname = $mixref->{MIXPDF};
+                   $pdfref = $this->{MIXPDF}{$pname};
+                   ( $mexpand =~ /m/ ) ? $pdfref->{USAGE}-- :  $pdfref->{USAGE}++;
+                   if( exists $pdfref->{STREAM} && $pdfref->{STREAM} != $streamct )
+                   { 
+                       die '$pname crosses streams';
+                   }
+                   else
+                   {
+                       $pdfref->{STREAM} = $streamct;
+                   }
+
+                   # if pdf uses a regression class, then regression trees are used
+                   if( $pdfref->{RCLASS} && exists $this->{REGTREE} )
+                   {
+                       $rclass = $pdfref->{RCLASS};
+                       foreach $regref ( values %{ $this->{REGTREE} } )
+                       {                           
+                           $regref->{USAGE}++;
+                           
+                           # keep track of number of pdfs mapping to each leaf
+                           die "Invalid pdf RCLASS for $pname\n" if( ! defined $regref->{TNODE}[$rclass] );
+                           
+                           $regref->{TNODE}[$rclass]++;
+                       }
+                   }
+
+
+                   $vname = $pdfref->{VARIANCE};
+                   $vref = $this->{VARIANCE}{$vname};
+                   ( $mexpand =~ /v|i/ ) ? $vref->{USAGE}-- : 
+                       $vref->{USAGE}++ ;
+                   if( exists $vref->{STREAM} && $vref->{STREAM} != $streamct )
+                   {
+                       die '$vname crosses streams';
+                   }
+                   else
+                   {
+                       $vref->{STREAM} = $streamct;
+                   }
+
+                   $mname = $pdfref->{MEAN};
+                   $mref = $this->{MEAN}{$mname};
+                   ( $mexpand =~ /u/ ) ?  $mref->{USAGE}-- :
+                       $mref->{USAGE}++;
+                   if( exists $mref->{STREAM} && $mref->{STREAM} != $streamct )
+                   {
+                       die '$mname crosses streams';
+                   }
+                   else
+                   {
+                       $mref->{STREAM} = $streamct;
+                   }
+               }
+               $streamct++;
+           }
+       }
+    }
+}
+
+#================================================================
+
+#  transformpdfs
+
+#  This function transforms all pdfs that are marked for usage
+#  using a TMF object as defined in HTKtmf.
+
+#--------------------------------
+sub transformpdfs
+{
+    my( $this, $tmf ) = @_;
+    my( $pdfname, $pref, $class );
+    my( $meanname, $mref, $mvecref );
+    my( $varname, $vref, $vvecref );
+    my( $gconstref );
+
+    foreach $pdfname ( keys %{ $this->{MIXPDF} } )
+    {
+       $pref = $this->{MIXPDF}{$pdfname};
+
+       next if( $pref->{USAGE} == 0 || ! exists $pref->{RCLASS} );
+
+       $class = $pref->{RCLASS};
+
+       # determine if this pdf mean vector needs to be transformed
+       $meanname = $pref->{MEAN};
+       $mref = $this->{MEAN}{$meanname};
+       if( exists $mref->{TMFRCLASS} )
+       {
+           die "HTKdata: cross rclass mean $meanname\n" if( $mref->{TMFRCLASS} != $class );
+
+           # mean already transformed
+           $mvecref = undef;
+       }
+       else
+       {
+           # need to transform the mean via this regression class
+           $mref->{TMFRCLASS} = $class;
+           $mvecref = $mref->{VECTOR};
+       }
+
+       # determine if this pdf variance vector needs to be transformed
+       $varname = $pref->{VARIANCE};
+       $vref = $this->{VARIANCE}{$varname};
+       if( exists $vref->{TMFRCLASS} )
+       {
+           die "HTKdata: cross rclass var $varname\n" if( $vref->{TMFRCLASS} != $class );
+
+           # variance already transformed
+           $vvecref = undef;
+       }
+       else
+       {
+           # need to transform the variance via this regression class if it is diagonal vector
+           $vref->{TMFRCLASS} = $class if( $vref->{TYPE} eq 'v' );
+           $vvecref = ( $vref->{TYPE} eq 'v' )  ?  $vref->{VECTOR}  :  undef;
+       }
+
+       if( exists $pref->{GCONST} )
+       {
+           $gconstref = \$pref->{GCONST};
+       }
+
+
+       $tmf->transformpdf( $class, $mvecref, $vvecref, $gconstref );
+    }
+}
+
+
+#================================================================
+
+# compressedmmf
+
+# Output HTK MMF file containing all and only data for loaded
+# hmm set
+
+#--------------------------------
+sub compressedmmf
+{
+
+    my( $this, $fh ) = @_;
+    my( $haveopt, $ref, $opt );
+    my( $rname, $rref );
+    my( $tname, $tref, $ntrans, $row );
+    my( $wname, $wref );
+    my( $mname, $mref );
+    my( $vname, $vref, $vtype, $elem );
+    my( $pname, $pref );
+    my( $sname, $sref, $nstream, @nummixes, $stream, $nmix, $mixref, $mix, $prob );
+    my( $hname, $href, $state, $nstates );
+
+
+    #output global options macro info - it should exist
+
+    $haveopt = 0;
+    if( exists $this->{STREAMINFO} )
+    {
+       print $fh "~o\n" unless $haveopt;
+       $haveopt = 1;
+
+       $ref = $this->{STREAMINFO};
+       print $fh "<STREAMINFO> ", $ref->{SIZE}, " ", join( " ", @{ $ref->{VECTOR} }), "\n";
+    }
+
+    if( exists $this->{VECSIZE} )
+    {
+       print $fh "~o\n" unless $haveopt;
+       $haveopt = 1;
+
+       print $fh "<VECSIZE> ", $this->{VECSIZE}, "\n";
+    }
+
+    if( exists $this->{HMMSETID} )
+    {
+       print $fh "~o\n" unless $haveopt;
+       $haveopt = 1;
+
+       print $fh "<HMMSETID> ", $this->{HMMSETID}, "\n";
+    }
+
+    if( exists $this->{DURKIND} )
+    {
+       print $fh "~o\n" unless $haveopt;
+       $haveopt = 1;
+
+       $opt = $this->{DURKIND};
+       print $fh "<$opt>\n";
+    }
+
+    if( exists $this->{COVKIND} )
+    {
+       print $fh "~o\n" unless $haveopt;
+       $haveopt = 1;
+
+       $opt = $this->{COVKIND};
+       print $fh "<$opt>\n";
+    }
+
+    if( exists $this->{PARMKIND} )
+    {
+       print $fh "~o\n" unless $haveopt;
+       $haveopt = 1;
+
+       $opt = $this->{PARMKIND};
+       print $fh "<$opt>\n";
+    }
+
+    # output all regression tree macros if used
+    foreach $rname( sort keys %{ $this->{REGTREE} } )
+    {
+       $rref = $this->{REGTREE}{$rname};
+       if( $rref->{USAGE} > 0 )
+       {
+           print $fh "~r \"$rname\"\n";
+           output_reg( $rref, $fh );
+       }
+    }
+
+    #output all transition  matrix macros used
+    foreach $tname   ( sort keys %{ $this->{TRANSP} } )
+    {
+       $tref = $this->{TRANSP}{$tname};
+
+       if( $tref->{USAGE} > 0 )
+       {
+           print $fh "~t \"$tname\"\n";
+           output_trans( $tref, $fh );
+       }
+    }
+    
+    # output all stream weight macros used
+    foreach $wname ( sort keys  %{ $this->{SWEIGHTS} } )
+    {
+       $wref = $this->{SWEIGHTS}{$wname};
+
+       if( $wref->{USAGE} > 0 )
+       {
+           print $fh "~w \"$wname\"\n";
+           output_swgt( $wref, $fh );
+       }
+    }
+
+    # output all mean vector macros used
+    foreach $mname ( sort keys  %{ $this->{MEAN} } )
+    {
+       $mref = $this->{MEAN}{$mname};
+
+       if( $mref->{USAGE} > 0 )
+       {
+           print $fh "~u \"$mname\"\n";
+           output_mean( $mref, $fh );
+       }
+    }
+    
+
+    # output all variance vector or matrix macros used
+    foreach $vname ( sort keys  %{ $this->{VARIANCE} } )
+    {
+
+       $vref = $this->{VARIANCE}{$vname};
+
+       if( $vref->{USAGE} > 0 )
+       {
+           $vtype = $vref->{TYPE};
+           print $fh "~$vtype \"$vname\"\n";
+           output_var( $vref, $fh );
+       }
+    }
+
+
+    #output all pdf's used
+    foreach $pname ( sort keys  %{ $this->{MIXPDF} } )
+    {
+       $pref = $this->{MIXPDF}{$pname};
+
+       if( $pref->{USAGE} > 0 )
+       {
+           print $fh "~m \"$pname\"\n";
+           output_mix( $this, $pref, $fh );
+       }
+    }
+
+
+    # output all state macros used
+    foreach $sname ( sort keys  %{ $this->{STATE} } )
+
+    {
+       $sref =  $this->{STATE}{$sname};
+
+       if( $sref->{USAGE} > 0  )
+       {
+           print $fh "~s \"$sname\"\n";
+
+           output_state( $this, $sref, $fh );
+       }
+    }
+
+
+    #output all hmms
+    foreach $hname ( sort keys  %{ $this->{HMM} } )
+    {
+       $href =  $this->{HMM}{$hname};
+
+       print $fh "~h \"$hname\"\n";
+       print $fh "<BEGINHMM>\n";
+
+       $nstates = $href->{NUMSTATES};
+       print $fh "<NUMSTATES> ${nstates}\n";
+
+       for( $state = 0; $state < $nstates-2; $state++ )
+       {
+           $sname = $href->{STATE}[$state];
+           print $fh "<STATE> ", $state+2, "\n";
+
+           $sref = $this->{STATE}{$sname};
+           if( $sref->{USAGE} > 0 )
+           {
+               print $fh "~s \"${sname}\"\n";
+           }
+           else
+           {
+               output_state( $this, $sref, $fh );
+           }
+       }
+
+       $tname = $href->{TRANSP};
+       $tref = $this->{TRANSP}{$tname};
+       if( $tref->{USAGE} > 0 )
+       {
+           print $fh "~t \"$tname\"\n";
+       }
+       else
+       {
+           output_trans( $tref, $fh );
+       }
+
+       print $fh "<ENDHMM>\n";
+    }
+}
+
+
+#================================================================
+
+# output_reg
+
+# output regression tree information
+
+#--------------------------------
+sub output_reg
+{
+    my( $rref, $fh ) = @_;
+    my( $lastnode, $nd );
+
+    print $fh  "<REGTREE> $rref->{LEAFS}\n";
+
+    $lastnode = $#{ $rref->{NODE} };
+    for( $nd=0; $nd <= $lastnode; $nd++ )
+    {
+       if( defined $rref->{NODE}[$nd] )
+       {
+           print $fh "<NODE> $nd @{$rref->{NODE}[$nd]}\n";
+       }
+    }
+
+    $lastnode = $#{ $rref->{TNODE} };
+    for( $nd=0; $nd <= $lastnode; $nd++ )
+    {
+       if( defined $rref->{TNODE}[$nd] )
+       {
+           print $fh  "<TNODE> $nd $rref->{TNODE}[$nd]\n";
+       }
+    }
+}
+
+#================================================================
+
+# output_trans
+
+# output transition matrix
+
+#--------------------------------
+
+sub output_trans
+{
+    my( $tref, $fh ) = @_;
+    my( $ntrans, $row );
+
+    $ntrans = $tref->{SIZE};
+    print $fh "<TRANSP> ", $ntrans, "\n";
+    for($row=0; $row < $ntrans; $row++ )
+    {
+       print $fh join( " ", @{ $tref->{MATRIX}[$row] } ), "\n";
+    }
+
+    return;
+}
+
+
+#================================================================
+
+# output_swgt
+
+# output stream weight vector
+
+#--------------------------------
+
+sub output_swgt
+{
+    my( $wref, $fh ) = @_;
+
+    print $fh "<SWEIGHTS> ", $wref->{SIZE}, " ";
+    print $fh join( " ", @{ $wref->{VECTOR} } ), "\n";
+    
+    return;
+}
+
+
+#================================================================
+
+# output_mean
+
+# output mean vector
+
+#--------------------------------
+
+sub output_mean
+{
+    my( $mref, $fh ) = @_;
+
+    print $fh "<MEAN> ", $mref->{SIZE}, "\n";
+    print $fh join( " ", @{ $mref->{VECTOR} } ), "\n";
+    
+    return;
+}
+
+
+#================================================================
+
+# output_var
+
+# output variance or covariance data
+
+#--------------------------------
+sub output_var
+{
+    my( $vref, $fh ) = @_;
+    my( $vtype, $elem, $row );
+
+    $vtype = $vref->{TYPE};
+    if( $vtype =~ /v/ )
+    {
+       print $fh "<VARIANCE> ", $vref->{SIZE}, "\n";
+       print $fh join( " ", @{ $vref->{VECTOR} } ), "\n";
+    }
+    else
+    {
+       # type assumed "i"
+       print $fh "<INVCOVAR> ", $vref->{SIZE}, "\n";
+       $elem = 0;
+       for( $row=$vref->{SIZE}; $row> 0; $row-- )
+       {
+           print $fh join( " ", @{ $vref->{VECTOR} }[$elem .. $elem+$row - 1 ] ), "\n";
+           $elem += $row;
+       }
+    }
+
+    return;
+}
+
+
+
+#================================================================
+
+# output_mix
+
+# output mixture data
+
+#--------------------------------
+sub output_mix
+{
+    my( $this, $pref, $fh ) = @_;
+    my( $mname, $mref );
+    my( $vname, $vref, $vtype );
+
+    if( exists $pref->{RCLASS} )
+    {
+       print $fh "<RCLASS> ", $pref->{RCLASS}, "\n";
+    }
+
+    $mname = $pref->{MEAN};
+    $mref = $this->{MEAN}{$mname};
+    if( $mref->{USAGE} > 0 )
+    {
+       print $fh "~u \"$mname\"\n";
+    }
+    else
+    {
+       # must be used since ~m used, and thus must need to be expanded inline
+       output_mean( $mref, $fh );
+    }          
+
+    $vname = $pref->{VARIANCE};
+    $vref = $this->{VARIANCE}{$vname};
+    $vtype = $vref->{TYPE};
+    if(  $vref->{USAGE} > 0 )
+    {
+       print $fh "~$vtype \"$vname\"\n";
+    }
+    else
+    {
+       output_var( $vref, $fh );
+    }
+
+    if( exists $pref->{GCONST} )
+    {
+       print $fh "<GCONST> ", $pref->{GCONST}, "\n";
+    }
+
+    return;
+}
+
+
+#================================================================
+
+# output_state
+
+# output state data
+
+#--------------------------------
+sub output_state
+{
+    my( $this, $sref, $fh ) = @_;
+    my( @nummixes, $nstream, $stream );
+    my( $wname, $wref );
+    my( $nmix, $mixref, $mix, $pname, $pref, $prob );
+
+    @nummixes = @{ $sref->{NUMMIXES} };
+    @nummixes or @nummixes = (1);
+
+    if( @nummixes > 1 || $nummixes[0] > 1 )
+    {
+       print $fh "<NUMMIXES> ", join(" ", @nummixes), "\n";
+    }          
+
+    if( exists $sref->{SWEIGHTS} )
+    {
+       $wname = $sref->{SWEIGHTS};
+       $wref = $this->{SWEIGHTS}{$wname};
+
+       if( $wref->{USAGE} > 0 )
+       {
+           print $fh "~w \"$wname\"\n";
+       }
+       else
+       {
+           output_swgt( $wref, $fh );
+       }
+    }
+
+    $stream = 0;
+    $nstream = @nummixes;
+
+    for( $stream=0; $stream < $nstream; $stream++ )
+    {
+       if( $nstream > 1 )
+       {
+           print $fh "<STREAM> ", $stream+1, "\n";
+       }
+           
+       $nmix = $nummixes[$stream];
+       
+       for( $mix = 0; $mix < $nmix; $mix++ )
+       {
+           $mixref = $sref->{STREAMMIX}[$stream][$mix];
+           
+           $pname = $mixref->{MIXPDF};
+           $prob = $mixref->{PROB};
+           $pref = $this->{MIXPDF}{$pname};
+
+           if( $nmix > 1 )
+           {
+               print $fh "<MIXTURE> ", $mix+1, " ", $prob, "\n";
+           }
+
+           if( $pref->{USAGE} > 0 )
+           {
+               print $fh "~m \"$pname\"\n";
+           }
+           else
+           {
+               output_mix( $this, $pref, $fh );
+           }
+       }
+    }
+
+    return;
+}
+
+
+#================================================================
+# mergehmms
+    
+# Merge a set of HMMs to produce a single hmm
+    
+#--------------------------------
+sub mergehmms
+{
+    my( $this, $mrgfile ) = @_;
+    my( $firsthmm, $hname, $hbname, $hbref, $href );
+    my( $tbref, $tref, $row, $col );
+    my( $tbname, $tbmname, $tbmref, $tfact );
+    my( $nstream, $state, $sbname, $sbref, $sname, $sref, $sfact );
+    my( $stream, $nbmix, $bmix, $nmix, $mix );
+    my( $lin, $snum, @hmmlist, %base );
+    my( $sbmname, $sbmref );
+    
+    
+    # number of data streams
+    $nstream = $this->{STREAMINFO}{SIZE};
+
+    # process all lines of merge file
+    open( MRG, "$mrgfile" ) or die "Can not open merge file $mrgfile\n";
+
+    while( $lin = <MRG> )
+    {
+       chomp($lin);
+       @hmmlist = split( " ", $lin );
+       
+
+       # first hmm on the line is the base hmm to merge into
+       $firsthmm  = 1;
+    
+      HMM:
+       foreach $hname ( @hmmlist )
+       {
+           if( $firsthmm )
+           {
+               # initialize base hmm
+               exists $this->{HMM}{$hname} or die "HMM $hname does not exist\n";
+               $hbref = $this->{HMM}{$hname};
+               $hbname = $hname;
+               
+               # keep track of base models to ensure no base to base merge
+               $base{$hbname} = 1;
+
+               # initialize if base model has not been used for merging
+               unless( exists $hbref->{MERGE}{NAME}{$hbname} )
+               {
+                   $hbref->{MERGE}{NAME}{$hbname} = 1;
+                   $hbref->{MERGE}{COUNT} = 1;
+               }
+
+               $firsthmm = 0;
+               next HMM;
+           }
+           else
+           {
+               unless( exists $this->{HMM}{$hname} )
+               {
+                   print STDERR "HMM $hname does not exist, not merged with $hbname\n";
+                   next HMM;
+               }               
+
+               if( exists $base{$hname} )
+               {
+                   die "Attempt to merge base model $hname into $hbname\n";
+               }
+
+               if( exists $hbref->{MERGE}{NAME}{$hname} )
+               {
+                   print STDERR "HMM $hname multiple merge for $hbname, not merged\n";
+                   next HMM;
+               }
+               else
+               {
+                   # add this hmm to the hmms merged with base
+                   $hbref->{MERGE}{NAME}{$hname} = ++$hbref->{MERGE}{COUNT};
+               }
+           }       
+           
+           # reference to data for hmm to merge with base hmm
+           $href = $this->{HMM}{$hname};
+
+           # hmms to merge must have same number of states
+           ($hbref->{NUMSTATES} == $href->{NUMSTATES} ) or
+               die "HMM state count conflict $hbname vs $hname\n";
+           
+
+           # transition probability merging
+
+           # check for first hmm $href using a different transition matrix than original $hbref
+           # this signals that the original transition matrix can not be used, (that is, all
+           # models being merged do not use the same transition matrix) and so 
+           # a new transition macro structure must be created for this base hmm
+           if( ! exists $hbref->{MERGE}{NEWTRANSP} &&
+               ($href->{TRANSP} ne $hbref->{TRANSP} ) )
+           {
+
+               # flag new transition macro created for this base hmm
+               $hbref->{MERGE}{NEWTRANSP} = 1;
+
+               # create new transp macro with unique name ($tbmname)
+               $tbname = $hbref->{TRANSP};
+               $tbref = $this->{TRANSP}{ $tbname };
+               $tbmname = "HMM_${hbname}_TRANSP_${tbname}_MRG";
+
+               # note: must have this line to declare reference before defining $tbmref
+               $this->{TRANSP}{$tbmname}{USAGE} = 0;
+
+               # copy transition data to new macro
+               $tbmref = $this->{TRANSP}{$tbmname};
+               $tbmref->{SIZE} = $tbref->{SIZE};
+               for( $row = 0; $row < $hbref->{NUMSTATES}; $row++ )
+               {
+                   for( $col = 0; $col < $href->{NUMSTATES}; $col++ )
+                   {
+                       $tbmref->{MATRIX}[$row][$col] = $tbref->{MATRIX}[$row][$col];
+                   }
+               }
+               # base hmm uses new transition macro
+               $hbref->{TRANSP} = $tbmname;
+           }
+           
+
+           # must do merge of transition data if new base transition matrix defined
+           if( exists $hbref->{MERGE}{NEWTRANSP} )
+           {
+
+               $tbref = $this->{TRANSP}{ $hbref->{TRANSP} };
+               $tref = $this->{TRANSP}{ $href->{TRANSP} };
+               $tfact = 1/( $hbref->{MERGE}{COUNT} );
+           
+               for( $row = 0; $row < $href->{NUMSTATES}; $row++ )
+               {
+                   for( $col = 0; $col < $href->{NUMSTATES}; $col++ )
+                   {
+                       $tbref->{MATRIX}[$row][$col] = (1-$tfact)*($tbref->{MATRIX}[$row][$col]) +
+                           $tfact*($tref->{MATRIX}[$row][$col]);
+                   }
+               }
+           }       
+
+
+           # state merging
+
+         STATE:
+           for( $state=0; $state < ($hbref->{NUMSTATES} - 2); $state++ )
+           {
+               # base model state
+               $sbname = $hbref->{STATE}[$state];
+               $sbref = $this->{STATE}{$sbname};
+
+               # construct new merged state macro for the base state if first hmm to merge
+               if( $hbref->{MERGE}{COUNT} == 2 )
+               {
+                   $snum = $state+2;
+                   $sbmname = "HMM_${hbname}_STATE_${snum}_MRG";
+                   
+                   # note: also declares new state name reference
+                   $this->{STATE}{$sbmname}{USAGE} = 0;
+
+                   #copy base state info to new state macro
+                   $sbmref = $this->{STATE}{$sbmname};
+                   $sbmref->{NUMMIXES} = [ @{ $sbref->{NUMMIXES} } ];
+                   if( exists $sbref->{SWEIGHTS} )
+                   {
+                       $sbmref->{SWEIGHTS} = $sbref->{SWEIGHTS}
+                   }
+
+                   for( $stream = 0; $stream < $nstream; $stream++ )
+                   {
+                       $nmix = $sbref->{NUMMIXES}[$stream];
+                       for( $mix = 0; $mix < $nmix; $mix++ )
+                       {
+                           $sbmref->{STREAMMIX}[$stream][$mix]{PROB} = 
+                               $sbref->{STREAMMIX}[$stream][$mix]{PROB};
+                           
+                           $sbmref->{STREAMMIX}[$stream][$mix]{MIXPDF} = 
+                               $sbref->{STREAMMIX}[$stream][$mix]{MIXPDF};
+                       }
+                   }
+                   
+                   # make base hmm model use new merged state macro
+                   $hbref->{STATE}[$state] = $sbmname;
+                   $sbref = $sbmref;
+
+                   # initialize merge statistics
+                   $sbref->{MERGE}{NAME}{$sbname} = 1;
+                   $sbref->{MERGE}{COUNT} = 1;
+                   $sbname = $sbmname;
+               }
+
+               # model to merge with base
+               $sname = $href->{STATE}[$state];
+               $sref = $this->{STATE}{$sname};
+               
+
+               $sbref->{MERGE}{NAME}{$sname} = ++$sbref->{MERGE}{COUNT};
+               $sfact = 1/( $sbref->{MERGE}{COUNT} );
+           
+               for( $stream=0; $stream < $nstream; $stream++ )
+               {
+                   # precondition the mixture pdf probabilities in the base state
+                   $nbmix = $sbref->{NUMMIXES}[$stream];
+                   for( $bmix = 0; $bmix < $nbmix; $bmix++ )
+                   {
+                       $sbref->{STREAMMIX}[$stream][$bmix]{PROB} *= (1-$sfact);
+                   }
+
+                   # add mixture information from $sref to the base state
+                   $nmix = $sref->{NUMMIXES}[$stream];
+                 MIX:
+                   for( $mix = 0; $mix < $nmix; $mix++ )
+                   {
+                       # check if mixture pdf already is in base state
+                       # if so, just adjust the mixture probability
+                       $nbmix = $sbref->{NUMMIXES}[$stream];
+                       for( $bmix = 0; $bmix < $nbmix; $bmix++ )
+                       {
+                           if( $sbref->{STREAMMIX}[$stream][$bmix]{MIXPDF} eq
+                               $sref->{STREAMMIX}[$stream][$mix]{MIXPDF} )
+                           {
+                               $sbref->{STREAMMIX}[$stream][$bmix]{PROB} = 
+                                   ($sbref->{STREAMMIX}[$stream][$bmix]{PROB} ) +
+                                       $sfact*( $sref->{STREAMMIX}[$stream][$mix]{PROB} );
+                               next MIX;
+                           }
+                       }
+
+                       # if you get to here, then this is a new mixture pdf not in the base state
+                       # for this stream - add new pdf to base state
+                       $sbref->{STREAMMIX}[$stream][$nbmix]{MIXPDF} = 
+                           $sref->{STREAMMIX}[$stream][$mix]{MIXPDF};
+
+                       $sbref->{STREAMMIX}[$stream][$nbmix]{PROB} = 
+                               $sfact*( $sref->{STREAMMIX}[$stream][$mix]{PROB} );
+                       
+                       $sbref->{NUMMIXES}[$stream]++;
+                   }
+               }
+           }
+           
+           # remove the HMM just merged with the base hmm
+           delete $this->{HMM}{$hname};
+       }
+    }
+    
+    close( MRG );
+
+
+    # clean up - remove base hmm name hash and  merge information
+    undef %base;
+
+    while( ($hname, $href) = each %{ $this->{HMM} } )
+    {
+       delete $href->{MERGE} if exists $href->{MERGE};
+    }
+
+    while( ($sname, $sref) = each %{ $this->{STATE} } )
+    {
+       delete $sref->{MERGE} if exists $sref->{MERGE};
+    }
+    
+    return;
+}
+
+
+#================================================================
+# mergestates
+    
+# Merge a set of states to produce single state and mark HMMs accordingly
+    
+# Note: the stream weighting is not merged - the stream weighting of the
+# base state will be the stream weighting of the merged state
+
+#--------------------------------
+sub mergestates
+{
+    my( $this, $mrgfile ) = @_;
+    my( $firststate, $sname, $sbname, $sbref, $sref );
+    my( $nstream, $state, $nstates, $sfact );
+    my( $stream, $nbmix, $bmix, $nmix, $mix );
+    my( $lin, $snum, @statelist, %base, %map );
+    my( $hname, $href );
+    
+    
+    # number of data streams
+    $nstream = $this->{STREAMINFO}{SIZE};
+
+    # process all lines of merge file
+    open( MRG, "$mrgfile" ) or die "Can not open merge file $mrgfile\n";
+
+    while( $lin = <MRG> )
+    {
+       chomp($lin);
+       @statelist = split( " ", $lin );
+       
+
+       # first state on the line is the base state to merge into
+       $firststate  = 1;
+    
+      STATE:
+       foreach $sname ( @statelist )
+       {
+           if( $firststate )
+           {
+               # initialize base state
+               exists $this->{STATE}{$sname} or die "State $sname does not exist\n";
+               $sbref = $this->{STATE}{$sname};
+               $sbname = $sname;
+               
+               # keep track of base states, can not merge base states with each other
+               $base{$sbname} = 1;
+
+               # mapping to be used for converting states in hmms, map base to itself
+               $map{$sbname} = $sbname;
+
+               # initialize if base model has not been used for merging yet
+               unless( exists $sbref->{MERGE}{NAME}{$sbname} )
+               {
+                   $sbref->{MERGE}{NAME}{$sbname} = 1;
+                   $sbref->{MERGE}{COUNT} = 1;
+               }
+
+               $firststate = 0;
+               next STATE;
+           }
+           else
+           {
+               unless( exists $this->{STATE}{$sname} )
+               {
+                   print STDERR "State $sname does not exist, not merged with $sbname\n";
+                   next STATE;
+               }               
+
+               if( exists $base{$sname} )
+               {
+                   die "Attempt to merge base state $sname into $sbname\n";
+               }
+
+               if( exists $sbref->{MERGE}{NAME}{$sname} )
+               {
+                   print STDERR "State $sname multiple merge for $sbname, not merged\n";
+                   next STATE;
+               }
+               else
+               {
+                   # add this state to the states merged with base state
+                   $sbref->{MERGE}{NAME}{$sname} = ++$sbref->{MERGE}{COUNT};
+
+                   # map this state to its merged base state
+                   $map{$sname} = $sbname;
+
+                   # reference to data for state to merge with base state
+                   $sref = $this->{STATE}{$sname};
+               }
+           }
+           
+
+           # merge state with base state
+
+           $sfact = 1/( $sbref->{MERGE}{COUNT} );
+           
+           for( $stream=0; $stream < $nstream; $stream++ )
+           {
+               # precondition the mixture pdf probabilities in the base state
+               $nbmix = $sbref->{NUMMIXES}[$stream];
+               for( $bmix = 0; $bmix < $nbmix; $bmix++ )
+               {
+                   $sbref->{STREAMMIX}[$stream][$bmix]{PROB} *= (1-$sfact);
+               }
+
+               # add mixture information from $sref to the base state
+               $nmix = $sref->{NUMMIXES}[$stream];
+             MIX:
+               for( $mix = 0; $mix < $nmix; $mix++ )
+               {
+                   # check if mixture pdf already is in base state
+                   # if so, just adjust the mixture probability
+                   $nbmix = $sbref->{NUMMIXES}[$stream];
+                   for( $bmix = 0; $bmix < $nbmix; $bmix++ )
+                   {
+                       if( $sbref->{STREAMMIX}[$stream][$bmix]{MIXPDF} eq
+                           $sref->{STREAMMIX}[$stream][$mix]{MIXPDF} )
+                       {
+                           $sbref->{STREAMMIX}[$stream][$bmix]{PROB} = 
+                               ($sbref->{STREAMMIX}[$stream][$bmix]{PROB} ) +
+                                   $sfact*( $sref->{STREAMMIX}[$stream][$mix]{PROB} );
+                           next MIX;
+                       }
+                   }
+
+                   # if you get to here, then this is a new mixture pdf not in the base state
+                   # for this stream - add new pdf to base state
+                   $sbref->{STREAMMIX}[$stream][$nbmix]{MIXPDF} = 
+                       $sref->{STREAMMIX}[$stream][$mix]{MIXPDF};
+
+                   $sbref->{STREAMMIX}[$stream][$nbmix]{PROB} = 
+                       $sfact*( $sref->{STREAMMIX}[$stream][$mix]{PROB} );
+                   
+                   $sbref->{NUMMIXES}[$stream]++;
+               }
+           }
+       }
+           
+       # remove the state just merged with the base state
+       delete $this->{STATE}{$sname};
+    }
+
+
+    close( MRG );
+
+
+    # Modify all HMMs to reflect the merged states that they now use
+    while( ($hname, $href) = each %{ $this->{HMM} } )
+    {
+       $nstates = $href->{NUMSTATES};
+       for( $state=0; $state < $nstates; $state++ )
+       {
+           $sname = $href->{STATE}[$state];
+           if( exists $map{$sname} )
+           {
+               $href->{STATE}[$state] = $map{$sname};
+           }
+       }
+    }
+
+
+    # clean up - remove base and map hashes and merge information
+    undef %base;
+    undef %map;
+
+    while( ($sname, $sref) = each %{ $this->{STATE} } )
+    {
+       delete $sref->{MERGE} if exists $sref->{MERGE};
+    }
+    
+    return;
+}
+
+
+#================================================================
+# mergevar
+    
+# Merge a set of variance vectors to a single variance vector, which
+# in effect ties the variances together.
+    
+#--------------------------------
+sub mergevar
+{
+    my( $this, $mrgfile ) = @_;
+    my( $firstvar, $vname, $vbname, $vbref, $vref );
+    my( $vfact, $vsize, $vix );
+    my( $lin, $snum, @varlist, %base, %map );
+    my( $mname, $mref );
+    
+    
+    # process all lines of merge file
+    open( MRG, "$mrgfile" ) or die "Can not open merge file $mrgfile\n";
+
+    while( $lin = <MRG> )
+    {
+       chomp($lin);
+       @varlist = split( " ", $lin );
+       
+
+       # first variance on the line is the base variance to merge into
+       $firstvar  = 1;
+    
+      VAR:
+       foreach $vname ( @varlist )
+       {
+           if( $firstvar )
+           {
+               # initialize base variance
+               exists $this->{VARIANCE}{$vname} or die "Variance $vname does not exist\n";
+               $vbref = $this->{VARIANCE}{$vname};
+
+               ( $vbref->{TYPE} =~ /v/ ) or die "Can only merge variances for now\n";
+
+               # base variance macro name
+               $vbname = $vname;
+               
+               # keep track of base variances, can not merge base variances with each other
+               $base{$vbname} = 1;
+
+               # mapping to be used for converting variances in mixtures, map base to itself
+               $map{$vbname} = $vbname;
+
+               # initialize merge info if base model has not been used for merging yet
+               unless( exists $vbref->{MERGE}{NAME}{$vbname} )
+               {
+                   $vbref->{MERGE}{NAME}{$vbname} = 1;
+                   $vbref->{MERGE}{COUNT} = 1;
+               }
+
+               $firstvar = 0;
+               next VAR;
+           }
+           else
+           {
+               unless( exists $this->{VARIANCE}{$vname} )
+               {
+                   print STDERR "VARIANCE $vname does not exist, not merged with $vbname\n";
+                   next VAR;
+               }               
+
+               if( exists $base{$vname} )
+               {
+                   die "Attempt to merge base variance $vname into $vbname\n";
+               }
+
+               if( exists $vbref->{MERGE}{NAME}{$vname} )
+               {
+                   print STDERR "State $vname multiple merge for $vbname, not merged\n";
+                   next VAR;
+               }
+               else
+               {
+                   # add this variance to the variances merged with base variance
+                   $vbref->{MERGE}{NAME}{$vname} = ++$vbref->{MERGE}{COUNT};
+
+                   # map this variance to its merged base variance name
+                   $map{$vname} = $vbname;
+
+                   # reference to data for variance to merge with base variance
+                   $vref = $this->{VARIANCE}{$vname};
+               }
+           }
+
+           if( $vref->{SIZE} != $vbref->{SIZE} )
+           {
+               die "Merge size conflict for ${vbref} and ${vref}\n";
+           }
+
+           # merge variance with base variance
+
+           $vfact = 1/( $vbref->{MERGE}{COUNT} );
+           
+           # average base variance with new variance
+           $vsize = $vbref->{SIZE};
+           for( $vix = 0; $vix < $vsize; $vix++ )
+           {
+               $vbref->{VECTOR}[$vix] *= (1-$vfact);
+               $vbref->{VECTOR}[$vix] += $vfact * $vref->{VECTOR}[$vix];
+           }
+
+       }
+           
+       # remove the variance just merged with the base variance
+       delete $this->{VARIANCE}{$vname};
+    }
+
+    close( MRG );
+
+    # Modify all mixture macros to reflect the merged variances
+    while( ($mname, $mref) = each %{ $this->{MIXPDF} } )
+    {
+       $vname = $mref->{VARIANCE};
+       if( exists $map{$vname} )
+       {
+           $mref->{VARIANCE} = $map{$vname};
+           
+           # remove GCONST if it exists, since it is no longer valid
+           # could recompute it here, but let HTK do that
+           if( exists $mref->{GCONST} )
+           {
+               delete $mref->{GCONST};
+           }
+       }
+    }
+
+    # clean up - remove base and map hashes and merge information
+    undef %base;
+    undef %map;
+
+    while( ($vname, $vref) = each %{ $this->{VARIANCE} } )
+    {
+       delete $vref->{MERGE} if exists $vref->{MERGE};
+    }
+    
+    return;
+}
+
+
+#================================================================
+# mergemean
+    
+# Merge a set of mean vectors to a single mean vector, which
+# in effect ties the means together.
+    
+#--------------------------------
+sub mergemean
+{
+    my( $this, $mrgfile ) = @_;
+    my( $firstmean, $uname, $ubname, $ubref, $uref );
+    my( $ufact, $usize, $uix );
+    my( $lin, $snum, @meanlist, %base, %map );
+    my( $mname, $mref );
+    
+    
+    # process all lines of merge file
+    open( MRG, "$mrgfile" ) or die "Can not open merge file $mrgfile\n";
+
+    while( $lin = <MRG> )
+    {
+       chomp($lin);
+       @meanlist = split( " ", $lin );
+       
+
+       # first mean on the line is the base mean to merge into
+       $firstmean  = 1;
+    
+      MEAN:
+       foreach $uname ( @meanlist )
+       {
+           if( $firstmean )
+           {
+               # initialize base mean
+               exists $this->{MEAN}{$uname} or die "Mean $uname does not exist\n";
+               $ubref = $this->{MEAN}{$uname};
+
+               # base mean macro name
+               $ubname = $uname;
+               
+               # keep track of base means, can not merge base means with each other
+               $base{$ubname} = 1;
+
+               # mapping to be used for converting means in mixtures, map base to itself
+               $map{$ubname} = $ubname;
+
+               # initialize merge info if base model has not been used for merging yet
+               unless( exists $ubref->{MERGE}{NAME}{$ubname} )
+               {
+                   $ubref->{MERGE}{NAME}{$ubname} = 1;
+                   $ubref->{MERGE}{COUNT} = 1;
+               }
+
+               $firstmean = 0;
+               next MEAN;
+           }
+           else
+           {
+               unless( exists $this->{MEAN}{$uname} )
+               {
+                   print STDERR "MEAN $uname does not exist, not merged with $ubname\n";
+                   next MEAN;
+               }               
+
+               if( exists $base{$uname} )
+               {
+                   die "Attempt to merge base mean $uname into $ubname\n";
+               }
+
+               if( exists $ubref->{MERGE}{NAME}{$uname} )
+               {
+                   print STDERR "State $uname multiple merge for $ubname, not merged\n";
+                   next MEAN;
+               }
+               else
+               {
+                   # add this mean to the means merged with base mean
+                   $ubref->{MERGE}{NAME}{$uname} = ++$ubref->{MERGE}{COUNT};
+
+                   # map this variance to its merged base variance name
+                   $map{$uname} = $ubname;
+
+                   # reference to data for mean to merge with base mean
+                   $uref = $this->{MEAN}{$uname};
+               }
+           }
+
+           if( $uref->{SIZE} != $ubref->{SIZE} )
+           {
+               die "Merge size conflict for ${ubref} and ${uref}\n";
+           }
+
+           # merge variance with base variance
+
+           $ufact = 1/( $ubref->{MERGE}{COUNT} );
+           
+           # average base mean with new mean
+           $usize = $ubref->{SIZE};
+           for( $uix = 0; $uix < $usize; $uix++ )
+           {
+               $ubref->{VECTOR}[$uix] *= (1-$ufact);
+               $ubref->{VECTOR}[$uix] += $ufact * $uref->{VECTOR}[$uix];
+           }
+
+       }
+           
+       # remove the mean just merged with the base mean
+       delete $this->{MEAN}{$uname};
+    }
+
+    close( MRG );
+
+    # Modify all mixture macros to reflect the merged means
+    while( ($mname, $mref) = each %{ $this->{MIXPDF} } )
+    {
+       $uname = $mref->{MEAN};
+       if( exists $map{$uname} )
+       {
+           $mref->{MEAN} = $map{$uname};
+       }
+    }
+
+    # clean up - remove base and map hashes and merge information
+    undef %base;
+    undef %map;
+
+    while( ($uname, $uref) = each %{ $this->{MEAN} } )
+    {
+       delete $uref->{MERGE} if exists $uref->{MERGE};
+    }
+    
+    return;
+}
diff --git a/TIesr_Tools/HTKtmf.pm b/TIesr_Tools/HTKtmf.pm
new file mode 100755 (executable)
index 0000000..c05de9c
--- /dev/null
@@ -0,0 +1,309 @@
+#================================================================
+#  HTKtmf.pm
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+#  This module creates an object to encapsulate an HTK MLLR transform
+#  set.  The module creates the object and provides a method to 
+#  transform data using one of the transforms from the object.  The
+#  public interface to this object is given below.
+
+
+#  The object has the following structure
+#  $tmf->{UID} = $user_id_string
+#  $tmf->{NAME} = $user_name_string
+#  $tmf->{MMFID} = $mmf_id_string
+#  $tmf->{RCID} = $rec_class_id_string
+#  $tmf->{CHAN} = $channel_type_string
+#  $tmf->{DESC} = $description_string
+#  $tmf->{NBLOCKS} = $num_blocks_in_xfm
+#  $tmf->{NODETHRESH} = $thresh_for_node_xfm
+
+#  For each node, there is an occupancy count
+#  $tmf->{NODEOCC}[$node] = $occupancy_float
+
+#  The tmf may have many regression class transforms
+#  $tmf->{TRANSFORM}[$class]{MEAN_TR}{SIZE} = $square_mtx_dimension_per_block
+#  $tmf->{TRANSFORM}[$class]{MEAN_TR}{BLOCK}[$block][$row][$col] = $xfm_float
+#  $tmf->{TRANSFORM}[$class]{BIASOFFSET} = [@bias_offset_array]
+#  $tmf->{TRANSFORM}[$class]{VARIANCE_TR} = [@variance_xfm_float_array]
+
+
+#  The object has the following available public interface methods
+
+#  Constructor for a reference to a tmf object.
+
+#  $tmf = HTKtmf->new() 
+
+#  Parse an HTK tmf file into the object structure
+
+#  $tmf->parsetmf( $file_name )
+
+#  Transform a pdf using the given transform.  This transforms the
+#  mean, variance, and gconst, given a transform and a mean and an
+#  optional variance vector and an optional gconst value.  If you do
+#  not wish the variance and gconst transformed, then use undef for
+#  the input of these values, or do not include them.  If a variance 
+#  transform is not included in $tmf, then the variance and gconst
+#  will not be affected.  NOTE: this does the transform of the data 
+#  supplied by the references directly, so it changes the original
+#  contents referred to by the mean, var and gconst values.
+
+#  $tmf->transformpdf( $class, \@mean, \@var, \$gconst );
+
+#----------------------------------------------------------------
+
+#  Package header.  Now nothing exported.
+
+package HTKtmf;
+
+use strict qw( vars refs );
+
+use Exporter ();
+@HTKtmf::ISA = qw( Exporter );
+
+
+#================================================================
+#  new
+
+#  Construct a new tmf hash data structure and return a reference
+#  to it.
+
+#================================================================
+sub new
+{
+    my $class = shift;
+    my $this = {};
+    return bless $this, $class;
+}
+
+
+#================================================================
+
+#  parsetmf
+
+#  This function is the top level function that opens a tmf file and
+#  parses it into the structure.
+
+#--------------------------------
+sub parsetmf
+{
+    my( $this, $fname ) = @_;
+    my( $lin, @elem );
+
+    open( FH, "<$fname" ) or die "HTKtmf: can not open $fname\n";
+
+    while( $lin = <FH> )
+    {
+       chomp($lin);
+
+       # skip empty lines
+       if( $lin =~ /^\s*$/ )
+       {
+           next;
+       }
+
+       @elem = split( /[<>\s]+/, $lin );
+       shift @elem if( $elem[0] eq '' );
+
+       if( $elem[0] =~ /(UID|NAME|MMFID|RCID|CHAN|DESC|NBLOCKS|NODETHRESH)/i )
+       {
+           $this->{$1} = join( " ", @elem[1 .. $#elem] );
+       }
+       elsif( $elem[0] =~ /NODEOCC/i )
+       {
+           $this->{NODEOCC}[ $elem[1] ] = $elem[2];
+       }
+
+       elsif( $elem[0] =~ /TRANSFORM/i )
+       {
+           $lin = _parsexfm($this, \*FH, $lin );
+       }
+
+       else
+       {
+           # no recognized tmf format line found
+           die "HTKtmf: invalid line: $lin ";
+       }
+    }
+
+    close(FH)
+
+}
+
+#================================================================
+
+#  _parsexfm
+
+#  This sub parses the transformation section of a tmf file
+
+#--------------------------------
+
+sub _parsexfm
+{
+    my( $this, $fh, $lin ) = @_;
+    my( @elem );
+    my( $class, $blocksize, $block, @rowvals, $vecsize );
+    my( $row );
+    
+
+    while( $lin )
+    {
+       @elem = split( /[<>\s]+/, $lin );
+       shift @elem if( $elem[0] eq '' );
+
+       if( $elem[0] =~ /TRANSFORM/i )
+       {
+           $class = $elem[1];
+       }
+
+       elsif( $elem[0] =~ /MEAN_TR/i )
+       {
+           $blocksize = $elem[1];
+           $this->{TRANSFORM}[$class]{MEAN_TR}{SIZE} = $blocksize;
+       }
+
+       elsif( $elem[0] =~ /BLOCK/i )
+       {
+           $block = $elem[1];
+
+           for( $row = 0; $row < $blocksize; $row++ )
+           {
+               $lin = <$fh> or die "HTKtmf: tmf file format error\n";
+               chomp $lin;
+               @rowvals = split( " ", $lin );
+               $this->{TRANSFORM}[$class]{MEAN_TR}{BLOCK}[$block][$row] = [ @rowvals ];
+           }
+       }
+       
+       elsif( $elem[0] =~ /BIASOFFSET/i )
+       {
+           $vecsize = $elem[1];
+
+           $lin = <$fh> or die "HTKtmf: tmf file format error\n";
+           chomp $lin;
+           @rowvals = split( " ", $lin );
+           die "HTKtmf: vector error\n" if (scalar @rowvals != $vecsize );
+           $this->{TRANSFORM}[$class]{BIASOFFSET} =  [ @rowvals ];
+       }
+
+       elsif( $elem[0] =~ /VARIANCE_TR/i )
+       {
+           $vecsize = $elem[1];
+
+           $lin = <$fh> or die "HTKtmf: tmf file format error\n";
+           chomp $lin;
+           @rowvals = split( " ", $lin );
+           die "HTKtmf: vector error\n" if (scalar @rowvals != $vecsize );
+           $this->{TRANSFORM}[$class]{VARIANCE_TR} =  [ @rowvals ];
+       }       
+
+       else
+       {
+           # this line is not part of a transform
+           return $lin;
+       }
+
+       # get next line
+       $lin = <$fh>;
+    }
+
+    # no remaining lines
+    return $lin
+}
+
+
+#================================================================
+
+#  transformpdf
+
+#  This function transforms the mean, variance, and gconst, given a
+#  transform class, and the mean vector, variance vector, and gconst
+#  value as references.  If you do not wish a component transformed,
+#  just provide undef for that reference.
+
+#--------------------------------
+sub transformpdf
+{
+    my( $this, $class, $meanref, $varref, $gconstref ) = @_;
+    
+    my( $nblocks, $blocksize, $vecsize );
+    my( $offset, $block, $blockref, $row, $col, @xfmval, $index );
+    my( $index, $el );
+    
+
+    # ensure the class exists
+    if( ! defined $this->{TRANSFORM}[$class] )
+    {
+       die "HTKtmf: invalid transform RCLASS $class\n";
+    }
+
+
+    # transformation block information 
+    $nblocks = $this->{NBLOCKS};
+    $blocksize = $this->{TRANSFORM}[$class]{MEAN_TR}{SIZE};
+
+    # transform the mean
+    if( defined $meanref )
+    {
+       # size of mean vector
+       $vecsize = scalar @{$meanref};
+                                         
+       die "HTKtmf: mean size error\n" if( $vecsize != $nblocks*$blocksize );
+
+       # Initialize transformed mean vector to bias value
+       @xfmval = @{ $this->{TRANSFORM}[$class]{BIASOFFSET} };
+
+       # transformation of mean by block matrix
+       # blocks are one-based
+       for( $block=1; $block <= $nblocks; $block++ )
+       {
+           $offset = $blocksize*($block-1);
+           $blockref = $this->{TRANSFORM}[$class]{MEAN_TR}{BLOCK}[$block];
+           
+           for( $row= 0; $row < $blocksize; $row++ )
+           {
+               $index = $offset + $row;
+               
+               for( $col=0, $el=$offset; $col < $blocksize; $col++, $el++ )
+               {
+                   $xfmval[$index] += $blockref->[$row][$col]*$meanref->[$el];
+               }
+           }
+       }
+
+       # copy transformed mean vector to the model
+       @{ $meanref } = @xfmval;
+    }
+
+    
+    # transform the variance if variance exists and transform exists
+    if( defined $varref )
+    {
+       return unless( defined $this->{TRANSFORM}[$class]{VARIANCE_TR} );
+
+       $vecsize = scalar @{$varref};
+       die "HTKtmf: var size error\n" if ( $vecsize != $nblocks*$blocksize );
+       
+       for( $row = 0; $row < $vecsize; $row++ )
+       {
+           $varref->[$row] *= $this->{TRANSFORM}[$class]{VARIANCE_TR}[$row];
+       }
+    }
+
+    if( defined $gconstref )
+    {
+       return unless( defined $this->{TRANSFORM}[$class]{VARIANCE_TR} );
+
+       $vecsize = $nblocks*$blocksize;
+
+       for( $row = 0; $row < $vecsize; $row++ )
+       {
+           ${$gconstref} *=  $this->{TRANSFORM}[$class]{VARIANCE_TR}[$row];
+       }
+    }
+    
+    return;
+}
diff --git a/TIesr_Tools/HTKtrees.pm b/TIesr_Tools/HTKtrees.pm
new file mode 100755 (executable)
index 0000000..2f54b01
--- /dev/null
@@ -0,0 +1,240 @@
+#----------------------------------------------------------------
+#  HTKtrees.pm
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+# This module contains functions that parse an HTK trees file.  The
+# HTK trees file consists of a set of questions and a set of trees
+# based on those questions.  The result of parsing is a perl structure
+# that contains all information about the questions and trees.  The
+# functions and the structure of the resulting object are described
+# below.
+
+# $trees = HTKtree->new() 
+# Creates a hash and and returns a reference to the hash object which
+# is of the type HTKtree.  The hash will subsequently be filled by
+# parsing the HTK trees file.  The structure contents are as follows:
+
+# $trees->{QS}{$qsname} = [ @array_of_triphone_contexts ];
+
+# $trees->{TREE}{$tree_name}{PHONE} = $phone_name;
+# $trees->{TREE}{$tree_name}{STATE} = $emitting_state_number;
+# $trees->{TREE}{$tree_name}{NODE}[$node]{QUESTION} = $qsname;
+# $trees->{TREE}{$tree_name}{NODE}[$node]{NO} = $no_result;
+# $trees->{TREE}{$tree_name}{NODE}[$node]{YES} = $yes_result;
+
+# In the above, $node is a tree node number.  While in HTK node
+# numbers are <= 0, this parser changes negative node numbers to
+# positive node numbers.  The $no_result and $yes_result will either
+# be a node number >=0, or will be a cluster context name indicating a
+# terminal leaf node of $node.  It is possible for a tree to be a
+# singleton tree.  In this case, $qsname of node 0 will be undefined,
+# and the no and yes results will both be the terminal leaf cluster
+# context name.
+
+# $trees->parsetrees($filename)
+# This function parses the tree, filling the object data structure.
+
+#----------------------------------------------------------------
+package HTKtrees;
+
+use strict;
+
+use Exporter;
+
+@HTKtrees::ISA = qw( Exporter );
+
+
+#--------------------------------
+# new
+
+# Construct a new trees structure and bless it into this class
+sub new
+{
+    my $class = shift;
+    my $trees = {};
+    return bless $trees, $class;
+}
+
+
+#--------------------------------
+# parsetrees
+
+# This subroutine parses a tree file.
+
+sub parsetrees
+{
+    my $treesref = shift;
+    my $filename = shift;
+
+    open(TREE, "$filename" ) or 
+       die "HTKtree: invalid file $filename\n";
+
+    while( my $line = <TREE> )
+    {
+       chomp $line;
+
+       # Skip blank lines
+       next if $line =~ /^\s*$/;
+
+       # Determine if start of question or tree
+       if( $line =~ /^\bQS\b/ )
+       {
+           parsequestion( $treesref, $line );
+       }
+       elsif( $line =~ /^\s*[^\s]+\[\d+\]\s*$/ )
+       {
+           parseonetree( $treesref, $line, *TREE );
+       }
+       else
+       {
+           die "HTKtrees: parse fail for line\n$line\n";
+       }
+    }
+
+    close(TREE);
+}
+
+
+#----------------------------------------------------------------
+# parsequestion
+
+# This subroutine parses a question and puts the data into the
+# object structure.
+sub parsequestion
+{
+    my $treesref = shift;
+    my $line = shift;
+
+    # The line contains the question. 
+    # Parse the question into name and contexts.
+    $line =~ /^\s*QS\s+\'([^\']+)\'\s+\{\s+(.*?)\s+\}\s*$/
+       or die "HTKtrees: question parse fail\n$line\n";
+    my $qsname = $1;
+    my $contexts = $2;
+
+    # Check format of the contexts
+    $contexts =~ /^([^\s,]+\s*,\s*)*[^\s,]+$/
+       or die "HTKtrees: question context parse fail\n$line\n";
+
+    # Split out each context
+    my @cxtarray = split( /\s*,\s*/, $contexts );
+    foreach my $cxt (@cxtarray)
+    {
+       $cxt =~ s/\"//g;
+    }
+
+    # Put the result of the parse in the structure
+    $treesref->{QS}{$qsname} = \@cxtarray;
+}
+
+
+#----------------------------------------------------------------
+#parseonetree
+
+# This subroutine parses a single tree and outputs the tree contents
+# to the structure.
+
+sub parseonetree
+{
+    use strict;
+
+    # Arguments
+    my $treesref = shift;
+    my $line = shift;
+    local *TREE = shift;
+
+    # The first line contains the phone and state information
+    $line =~ /^\s*(([^\s]+)\[(\d+)\])\s*$/;
+    my $treename = $1;
+    my $phone = $2;
+    my $state = $3;
+
+    $treesref->{TREE}{$treename}{STATE} = $state;
+    $treesref->{TREE}{$treename}{PHONE} = $phone;
+    my $tree = $treesref->{TREE}{$treename};
+
+
+    # Parse the tree structure
+    my $complete = 0;
+    my $intree = 0;
+    while( $line = <TREE> )
+    {
+       chomp $line;
+
+       # Singleton tree
+       if( ! $intree and 
+           $line =~ /^\s*(\"[^\"]+?\"|[^\"\s{}]+)\s*$/ )
+       {
+           my $result = $1;
+           $result =~ s/\"//g;
+           $tree->{NODE}[0]{YES} = $result;
+           $tree->{NODE}[0]{NO} = $result;
+           $tree->{NODE}[0]{QUESTION} = undef;
+           $complete = 1;
+           last;
+       }
+
+       # Start of tree
+       elsif( ! $intree and
+              $line =~ /^\s*\{\s*$/ )
+       {
+           $intree = 1;
+       }
+
+       # tree node line
+       elsif( $intree and 
+              $line =~  m{
+                  ^\s*
+                      -?(\d+)\s+   # Node number
+                      \'([^\']+)\'\s+   # Question name
+                      (\"[^\"]+?\"|[^\s\"]+|-\d+)\s+  #No result
+                      (\"[^\"]+?\"|[^\s\"]+|-\d+)\s*$  #Yes result
+                  }x
+              )
+       {
+           my $node = $1;
+           my $question = $2;
+           my $noans = $3;
+           my $yesans = $4;
+           $noans =~ s/-// if $noans =~ /^-\d+$/;
+           $noans =~ s/\"//g;
+           $yesans =~ s/-// if $yesans =~ /^-\d+$/;
+           $yesans =~ s/\"//g;
+           $tree->{NODE}[$node]{QUESTION} = $question;
+           $tree->{NODE}[$node]{NO} = $noans;
+           $tree->{NODE}[$node]{YES} = $yesans;
+       }
+       
+                                      
+       # End of tree, check for at least one node.
+       # This is not a complete test for a valid tree.  In order
+       # to do that you would have to parse the tree and ensure
+       # that all nodes wind up in a terminal leaf node, etc.  Maybe
+       # that could be added as a function later, but since 
+       # trees are generated by HTK they should be ok, unless 
+       # the user edits the trees file.
+
+       elsif( $intree and
+              $line =~ /^\s*\}\s*$/ )
+       {
+           die "HTKtrees: Invalid tree for $treename\n" 
+               unless defined $tree->{NODE}[0];
+           
+           $complete = 1;
+           $intree = 0;
+           last;
+       }
+       
+       # Line is not valid line for a tree
+       else
+       {
+           die "HTKtrees: Invalid tree for $treename\n";
+       }
+    }
+
+    # A complete tree was not found
+    die "HTKtrees: incomplete tree for $treename\n" unless $complete;
+}
diff --git a/TIesr_Tools/Makefile b/TIesr_Tools/Makefile
new file mode 100644 (file)
index 0000000..87127ac
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+# This Makefile will build all of the TIesr Tools for a given
+# configuration. It is assumed that the gnu tools, such as gcc and g++ exist
+# and are on the PATH so that they can be accessed by specifying "gcc" and
+# "g++" on the command line (or "gcc.exe" an "g++.exe for Windows).  The
+# proper method of using this Makefile is to build for a given configuration,
+# for example:
+#
+# make LinuxDebugGnu
+#
+# The valid configurations are:
+#
+# LinuxDebugGnu
+# LinuxReleaseGnu
+# WindowsDebugMinGW
+# WindowsReleaseMinGW
+#
+# The Makefile also supports building any subset of projects for the selected
+# configuration by specifying the list of projects as the PROJECTS variable
+# on the command line.  For example, to build the TIesrDT and TestTIesrDT 
+# projects for the LinuxDebugGnu configuration:
+#
+# make LinuxDebugGnu  PROJECTS='dictproc'
+#
+# Supported projects are:
+#
+# dictproc
+#
+# Build steps that can be performed are specified by the STEP variable, which 
+# may be set to "clean", "build", or "clobber".  If not set, "build" is the default.
+#
+
+# Supported configurations
+WINCONFS = WindowsDebugMinGW WindowsReleaseMinGW
+LINUXCONFS = LinuxDebugGnu LinuxReleaseGnu 
+
+# Configurations are phony targets
+.PHONY : $(WINCONFS) $(LINXCONFS)
+
+# Supported projects that are OS independent
+TOOLPROJECTS = dictproc gaussiancluster
+
+# Projects that are OS dependent
+WINPROJECTS = 
+LINUXPROJECTS = 
+
+# Projects are phony targets
+.PHONY : $(TOOLPROJECTS) $(WINPROJECTS) $(LINUXPROJECTS)
+
+# Unless PROJECTS is specified on the command line, the target will build all
+# projects for the given configuration
+BUILDWINPROJECTS =   $(WINPROJECTS) $(TOOLPROJECTS)
+BUILDLINUXPROJECTS =   $(LINUXPROJECTS) $(TOOLPROJECTS)
+
+#If PROJECTS is defined on the command line, it replaces projects to build
+ifdef PROJECTS
+BUILDWINPROJECTS = $(PROJECTS)
+BUILDLINUXPROJECTS = $(PROJECTS)
+endif
+
+# Unless STEP is specified, default to build
+STEP=build
+
+# Specify use of windows Cygwin gcc tools if building for Windows
+$(WINCONFS) : WINTOOLS=CC=gcc.exe CCC=g++.exe CXX=g++.exe AS=as.exe CND_PLATFORM=Cygwin-Windows
+$(LINUXCONFS) : WINTOOLS=
+
+# Define a variable holding the configuration to be built
+WindowsDebugMinGW : BUILDCONF=WindowsDebugMinGW
+WindowsReleaseMinGW : BUILDCONF=WindowsReleaseMinGW
+LinuxDebugGnu : BUILDCONF=LinuxDebugGnu
+LinuxReleaseGnu : BUILDCONF= LinuxReleaseGnu
+
+# Rules to build all requested projects for the target configuration
+$(WINCONFS) : $(BUILDWINPROJECTS)
+
+$(LINUXCONFS) : $(BUILDLINUXPROJECTS)
+
+# Rules to build each project
+dictproc : 
+       cd dictproc && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+
+gaussiancluster :
+       cd GaussianCluster && $(MAKE) SUB=no CONF=$(BUILDCONF) $(WINTOOLS) $(STEP)
+
+.PHONY : help
+help : 
+       @echo 'This Makefile will build all of the TIesr Tools for a given'
+       @echo 'configuration. It is assumed that the gnu tools, such as gcc and g++ exist and'
+       @echo 'are on the PATH so that they can be accessed by specifying "gcc" and "g++" on the'
+       @echo 'command line (or "gcc.exe" an "g++.exe" for Windows).  The proper method of'
+       @echo 'using this Makefile is to build for a given configuration, for example:'
+       @echo ' '
+       @echo 'make LinuxDebugGnu'
+       @echo ' '
+       @echo 'The valid configurations are:'
+       @echo ' '
+       @echo 'LinuxDebugGnu'
+       @echo 'LinuxReleaseGnu'
+       @echo 'WindowsDebugMinGW'
+       @echo 'WindowsReleaseMinGW'
+       @echo ' '
+       @echo 'The Makefile also supports building any subset of projects for the selected'
+       @echo 'configuration by specifying the list of projects as the PROJECTS variable'
+       @echo 'on the command line.  For example, to build the dictproc'
+       @echo 'project for the LinuxDebugGnu configuration:'
+       @echo ' '
+       @echo 'make LinuxDebugGnu  PROJECTS="dictproc"'
+       @echo ' '
+       @echo 'Supported projects are:'
+       @echo ' '
+       @echo 'dictproc'
+       @echo 'gaussiancluster'
+       @echo ' '
+       @echo 'Build steps that can be performed are specified by the STEP variable, which'
+       @echo 'may be set to "clean", "build", or "clobber".  If not set, "build" is the default.'
+       @echo 'For example:'
+       @echo ' '
+       @echo 'make LinuxDebugGnu PROJECTS=dictproc STEP=clean'
diff --git a/TIesr_Tools/TIesrModel.pm b/TIesr_Tools/TIesrModel.pm
new file mode 100644 (file)
index 0000000..ac216e6
--- /dev/null
@@ -0,0 +1,1019 @@
+#================================================================
+#  Module TIesrModel.pm
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+#  ALL RIGHTS RESERVED
+
+
+#  This module creates an object to encapsulate a TIESR fixed point
+#  model set. The module creates the object and provides methods
+#  to parse the models and expose the components of the models.  The
+#  public interface to this object is given below.  Unlike many
+#  modules, the output object structure is provided for use by
+#  applications so that the models can be manipulated.
+#  
+
+#  The object has the following structure
+
+#  $model->{NUMHMMS} = $number of HMMs in model set
+
+#  $model->{DIM} = $feature dimension
+
+#  $model->{WORDS} = \@array of WORDS represented by this HMM model set
+
+#  $model->{HMMMAP} = \@array mapping each (possibly triphone) HMM index to a monophone index
+
+#  Note: means, variances, and gconst are all represented in signed short,
+#  without any conversion to floating point.
+
+#  $model->{NUMMEANS} = $number of mean vectors
+#  $model->{MEANS} = \@array of mean vector references consisting of array of feature means
+
+#  $model->{NUMVARS} = $number of var vectors
+#  $model->{VARS} = \@array of variance vectors consisting of array of variances
+
+#  $model->{SCALES} = \@array of byte shift scaling if either mean or variance is in byte
+
+#  $model->{GCONST} \@array of gconst values
+
+#  $model->{TRANS} = \@array of transition structures holding transition info 
+
+#  $model->{PDF} = \@array of pdf structures holding pdf info
+
+#  $model->{HMM} = \@array of HMM structures holding HMM data
+
+#  $model->{NUMCLUSTERS} = $number of gaussian clusters (if available)
+
+#  $model->{CLUSTER} = \@array of cluster index for each gaussian mean vector
+
+#  $model->{CENTROID} = \@array of references to cluster centroid vectors
+
+#  The transition structure is as follows
+#  $trn->{NUMSTATES} = $number of states in transition matrix
+#  $trn->{ENTRY} = \@array of ln entry prob into state 0..NUMSTATES-1 (last non-emitting state excluded )
+#  $trn->{TRANS} = \[$i][$j] ln prob of transition from emitting state $i to all states $j
+
+#  The pdf structure is as follows
+#  $pdf->{NUMGAUSS} = $number of Gaussians in pdf
+#  $pdf->{GAUSS} = \@array of Gaussian info for each Gaussian of the pdf
+
+#  The Gaussian info structure is as follows
+#  $gauss->{WGT} = $weight in ln of Gaussian component
+#  $gauss->{MEAN} = $mean vector index
+#  $gauss->{VAR} = $var vector index
+
+#  The HMM info structure is as follows
+#  $hmm->{TRANS} = $index of transition matrix info for this HMM
+#  $hmm->{PDF} = \@array of PDF indices for each emitting state
+#  $hmm->{NAME} = $hmmname if a listing of HMMs provided during parse
+
+
+#  The object has the following available public interface methods
+
+#  Constructor for a reference to a tmf object.
+#  $model = TIesrModel->new() 
+
+#  Parse the TIesr model files into the object structure.  If an HMM
+#  list file is provided then additional information will be available
+#  in the structure for each HMM 
+#  $model->parse( $modeldir [,$hmm_list_file] )
+
+#  Output a model set.  Flags indicating whether to do $bytemean and
+#  $bytevar output are required. If $little_endian is true output will
+#  be in little endian format.
+#  $model->output( $modeldir, $bytemean, $bytevar, $little_endian )
+
+#----------------------------------------------------------------
+
+#  Package header.  Now nothing exported.
+
+package TIesrModel;
+
+use strict qw( vars refs );
+
+use Exporter ();
+@TIesrModel::ISA = qw( Exporter );
+
+
+#----------------------------------------------------------------
+#  new
+
+#  Construct a new TIesrModel hash data structure and return a reference
+#  to it.  At this time the constructor does not provide for 
+#  cloning by passing a reference to a blessed TIesrModel object.
+#------------------------------------------------------------
+sub new
+{
+    my $class = shift;
+    my $this = {};
+    return bless $this, $class;
+}
+
+
+#----------------------------------------------------------------
+
+#  parse
+
+#  This function parses the model data into a structure.
+
+#----------------------------------------------------------------
+sub parse
+{
+    my( $model,  $modeldir, $hmmfile ) = @_;
+
+    # if configuration data exists get it or set defaults
+    my $buf;
+    my ($bytemean, $bytevar, $le);
+    my $pks;
+    if( open( FH, "${modeldir}/config.bin" ) )
+    {
+       read  FH, $buf, 6;
+       ($bytemean,$bytevar,$le) = unpack "n*", $buf;
+       $pks =  $le ?  "v*"  : "n*";
+       close(FH);
+    }
+    else
+    {
+       # if no config.bin, assume byte mean and var which was the latest
+       # config prior to implementing config.bin.  Endian must be found
+       # from dim.bin file
+       $bytemean = 1;
+       $bytevar = 1;
+    }
+
+    # Get dimension data.  Determine if big/little endian if needed
+    open( FH, "${modeldir}/dim.bin") or die "Invalid dim.bin file\n";
+    read FH, $buf, 2;
+    if( defined $pks )
+    {
+       $model->{DIM} = unpack $pks, $buf;
+    }
+    else
+    {
+       my $dim = unpack "n", $buf;
+       $pks =  ( $dim & 0xff00 )  ? "v*" : "n*";
+       $model->{DIM} = unpack $pks, $buf;
+    }
+    close(FH);
+
+
+    # Get words represented in grammar
+    open( FH, "$modeldir/word.lis" ) or die "Could not open word.lis\n";
+    my @words = <FH>;
+    close(FH);
+    chomp @words;
+    $model->{WORDS} = \@words;
+
+
+    # Get hmm to phone mapping array
+    if( open( FH, "$modeldir/hmm2phone.bin" ) )
+    {
+       my $hmmidx = 0;
+       while( read FH, $buf, 2 )
+       {
+           my $phone = unpack $pks, $buf;
+           $phone -= 2**16 if $phone >= 2**15;
+           $model->{HMMMAP}[$hmmidx++] = $phone;
+       }
+       close(FH);
+    }
+    
+
+    # Obtain scale information if byte mean or var
+    if( $bytemean or $bytevar )
+    {
+       open( FH, "$modeldir/scale.bin" ) or die "Could not open scale.bin\n";
+       read FH, $buf, $model->{DIM}*8;
+       my @scales = unpack $pks, $buf;
+       $model->{SCALES} = \@scales;
+       close(FH);
+    }
+
+    # Get mean vectors
+    open(FH, "$modeldir/mu.bin" ) or die "Could not open mu.bin\n";
+    my $nummeans;
+    read FH, $buf, 2;
+    $nummeans = unpack $pks, $buf;
+    $model->{NUMMEANS} = $nummeans;
+
+    my $r_means = get_vectors( *FH, $nummeans, $model->{DIM}, $pks, $bytemean, $model->{SCALES} );
+    $model->{MEANS} = $r_means;
+    close(FH);
+
+    # Get var vectors
+    open(FH, "$modeldir/var.bin" ) or die "Could not open var.bin\n";
+    my $numvars;
+    read FH, $buf, 2;
+    $numvars = unpack $pks, $buf;
+    $model->{NUMVARS} = $numvars;
+
+    # variance scales are last half of scales
+    my @scales;
+    if( $bytevar )
+    {
+       @scales = @{$model->{SCALES}};
+       @scales = @scales[ 2*$model->{DIM} .. $#{$model->{SCALES}} ];
+    }    
+    my $r_vars = get_vectors( *FH, $numvars, $model->{DIM}, $pks, $bytevar, \@scales );
+
+    $model->{VARS} = $r_vars;
+
+
+    # Get GCONST values
+    open(FH, "$modeldir/gconst.bin" ) or die "Could not open gconst.bin\n";
+    my $numgconst;
+    read FH, $buf, 2;
+    $numgconst = unpack $pks, $buf;
+
+    # Read all gconst values, ensuring they are in signed short
+    read FH, $buf, 2*$numgconst;
+    my @gconst = unpack $pks, $buf;
+    my $gconst;
+    foreach $gconst (@gconst)
+    {
+       $gconst  -= 2**16 if $gconst >= 2**15;
+    } 
+    $model->{GCONST} = \@gconst;
+    close(FH);
+
+
+    # Read in Transition matrix info
+    get_trans( $modeldir, $model, $pks );
+
+
+    # Read in Gaussian mixture info
+    get_mixture( $modeldir, $model, $pks );
+
+    # Read in Gaussian cluster info if it exists
+    get_cluster( $modeldir, $model, $pks );
+
+
+    # Read in hmm information
+    get_hmm( $modeldir, $model, $pks );
+
+    if( $hmmfile )
+    {
+       open( FH, $hmmfile ) or die "Could not open hmm list file\n";
+       my @hmmnames = <FH>;
+       close(FH);
+       chomp( @hmmnames );
+
+       die "HMM name list count mismatch\n" if ($#hmmnames != $#{$model->{HMM}} );
+
+       my $index = 0;
+       foreach my $name (@hmmnames)
+       {
+           $model->{HMM}[$index++]{NAME} = $name;
+       }
+       close(FH);
+    }
+
+}
+
+
+#----------------------------------------------------------------
+# get_trans
+
+# Read transition matrix information from file
+
+#----------------------------------------------------------------
+sub get_trans
+{
+    my( $modeldir, $model, $pks ) = @_;
+
+    open(FH, "$modeldir/tran.bin" ) or die "Could not open tran.bin\n";
+    my $buf;
+    my $fsize;
+    my $nstates;
+    my $ntrans = 0;
+    read FH, $buf, 2;
+    $fsize = unpack $pks, $buf;
+
+    while( read FH, $buf, 2 )
+    {
+       $nstates = unpack $pks, $buf;
+       $model->{TRANS}[$ntrans]{NUMSTATES} = $nstates;
+
+       my $r_entry = [];
+       read FH, $buf, 2*($nstates-1);
+       @$r_entry = unpack $pks, $buf;
+       my $val;
+       foreach $val (@$r_entry)
+       {
+           $val -= 2**16  if $val >= 2**15;
+       }
+       $model->{TRANS}[$ntrans]{ENTRY} = $r_entry;
+
+       # Obtain transitions from each emitting state to all states
+       foreach my $state ( 0 .. $nstates-2)
+       {
+
+           my $r_trans = [];
+           read FH, $buf, 2*($nstates);
+           @$r_trans = unpack $pks, $buf;
+           foreach $val (@$r_trans)
+           {
+               $val -= 2**16  if $val >= 2**15;
+           }
+           $model->{TRANS}[$ntrans]{TRANS}[$state] = $r_trans;
+       }
+
+       $ntrans++;
+    }
+    close(FH);
+}
+
+
+#----------------------------------------------------------------
+# get_mixture
+
+# Read mixture information from file
+
+#----------------------------------------------------------------
+sub get_mixture
+{
+    my( $modeldir, $model, $pks ) = @_;
+
+    open(FH, "$modeldir/mixture.bin" ) or die "Could not open tran.bin\n";
+    my $buf;
+    my $fsize;
+    read FH, $buf, 2;
+    $fsize = unpack $pks, $buf;
+
+    my $nmix = 0;
+    while( read FH, $buf, 2 )
+    {
+       my $ngauss;
+       $ngauss = unpack $pks, $buf;
+       $model->{PDF}[$nmix]{NUMGAUSS} = $ngauss;
+
+       my $gauss;
+       for $gauss ( 0 .. $ngauss-1 )
+       {
+           my @ginfo;
+           read FH, $buf, 6;
+           @ginfo = unpack $pks, $buf;
+           $ginfo[0] -= 2**16 if $ginfo[0] >= 2**15;
+
+           @{$model->{PDF}[$nmix]{GAUSS}[$gauss]}{WGT,MEAN,VAR} = @ginfo;
+       }
+       $nmix++;
+    }
+    close(FH);
+}
+
+
+#---------------------------------------------------------------
+# get_cluster
+
+# Get cluster information that supports rapid JAC and ORM if 
+# the files exist.
+#---------------------------------------------------------------
+sub get_cluster
+{
+    my( $modeldir, $model, $pks ) = @_;
+
+    # Get number of gaussians clustered
+    open(FH, "$modeldir/o2amidx.bin" ) or return;
+
+    my $buf;
+    my $ngauss;
+
+    read FH, $buf, 2;
+    ($ngauss) = unpack $pks, $buf;
+
+    die "Invalid cluster data\n" unless $ngauss == $model->{NUMMEANS};
+
+    # Read in all cluster classes for each Gaussian
+    read FH, $buf, $ngauss;
+    my @clusters = unpack "C*", $buf;
+    $model->{CLUSTER} = \@clusters;
+    close(FH);
+    
+
+    # Get number of class cluster mean centroids
+    open(FH, "$modeldir/vqcentr.bin" ) or 
+       die "Failed to open ${modeldir}/vqcentr.bin\n";
+
+    read FH, $buf, 4;
+    my $ncluster;
+    my $ndim;
+    ($ncluster, $ndim) = unpack $pks, $buf;
+
+    $model->{NUMCLUSTERS} = $ncluster;
+    
+    # Read all class cluster centroid vectors
+    for( my $class=0; $class < $ncluster; $class++ )
+    {
+       my $r_vec = [];
+       
+       read FH, $buf, 2*$ndim;
+       @$r_vec = unpack $pks, $buf;
+
+       foreach my $val ( @$r_vec )
+       {
+           $val -= 2**16  if $val >= 2**15;
+       }
+
+
+       $model->{CENTROID}[$class] = $r_vec;
+    }
+
+    close(FH);
+}
+
+
+#----------------------------------------------------------------
+#  get_hmm
+
+#  Retrieve the gender-dependent HMM info 
+#----------------------------------------------------------------
+sub get_hmm
+{
+    my( $modeldir, $model, $pks ) = @_;
+
+    # Get number of gender-dependent HMMs from net.bin file
+    open(FH, "$modeldir/net.bin" ) or die "Could not open net.bin\n";
+    my $buf;
+    my $fsize;
+    my $nhmms;
+    read FH, $buf, 4;
+    ($fsize,$nhmms) = unpack $pks, $buf;
+    close(FH);
+    $model->{NUMHMMS} = $nhmms;
+
+
+    # Build a hash that maps from a transition offset to a transition info index.
+    # This is needed because hmm.bin has transition offsets rather than indices.
+    my %toffset;
+    my $index = 0;
+    my $offset = 0;
+    foreach my $tran ( @{$model->{TRANS}} )
+    {
+       $toffset{$offset} = $index;
+       $offset += $tran->{NUMSTATES} * $tran->{NUMSTATES};
+       $index++;
+    }
+    
+    # Open hmm.bin file
+    open(FH, "$modeldir/hmm.bin" ) or die "Could not open hmm.bin\n";
+    read FH, $buf, 2;
+    $fsize = unpack $pks, $buf;
+
+    # Read past offsets
+    read FH, $buf, 2*$nhmms;
+
+    #Gather data for all hmms
+    foreach my $hmm ( 0 .. $nhmms-1 )
+    {
+
+       # Transition index from offset
+       my $trnoff;
+       read FH, $buf, 2;
+       $trnoff = unpack $pks, $buf;
+       die "Bad hmm offset\n" unless exists $toffset{$trnoff};
+       my $tran =$toffset{$trnoff}; 
+       $model->{HMM}[$hmm]{TRANS} = $tran;
+       
+       # PDF indices for each emitting state
+       my $nstates = $model->{TRANS}[$tran]{NUMSTATES};
+       my $r_pdf = [];
+       read FH, $buf, 2*($nstates-1);
+       @$r_pdf = unpack $pks, $buf;
+       $model->{HMM}[$hmm]{PDF} = $r_pdf;
+    }
+
+    close(FH);
+}
+
+
+#----------------------------------------------------------------
+# get_vectors
+
+# Retrieve vectors of means or variances in short.
+#----------------------------------------------------------------
+sub get_vectors
+{
+    local (*FH) = shift;
+    my ( $numvec, $dim, $pks, $byteflag, $r_scales ) = @_;
+
+    my @vectors;
+    my $vecidx;
+    my $buf;
+    for $vecidx (0 .. $numvec-1)
+    {
+       my $r_vec = [];
+       if( $byteflag )
+       {
+           # Read static and delta bytes packed into short values
+           read FH, $buf, 2*$dim;
+           my @vec;
+           @vec = unpack $pks, $buf;
+           
+           # unpack byte information from short data in vec
+           my $index;
+           for $index ( 0 .. $dim - 1 )
+           {
+               # Convert unsigned short to two signed bytes
+               $buf = pack "cc", ( ($vec[$index] & 0xff00) >> 8 ), ($vec[$index] & 0x00ff);
+               my @bytes = unpack "cc", $buf;
+
+               # byte vectors have interleaved static/dynamic elements
+               $$r_vec[$index] = ( $bytes[0] * (2**8) )/( 2**$$r_scales[$index]);
+               $$r_vec[$index + $dim] =  ( $bytes[1] * (2**8) )/(2**$$r_scales[$index+$dim]);
+           }
+       }
+
+       else
+       {
+           # Read static and delta short data elements
+           read FH, $buf, $dim*2*2;
+           my @vec = unpack $pks, $buf;
+
+           # convert unsigned short to signed short
+           foreach my $val (@vec)
+           {
+               $val -= 2**16 if $val >= 2**15;
+           }
+
+           @$r_vec = @vec;
+       }
+
+       $vectors[$vecidx] = $r_vec;
+    }
+
+    return \@vectors;
+}
+
+
+#------------------------------------------------------------------
+# output
+
+# Output the model data to a directory in the format requested.
+#------------------------------------------------------------------
+sub output
+{
+    my( $model, $outdir, $bytemean, $bytevar, $little_endian ) = @_;
+
+
+    my $pkshort = $little_endian ?  "v*"  : "n*" ;
+
+    # Output the configuration file
+    open( CNF, ">${outdir}/config.bin" ) or
+       die "Failed to open ${outdir}/config.bin\n";
+    print CNF pack $pkshort, ( $bytemean ?  1 : 0 );
+    print CNF pack $pkshort, ( $bytevar ?  1 : 0 );
+    print CNF pack $pkshort, ( $little_endian ?  1 : 0 );
+    close( CNF );
+
+
+    # Output dim.bin
+    open( DIM, ">${outdir}/dim.bin" ) or 
+       die "Failed to open ${outdir}/dim.bin\n";
+    print DIM pack $pkshort, $model->{DIM};
+    close(DIM);
+
+
+    # Output the word list
+    open( WRD, ">${outdir}/word.lis" ) or
+       die "Failed to open ${outdir}/word.lis\n";
+    foreach my $word ( @{ $model->{WORDS} } )
+    {
+       print WRD "$word\n";
+    }
+    close( WRD );
+
+
+    # Output hmm to phone mapping array
+    open( MAP, ">${outdir}/hmm2phone.bin" ) or
+       die "Failed to open ${outdir}/hmm2phone.bin\n";
+    print MAP pack $pkshort, @{ $model->{HMMMAP} };
+    close( MAP );
+
+
+    # Output hmm transition array information
+    output_trans( $model, $outdir, $pkshort );
+
+
+    # Output state pdf mixture information
+    output_mixture( $model, $outdir, $pkshort );
+
+    
+    output_cluster( $model, $outdir, $pkshort );
+
+    
+    # Output hmm information
+    output_hmm( $model, $outdir, $pkshort );
+
+
+    # Output Gaussian information, based on what characteristics 
+    # of the output means and variances are requested.
+    output_gconst( $model, $outdir, $pkshort );
+
+    my $refmscales = output_mean( $model, $outdir, $pkshort, $bytemean );
+
+    my $refvscales = output_var( $model, $outdir, $pkshort, $bytevar );
+
+    if( $bytemean or $bytevar )
+    {
+       open( SC, ">${outdir}/scale.bin" ) or 
+           die "Failed to open ${outdir}/scale.bin\n";
+
+       print SC pack $pkshort, @{ $refmscales };
+       print SC pack $pkshort, @{ $refvscales };
+    }
+}
+
+#-------------------------------------------------------------
+# output_trans
+
+# Output transition array data for each transition
+#-------------------------------------------------------------
+sub output_trans
+{
+    my ( $model, $outdir, $pkshort ) = @_;
+
+    my $trnsize = 0;
+    open( TRN, ">${outdir}/tran.bin" ) or
+       die "Failed to open ${outdir}/tran.bin\n";
+
+    # Dummy initial size
+    print TRN pack $pkshort, $trnsize;
+
+    #Output all transition array info
+    foreach my $trnref ( @{ $model->{TRANS} } )
+    {
+       # Number of states in transition array including final non-emitting state
+       my $nstates = $trnref->{NUMSTATES};
+       print TRN pack $pkshort, $nstates;
+       $trnsize++;
+
+       # Entry probabilities in integer log
+       print TRN pack $pkshort, @{ $trnref->{ENTRY} };
+       $trnsize += scalar( @{ $trnref->{ENTRY} } );
+       
+
+       # Transition probabilities in integer log for each state
+       foreach my $state ( 0 .. $nstates-2 )
+       {
+           print TRN pack $pkshort, @{ $trnref->{TRANS}[$state] };
+           $trnsize += scalar(@{ $trnref->{TRANS}[$state] } ); 
+       }
+    }
+    
+    # output final size of tran data
+    seek TRN, 0, 0;
+    print TRN pack $pkshort, $trnsize;
+    close( TRN );
+}
+
+#-----------------------------------------------------------------
+# output_mixture
+
+# output Gaussian mixture info. Also outputs the pdf.bin offsets
+#-----------------------------------------------------------------
+sub output_mixture
+{
+    my ( $model, $outdir, $pkshort ) = @_;
+
+    open( MIX, ">${outdir}/mixture.bin" ) or
+       die "Failed to open ${outdir}/mixture.bin\n";
+
+
+    open( PDF, ">${outdir}/pdf.bin" ) or
+       die "Failed to open ${outdir}/pdf.bin\n";
+
+
+    # Initialize dummy size of mixture data
+    my $mixsize = 0;
+    print MIX pack $pkshort, $mixsize;
+
+    # Put number of pdfs in pdf.bin
+    print PDF pack $pkshort, scalar( @{ $model->{PDF} } );
+
+
+    # Output each Gaussian mixture
+    foreach my $mixref ( @{ $model->{PDF} } )
+    {
+       # Output offset of this pdf 
+       print PDF pack $pkshort, $mixsize;
+
+       # Number of Gaussian components in mixture
+       my $ngauss = $mixref->{NUMGAUSS};
+       print MIX pack $pkshort, $ngauss;
+       $mixsize++;
+
+
+       foreach my $gauss ( 0 ..  $ngauss-1 )
+       {
+           my @ginfo = @{ $mixref->{GAUSS}[$gauss] }{WGT,MEAN,VAR};
+           print MIX pack $pkshort, @ginfo;
+           $mixsize += scalar( @ginfo );
+       }
+                          
+    }
+
+    close( PDF );
+
+    # Output final size of mixture data
+    seek MIX, 0, 0;
+    print MIX pack $pkshort, $mixsize;
+    close( MIX );
+}
+
+#----------------------------------------------------------------------
+# output_cluster
+
+# Output cluster information if available.
+#---------------------------------------------------------------------
+sub output_cluster
+{
+    my ( $model, $outdir, $pkshort ) = @_;
+
+    return if ! exists $model->{NUMCLUSTERS};
+
+
+    # Output cluster index for each mean vector
+    open( CLS, ">${outdir}/o2amidx.bin" ) or
+       die "Failed to open ${outdir}/o2amidx.bin\n";
+    
+    print CLS pack $pkshort, $model->{NUMMEANS};
+
+    print CLS pack "C*", @{ $model->{CLUSTER} };
+
+    close( CLS );
+
+
+    # Output cluster centroids for each cluster class
+    open( CEN, ">${outdir}/vqcentr.bin" ) or 
+       die "Failed to open ${outdir}/vqcentr.bin\n";
+
+    print CEN pack $pkshort, $model->{NUMCLUSTERS};
+    print CEN pack $pkshort, scalar( @{ $model->{CENTROID}[0] } );
+    for( my $class = 0; $class < $model->{NUMCLUSTERS}; $class++ )
+    {
+       print CEN pack $pkshort, @{ $model->{CENTROID}[$class] };
+    }
+    close( CEN );
+}
+
+
+
+
+#-----------------------------------------------------------------------
+# output_hmm
+
+# Output HMM info which tells which transition matrix, and state pdfs are
+# used by each HMM.
+#-----------------------------------------------------------------------
+sub output_hmm
+{
+
+    my ( $model, $outdir, $pkshort ) = @_;
+
+    open( HMM, ">${outdir}/hmm.bin" ) or
+       die "Failed to open ${outdir}/hmm.bin\n";
+
+    # Initialize dummy size
+    my $hmmsize = 0;
+    print HMM pack $pkshort, $hmmsize;
+
+    # Initialize dummy HMM offsets
+    my $nhmms = $model->{NUMHMMS};
+    my @hmmoffset = (0) x $nhmms;
+    print HMM pack $pkshort, @hmmoffset;
+    $hmmsize += $nhmms;
+
+    # Build a list that maps from a transition indices to offsets
+    # in tran.bin. This is needed because HMM definitions in
+    # hmm.bin specify transition offsets in tran.bin rather than indices.
+    my @toffset;
+    my $trnindex = 0;
+    my $trnoffset = 0;
+    foreach my $tran ( @{$model->{TRANS}} )
+    {
+       $toffset[$trnindex] = $trnoffset;
+       $trnoffset += $tran->{NUMSTATES} * $tran->{NUMSTATES};
+       $trnindex++;
+    }
+
+
+    # Output data for each HMM
+    my $hmmindex = 0;
+    foreach my $hmmref ( @{ $model->{HMM} } )
+    {
+       $hmmoffset[$hmmindex++] = $hmmsize;
+
+       # Offset to transition array info in tran.bin
+       $trnindex = $hmmref->{TRANS};
+       print HMM pack $pkshort, $toffset[$trnindex];
+       $hmmsize++;
+
+       # PDF mixture indices for each state
+       print HMM pack $pkshort, @{ $hmmref->{PDF} };
+       $hmmsize += scalar( @{ $hmmref->{PDF} } );
+    }
+
+
+    # Output final file size and hmm offset info
+    seek HMM, 0, 0;
+    print HMM pack $pkshort, $hmmsize;
+    print HMM pack $pkshort, @hmmoffset;
+    close( HMM );
+}
+
+
+#------------------------------------------------------------
+# output_gconst
+
+# Output Gaussian constant for each Gaussian
+#------------------------------------------------------------
+sub output_gconst
+{
+    my ( $model, $outdir, $pkshort ) = @_;
+
+    open( GC, ">${outdir}/gconst.bin" ) or
+       die "Failed to open ${outdir}/gconst.bin\n";
+
+    print GC pack $pkshort, scalar( @{ $model->{GCONST} } );
+    
+    print GC pack $pkshort, @{ $model->{GCONST} };
+
+    close( GC );
+}
+
+
+#------------------------------------------------------------
+# output_mean
+
+# Output mean vectors. If they are to be byte-packed, then
+# scales will have to be determined, and the vectors packed
+# into bytes.
+#------------------------------------------------------------
+sub output_mean
+{
+    my ( $model, $outdir, $pkshort, $bytemean ) = @_;
+
+
+    my @mscales;
+
+    open( MN, ">${outdir}/mu.bin" ) or
+       die "Failed to open ${outdir}/mu.bin\n";
+
+
+    # Output number of mean vectors
+    print MN pack $pkshort, $model->{NUMMEANS};
+
+
+
+    # Output 16-bit mean vectors if requested
+    if( ! $bytemean )
+    {
+       foreach my $meanref ( @{ $model->{MEANS} } )
+       {
+           print MN pack $pkshort, @{ $meanref };
+       }
+       close( MN );
+
+       return \@mscales;
+    }
+       
+
+    # Must calculate scale vector for each static and dynamic element
+    # of the mean vector
+    my @maxval;
+    my $mindex;
+    foreach my $meanref  ( @{ $model->{MEANS} } )
+    {
+       $mindex = 0;
+       foreach my $meanel ( @{$meanref} )
+       {
+           if(  abs $meanel > $maxval[$mindex] or ! defined $maxval[$mindex] )
+           {
+               $maxval[$mindex] = abs $meanel;
+           }
+           $mindex++;
+       }
+    }
+
+    my $ndim = $model->{DIM};
+    for( $mindex = 0; $mindex < 2 * $ndim; $mindex++ )
+    {
+       my $scale = 0;
+
+       while( $maxval[$mindex] < 0x4000 )
+       {
+           $maxval[$mindex] *= 2;
+           $scale++;
+       }
+
+       $mscales[$mindex] = $scale;
+    }
+
+
+    # Pack the mean vectors into scaled bytes
+    foreach my $meanref  ( @{ $model->{MEANS} } )
+    {
+       for( $mindex = 0; $mindex < $ndim; $mindex++ )
+       {
+           my $static = $meanref->[$mindex];
+           my $dynamic = $meanref->[$mindex + $ndim];
+
+           $static = $static * 2**($mscales[$mindex] - 8 );
+           $dynamic = $dynamic * 2**($mscales[$mindex + $ndim] - 8 );
+
+           my $outval = ( ($static & 0xff) << 8 ) | ( $dynamic & 0xff );
+           print MN pack $pkshort, $outval;
+       }
+    }
+
+    return \@mscales;
+}
+
+
+
+#------------------------------------------------------------
+# output_var
+
+# Output var vectors. If they are to be byte-packed, then
+# scales will have to be determined, and the vectors packed
+# into bytes.
+#------------------------------------------------------------
+sub output_var
+{
+    my ( $model, $outdir, $pkshort, $bytevar ) = @_;
+
+
+    my @vscales;
+
+    open( VAR, ">${outdir}/var.bin" ) or
+       die "Failed to open ${outdir}/var.bin\n";
+
+
+    # Output number of variance vectors
+    print VAR pack $pkshort, $model->{NUMVARS};
+
+
+    # Output 16-bit var vectors if requested
+    if( ! $bytevar )
+    {
+       foreach my $varref ( @{ $model->{VARS} } )
+       {
+           print VAR pack $pkshort, @{ $varref };
+       }
+       close( VAR );
+
+       return \@vscales;
+    }
+       
+
+    # Must calculate scale vector for each static and dynamic element
+    # of the var vector
+    my @maxval;
+    my $vindex;
+    foreach my $varref  ( @{ $model->{VARS} } )
+    {
+       $vindex = 0;
+       foreach my $varel ( @{ $varref } )
+       {
+           if(  abs $varel > $maxval[$vindex] or ! defined $maxval[$vindex] )
+           {
+               $maxval[$vindex] = abs $varel;
+           }
+           $vindex++;
+       }
+    }
+
+    my $ndim = $model->{DIM};
+    for( $vindex = 0; $vindex < 2 * $ndim; $vindex++ )
+    {
+       my $scale = 0;
+
+       while( $maxval[$vindex] < 0x4000 )
+       {
+           $maxval[$vindex] *= 2;
+           $scale++;
+       }
+
+       $vscales[$vindex] = $scale;
+    }
+
+
+    # Pack the mean vectors into scaled bytes
+    foreach my $varref  ( @{ $model->{VARS} } )
+    {
+       for( $vindex = 0; $vindex < $ndim; $vindex++ )
+       {
+           my $static = $varref->[$vindex];
+           my $dynamic = $varref->[$vindex + $ndim];
+
+           $static = $static * 2**($vscales[$vindex] - 8 );
+           $dynamic = $dynamic * 2**($vscales[$vindex + $ndim] - 8 );
+
+           my $outval = ( ($static & 0xff) << 8 ) | ( $dynamic & 0xff );
+           print VAR pack $pkshort, $outval;
+       }
+    }
+
+    return \@vscales;
+}
diff --git a/TIesr_Tools/TIesrNet.pm b/TIesr_Tools/TIesrNet.pm
new file mode 100644 (file)
index 0000000..5fdae2f
--- /dev/null
@@ -0,0 +1,603 @@
+#================================================================
+#  Module TIesrNet.pm
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+#  This module creates an object to encapsulate a TIESR fixed point
+#  grammar network. The module creates the object and provides methods
+#  to parse the network and expose the components of the network.  The
+#  public interface to this object is given below.  Unlike many
+#  modules, the output object structure is provided for use by
+#  applications so that the network can be manipulated.
+#  
+#  In the network, symbols are nodes of the grammar that correspond to 
+#  a specific hmm in that grammar context of the FSA.  The FSA has
+#  HMMs tied to symbols (nodes) rather than transitions between nodes.
+
+
+#  The object has the following structure
+#  $net->{NUMHMMS} = $number of HMMs in grammar
+#  $net->{NUMSYMS} = $number of symbols (nodes) in the grammar
+#  $net->{NUMWORDS} = $number of words in the grammar
+#  $net->{NUMSETS} = $number of HMM sets in grammar (male, female, etc)
+#  $net->{NUMPERSET} = $number of HMMs per set
+#  $net->{STARTSYMS} = @array of start symbols of the grammar
+#  $net->{ENDSYMS} = @array of end symbols of the grammar
+#  $net->{SYMBOLS} = @array of symbol structures representing symbols in the grammar
+
+#  The symbol structure is as follows
+#  $sym->{HMMCODE} = $code index of the HMM corresponding to this symbol
+#  $sym->{HMMNAME} = $name of the HMM if the hmm list is supplied, see below
+#  $sym->{NUMTRANS} = $number of transitions from symbol
+#  $sym->{TRANS} = @array of transition symbols this symbol transitions TO
+#  $sym->{WORDSYM} = $boolean indicating this symbol has a word tag
+#  $sym->{WORDINDEX} = $index of the word this HMM corresponds to
+#  $sym->{WORDNAME} = $name of the word if word list file supplied, see below
+
+
+#  The object has the following available public interface methods
+
+#  Constructor for a reference to a tmf object.
+#  $net = TIesrNet->new() 
+
+#  Parse a TIesrFlex output net.bin file file into the object structure. undef for the
+#  $word_list_file, $hmm_list_file, and $hmm2phonefile is allowed.
+#  If $hmm_list_file and $hmm2phonefile are supplied, and $addsil
+#  is set to non-zero, then the _SIL model will be added at the
+#  beginning of the phone list, as TIesrFlex does.
+#  $net->parsenet( $net_file, $word_list_file, $hmm_list_file, $hmm2phonefile, $addsil )
+
+#  Output a grammar network.  If $little_endian is true output will
+#  be in little endian format.
+#  $net->output( $netfile, $little_endian);
+
+
+#  Parse a phrase according to the present grammar.  There must be
+#  word information available when the network was parsed in order
+#  to parse a phrase according to the network.  The returned value
+#  is a an array of references to arrays that contain valid 
+#  symbol index sequences making up the parse.  Note that there could
+#  be multiple sequences, since there may be multiple pronunciations
+#  for words.  If a symbol loops, only a single instance of the symbol
+#  index will be included in the parse.
+#  @sequences = $net->phraseparse( $phrase );
+
+#----------------------------------------------------------------
+
+#  Package header.  Now nothing exported.
+
+package TIesrNet;
+
+use strict qw( vars refs );
+
+use Exporter ();
+@TIesrNet::ISA = qw( Exporter );
+
+
+#----------------------------------------------------------------
+#  new
+
+#  Construct a new TIesrNet hash data structure and return a reference
+#  to it.  At this time the constructor does not provide for 
+#  cloning by passing a reference to a blessed TIesrNet object.
+#------------------------------------------------------------
+sub new
+{
+    my $class = shift;
+    my $this = {};
+    return bless $this, $class;
+}
+
+
+#----------------------------------------------------------------
+
+#  parsenet
+
+#  This function parses a network into a structure.
+
+#----------------------------------------------------------------
+sub parsenet
+{
+    my( $net, $netfile, $wordfile, $hmmlist, $hmm2phone, $addsil ) = @_;
+
+    open( NET, "$netfile") or die "Invalid net file $netfile";
+
+    # Get heading data.  Determine if big/little endian and get header data 
+    my( $buf, @netdata );
+    my( $pks );
+    read NET, $buf, 12;
+    @netdata = unpack "n*", $buf;
+    if( $netdata[4] & 0xff00 )
+    {
+       $pks = "v*";
+    }
+    else
+    {
+       $pks = "n*";
+    }
+    my $numwords;
+    ($numwords, 
+     $net->{NUMHMMS},
+     $net->{NUMSYMS},
+     $net->{NUMWORDS},
+     $net->{NUMSETS},
+     $net->{NUMPERSET} ) = unpack $pks, $buf;
+
+    
+    # skip past offsets
+    read NET, $buf, ($net->{NUMSYMS} + 2)*2;
+    # @offsets = unpack $pks, $buf;
+
+
+    #read start symbols
+    my( $hmmcode, $numsyms, @startsyms );
+    read NET, $buf, 4;
+    ($hmmcode, $numsyms) = unpack $pks, $buf;
+
+    read NET, $buf, ($numsyms*2);
+    @startsyms = unpack $pks, $buf;
+    $net->{STARTSYMS} = \@startsyms;
+
+    #read ending symbols
+    my( @endsyms );
+    read NET, $buf, 4;
+    ($hmmcode, $numsyms) = unpack $pks, $buf;
+
+    read NET, $buf, ($numsyms*2);
+    @endsyms = unpack $pks, $buf;
+    $net->{ENDSYMS} = \@endsyms;
+    
+    # if hmm list exists, build array of hmm names
+    my @hmms;
+    if( -f $hmmlist )
+    {
+       # If hmm2phone file exists, get the indices of the phones in the phone list
+       my @hmmindices;
+       if( -f $hmm2phone )
+       {
+           open( LIST, $hmm2phone ) or die "Could not open hmm2phone.bin file\n";
+           read LIST, $buf, $net->{NUMPERSET}*2;
+           @hmmindices = unpack $pks, $buf;
+           close( LIST );
+
+           foreach my $hindex (@hmmindices)
+           {
+               $hindex = $hindex - 2**16  if( $hindex >= 2**15 );
+               $hindex++;
+           }
+       }
+           
+       open( LIST, $hmmlist ) or die "Could not open HMM list $hmmlist\n";
+
+       @hmms = <LIST>;
+       chomp @hmms;
+       
+       close( LIST );
+
+       unshift @hmms, "_SIL" if ($addsil);
+
+       @hmms = @hmms[@hmmindices] if( @hmmindices );
+    }
+    else
+    {
+       undef @hmms;
+    }
+
+
+    # if word list exists, build array of hmm names
+    my @words;
+    if( -f $wordfile )
+    {
+       open( LIST, $wordfile ) or die "Could not open word list $wordfile\n";
+
+       @words = <LIST>;
+       foreach my $wrd (@words)
+       {
+           $wrd =~ s/\s+$//;
+       }
+       
+       close( LIST );
+    }
+    else
+    {
+       undef @words;
+    }
+
+
+    # read all network symbol information
+    my $sym;
+    for( $sym=0; $sym < $net->{NUMSYMS}; $sym++ )
+    {
+       read NET, $buf, 4;
+       ($hmmcode, $numsyms) = unpack $pks, $buf;
+       $net->{SYMBOLS}[$sym]{HMMCODE} = $hmmcode;
+       $net->{SYMBOLS}[$sym]{HMMNAME} = $hmms[$hmmcode] if @hmms;
+
+       $net->{SYMBOLS}[$sym]{NUMTRANS} = ($numsyms & 0x7fff);
+       $net->{SYMBOLS}[$sym]{WORDSYM} = ($numsyms & 0x8000);
+
+       read NET, $buf, ($numsyms & 0x7fff)*2;
+       my $r_trans = [];
+       @$r_trans = unpack $pks, $buf;
+       $net->{SYMBOLS}[$sym]{TRANS} = $r_trans;
+
+       if( $net->{SYMBOLS}[$sym]{WORDSYM} )
+       {
+           my( $wordindex );
+           read NET, $buf, 2;
+           $wordindex =  unpack $pks, $buf;
+           $net->{SYMBOLS}[$sym]{WORDINDEX} = $wordindex;
+           $net->{SYMBOLS}[$sym]{WORDNAME} = $words[$wordindex] if @words;
+       }
+    }
+       
+    close(NET);
+}
+
+
+#----------------------------------------------------------------
+# output
+
+# This function outputs a network in either little or big endian 
+# format.
+#----------------------------------------------------------------
+sub output
+{
+    my( $net, $netfile, $little ) = @_;
+    
+    open( NET, ">$netfile" ) or die "Could not open net file $netfile\n";
+    
+    my $outs = $little ? "v*" :  "n*";
+
+    
+    # Size of file data in short, dummy for now, filled in later
+    my $fsize = 0;
+    my $buf;
+    $buf = pack $outs, 0;
+    print NET $buf;
+
+
+    # header information
+    $buf = pack $outs, ( $net->{NUMHMMS},
+                        $net->{NUMSYMS},
+                        $net->{NUMWORDS},
+                        $net->{NUMSETS},
+                        $net->{NUMPERSET} );
+    print NET $buf;
+    $fsize += 5;
+
+    
+    # reserve space for offsets
+    my $offidx = 0;
+    my @offsets = (0) x ( $net->{NUMSYMS} + 2 );
+    $buf = pack $outs, @offsets;
+    print NET $buf;
+    $fsize += $net->{NUMSYMS} + 2;
+
+
+    # output start symbols
+    $offsets[$offidx++] = $fsize;
+    $buf = pack $outs, ( -2, scalar(@{$net->{STARTSYMS}}), @{$net->{STARTSYMS}} );
+    print NET $buf;
+    $fsize += scalar( @{$net->{STARTSYMS}} ) + 2;
+
+    
+    # output end symbols
+    $offsets[$offidx++] = $fsize;
+    $buf = pack $outs, ( -2, scalar( @{$net->{ENDSYMS}} ), @{$net->{ENDSYMS}} );
+    print NET $buf;
+    $fsize += scalar( @{$net->{ENDSYMS}} ) + 2;
+    
+
+    #output all symbol information
+    my $sym;
+    for( $sym=0; $sym < $net->{NUMSYMS}; $sym++ )
+    {
+       $offsets[$offidx++] = $fsize;
+
+       my $r_sym;
+       $r_sym = $net->{SYMBOLS}[$sym];
+       
+       my $numtrans;
+       $numtrans = $r_sym->{NUMTRANS};
+       $numtrans |= 0x8000 if $r_sym->{WORDSYM};
+
+       $buf = pack  $outs, ( $r_sym->{HMMCODE}, $numtrans, @{$r_sym->{TRANS}} );
+       print NET $buf;
+       $fsize += scalar( @{$r_sym->{TRANS}} ) + 2;
+
+       if( $r_sym->{WORDSYM} )
+       {
+           $buf = pack  $outs, $r_sym->{WORDINDEX};
+           print NET $buf;
+           $fsize++;
+       }
+    }
+    
+    # Now write file size and offsets
+    seek NET, 0, 0;
+    $buf = pack $outs, $fsize;
+    print NET $buf;
+
+    seek NET, 5*2, 1;
+    $buf = pack $outs, @offsets;
+    print NET $buf;
+
+    close(NET);
+}
+
+
+
+#----------------------------------------------------------------
+# phraseparse
+#
+# This subroutine parses a phrase and returns an array or arrays
+# giving all of the parse values.  If the returned reference is
+# undef, then the phrase does not parse.
+#----------------------------------------------------------------
+sub phraseparse
+{
+    my( $net, $phrase) = @_;
+
+    # list of valid sequences, a list of sequence lists
+    my (@seqs);
+    undef @seqs;
+
+    # Each individual word of the phrase
+    $phrase = uc $phrase;
+    my @words = split( " ", $phrase );
+
+
+    # Extend the parse for each word
+    foreach my $word (@words)
+    {
+       # Extend the sequences for this word
+       @seqs = expand_seqs($net, $word, @seqs);
+
+       # If at any time no valid sequences remain, return 
+       # the empty array
+       if( scalar(@seqs) == 0 )
+       {
+           return @seqs;
+       }
+    }
+
+
+    # Final expansion to include ending silences and ensure
+    # all ending symbols are stop symbols
+    @seqs = expand_final($net, @seqs);
+
+
+    # At the end of parsing, return the array of valid symbol sequences
+    return @seqs;
+}
+
+
+#----------------------------------------------------------------
+# expand_seqs 
+#
+# Expand the sequences that are presently valid until they get to the 
+# next word.  This will create new sequences if multiple paths are 
+# available from a symbol.  If the sequence ends up at a word that is
+# not the word of interest, then the sequence is invalid, and is removed
+# from the sequence list.  A symbol with _SIL is treated as a symbol
+# that is not a word-ending symbol.
+#----------------------------------------------------------------
+sub expand_seqs
+{
+    my($net, $word, @seqs) = @_;
+
+    my(@priorseqs);
+
+    my $doexpand = 1;
+    my $excount = 0;
+    while( $doexpand )
+    {
+       $doexpand = 0;
+
+       # if at start then initialize sequences
+       if( scalar(@seqs) == 0 )
+       {
+           foreach my $startidx ( @{$net->{STARTSYMS}} )
+           {
+               my $rsym = $net->{SYMBOLS}[$startidx];
+               my $wordsym = $rsym->{WORDSYM};
+               my $symname = $rsym->{WORDNAME};
+               $symname =~ s/\+\d+// if $symname;
+               $symname = uc $symname if $symname;
+
+               # if starting symbol is not word symbol or is _SIL, then
+               # the sequence is valid, and further expansion is necessary
+               if( ! $wordsym or $symname eq "_SIL" )
+               {
+                   # start a new sequence list, and put it in list of sequences 
+                   push @seqs, [$startidx];
+                   $doexpand = 1;
+                   next;
+               }
+
+               # if the starting symbol explains the current word then
+               # the sequence is valid but expansion need not continue
+               if( $wordsym and $symname eq $word )
+               {
+                   # start a new sequence list, and put it in list of sequences 
+                   push @seqs, [$startidx];
+               }
+           }
+       }
+
+       # expand existing sequences
+       else
+       {
+           # store prior sequences, rebuild expanded sequences
+           @priorseqs = @seqs;
+           undef @seqs;
+
+           # Expand prior sequences to the next word symbol
+           foreach my $rseq ( @priorseqs )
+           {
+               my $lastsymidx = $$rseq[ $#{$rseq} ];
+               my $rsym = $net->{SYMBOLS}[$lastsymidx];
+               my $rtrans = $rsym->{TRANS};
+               my $ntrans = $rsym->{NUMTRANS};
+               my $wordsym = $rsym->{WORDSYM};
+               my $symname = $rsym->{WORDNAME};
+               $symname =~ s/\+\d+// if $symname;
+               $symname = uc $symname if $symname;
+
+               # if a sequence that explains the current word has been found,
+               # maintain it but do not request further expansion
+               if( $wordsym and  $symname eq $word and $excount > 0 )
+               {
+                   # remember this sequence as a current sequence
+                   push @seqs, $rseq;
+                   next;
+               }
+
+               # try to expand this sequence to explain the present word
+               foreach my $transymidx ( @{$rtrans} )
+               {
+                   # do not expand loop transitions
+                   next if( $transymidx == $lastsymidx);
+
+                   my $rtsym = $net->{SYMBOLS}[$transymidx];
+                   my $twordsym = $rtsym->{WORDSYM};
+                   my $tsymname = $rtsym->{WORDNAME};
+                   $tsymname =~ s/\+\d+// if $tsymname;
+                   $tsymname = uc $tsymname if $tsymname;
+
+                   # Expand if the transition symbol is a word symbol
+                   # that does explain current word, but no need to
+                   # continue expansion
+                   if(  $twordsym and $tsymname eq $word )
+                   {
+                       # add symbol to sequence list and save as new sequence
+                       push @seqs, [ @{$rseq}, $transymidx ];
+                       next;
+                   }
+                                   
+                   # Expand if the transition symbol is a non-word symbol,
+                   # or is a silence symbol. Expansion should continue.
+                   if( ! $twordsym or $tsymname eq "_SIL" )
+                   {
+                       # add symbol to sequence list and save as new sequence
+                       push @seqs, [ @{$rseq}, $transymidx ];
+                       $doexpand = 1;
+                   }
+
+               } # foreach transsymidx
+
+           } # foreach $rseq (prior sequence)
+
+       } # expand else
+
+       # return immediately if expansion yields no sequences
+       return @seqs if ( scalar(@seqs) == 0 );
+
+       # another expansion cycle has taken place
+       $excount++;
+
+    } # while doexpand
+
+    return @seqs;
+}
+
+
+
+
+#----------------------------------------------------------------
+# final_expand
+#
+# All sequences input to final_expand explain the words in the
+# phrase exactly.  final_expand checks these sequences to ensure that
+# they ar valid stop sequences with a valid stop symbol.  Further searching
+# is done to include sequences of _SIL symbols at the end of the
+# phrase that end with a stop symbol.
+#----------------------------------------------------------------
+sub expand_final
+{
+    my($net, @seqs) = @_;
+
+    my(@finalseqs);
+    my(@toexpandseqs);
+
+    # make a hash of end symbol indices
+    my(%endsymhash);
+    @endsymhash{ @{$net->{ENDSYMS}} } = ( @{$net->{ENDSYMS}} );
+
+
+    undef @finalseqs;
+
+    # Initial check of input sequences
+    foreach my $rseq (@seqs)
+    {
+       my $lastsymidx = $$rseq[ $#{$rseq} ];
+       my $rsym = $net->{SYMBOLS}[$lastsymidx];
+       my $rtrans = $rsym->{TRANS};
+       my $ntrans = $rsym->{NUMTRANS};
+       my $wordsym = $rsym->{WORDSYM};
+       my $symname = $rsym->{WORDNAME};
+       $symname =~ s/\+\d+// if $symname;
+       $symname = uc $symname if $symname;
+
+       # if the input sequence ends at a stop symbol, then it is a 
+       # valid final sequence explaining the phrase
+       push @finalseqs, $rseq if( exists $endsymhash{$lastsymidx} );
+
+       # All sequences should be checked for trailing _SIL
+       push @toexpandseqs, $rseq;
+    }
+
+
+    # Expand all sequences to include final _SIL
+    while( scalar(@toexpandseqs) )
+    {
+       @seqs = @toexpandseqs;
+       undef @toexpandseqs;
+
+       # Process each final symbol of sequences to expand
+       foreach my $rseq ( @seqs )
+       {
+           my $lastsymidx = $$rseq[ $#{$rseq} ];
+           my $rsym = $net->{SYMBOLS}[$lastsymidx];
+           my $rtrans = $rsym->{TRANS};
+           my $ntrans = $rsym->{NUMTRANS};
+           my $wordsym = $rsym->{WORDSYM};
+           my $symname = $rsym->{WORDNAME};
+           $symname =~ s/\+\d+// if $symname;
+           $symname = uc $symname if $symname;
+               
+           # check if the sequence should be expanded by trailing _SIL
+           foreach my $transymidx ( @{$rtrans} )
+           {
+               # do not expand loops
+               next if $transymidx == $lastsymidx;
+           
+               my $rtsym = $net->{SYMBOLS}[$transymidx];
+               my $twordsym = $rtsym->{WORDSYM};
+               my $tsymname = $rtsym->{WORDNAME};
+               $tsymname =~ s/\+\d+// if $tsymname;
+               $tsymname = uc $tsymname if $tsymname;
+
+               # expand only if transition is to _SIL
+               if( $twordsym and $tsymname eq "_SIL" )
+               {
+                   # new sequence with an ending _SIL
+                   my $newseq = [ @{$rseq}, $transymidx ];
+                   push @toexpandseqs, $newseq;
+
+                   # if the _SIL is an ending _SIL, then this is a
+                   # valid final sequence
+                   push @finalseqs, $newseq if( exists $endsymhash{$transymidx} );
+               }
+
+           } #foreach trans
+
+       } #foreach rseq prior sequence
+       
+    } #while expansion cycle
+    
+    return @finalseqs;
+}
diff --git a/TIesr_Tools/cluster_models.pl b/TIesr_Tools/cluster_models.pl
new file mode 100755 (executable)
index 0000000..cf2153d
--- /dev/null
@@ -0,0 +1,267 @@
+#!/usr/local/bin/perl
+#---------------------------------------------------------------- 
+# cluster_models.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+$USAGE = "
+cluster_models -Help -r recfile -o treefile";
+
+
+$DOCUMENTATION = " 
+
+This perl script is used to cluster the acoustic match scores from the
+output of the htk_model_compare.pl perl script, and to output a 
+TIesr-compatible hierarchical tree file that clusters models according
+to their similarity. The arguments to the script are as follows:
+
+-Help : Output this help info.
+-r    : recognition score text file name generated by htk_model_compare.pl
+-o    : Output binary tree file name
+-le   : Flag indicating to output littleendian compatible binary file
+";
+
+#----------------------------------------------------------------
+
+use Getopt::Long;
+
+use Algorithm::Cluster;
+
+# Get script parameters
+GetOptions( 'Help' => \$outdoc,
+           'r=s' => \$recfile,
+            'o=s' => \$outfile,
+           'le'  => \$littleendian
+           );
+
+
+# Output documentation if requested
+if( $outdoc )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+
+# Read in the list of scores created by htk model compare
+die "$0 : Invalid dist file\n" unless -f $recfile;
+open( SCORE, "<$recfile" ) or die "$0 : Can not open $recfile\n";
+
+@scores=();
+
+while( <SCORE> )
+{
+    chomp;
+
+    @data = split (" ");
+
+    push @scores, $data[5];
+}
+close( SCORE );
+
+
+# Put scores into a lower triangular square array, 
+# averaging the corresponding entries. This is the
+# format that treecluster requires.
+$numphones = int ( sqrt( scalar @scores) + 0.5 );
+die "$0 : Invalid number of scores\n"
+    unless $numphones*$numphones == scalar( @scores );
+
+# First row is empty
+$sarray[0] = [];
+
+# Form lower triangular part of score array
+for( $row = 1; $row < $numphones; $row++ )
+{
+    for( $col = 0; $col < $row; $col++ )
+    {
+       $sarray[$row][$col] = 
+           -( $scores[$row*$numphones + $col] + 
+              $scores[$col*$numphones + $row ]  )/2;
+    }
+}
+
+
+# Cluster the model scores to determine similar models
+%params = ( data => \@sarray,
+           method => 'm' );
+
+$tree = Algorithm::Cluster::treecluster( %params );
+
+
+# Locate the top node of the tree. This appears to be the
+# last node of $tree, but do not know if this is certain.
+$nnodes = $tree->length;
+
+# Create hash containing all negative node numbers
+@survive{(-$nnodes) .. -1} = ((-$nnodes) .. -1 );
+
+# Loop over all nodes
+for( $ixnode = 0; $ixnode < $nnodes; $ixnode++ )
+{
+    $node = $tree->get($ixnode);
+    $left = $node->left;
+    $right = $node->right;
+    
+    # Remove node numbers from survive hash that are referenced by current node
+    delete $survive{$left} if $left < 0  && exists $survive{$left};
+    delete $survive{$right} if $right < 0 && exists $survive{$right};
+}
+# Only the top node is not referenced by any other node
+($topnode) = keys(%survive);
+
+
+# Recursively traverse the tree, determining node structure and
+# terminal node to phone mapping.
+traverse_tree( $topnode );
+
+
+# Construct list of left-to-right node indices by tree level for non-terminal nodes
+foreach $lev ( 1 .. $maxlevel )
+{
+    push @levelntlist,  @{$levelntindices[$lev]};
+}      
+
+# Make a list to look up ordered non-terminal indices from the original left-to-right
+# tree level node indices. Note that the ordered indices are offset by $numphones.
+@orderedntindices[ @levelntlist ] = ($numphones .. 2*$numphones-2);
+
+# Define the ordered index of the non-existent parent of the top-level node
+$orderedntindices[$numphones-1] = 2*$numphones-1;
+
+
+# Output the tree in TIesr-compatible binary format
+open( OUT, ">$outfile" ) or die "$0 : Could not open $outfile\n";
+
+$format = $littleendian  ?  "v*" : "n*";
+
+# Output number of terminals
+print OUT pack $format, $numphones;
+
+# Output left-to-right level-ordered parent index of each terminal
+print OUT pack $format, @orderedntindices[ @termparent ];
+
+# Output level-ordered parent index of each non-terminal
+@parentntindices = @ntparent[ @levelntlist ];
+print OUT pack $format, @orderedntindices[ @parentntindices ];
+
+# Output number of phones
+print OUT pack $format, $numphones;
+
+# Output terminal index for each phone.
+@termindices[@pmap] = (0 .. $#pmap);
+print OUT pack $format, @termindices;
+
+close(OUT);
+
+
+exit(0); 
+
+
+#-----------------------------------------------------------------
+# traverse_tree
+
+# Traverse the cluster tree depth-first, and left to right. Determine
+# the level of each non-terminal node in two-dimensional @array level,
+# determine phone to terminal node mapping in array @pmap. Determine
+# terminal and non-terminal node indices. Terminal nodes have indices
+# of 0 to numphones-1, and non-terminal nodes have indices of
+# numphones to 2*numphones-1.  Determine terminal and non-terminal
+# node parents.
+#---------------------
+sub traverse_tree
+{
+    # Current node number, which is negative
+    my $nodenum = shift @_;
+
+
+    # Convert negative node number to node index. Node indices run from
+    # 0 to $numphones-2
+    my $nodeindex = -$nodenum - 1;
+
+
+    # Initialization at start of traversing
+    if( $nodenum == $topnode )
+    {
+       # Top level parent node assigned to non-existing non-terminal index
+       $ntparent[$nodeindex] = $nodeindex + 1;
+
+       # Track maximum level of nodes in tree. Terminal nodes are at 
+       # level zero.
+       $maxlevel = 0;
+    }
+
+
+    # Obtain left and right children of current node
+    my $node = $tree->get($nodeindex);
+    my $left = $node->left;
+    my $right = $node->right;
+    my ( $leftlevel, $rightlevel );
+
+
+    # Decend left child first
+    if( $left < 0 )
+    {
+       # Parent of non-terminal left child node is current node
+       my $leftindex = -$left - 1;
+       $ntparent[$leftindex] = $nodeindex;
+
+       # Decend to and return level of left child
+       $leftlevel = traverse_tree( $left );
+    }
+    else
+    {
+       # Left child is terminal node containing phone index
+       push @pmap, $left;
+       
+
+       # Parent of child terminal node is current node
+       push @termparent, $nodeindex;
+
+       # Terminal node is at level 0
+       $leftlevel = 0;
+    }
+
+
+    # Decend right child
+    if( $right < 0 )
+    {
+       # Parent of non-terminal right child node is current node
+       my $rightindex = -$right - 1;
+       $ntparent[$rightindex] = $nodeindex;
+
+       # Return level of right child
+       $rightlevel = traverse_tree( $right );
+    }
+    else
+    {
+       # Right child is terminal node containing phone index
+       push @pmap, $right;
+       
+
+       # Parent of child terminal node is current node
+       push @termparent, $nodeindex;
+
+       # Terminal node is at level 0
+       $rightlevel = 0;
+    }
+    
+    
+    # Determine level of the current node, and keep track of order of 
+    # occurrence of nodes of each level, left to right.
+    my $curlevel = $leftlevel >= $rightlevel ?  $leftlevel  :  $rightlevel;
+    $curlevel++;
+
+    push @{$levelntindices[$curlevel]}, $nodeindex;
+
+    # Track maximum level
+    $maxlevel = $curlevel if $maxlevel < $curlevel;
+
+    return $curlevel;
+}
+
+
+
diff --git a/TIesr_Tools/dictproc/.dep.inc b/TIesr_Tools/dictproc/.dep.inc
new file mode 100755 (executable)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/TIesr_Tools/dictproc/Makefile b/TIesr_Tools/dictproc/Makefile
new file mode 100644 (file)
index 0000000..6231e38
--- /dev/null
@@ -0,0 +1,111 @@
+# Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+# ALL RIGHTS RESERVED#
+
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_PLATFORM_${CONF}       platform name (current configuration)
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/TIesr_Tools/dictproc/nbproject/Makefile-LinuxDebugGnu.mk b/TIesr_Tools/dictproc/nbproject/Makefile-LinuxDebugGnu.mk
new file mode 100644 (file)
index 0000000..a7447c6
--- /dev/null
@@ -0,0 +1,127 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/src/dictproc.o \
+       ${OBJECTDIR}/src/english.o \
+       ${OBJECTDIR}/src/map.o \
+       ${OBJECTDIR}/src/phoneme.o \
+       ${OBJECTDIR}/src/parse.o \
+       ${OBJECTDIR}/src/spellword.o \
+       ${OBJECTDIR}/src/saynum.o \
+       ${OBJECTDIR}/src/phones.o \
+       ${OBJECTDIR}/src/compress_entry.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxDebugGnu.mk ../../Dist/LinuxDebugGnu/bin/dictproc
+
+../../Dist/LinuxDebugGnu/bin/dictproc: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxDebugGnu/bin
+       ${LINK.c} -v -o ../../Dist/${CND_CONF}/bin/dictproc ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/src/dictproc.o: nbproject/Makefile-${CND_CONF}.mk src/dictproc.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/dictproc.o src/dictproc.c
+
+${OBJECTDIR}/src/english.o: nbproject/Makefile-${CND_CONF}.mk src/english.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/english.o src/english.c
+
+${OBJECTDIR}/src/map.o: nbproject/Makefile-${CND_CONF}.mk src/map.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/map.o src/map.c
+
+${OBJECTDIR}/src/phoneme.o: nbproject/Makefile-${CND_CONF}.mk src/phoneme.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/phoneme.o src/phoneme.c
+
+${OBJECTDIR}/src/parse.o: nbproject/Makefile-${CND_CONF}.mk src/parse.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/parse.o src/parse.c
+
+${OBJECTDIR}/src/spellword.o: nbproject/Makefile-${CND_CONF}.mk src/spellword.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/spellword.o src/spellword.c
+
+${OBJECTDIR}/src/saynum.o: nbproject/Makefile-${CND_CONF}.mk src/saynum.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/saynum.o src/saynum.c
+
+${OBJECTDIR}/src/phones.o: nbproject/Makefile-${CND_CONF}.mk src/phones.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/phones.o src/phones.c
+
+${OBJECTDIR}/src/compress_entry.o: nbproject/Makefile-${CND_CONF}.mk src/compress_entry.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/compress_entry.o src/compress_entry.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxDebugGnu
+       ${RM} ../../Dist/LinuxDebugGnu/bin/dictproc
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesr_Tools/dictproc/nbproject/Makefile-LinuxReleaseGnu.mk b/TIesr_Tools/dictproc/nbproject/Makefile-LinuxReleaseGnu.mk
new file mode 100644 (file)
index 0000000..845eabc
--- /dev/null
@@ -0,0 +1,127 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc
+CCC=g++
+CXX=g++
+FC=gfortran
+AS=as
+
+# Macros
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/src/dictproc.o \
+       ${OBJECTDIR}/src/english.o \
+       ${OBJECTDIR}/src/map.o \
+       ${OBJECTDIR}/src/phoneme.o \
+       ${OBJECTDIR}/src/parse.o \
+       ${OBJECTDIR}/src/spellword.o \
+       ${OBJECTDIR}/src/saynum.o \
+       ${OBJECTDIR}/src/phones.o \
+       ${OBJECTDIR}/src/compress_entry.o
+
+# C Compiler Flags
+CFLAGS=-v
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/lib -Wl,-rpath ${CND_BASEDIR}/../../Dist/${CND_CONF}/lib -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-LinuxReleaseGnu.mk ../../Dist/LinuxReleaseGnu/bin/dictproc
+
+../../Dist/LinuxReleaseGnu/bin/dictproc: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/LinuxReleaseGnu/bin
+       ${LINK.c} -v -o ../../Dist/${CND_CONF}/bin/dictproc ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/src/dictproc.o: nbproject/Makefile-${CND_CONF}.mk src/dictproc.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/dictproc.o src/dictproc.c
+
+${OBJECTDIR}/src/english.o: nbproject/Makefile-${CND_CONF}.mk src/english.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/english.o src/english.c
+
+${OBJECTDIR}/src/map.o: nbproject/Makefile-${CND_CONF}.mk src/map.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/map.o src/map.c
+
+${OBJECTDIR}/src/phoneme.o: nbproject/Makefile-${CND_CONF}.mk src/phoneme.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/phoneme.o src/phoneme.c
+
+${OBJECTDIR}/src/parse.o: nbproject/Makefile-${CND_CONF}.mk src/parse.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/parse.o src/parse.c
+
+${OBJECTDIR}/src/spellword.o: nbproject/Makefile-${CND_CONF}.mk src/spellword.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/spellword.o src/spellword.c
+
+${OBJECTDIR}/src/saynum.o: nbproject/Makefile-${CND_CONF}.mk src/saynum.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/saynum.o src/saynum.c
+
+${OBJECTDIR}/src/phones.o: nbproject/Makefile-${CND_CONF}.mk src/phones.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/phones.o src/phones.c
+
+${OBJECTDIR}/src/compress_entry.o: nbproject/Makefile-${CND_CONF}.mk src/compress_entry.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/compress_entry.o src/compress_entry.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/LinuxReleaseGnu
+       ${RM} ../../Dist/LinuxReleaseGnu/bin/dictproc
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesr_Tools/dictproc/nbproject/Makefile-WindowsDebugMinGW.mk b/TIesr_Tools/dictproc/nbproject/Makefile-WindowsDebugMinGW.mk
new file mode 100644 (file)
index 0000000..e3ff416
--- /dev/null
@@ -0,0 +1,127 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/src/dictproc.o \
+       ${OBJECTDIR}/src/english.o \
+       ${OBJECTDIR}/src/map.o \
+       ${OBJECTDIR}/src/phoneme.o \
+       ${OBJECTDIR}/src/parse.o \
+       ${OBJECTDIR}/src/spellword.o \
+       ${OBJECTDIR}/src/saynum.o \
+       ${OBJECTDIR}/src/phones.o \
+       ${OBJECTDIR}/src/compress_entry.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/ -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsDebugMinGW.mk ../../Dist/WindowsDebugMinGW/dictproc.exe
+
+../../Dist/WindowsDebugMinGW/dictproc.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsDebugMinGW
+       ${LINK.c} -v -mno-cygwin -o ../../Dist/${CND_CONF}/dictproc.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/src/dictproc.o: nbproject/Makefile-${CND_CONF}.mk src/dictproc.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/dictproc.o src/dictproc.c
+
+${OBJECTDIR}/src/english.o: nbproject/Makefile-${CND_CONF}.mk src/english.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/english.o src/english.c
+
+${OBJECTDIR}/src/map.o: nbproject/Makefile-${CND_CONF}.mk src/map.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/map.o src/map.c
+
+${OBJECTDIR}/src/phoneme.o: nbproject/Makefile-${CND_CONF}.mk src/phoneme.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/phoneme.o src/phoneme.c
+
+${OBJECTDIR}/src/parse.o: nbproject/Makefile-${CND_CONF}.mk src/parse.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/parse.o src/parse.c
+
+${OBJECTDIR}/src/spellword.o: nbproject/Makefile-${CND_CONF}.mk src/spellword.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/spellword.o src/spellword.c
+
+${OBJECTDIR}/src/saynum.o: nbproject/Makefile-${CND_CONF}.mk src/saynum.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/saynum.o src/saynum.c
+
+${OBJECTDIR}/src/phones.o: nbproject/Makefile-${CND_CONF}.mk src/phones.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/phones.o src/phones.c
+
+${OBJECTDIR}/src/compress_entry.o: nbproject/Makefile-${CND_CONF}.mk src/compress_entry.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -g -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/compress_entry.o src/compress_entry.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsDebugMinGW
+       ${RM} ../../Dist/WindowsDebugMinGW/dictproc.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesr_Tools/dictproc/nbproject/Makefile-WindowsReleaseMinGW.mk b/TIesr_Tools/dictproc/nbproject/Makefile-WindowsReleaseMinGW.mk
new file mode 100644 (file)
index 0000000..c7b3035
--- /dev/null
@@ -0,0 +1,127 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=
+CCC=
+CXX=
+FC=
+AS=
+
+# Macros
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/src/dictproc.o \
+       ${OBJECTDIR}/src/english.o \
+       ${OBJECTDIR}/src/map.o \
+       ${OBJECTDIR}/src/phoneme.o \
+       ${OBJECTDIR}/src/parse.o \
+       ${OBJECTDIR}/src/spellword.o \
+       ${OBJECTDIR}/src/saynum.o \
+       ${OBJECTDIR}/src/phones.o \
+       ${OBJECTDIR}/src/compress_entry.o
+
+# C Compiler Flags
+CFLAGS=-v -mno-cygwin
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Assembler Flags
+ASFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-L../../Dist/${CND_CONF}/ -lTIesrDT
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-WindowsReleaseMinGW.mk ../../Dist/WindowsReleaseMinGW/dictproc.exe
+
+../../Dist/WindowsReleaseMinGW/dictproc.exe: ${OBJECTFILES}
+       ${MKDIR} -p ../../Dist/WindowsReleaseMinGW
+       ${LINK.c} -v -mno-cygwin -o ../../Dist/${CND_CONF}/dictproc.exe ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/src/dictproc.o: nbproject/Makefile-${CND_CONF}.mk src/dictproc.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/dictproc.o src/dictproc.c
+
+${OBJECTDIR}/src/english.o: nbproject/Makefile-${CND_CONF}.mk src/english.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/english.o src/english.c
+
+${OBJECTDIR}/src/map.o: nbproject/Makefile-${CND_CONF}.mk src/map.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/map.o src/map.c
+
+${OBJECTDIR}/src/phoneme.o: nbproject/Makefile-${CND_CONF}.mk src/phoneme.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/phoneme.o src/phoneme.c
+
+${OBJECTDIR}/src/parse.o: nbproject/Makefile-${CND_CONF}.mk src/parse.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/parse.o src/parse.c
+
+${OBJECTDIR}/src/spellword.o: nbproject/Makefile-${CND_CONF}.mk src/spellword.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/spellword.o src/spellword.c
+
+${OBJECTDIR}/src/saynum.o: nbproject/Makefile-${CND_CONF}.mk src/saynum.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/saynum.o src/saynum.c
+
+${OBJECTDIR}/src/phones.o: nbproject/Makefile-${CND_CONF}.mk src/phones.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/phones.o src/phones.c
+
+${OBJECTDIR}/src/compress_entry.o: nbproject/Makefile-${CND_CONF}.mk src/compress_entry.c 
+       ${MKDIR} -p ${OBJECTDIR}/src
+       ${RM} $@.d
+       $(COMPILE.c) -O2 -Wall -Isrc -I../../TIesrDT/src -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/compress_entry.o src/compress_entry.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/WindowsReleaseMinGW
+       ${RM} ../../Dist/WindowsReleaseMinGW/dictproc.exe
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/TIesr_Tools/dictproc/nbproject/Makefile-impl.mk b/TIesr_Tools/dictproc/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..2fefc66
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=dictproc
+
+# Active Configuration
+DEFAULTCONF=LinuxDebugGnu
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=LinuxDebugGnu LinuxReleaseGnu WindowsDebugMinGW WindowsReleaseMinGW 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/TIesr_Tools/dictproc/nbproject/Makefile-variables.mk b/TIesr_Tools/dictproc/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..625ee4c
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+CND_BUILDDIR=build
+CND_DISTDIR=dist
+# LinuxDebugGnu configuration
+CND_PLATFORM_LinuxDebugGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin
+CND_ARTIFACT_NAME_LinuxDebugGnu=dictproc
+CND_ARTIFACT_PATH_LinuxDebugGnu=../../Dist/LinuxDebugGnu/bin/dictproc
+CND_PACKAGE_DIR_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxDebugGnu=dictproc.tar
+CND_PACKAGE_PATH_LinuxDebugGnu=dist/LinuxDebugGnu/GNU_current-Linux-x86/package/dictproc.tar
+# LinuxReleaseGnu configuration
+CND_PLATFORM_LinuxReleaseGnu=GNU_current-Linux-x86
+CND_ARTIFACT_DIR_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin
+CND_ARTIFACT_NAME_LinuxReleaseGnu=dictproc
+CND_ARTIFACT_PATH_LinuxReleaseGnu=../../Dist/LinuxReleaseGnu/bin/dictproc
+CND_PACKAGE_DIR_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package
+CND_PACKAGE_NAME_LinuxReleaseGnu=dictproc.tar
+CND_PACKAGE_PATH_LinuxReleaseGnu=dist/LinuxReleaseGnu/GNU_current-Linux-x86/package/dictproc.tar
+# WindowsDebugMinGW configuration
+CND_PLATFORM_WindowsDebugMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW
+CND_ARTIFACT_NAME_WindowsDebugMinGW=dictproc.exe
+CND_ARTIFACT_PATH_WindowsDebugMinGW=../../Dist/WindowsDebugMinGW/dictproc.exe
+CND_PACKAGE_DIR_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsDebugMinGW=dictproc.tar
+CND_PACKAGE_PATH_WindowsDebugMinGW=dist/WindowsDebugMinGW/Cygwin-Linux-x86/package/dictproc.tar
+# WindowsReleaseMinGW configuration
+CND_PLATFORM_WindowsReleaseMinGW=Cygwin-Linux-x86
+CND_ARTIFACT_DIR_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW
+CND_ARTIFACT_NAME_WindowsReleaseMinGW=dictproc.exe
+CND_ARTIFACT_PATH_WindowsReleaseMinGW=../../Dist/WindowsReleaseMinGW/dictproc.exe
+CND_PACKAGE_DIR_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package
+CND_PACKAGE_NAME_WindowsReleaseMinGW=dictproc.tar
+CND_PACKAGE_PATH_WindowsReleaseMinGW=dist/WindowsReleaseMinGW/Cygwin-Linux-x86/package/dictproc.tar
diff --git a/TIesr_Tools/dictproc/nbproject/Package-LinuxDebugGnu.bash b/TIesr_Tools/dictproc/nbproject/Package-LinuxDebugGnu.bash
new file mode 100644 (file)
index 0000000..8401bfb
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxDebugGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/dictproc
+OUTPUT_BASENAME=dictproc
+PACKAGE_TOP_DIR=dictproc/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/dictproc/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/dictproc.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/dictproc.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesr_Tools/dictproc/nbproject/Package-LinuxReleaseGnu.bash b/TIesr_Tools/dictproc/nbproject/Package-LinuxReleaseGnu.bash
new file mode 100644 (file)
index 0000000..02c1dfc
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=GNU_current-Linux-x86
+CND_CONF=LinuxReleaseGnu
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/bin/dictproc
+OUTPUT_BASENAME=dictproc
+PACKAGE_TOP_DIR=dictproc/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/dictproc/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/dictproc.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/dictproc.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesr_Tools/dictproc/nbproject/Package-WindowsDebugMinGW.bash b/TIesr_Tools/dictproc/nbproject/Package-WindowsDebugMinGW.bash
new file mode 100644 (file)
index 0000000..96fec3e
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsDebugMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/dictproc.exe
+OUTPUT_BASENAME=dictproc.exe
+PACKAGE_TOP_DIR=dictproc/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/dictproc/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/dictproc.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/dictproc.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesr_Tools/dictproc/nbproject/Package-WindowsReleaseMinGW.bash b/TIesr_Tools/dictproc/nbproject/Package-WindowsReleaseMinGW.bash
new file mode 100644 (file)
index 0000000..42668e3
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_PLATFORM=Cygwin-Linux-x86
+CND_CONF=WindowsReleaseMinGW
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=../../Dist/${CND_CONF}/dictproc.exe
+OUTPUT_BASENAME=dictproc.exe
+PACKAGE_TOP_DIR=dictproc/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/dictproc/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/dictproc.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/dictproc.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/TIesr_Tools/dictproc/nbproject/configurations.xml b/TIesr_Tools/dictproc/nbproject/configurations.xml
new file mode 100755 (executable)
index 0000000..9d91e28
--- /dev/null
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+      <itemPath>src/dictproc.h</itemPath>
+      <itemPath>src/dmakeup.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ResourceFiles"
+                   displayName="Resource Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>src/compress_entry.c</itemPath>
+      <itemPath>src/dictproc.c</itemPath>
+      <itemPath>src/english.c</itemPath>
+      <itemPath>src/map.c</itemPath>
+      <itemPath>src/parse.c</itemPath>
+      <itemPath>src/phoneme.c</itemPath>
+      <itemPath>src/phones.c</itemPath>
+      <itemPath>src/saynum.c</itemPath>
+      <itemPath>src/spellword.c</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="LinuxDebugGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/dictproc</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>GNU_current|GNU</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <ccTool>
+          <developmentMode>5</developmentMode>
+        </ccTool>
+        <fortranCompilerTool>
+          <developmentMode>5</developmentMode>
+        </fortranCompilerTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/bin/dictproc</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/lib</pElem>
+          </linkerAddLib>
+          <linkerDynSerch>
+            <pElem>${CND_BASEDIR}/../../Dist/${CND_CONF}/lib</pElem>
+          </linkerDynSerch>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsDebugMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <incDir>
+            <pElem>src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/dictproc.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <compilerSet>Cygwin|Cygwin</compilerSet>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <cTool>
+          <developmentMode>5</developmentMode>
+          <incDir>
+            <pElem>src</pElem>
+            <pElem>../../TIesrDT/src</pElem>
+          </incDir>
+          <commandLine>-v -mno-cygwin</commandLine>
+          <warningLevel>2</warningLevel>
+        </cTool>
+        <linkerTool>
+          <output>../../Dist/${CND_CONF}/dictproc.exe</output>
+          <linkerAddLib>
+            <pElem>../../Dist/${CND_CONF}/</pElem>
+          </linkerAddLib>
+          <linkerLibItems>
+            <linkerLibLibItem>TIesrDT</linkerLibLibItem>
+          </linkerLibItems>
+          <commandLine>-v -mno-cygwin</commandLine>
+        </linkerTool>
+      </compileType>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesr_Tools/dictproc/nbproject/private/configurations.xml b/TIesr_Tools/dictproc/nbproject/private/configurations.xml
new file mode 100755 (executable)
index 0000000..efde48f
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>0</defaultConf>
+  <confs>
+    <conf name="LinuxDebugGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="LinuxReleaseGnu" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsDebugMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>false</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+    <conf name="WindowsReleaseMinGW" type="1">
+      <gdbdebugger version="2">
+        <gdb_command>gdb</gdb_command>
+        <array_repeat_threshold>10</array_repeat_threshold>
+      </gdbdebugger>
+      <gizmo_options version="1">
+      </gizmo_options>
+      <runprofile version="5">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>false</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/TIesr_Tools/dictproc/nbproject/private/private.properties b/TIesr_Tools/dictproc/nbproject/private/private.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/TIesr_Tools/dictproc/nbproject/private/private.xml b/TIesr_Tools/dictproc/nbproject/private/private.xml
new file mode 100755 (executable)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/TIesr_Tools/dictproc/nbproject/project.properties b/TIesr_Tools/dictproc/nbproject/project.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/TIesr_Tools/dictproc/nbproject/project.xml b/TIesr_Tools/dictproc/nbproject/project.xml
new file mode 100755 (executable)
index 0000000..ba342b6
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.cnd.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>dictproc</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions>c</c-extensions>
+            <cpp-extensions/>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/TIesr_Tools/dictproc/src/compress_entry.c b/TIesr_Tools/dictproc/src/compress_entry.c
new file mode 100755 (executable)
index 0000000..6e1c1f4
--- /dev/null
@@ -0,0 +1,630 @@
+/*=======================================================================
+ compress_entry.c
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+#include   "dictproc.h"
+
+/* dictionary entry */
+int  cur_entry;
+char *entry[ MAX_ENTRY ];
+char *entry_pron[ MAX_ENTRY ];
+
+/* monophone */
+char *phone[ MAX_PHONE ];
+int n_phone;                /* 46 + "bbb" = 47 */
+
+/* pronunciation match */
+char *pron_dict;
+char *pron_def;
+int  len_dict;
+int  len_def;
+int  gerrc, gsubc, gdelc, ginsc;
+char g_match_pattern[ MAX_PRON ];
+int  g_match_pattern_cnt;
+
+/* ---------------------------------------------------------------------------
+   some string functions ...
+   ---------------------------------------------------------------------- */
+
+int get_strlen( char *str )
+{
+  int   len = 0;
+
+  while ( *str++ ) len++;
+  
+  return len;
+}
+
+void copy_str(char *str1, char *str2)
+{
+  while ( *str2 )
+    *str1++ = *str2++;
+    
+  *str1 = '\0';
+}
+
+int equal_str(char *str1, char *str2)
+{
+  while ( *str1 && *str2  && ( *str1 == *str2 ) ) {
+    str1++;
+    str2++;
+  }
+
+  if ( *str1 == '\0' && *str2 == '\0' ) return 1;
+  else return 0;
+}
+
+/* ---------------------------------------------------------------------------
+   return -1 0 1 if str1 < = > str2
+   ---------------------------------------------------------------------- */
+
+int compare_str(char *str1, char *str2)
+{
+  while ( *str1 && *str2 ) {
+
+    if ( *str1 > *str2 ) 
+      return 1;
+    else if ( *str1 < *str2 ) 
+      return -1;
+
+    str1++;
+    str2++;
+  }
+
+  if ( ( *str1 == 0 ) && ( *str2 != 0 ) )
+    return -1;
+  else if ( ( *str1 != 0 ) && ( *str2 == 0 ) )
+    return 1;
+  else
+    return 0;
+}
+
+/* ---------------------------------------------------------------------------
+   read monophone names
+   ---------------------------------------------------------------------- */
+
+void read_phone( char *fname )
+{
+  FILE  *fp;
+  char  buf[ MAX_STR ];
+  char  *ptr;
+
+  n_phone = 0;
+
+  fp = fopen(fname, "r");
+  if( fp == NULL )
+  {
+      fprintf( stderr, "Failed to open phone file %s\n", fname );
+      exit(1);
+  }
+  while ( fgets(buf, MAX_STR, fp) ) {
+    ptr = (char *) strtok(buf, DELIMIT);
+    phone[ n_phone ] = (char *) strdup( ptr );
+    n_phone++;
+  }
+
+  fclose( fp );
+}
+
+int get_phone_idx(char *name)
+{
+  int i;
+
+  for(i = 0; i < n_phone; i++) {
+    if ( strcmp(name, phone[i]) == 0 )
+      return i;
+  }
+
+  fprintf(stderr, "Error: %s not a phone\n", name );
+  return( -1 );
+}
+
+/* ---------------------------------------------------------------------------
+   pron2bin
+
+   Convert ascii phone sequence to binary, where each phone is represented
+   by its index in the input phone list as a byte.
+
+   pron[0] = length in bytes, total length of data in pron is pron[0] + 1
+
+   pron[0] can equal zero if str contains no phones.
+   ---------------------------------------------------------------------- */
+
+void pron2bin(char *str, char *pron)
+{
+  int   i = 1;
+  char  *ptr;
+
+  ptr = (char *) strtok(str, DELIMIT);
+  while( ptr )
+  {
+     pron[ i++ ] = get_phone_idx( ptr );
+     ptr = (char *) strtok(NULL, DELIMIT) ;
+  }
+  pron[ 0 ] = i - 1;
+}
+
+/* ---------------------------------------------------------------------------
+   convert g_match_pattern sequence to pron_err
+   pron_err[0] = length in bytes, total length is pron_err[0] + 1
+
+   pron_dict set by calling function
+   ---------------------------------------------------------------------- */
+
+void pron2err( char *pron_err )
+{
+  int   i;
+  int   len, idx1, idx2;
+  char  pron[ MAX_PRON ];
+
+  if ( g_match_pattern_cnt > MAX_POS ) {
+    fprintf(stderr, "Error: phone alignment length exceeds %d\n", MAX_POS);
+    exit(1);
+  }
+
+  /* align, make space for insertion */
+
+  idx1 = idx2 = 0;
+
+  for (i = 0; i < g_match_pattern_cnt; i++) {
+
+    if ( g_match_pattern[ i ] == MATCH ) {
+
+      pron[ idx1++ ] = pron_dict[ idx2++ ];
+      
+    } else if ( g_match_pattern[ i ] == SUB ) {
+
+      pron[ idx1++ ] = pron_dict[ idx2++ ];
+      
+    } else if ( g_match_pattern[ i ] == DEL ) {
+
+      pron[ idx1++ ] = pron_dict[ idx2++ ];
+      
+    } else if ( g_match_pattern[ i ] == INS ) {
+
+      idx1++;
+
+    }
+  }
+
+  /* encode the error */
+
+  len = 0;
+  
+  for (i = 0; i < g_match_pattern_cnt; i++) {
+    
+    if ( g_match_pattern[ i ] == SUB ) {
+      
+      pron_err[ 1 + len ] = SUB | i;         /* position */
+      pron_err[ 1 + len + 1 ] = pron[ i ];   /* phone */
+      len += 2;
+
+    } else if ( g_match_pattern[ i ] == DEL ) {
+
+      pron_err[ 1 + len ] = DEL | i;         /* position */
+      pron_err[ 1 + len + 1 ] = pron[ i ];   /* phone */
+      len += 2;
+
+    } else if ( g_match_pattern[ i ] == INS ) {
+
+      pron_err[ 1 + len ] = INS | i;         /* position */
+      len++;
+
+    }
+  }
+
+  pron_err[0] = len;
+}
+
+/* ---------------------------------------------------------------------------
+   convert pron_err sequence to pron,
+   pron[0] = length in bytes, total length is pron[0] + 1
+
+   pron_def set by the calling function
+   ---------------------------------------------------------------------- */
+
+void err2pron( char *pron_err, char *pron )
+{
+  int   i;
+  int   len, idx1, idx2, pos, insc;
+
+  /* go through pron_err and reconstruct pron */
+
+  insc = 0;
+  idx1 = idx2 = 0;
+  len = pron_err[0];
+
+  i = 1;
+
+  while ( i <= len ) {
+
+    if ( ( pron_err[i] & MASK ) == SUB ) {            /* SUB */
+
+      pos = pron_err[i] & 0x3f;   /* position */
+      while ( idx1 + insc < pos )
+       pron[ 1 + idx1++ ] = pron_def[ idx2++ ];
+
+      pron[ 1 + idx1++ ] = pron_err[ i + 1 ];
+      idx2++;
+
+      i += 2;
+
+    } else if ( ( pron_err[i] & MASK ) == DEL ) {     /* DEL */
+      
+      pos = pron_err[i] & 0x3f;   /* position */
+      while ( idx1 + insc < pos )
+       pron[ 1 + idx1++ ] = pron_def[ idx2++ ];
+
+      pron[ 1 + idx1++ ] = pron_err[ i + 1 ];
+
+      i += 2;
+
+    } else {                                          /* INS */
+
+      pos = pron_err[i] & 0x3f;   /* position */
+      while ( idx1 + insc < pos )
+       pron[ 1 + idx1++ ] = pron_def[ idx2++ ];
+
+      idx2++;
+
+      insc++;
+
+      i++;
+    }
+  }
+
+  /* the rest, including no err */
+
+  while ( idx2 < len_def )
+    pron[ 1 + idx1++ ] = pron_def[ idx2++ ];
+
+  pron[0] = idx1;
+}
+
+ /* ---------------------------------------------------------------------------
+    check if two binary pron's are equal
+   ---------------------------------------------------------------------- */
+int equal_pron(char *pron1, char *pron2)
+{
+  int   i, len;
+
+  if ( pron1[0] != pron2[0] ) return 0;
+
+  len = pron1[0];
+  for (i = 1; i <= len; i++)
+    if ( pron1[i] != pron2[i] ) return 0;
+
+  return 1;
+}
+
+/* ---------------------------------------------------------------------------
+   must do buf[0] = '\0' before calling expand_str()
+   ---------------------------------------------------------------------- */
+
+void expand_str(char *buf, int idx)
+{
+  int   len;
+
+  if ( (signed char) entry[ idx ][ 0 ] >= 0 ) {
+
+    copy_str(buf, entry[ idx ]);
+    
+  } else {
+    
+    expand_str(buf, idx - 1);
+    len = - (signed char) entry[ idx ][ 0 ];
+    buf += len;
+    copy_str(buf, &entry[ idx ][ 1 ]);
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   must do buf[0] = '\0' before calling expand_pron()
+   very similar to expand_str(), but the format is different.
+
+   "String" is terminated by '\0'.
+
+   "Pronunciation" is prefixed by length, followed by length bytes,
+   there is no termination char.
+   ---------------------------------------------------------------------- */
+
+void expand_pron(char *buf, int idx)
+{
+  int   len, base;
+  int   i;
+
+  if ( entry_pron[ idx ][ 0 ] == 0 ) {
+
+    buf[0] = '\0';
+
+  } else if ( ( entry_pron[ idx ][ 1 ] & MASK ) != MATCH ) {
+
+    len = entry_pron[ idx ][ 0 ];
+    for (i = 1; i <= len; i++) buf[ i ] = entry_pron[ idx ][ i ];
+    buf[0] = len;
+    
+  } else {
+    
+    expand_pron(buf, idx - 1);
+    len = entry_pron[ idx ][ 1 ];
+    base = len + 1;
+    len = entry_pron[ idx ][ 0 ] - 1;
+    for (i = 0; i < len; i++) buf[ base + i ] = entry_pron[ idx ][ 2 + i ];
+    buf[0] = base + len - 1;
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   compare str with entry[ cur_entry - 1 ]
+   ---------------------------------------------------------------------- */
+
+void compare_entry(char *str, int *cnt)
+{
+  char  buf[ MAX_STR ], *ptr;
+  
+  buf[0] = '\0';
+  expand_str(buf, cur_entry - 1);
+  ptr = buf;
+
+  *cnt = 0;
+  while ( *str && *ptr && ( *str == *ptr ) ) {
+    *cnt += 1;
+    str++;
+    ptr++;
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   compare pron with entry_pron[ cur_entry - 1 ]
+   ---------------------------------------------------------------------- */
+
+void compare_entry_pron(char *pron, int *cnt)
+{
+  char  buf[ MAX_PRON ], *ptr;
+  int   len;
+  int   i;
+
+  buf[0] = '\0';
+  expand_pron(buf, cur_entry - 1);
+  len = pron[0] < buf[0] ? pron[0] : buf[0];
+  ptr = buf;
+
+  pron++;
+  ptr++;
+  for (i = 0; i < len; i++) {
+    if ( pron[i] != ptr[i] ) break;
+  }
+
+  *cnt = i;
+}
+
+/* ---------------------------------------------------------------------------
+   encode str and put it into entry[ cur_entry ]
+   cur_entry needs to be incremented by the calling function
+   ---------------------------------------------------------------------- */
+
+void encode_entry( char *str )
+{
+  int   match_cnt;
+  int   len;
+  char  buf[ MAX_STR ];
+
+  if ( cur_entry - 1 >= 0 ) {
+
+    compare_entry(str, &match_cnt);
+
+    /* need to match more than one char to be useful */
+    
+    if ( match_cnt > 1 ) {
+
+      buf[0] = (signed char) - match_cnt;
+      copy_str(&buf[1], str + match_cnt);
+      len = get_strlen( buf );
+      entry[ cur_entry ] = (char *) malloc( len + 1 );
+      copy_str( entry[ cur_entry ], buf );
+
+    } else {
+
+      entry[ cur_entry ] = (char *) strdup( str );
+    }
+
+  } else {
+    
+    entry[ cur_entry ] = (char *) strdup( str );
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   encode pron and put it into entry_pron[ cur_entry ]
+   cur_entry needs to be incremented by the calling function
+   ---------------------------------------------------------------------- */
+
+void encode_entry_pron( char *pron )
+{
+  int   match_cnt;
+  int   len, base;
+  int   i;
+
+  /* no delta encode, to debug err encode alone */
+  /*
+  len = pron[0] + 1;
+  entry_pron[ cur_entry ] = (char *) malloc( len );
+  for (i = 0; i < len; i++) entry_pron[ cur_entry ][ i ] = pron[i];
+  
+  return;
+  */
+  /* delta encode */
+
+  if ( cur_entry - 1 >= 0 ) {
+
+    compare_entry_pron(pron, &match_cnt);
+
+    /* need to match more than one char to be useful */
+    
+    if ( match_cnt > 1 ) {
+
+      len = pron[0] - match_cnt + 1;
+      entry_pron[ cur_entry ] = (char *) malloc( len + 1 );
+      entry_pron[ cur_entry ][0] = len;
+      entry_pron[ cur_entry ][1] = match_cnt;
+      base = match_cnt + 1;
+      len--;
+      for (i = 0; i < len; i++) 
+       entry_pron[ cur_entry ][ 2 + i ] = pron[ base + i ];
+
+    } else {
+
+      len = pron[0] + 1;
+      entry_pron[ cur_entry ] = (char *) malloc( len );
+      for (i = 0; i < len; i++) entry_pron[ cur_entry ][ i ] = pron[i];
+    }
+
+  } else {
+
+    len = pron[0] + 1;
+    entry_pron[ cur_entry ] = (char *) malloc( len );
+    for (i = 0; i < len; i++) entry_pron[ cur_entry ][ i ] = pron[i];
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   copy match pattern
+   ---------------------------------------------------------------------- */
+
+void copy_match_pattern(char *mp1, int *mpc1, char *mp2, int mpc2)
+{
+  int   i;
+
+  for (i = 0; i < mpc2; i++)
+    mp1[i] = mp2[i];
+
+  *mpc1 = mpc2;
+}
+
+/* ---------------------------------------------------------------------------
+   match
+
+   Match the dictionary pronunciation with the default pronunciation.  This
+   is a recursive function to determine the best way to encode the difference
+   in pronunciation.
+   ---------------------------------------------------------------------- */
+
+void
+match(int subc,       /* substitution count */
+      int delc,       /* deletion count */
+      int insc,       /* insertion count */
+      int idx_dict,   /* index to dictionary pronunciation */
+      int idx_def,    /* index to default pronunciation */
+      char *match_pattern,
+      int match_pattern_cnt)
+{
+  char  match_pattern_2[ MAX_PRON ];
+  int   match_pattern_cnt_2;
+  int   errc;
+  int   i;
+  
+  errc = subc + delc + insc;
+  copy_match_pattern(match_pattern_2, &match_pattern_cnt_2,
+                    match_pattern, match_pattern_cnt);
+
+  if ( idx_dict >= len_dict ) {          /* dict pron run out, insertion ? */
+
+    insc = insc + len_def - idx_def;
+    errc = errc + len_def - idx_def;
+    for (i = 0; i < len_def - idx_def; i++) {
+      match_pattern_2[ match_pattern_cnt_2 + i ] = INS;
+    }
+    match_pattern_cnt_2 += len_def - idx_def;
+
+    if ( errc < gerrc ) {
+      gsubc = subc;
+      gdelc = delc;
+      ginsc = insc;
+      gerrc = errc;
+      copy_match_pattern(g_match_pattern, &g_match_pattern_cnt,
+                        match_pattern_2, match_pattern_cnt_2);
+    }
+
+  } else if ( idx_def >= len_def ) {    /* def pron run out, deletion ? */
+  
+    delc = delc + len_dict - idx_dict;
+    errc = errc + len_dict - idx_dict;
+    for (i = 0; i < len_dict - idx_dict; i++) {
+      match_pattern_2[ match_pattern_cnt_2 + i ] = DEL;
+    }
+    match_pattern_cnt_2 += len_dict - idx_dict;
+
+    if ( errc < gerrc ) {
+      gsubc = subc;
+      gdelc = delc;
+      ginsc = insc;
+      gerrc = errc;
+      copy_match_pattern(g_match_pattern, &g_match_pattern_cnt,
+                        match_pattern_2, match_pattern_cnt_2);
+    }
+
+  } else if ( pron_dict[ idx_dict ] == pron_def[ idx_def ] ) {
+
+    if ( errc < gerrc ) {               /* match */
+
+      match_pattern_2[ match_pattern_cnt_2 ] = MATCH;
+      match_pattern_cnt_2++;
+      match(subc, delc, insc, idx_dict + 1, idx_def + 1,
+           match_pattern_2, match_pattern_cnt_2);
+    }
+
+    if ( errc + 1 < gerrc ) {           /* deletion */
+
+      copy_match_pattern(match_pattern_2, &match_pattern_cnt_2,
+                        match_pattern, match_pattern_cnt);
+      match_pattern_2[ match_pattern_cnt_2 ] = DEL;
+      match_pattern_cnt_2++;
+      match(subc, delc + 1, insc, idx_dict + 1, idx_def,
+           match_pattern_2, match_pattern_cnt_2);
+    }
+
+    if ( errc + 1 < gerrc ) {           /* insertion */
+
+      copy_match_pattern(match_pattern_2, &match_pattern_cnt_2,
+                        match_pattern, match_pattern_cnt);
+      match_pattern_2[ match_pattern_cnt_2 ] = INS;
+      match_pattern_cnt_2++;
+      match(subc, delc, insc + 1, idx_dict, idx_def + 1,
+           match_pattern_2, match_pattern_cnt_2);
+    }
+
+  } else {
+    
+    if ( errc + 1 < gerrc ) {           /* substitution */
+      
+      match_pattern_2[ match_pattern_cnt_2 ] = SUB;
+      match_pattern_cnt_2++;
+      match(subc + 1, delc, insc, idx_dict + 1, idx_def + 1,
+           match_pattern_2, match_pattern_cnt_2);
+    }
+    
+    if ( errc + 1 < gerrc ) {           /* deletion */
+      
+      copy_match_pattern(match_pattern_2, &match_pattern_cnt_2,
+                        match_pattern, match_pattern_cnt);
+      match_pattern_2[ match_pattern_cnt_2 ] = DEL;
+      match_pattern_cnt_2++;
+      match(subc, delc + 1, insc, idx_dict + 1, idx_def,
+           match_pattern_2, match_pattern_cnt_2);
+    }
+
+    if ( errc + 1 < gerrc ) {           /* insertion */
+
+      copy_match_pattern(match_pattern_2, &match_pattern_cnt_2,
+                        match_pattern, match_pattern_cnt);
+      match_pattern_2[ match_pattern_cnt_2 ] = INS;
+      match_pattern_cnt_2++;
+      match(subc, delc, insc + 1, idx_dict, idx_def + 1,
+           match_pattern_2, match_pattern_cnt_2);
+    }
+
+  }
+}
diff --git a/TIesr_Tools/dictproc/src/dictproc.c b/TIesr_Tools/dictproc/src/dictproc.c
new file mode 100755 (executable)
index 0000000..ecbeb21
--- /dev/null
@@ -0,0 +1,430 @@
+/*=======================================================================
+ dictproc.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+
+  This program is used to compress a dictionary file into a binary
+  file that is compatible with the TIesrDict API.  The compressed
+  binary dictionary is delta encoded based upon the default
+  pronunciation supplied by an API that can develop a default
+  pronunciation from a word spelling.
+
+  The program originally used a rule-based utility to generate
+  the default pronunciation, which was specific to English.  The
+  utility included some text-normalization capabilities. This
+  rule-based system was derived from the public domain source code
+  ENGLISH TO PHONEME TRANSLATION written by John A. Wasser, 4/15/85.
+
+  Later, the capability was added to optionally use the TIesrDT
+  API, which is the preferred method. TIesrDT is based on
+  decision tree generation of phonetic pronunciations, where
+  there is a decision tree for each letter of a spelled word.
+  This method requires more space to store the decision trees,
+  but provides more accurate pronunciations.
+
+======================================================================*/
+// System includes
+#include <sys/types.h>
+#include <dirent.h>
+
+/* Now use TIesrDT rather than dtmakeup */
+/* #include "dtmakeup_user.h" */
+#include <TIesrDT_User.h>
+
+#include   "dictproc.h"
+
+
+/* Now done via input argument */
+/* #define     MAP        1 */       /* 0: no map, 1: map */
+
+extern int  cur_entry;
+extern char *entry[];
+extern char *entry_pron[];
+
+extern char *phone[];
+extern int n_phone;                /* 46 + "bbb" = 47 */
+
+extern char *pron_dict;
+extern char *pron_def;
+extern int  len_dict;
+extern int  len_def;
+extern int  gerrc, gsubc, gdelc, ginsc;
+extern char g_match_pattern[];
+extern int  g_match_pattern_cnt;
+
+static char prev_word[ MAX_STR ];
+static char save_word[ MAX_STR ];
+
+static int little_endian;
+
+/* ---------------------------------------------------------------------------
+   output a 32-bit, big endian or little endian
+   ---------------------------------------------------------------------- */
+
+void
+output_int32(FILE *fp, int i32)
+{
+  if ( little_endian ) {
+
+    fputc( 0xff & i32, fp);
+    i32 = i32 >> 8;
+    fputc( 0xff & i32, fp);
+    i32 = i32 >> 8;
+    fputc( 0xff & i32, fp);
+    i32 = i32 >> 8;
+    fputc( 0xff & i32, fp);
+
+  } else {
+
+    fputc( ( i32 >> 24 ) & 0xff, fp );
+    fputc( ( i32 >> 16 ) & 0xff, fp );
+    fputc( ( i32 >> 8 ) & 0xff, fp );
+    fputc( i32 & 0xff, fp );
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   word: entry word
+   ptr1: correct phone sequence (from the input dictionary)
+   ptr2: phone sequence from rule (default)
+   ---------------------------------------------------------------------- */
+
+void process(char *word, char *ptr1, char *ptr2)
+{
+  char  pron1[ MAX_PRON ], pron2[ MAX_PRON ], pron_err[ MAX_PRON ];
+  char  match_pattern[ MAX_PRON ];
+
+  /* convert from ASCII string to byte phone index.
+   pron1 is dictionary pronunciation, pron2 is default. */
+  pron2bin(ptr1, pron1);
+  pron2bin(ptr2, pron2);
+
+  /* Prepare for align. Initialize global substitution, deletion, and
+     insertion counts to a large value.  Alignment matching finds the
+     pattern of insertions, substitutions and deletions that minimizes
+     the sum of the three types of misalignment errors. */
+
+  gsubc = gdelc = ginsc = LARGE;
+
+  gerrc = gsubc + gdelc + ginsc;
+
+  g_match_pattern_cnt = 0;
+
+  /* Length of phone string for each pronunciation.  len_def may be zero. */
+  len_dict = (int) pron1[0];
+  len_def = (int) pron2[0];
+
+  /* Pointers to pronunciations.  */
+  pron_dict = &pron1[1];
+  pron_def = &pron2[1];
+
+  /* Align pronunciations. */
+  match(0, 0, 0, 0, 0, match_pattern, 0);
+
+  /* error encode, convert to pron error */
+  pron2err( pron_err );
+
+  /* delta encode and store */
+  if ( pron_err[0] == '\0' ) {           /* same as default pron */
+
+    if ( equal_str(word, prev_word) ) {  /* prev nondef exist, need to save */
+
+      encode_entry( word );
+      encode_entry_pron( pron_err );
+      cur_entry++;
+
+    } else {
+
+      copy_str( save_word, word );       /* tag def, may need to save later */
+    }
+
+  } else {                               /* different from default pron */
+
+    if ( equal_str(word, save_word) ) {  /* prev def need to save */
+
+      encode_entry( save_word );
+      pron2[0] = '\0';                   /* reset to default */
+      encode_entry_pron( pron2 );
+      cur_entry++;
+
+      save_word[0] = '\0';               /* def saved, clear tag */
+
+      encode_entry( word );              /* save nondef */
+      encode_entry_pron( pron_err );
+      cur_entry++;
+
+    } else {
+
+      encode_entry( word );              /* save nondef */
+      encode_entry_pron( pron_err );
+      cur_entry++;
+    }
+
+    copy_str( prev_word, word );
+  }
+}
+
+/* ---------------------------------------------------------------------------
+   debug
+   ---------------------------------------------------------------------- */
+
+void decode_all_entry()
+{
+  int   i, j;
+  char  line[ MAX_STR ], pron_ascii[ MAX_STR ], pron_bin[ MAX_PRON ];
+  char  pron[ MAX_PRON ];
+  char  pron_err[ MAX_PRON ];
+  int   entry_size = 0, entry_pron_size = 0;
+
+  for (i = 0; i < cur_entry; i++) {
+
+    entry_size += get_strlen( entry[i] );
+
+    line[0] = '\0';
+    expand_str(line, i);
+    printf("%s\t", line);
+    
+    entry_pron_size += entry_pron[i][0];
+
+    pron_err[0] = '\0';
+    expand_pron(pron_err, i);
+    epd_make_string(line, pron_ascii, MAX_STR);
+    pron2bin(pron_ascii, pron_bin);
+    len_def = pron_bin[0];
+    pron_def = &pron_bin[1];
+    err2pron( pron_err, pron );
+    for (j = 0; j < pron[0]; j++)
+      printf("%s ", phone[ pron[ 1 + j ] ]);
+    printf("\n");
+  }
+
+  fprintf(stderr, "word size = %d pron size = %d\n", 
+         entry_size, entry_pron_size);
+}
+/* ---------------------------------------------------------------------------
+   output dictionary
+   ---------------------------------------------------------------------- */
+
+int output_entry( FILE *fp, int idx )
+{
+  int   len, byte_cnt;
+  signed char  len_char;
+  int   i;
+
+  /* output alignemnt byte, it is unique, no other byte can be ALIGN,
+     this alignment byte allows us to not use an address array */
+  len_char = ALIGN;    /* tmp */
+  fwrite( &len_char, sizeof( char ), 1, fp);
+
+  /* output the delta-encoded entry name */
+  i = 0;
+  while ( entry[ idx ][ i ] )
+    fwrite( &entry[ idx ][ i++ ], sizeof( char ), 1, fp);
+
+  byte_cnt = i + 1;
+
+  /* output the pronunciation size and error-delta encoded pronunciation,
+     the pronunciation size is converted into negative to act as
+     delimiter for the entry name */
+  len = entry_pron[ idx ][ 0 ];
+  len_char = (signed char) entry_pron[ idx ][ 0 ] | (signed char) 0x80;
+  fwrite( &len_char, sizeof( char ), 1, fp);
+
+  for (i = 0; i < len; i++)
+    fwrite( &entry_pron[ idx ][ 1 + i ], sizeof( char ), 1, fp);
+
+  byte_cnt += len + 1;
+
+  return byte_cnt;
+}
+
+/* ---------------------------------------------------------------------------
+   main
+   ---------------------------------------------------------------------- */
+
+int main(int argc, char **argv)
+{
+  FILE  *fpi, *fpo;
+  char  line[ MAX_STR ], buf[ MAX_STR ], buf1[ MAX_STR ], buf2[ MAX_STR ];
+  char  *ptr1, *ptr2;
+  int   entry_offset;
+  int   i;
+  int dodt = 0;
+  char* dt_dir;
+  DIR *dirp;
+  int domap = 1;
+
+
+  /* TIesrDT API instance and error tracking variable */
+  TIesrDT_t dtInstance;
+  TIesrDT_Error_t dtError;
+
+
+  if ( argc <  5 ) {
+    fprintf(stderr, "\nusage: %s dict_in phone dict_out (little_endian or big_endian) [map] [dt_dir]\n\n", argv[0]);
+    exit(1);
+  }
+
+  if ( strcmp(argv[4], "little_endian") == 0 ) {
+    little_endian = 1;
+  } else if ( strcmp(argv[4], "big_endian") == 0 ) {
+    little_endian = 0;
+  } else {
+    fprintf(stderr, "Error: specify little_endian or big_endian!\n");
+    exit(1);
+  }
+
+
+  /* Determine if mapping is to be performed */
+  if( argc >= 6 )
+  {
+      domap = atoi( argv[5] );
+  }
+
+
+  /* 
+     If a decision tree directory is specified, check for valid
+     directory, and if so, use decision tree. 
+  */
+  if( argc == 7 )
+  {
+     dt_dir = argv[6];
+     dirp = opendir( dt_dir );
+     if( dirp == NULL )
+     {
+         fprintf( stderr, "Error: failed to open %s\n", dt_dir );
+       exit(1);
+     }
+     closedir( dirp );
+     dodt = 1;
+
+     /* Create a TIesrDT instance */
+     dtError = TIesrDT_CreatePreload( &dtInstance, dt_dir );
+     if( dtError != TIesrDTErrorNone )
+     {
+       fprintf(stderr, "Could not create TIesrDT instance\n" );
+       exit(1);
+     }
+  }
+
+  /* Initialize dictionary processing globals */
+  cur_entry = 0;
+  prev_word[0] = '\0';
+  save_word[0] = '\0';
+
+  /* Open input dictionary */
+  fpi = fopen(argv[1], "r");
+  if( fpi == NULL )
+  {
+      fprintf( stderr, "Could not open %s\n", argv[1] );
+      exit(1);
+  }
+
+  /* Read list of all phones used in the dictionary */
+  read_phone( argv[2] );
+
+
+  while ( fgets(line, MAX_STR, fpi) ) 
+  {
+     /* Obtain pointer to the word */
+     ptr1 = (char *) strtok(line, DELIMIT);
+
+     /* Obtain pointer to the word pronunciation phone string */
+     ptr2 = (char *) strtok(NULL, "\n");
+
+
+     /* Output word being compressed */
+     printf( "%s\n", ptr1 );
+     fflush( stdout );
+
+
+    /* get default pronunciation in buf */
+    if( dodt )
+    {
+       /* Now use TIesrDT API to get the default pronunciation */
+       /* epd_make_case( ptr1, buf, MAX_STR, dt_dir, true ); */
+       
+       dtError = TIesrDT_Pron( dtInstance, ptr1, buf, MAX_STR );
+       if( dtError != TIesrDTErrorNone )
+       {
+         TIesrDT_Destroy( dtInstance );
+         fprintf( stderr, "TIesrDT failure for %s\n", ptr1 );
+         exit(1);
+       }
+    }
+    else
+    {
+       epd_make_string(ptr1, buf, MAX_STR);
+    }
+    
+    
+if( ! domap )
+{
+
+    /* Add the word in ptr1 to the compressed dictionary
+       based on delta coding between ptr2 (dictionary) and buf (default) 
+       pronunciations. */
+    process( ptr1, ptr2, buf );
+}
+
+else if( domap )
+{
+    
+    /* Add stop closures to dictionary pronunciation held in ptr2 */
+    map_pron(ptr2, buf1);
+
+    /* Add stop closures to default word pronunciation held in buf. */
+    map_pron(buf, buf2);
+
+    /* Add the word in ptr1 to the compressed dictionary
+       based on delta coding between buf1 (dictionary)  and buf2 (default)
+       pronunciations. */
+    process( ptr1, buf1, buf2 );
+}
+
+    if ( cur_entry >= MAX_ENTRY ) {
+      fprintf(stderr, "Error: Exceed max entry %d\n", MAX_ENTRY);
+      exit(1);
+    }
+  }
+
+  fclose( fpi );
+
+  dtError = TIesrDT_Destroy( dtInstance );
+  if( dtError != TIesrDTErrorNone )
+  {
+     fprintf( stderr, "Fail during TIesrDT destroy\n" );
+  }
+
+
+  /* output the binary dictionary,
+     the binary dictionary starts with the size of the file - 4 */
+
+  fpo = fopen(argv[3], "wb");
+  if( fpo == NULL )
+  {
+      fprintf( stderr, "Could not open output %s\n", argv[3]);
+      exit(1);
+  }
+
+  entry_offset = 0;
+
+  /* dummy size of the dictionary, don't know yet */
+  output_int32( fpo, entry_offset );
+
+  for (i = 0; i < cur_entry; i++)
+    entry_offset += output_entry( fpo, i );
+
+  /* real size of the dictionary, not including this 4 bytes */
+  rewind( fpo );
+  output_int32( fpo, entry_offset );
+
+  fclose( fpo );
+
+  /* decode_all_entry(); */
+
+  exit(0);
+
+}
diff --git a/TIesr_Tools/dictproc/src/dictproc.h b/TIesr_Tools/dictproc/src/dictproc.h
new file mode 100644 (file)
index 0000000..331e3b3
--- /dev/null
@@ -0,0 +1,44 @@
+/*=======================================================================
+ dictproc.h
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+
+======================================================================*/
+#include   <stdlib.h>
+#include   <stdio.h>
+#include   <string.h>
+
+#define    MAX_PHONE    100      /* English has 46 */
+#define    MAX_PRON     100      /* max # of phones in a word */
+#define    MAX_ENTRY    300000
+#define    MAX_STR      1024
+#define    DELIMIT      " \n\t"
+#define    MAX_POS      62       /* max number of phone alignment in a word */
+
+#define    ALIGN        (char) 0xff   /* nothing else can be 0xff */
+#define    MASK         (char) 0xc0   /* MSB two bits */
+#define    MATCH        (char) 0x00
+#define    SUB          (char) 0x40
+#define    DEL          (char) 0x80
+#define    INS          (char) 0xc0
+
+#define    LARGE        9999
+
+extern int epd_make_string(char *, char *, int);
+extern void encode_entry( char * );
+extern void encode_entry_pron( char * );
+extern void expand_str(char *, int);
+extern int get_strlen( char * );
+extern void copy_str(char *, char *);
+extern void read_phone( char * );
+extern int get_phone_idx(char *);
+extern void pron2bin(char *, char *);
+extern void pron2err( char * );
+extern void err2pron( char *, char * );
+extern int equal_pron(char *, char *);
+extern int equal_str(char *, char *);
+extern int compare_str(char *, char *);
+extern void match(int, int, int, int, int, char *, int);
+extern void map_pron(char *, char *);
+
diff --git a/TIesr_Tools/dictproc/src/dmakeup.h b/TIesr_Tools/dictproc/src/dmakeup.h
new file mode 100644 (file)
index 0000000..472df24
--- /dev/null
@@ -0,0 +1,24 @@
+/*=======================================================================
+ dmakeup.h
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+/* The following are all internal functions. */
+extern void  dmk_outstring(char *string);
+extern void  dmk_word(char *word);
+extern void  dmk_say_cardinal(long int value);
+extern void  dmk_say_ordinal(long int value);
+extern void  dmk_say_ascii(int character);
+extern void  dmk_spell_word(char *word);
+extern char *dmk_map_phones(char *buff_in);
+
+#define MAX_BUF 1024
+
+#if defined sun && ! defined __svr4__ /* SunOS4 needs these */
+extern int fprintf(FILE *stream, const char *format, ...);
+extern int fputs(const char *s, FILE *stream);
+extern int fflush(FILE *stream);
+extern int tolower(int c);
+extern int toupper(int c);
+#endif
diff --git a/TIesr_Tools/dictproc/src/english.c b/TIesr_Tools/dictproc/src/english.c
new file mode 100644 (file)
index 0000000..358e715
--- /dev/null
@@ -0,0 +1,686 @@
+/*============================================================
+ english.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+==============================================================*/
+
+/*-------------------------------------------------------------
+ This source code is derived from the public domain code ENGLISH
+ TO PHONEME TRANSLATION written by John A. Wasser, 4/15/85.
+ --------------------------------------------------------------*/
+
+
+/*
+**     English to Phoneme rules.
+**
+**     Derived from: 
+**
+**          AUTOMATIC TRANSLATION OF ENGLISH TEXT TO PHONETICS
+**                 BY MEANS OF LETTER-TO-SOUND RULES
+**
+**                     NRL Report 7948
+**
+**                   January 21st, 1976
+**         Naval Research Laboratory, Washington, D.C.
+**
+**
+**     Published by the National Technical Information Service as
+**     document "AD/A021 929".
+**
+**
+**
+**     The Phoneme codes:
+**
+**             IY      bEEt            IH      bIt
+**             EY      gAte            EH      gEt
+**             AE      fAt             AA      fAther
+**             AO      lAWn            OW      lOne
+**             UH      fUll            UW      fOOl
+**             ER      mURdER          AX      About
+**             AH      bUt             AY      hIde
+**             AW      hOW             OY      tOY
+**     
+**             p       Pack            b       Back
+**             t       Time            d       Dime
+**             k       Coat            g       Goat
+**             f       Fault           v       Vault
+**             TH      eTHer           DH      eiTHer
+**             s       Sue             z       Zoo
+**             SH      leaSH           ZH      leiSure
+**             HH      How             m       suM
+**             n       suN             NG      suNG
+**             l       Laugh           w       Wear
+**             y       Young           r       Rate
+**             CH      CHar            j       Jar
+**             w       WHere
+**
+**
+**     Rules are made up of four parts:
+**     
+**             The left context.
+**             The text to match.
+**             The right context.
+**             The phonemes to substitute for the matched text.
+**
+**     Procedure:
+**
+**             Seperate each block of letters (apostrophes included) 
+**             and add a space on each side.  For each unmatched 
+**             letter in the word, look through the rules where the 
+**             text to match starts with the letter in the word.  If 
+**             the text to match is found and the right and left 
+**             context patterns also match, output the phonemes for 
+**             that rule and skip to the next unmatched letter.
+**
+**
+**     Special Context Symbols:
+**
+**             #       One or more vowels
+**             :       Zero or more consonants
+**             ^       One consonant.
+**             .       One of B, D, V, G, J, L, M, N, R, W or Z (voiced 
+**                     consonants)
+**             %       One of ER, E, ES, ED, ING, ELY (a suffix)
+**                     (Found in right context only)
+**             +       One of E, I or Y (a "front" vowel)
+**
+*/
+
+
+/* Context definitions */
+static char Anything[] = "";   /* No context requirement */
+static char Nothing[] = " ";   /* Context is beginning or end of word */
+
+/* Phoneme definitions */
+static char Pause[] = " ";     /* Short silence */
+static char Silent[] = "";     /* No phonemes */
+
+#define LEFT_PART      0
+#define MATCH_PART     1
+#define RIGHT_PART     2
+#define OUT_PART       3
+
+typedef char *Rule[4]; /* Rule is an array of 4 character pointers */
+
+/*0 = Punctuation */
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule punct_rules[] =
+       {
+       {Anything,      " ",            Anything,       Pause   },
+       {Anything,      "-",            Anything,       Silent  },
+       {Anything,      "_",            Anything,       Silent  },
+       {".",           "'S",           Anything,       "z"     },
+       {"#:.E",        "'S",           Anything,       "z"     },
+       {"#",           "'S",           Anything,       "z"     },
+       {Anything,      "'",            Anything,       Silent  },
+       {Anything,      ",",            Anything,       Pause   },
+       {Anything,      ".",            Anything,       Pause   },
+       {Anything,      "?",            Anything,       Pause   },
+       {Anything,      "!",            Anything,       Pause   },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule A_rules[] =
+       {
+       {Anything,      "A",            Nothing,        "AX"    },
+       {Nothing,       "ARE",          Nothing,        "AAr"   },
+       {Nothing,       "AR",           "O",            "AXr"   },
+       {Anything,      "AR",           "#",            "EHr"   },
+       {"^",           "AS",           "#",            "EYs"   },
+       {Anything,      "A",            "WA",           "AX"    },
+       {Anything,      "AW",           Anything,       "AO"    },
+       {" :",          "ANY",          Anything,       "EHnIY" },
+       {Anything,      "A",            "^+#",          "EY"    },
+       {"#:",          "ALLY",         Anything,       "AXlIY" },
+       {Nothing,       "AL",           "#",            "AXl"   },
+       {Anything,      "AGAIN",        Anything,       "AXgEHn"},
+       {"#:",          "AG",           "E",            "IHj"   },
+       {Anything,      "A",            "^+:#",         "AE"    },
+       {" :",          "A",            "^+ ",          "EY"    },
+       {Anything,      "A",            "^%",           "EY"    },
+       {Nothing,       "ARR",          Anything,       "AXr"   },
+       {Anything,      "ARR",          Anything,       "AEr"   },
+       {" :",          "AR",           Nothing,        "AAr"   },
+       {Anything,      "AR",           Nothing,        "ER"    },
+       {Anything,      "AR",           Anything,       "AAr"   },
+       {Anything,      "AIR",          Anything,       "EHr"   },
+       {Anything,      "AI",           Anything,       "EY"    },
+       {Anything,      "AY",           Anything,       "EY"    },
+       {Anything,      "AU",           Anything,       "AO"    },
+       {"#:",          "AL",           Nothing,        "AXl"   },
+       {"#:",          "ALS",          Nothing,        "AXlz"  },
+       {Anything,      "ALK",          Anything,       "AOk"   },
+       {Anything,      "AL",           "^",            "AOl"   },
+       {" :",          "ABLE",         Anything,       "EYbAXl"},
+       {Anything,      "ABLE",         Anything,       "AXbAXl"},
+       {Anything,      "ANG",          "+",            "EYnj"  },
+       {Anything,      "A",            Anything,       "AE"    },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule B_rules[] =
+       {
+       {Nothing,       "BE",           "^#",           "bIH"   },
+       {Anything,      "BEING",        Anything,       "bIYIHNG"},
+       {Nothing,       "BOTH",         Nothing,        "bOWTH" },
+       {Nothing,       "BUS",          "#",            "bIHz"  },
+       {Anything,      "BUIL",         Anything,       "bIHl"  },
+       {Anything,      "B",            Anything,       "b"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule C_rules[] =
+       {
+       {Nothing,       "CH",           "^",            "k"     },
+       {"^E",          "CH",           Anything,       "k"     },
+       {Anything,      "CH",           Anything,       "CH"    },
+       {" S",          "CI",           "#",            "sAY"   },
+       {Anything,      "CI",           "A",            "SH"    },
+       {Anything,      "CI",           "O",            "SH"    },
+       {Anything,      "CI",           "EN",           "SH"    },
+       {Anything,      "C",            "+",            "s"     },
+       {Anything,      "CK",           Anything,       "k"     },
+       {Anything,      "COM",          "%",            "kAHm"  },
+       {Anything,      "C",            Anything,       "k"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule D_rules[] =
+       {
+       {"#:",          "DED",          Nothing,        "dIHd"  },
+       {".E",          "D",            Nothing,        "d"     },
+       {"#:^E",        "D",            Nothing,        "t"     },
+       {Nothing,       "DE",           "^#",           "dIH"   },
+       {Nothing,       "DO",           Nothing,        "dUW"   },
+       {Nothing,       "DOES",         Anything,       "dAHz"  },
+       {Nothing,       "DOING",        Anything,       "dUWIHNG"},
+       {Nothing,       "DOW",          Anything,       "dAW"   },
+       {Anything,      "DU",           "A",            "jUW"   },
+       {Anything,      "D",            Anything,       "d"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule E_rules[] =
+       {
+       {"#:",          "E",            Nothing,        Silent  },
+       {"':^",         "E",            Nothing,        Silent  },
+       {" :",          "E",            Nothing,        "IY"    },
+       {"#",           "ED",           Nothing,        "d"     },
+       {"#:",          "E",            "D ",           Silent  },
+       {Anything,      "EV",           "ER",           "EHv"   },
+       {Anything,      "E",            "^%",           "IY"    },
+       {Anything,      "ERI",          "#",            "IYrIY" },
+       {Anything,      "ERI",          Anything,       "EHrIH" },
+       {"#:",          "ER",           "#",            "ER"    },
+       {Anything,      "ER",           "#",            "EHr"   },
+       {Anything,      "ER",           Anything,       "ER"    },
+       {Nothing,       "EVEN",         Anything,       "IYvEHn"},
+       {"#:",          "E",            "W",            Silent  },
+       {"T",           "EW",           Anything,       "UW"    },
+       {"S",           "EW",           Anything,       "UW"    },
+       {"R",           "EW",           Anything,       "UW"    },
+       {"D",           "EW",           Anything,       "UW"    },
+       {"L",           "EW",           Anything,       "UW"    },
+       {"Z",           "EW",           Anything,       "UW"    },
+       {"N",           "EW",           Anything,       "UW"    },
+       {"J",           "EW",           Anything,       "UW"    },
+       {"TH",          "EW",           Anything,       "UW"    },
+       {"CH",          "EW",           Anything,       "UW"    },
+       {"SH",          "EW",           Anything,       "UW"    },
+       {Anything,      "EW",           Anything,       "yUW"   },
+       {Anything,      "E",            "O",            "IY"    },
+       {"#:S",         "ES",           Nothing,        "IHz"   },
+       {"#:C",         "ES",           Nothing,        "IHz"   },
+       {"#:G",         "ES",           Nothing,        "IHz"   },
+       {"#:Z",         "ES",           Nothing,        "IHz"   },
+       {"#:X",         "ES",           Nothing,        "IHz"   },
+       {"#:J",         "ES",           Nothing,        "IHz"   },
+       {"#:CH",        "ES",           Nothing,        "IHz"   },
+       {"#:SH",        "ES",           Nothing,        "IHz"   },
+       {"#:",          "E",            "S ",           Silent  },
+       {"#:",          "ELY",          Nothing,        "lIY"   },
+       {"#:",          "EMENT",        Anything,       "mEHnt" },
+       {Anything,      "EFUL",         Anything,       "fUHl"  },
+       {Anything,      "EE",           Anything,       "IY"    },
+       {Anything,      "EARN",         Anything,       "ERn"   },
+       {Nothing,       "EAR",          "^",            "ER"    },
+       {Anything,      "EAD",          Anything,       "EHd"   },
+       {"#:",          "EA",           Nothing,        "IYAX"  },
+       {Anything,      "EA",           "SU",           "EH"    },
+       {Anything,      "EA",           Anything,       "IY"    },
+       {Anything,      "EIGH",         Anything,       "EY"    },
+       {Anything,      "EI",           Anything,       "IY"    },
+       {Nothing,       "EYE",          Anything,       "AY"    },
+       {Anything,      "EY",           Anything,       "IY"    },
+       {Anything,      "EU",           Anything,       "yUW"   },
+       {Anything,      "E",            Anything,       "EH"    },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule F_rules[] =
+       {
+       {Anything,      "FUL",          Anything,       "fUHl"  },
+       {Anything,      "F",            Anything,       "f"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule G_rules[] =
+       {
+       {Anything,      "GIV",          Anything,       "gIHv"  },
+       {Nothing,       "G",            "I^",           "g"     },
+       {Anything,      "GE",           "T",            "gEH"   },
+       {"SU",          "GGES",         Anything,       "gjEHs" },
+       {Anything,      "GG",           Anything,       "g"     },
+       {" B#",         "G",            Anything,       "g"     },
+       {Anything,      "G",            "+",            "j"     },
+       {Anything,      "GREAT",        Anything,       "grEYt" },
+       {"#",           "GH",           Anything,       Silent  },
+       {Anything,      "G",            Anything,       "g"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule H_rules[] =
+       {
+       {Nothing,       "HAV",          Anything,       "hAEv"  },
+       {Nothing,       "HERE",         Anything,       "hIYr"  },
+       {Nothing,       "HOUR",         Anything,       "AWER"  },
+       {Anything,      "HOW",          Anything,       "hAW"   },
+       {Anything,      "H",            "#",            "h"     },
+       {Anything,      "H",            Anything,       Silent  },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule I_rules[] =
+       {
+       {Nothing,       "IN",           Anything,       "IHn"   },
+       {Nothing,       "I",            Nothing,        "AY"    },
+       {Anything,      "IN",           "D",            "AYn"   },
+       {Anything,      "IER",          Anything,       "IYER"  },
+       {"#:R",         "IED",          Anything,       "IYd"   },
+       {Anything,      "IED",          Nothing,        "AYd"   },
+       {Anything,      "IEN",          Anything,       "IYEHn" },
+       {Anything,      "IE",           "T",            "AYEH"  },
+       {" :",          "I",            "%",            "AY"    },
+       {Anything,      "I",            "%",            "IY"    },
+       {Anything,      "IE",           Anything,       "IY"    },
+       {Anything,      "I",            "^+:#",         "IH"    },
+       {Anything,      "IR",           "#",            "AYr"   },
+       {Anything,      "IZ",           "%",            "AYz"   },
+       {Anything,      "IS",           "%",            "AYz"   },
+       {Anything,      "I",            "D%",           "AY"    },
+       {"+^",          "I",            "^+",           "IH"    },
+       {Anything,      "I",            "T%",           "AY"    },
+       {"#:^",         "I",            "^+",           "IH"    },
+       {Anything,      "I",            "^+",           "AY"    },
+       {Anything,      "IR",           Anything,       "ER"    },
+       {Anything,      "IGH",          Anything,       "AY"    },
+       {Anything,      "ILD",          Anything,       "AYld"  },
+       {Anything,      "IGN",          Nothing,        "AYn"   },
+       {Anything,      "IGN",          "^",            "AYn"   },
+       {Anything,      "IGN",          "%",            "AYn"   },
+       {Anything,      "IQUE",         Anything,       "IYk"   },
+       {Anything,      "I",            Anything,       "IH"    },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule J_rules[] =
+       {
+       {Anything,      "J",            Anything,       "j"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule K_rules[] =
+       {
+       {Nothing,       "K",            "N",            Silent  },
+       {Anything,      "K",            Anything,       "k"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule L_rules[] =
+       {
+       {Anything,      "LO",           "C#",           "lOW"   },
+       {"L",           "L",            Anything,       Silent  },
+       {"#:^",         "L",            "%",            "AXl"   },
+       {Anything,      "LEAD",         Anything,       "lIYd"  },
+       {Anything,      "L",            Anything,       "l"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule M_rules[] =
+       {
+       {Anything,      "MOV",          Anything,       "mUWv"  },
+       {Anything,      "M",            Anything,       "m"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule N_rules[] =
+       {
+       {"E",           "NG",           "+",            "nj"    },
+       {Anything,      "NG",           "R",            "NGg"   },
+       {Anything,      "NG",           "#",            "NGg"   },
+       {Anything,      "NGL",          "%",            "NGgAXl"},
+       {Anything,      "NG",           Anything,       "NG"    },
+       {Anything,      "NK",           Anything,       "NGk"   },
+       {Nothing,       "NOW",          Nothing,        "nAW"   },
+       {Anything,      "N",            Anything,       "n"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule O_rules[] =
+       {
+       {Anything,      "OF",           Nothing,        "AXv"   },
+       {Anything,      "OROUGH",       Anything,       "EROW"  },
+       {"#:",          "OR",           Nothing,        "ER"    },
+       {"#:",          "ORS",          Nothing,        "ERz"   },
+       {Anything,      "OR",           Anything,       "AOr"   },
+       {Nothing,       "ONE",          Anything,       "wAHn"  },
+       {Anything,      "OW",           Anything,       "OW"    },
+       {Nothing,       "OVER",         Anything,       "OWvER" },
+       {Anything,      "OV",           Anything,       "AHv"   },
+       {Anything,      "O",            "^%",           "OW"    },
+       {Anything,      "O",            "^EN",          "OW"    },
+       {Anything,      "O",            "^I#",          "OW"    },
+       {Anything,      "OL",           "D",            "OWl"   },
+       {Anything,      "OUGHT",        Anything,       "AOt"   },
+       {Anything,      "OUGH",         Anything,       "AHf"   },
+       {Nothing,       "OU",           Anything,       "AW"    },
+       {"H",           "OU",           "S#",           "AW"    },
+       {Anything,      "OUS",          Anything,       "AXs"   },
+       {Anything,      "OUR",          Anything,       "AOr"   },
+       {Anything,      "OULD",         Anything,       "UHd"   },
+       {"^",           "OU",           "^L",           "AH"    },
+       {Anything,      "OUP",          Anything,       "UWp"   },
+       {Anything,      "OU",           Anything,       "AW"    },
+       {Anything,      "OY",           Anything,       "OY"    },
+       {Anything,      "OING",         Anything,       "OWIHNG"},
+       {Anything,      "OI",           Anything,       "OY"    },
+       {Anything,      "OOR",          Anything,       "AOr"   },
+       {Anything,      "OOK",          Anything,       "UHk"   },
+       {Anything,      "OOD",          Anything,       "UHd"   },
+       {Anything,      "OO",           Anything,       "UW"    },
+       {Anything,      "O",            "E",            "OW"    },
+       {Anything,      "O",            Nothing,        "OW"    },
+       {Anything,      "OA",           Anything,       "OW"    },
+       {Nothing,       "ONLY",         Anything,       "OWnlIY"},
+       {Nothing,       "ONCE",         Anything,       "wAHns" },
+       {Anything,      "ON'T",         Anything,       "OWnt"  },
+       {"C",           "O",            "N",            "AA"    },
+       {Anything,      "O",            "NG",           "AO"    },
+       {" :^",         "O",            "N",            "AH"    },
+       {"I",           "ON",           Anything,       "AXn"   },
+       {"#:",          "ON",           Nothing,        "AXn"   },
+       {"#^",          "ON",           Anything,       "AXn"   },
+       {Anything,      "O",            "ST ",          "OW"    },
+       {Anything,      "OF",           "^",            "AOf"   },
+       {Anything,      "OTHER",        Anything,       "AHDHER"},
+       {Anything,      "OSS",          Nothing,        "AOs"   },
+       {"#:^",         "OM",           Anything,       "AHm"   },
+       {Anything,      "O",            Anything,       "AA"    },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule P_rules[] =
+       {
+       {Anything,      "PH",           Anything,       "f"     },
+       {Anything,      "PEOP",         Anything,       "pIYp"  },
+       {Anything,      "POW",          Anything,       "pAW"   },
+       {Anything,      "PUT",          Nothing,        "pUHt"  },
+       {Anything,      "P",            Anything,       "p"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule Q_rules[] =
+       {
+       {Anything,      "QUAR",         Anything,       "kwAOr" },
+       {Anything,      "QU",           Anything,       "kw"    },
+       {Anything,      "Q",            Anything,       "k"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule R_rules[] =
+       {
+       {Nothing,       "RE",           "^#",           "rIY"   },
+       {Anything,      "R",            Anything,       "r"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule S_rules[] =
+       {
+       {Anything,      "SH",           Anything,       "SH"    },
+       {"#",           "SION",         Anything,       "ZHAXn" },
+       {Anything,      "SOME",         Anything,       "sAHm"  },
+       {"#",           "SUR",          "#",            "ZHER"  },
+       {Anything,      "SUR",          "#",            "SHER"  },
+       {"#",           "SU",           "#",            "ZHUW"  },
+       {"#",           "SSU",          "#",            "SHUW"  },
+       {"#",           "SED",          Nothing,        "zd"    },
+       {"#",           "S",            "#",            "z"     },
+       {Anything,      "SAID",         Anything,       "sEHd"  },
+       {"^",           "SION",         Anything,       "SHAXn" },
+       {Anything,      "S",            "S",            Silent  },
+       {".",           "S",            Nothing,        "z"     },
+       {"#:.E",        "S",            Nothing,        "z"     },
+       {"#:^##",       "S",            Nothing,        "z"     },
+       {"#:^#",        "S",            Nothing,        "s"     },
+       {"U",           "S",            Nothing,        "s"     },
+       {" :#",         "S",            Nothing,        "z"     },
+       {Nothing,       "SCH",          Anything,       "sk"    },
+       {Anything,      "S",            "C+",           Silent  },
+       {"#",           "SM",           Anything,       "zm"    },
+       {"#",           "SN",           "'",            "zAXn"  },
+       {Anything,      "S",            Anything,       "s"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule T_rules[] =
+       {
+       {Nothing,       "THE",          Nothing,        "DHAX"  },
+       {Anything,      "TO",           Nothing,        "tUW"   },
+       {Anything,      "THAT",         Nothing,        "DHAEt" },
+       {Nothing,       "THIS",         Nothing,        "DHIHs" },
+       {Nothing,       "THEY",         Anything,       "DHEY"  },
+       {Nothing,       "THERE",        Anything,       "DHEHr" },
+       {Anything,      "THER",         Anything,       "DHER"  },
+       {Anything,      "THEIR",        Anything,       "DHEHr" },
+       {Nothing,       "THAN",         Nothing,        "DHAEn" },
+       {Nothing,       "THEM",         Nothing,        "DHEHm" },
+       {Anything,      "THESE",        Nothing,        "DHIYz" },
+       {Nothing,       "THEN",         Anything,       "DHEHn" },
+       {Anything,      "THROUGH",      Anything,       "THrUW" },
+       {Anything,      "THOSE",        Anything,       "DHOWz" },
+       {Anything,      "THOUGH",       Nothing,        "DHOW"  },
+       {Nothing,       "THUS",         Anything,       "DHAHs" },
+       {Anything,      "TH",           Anything,       "TH"    },
+       {"#:",          "TED",          Nothing,        "tIHd"  },
+       {"S",           "TI",           "#N",           "CH"    },
+       {Anything,      "TI",           "O",            "SH"    },
+       {Anything,      "TI",           "A",            "SH"    },
+       {Anything,      "TIEN",         Anything,       "SHAXn" },
+       {Anything,      "TUR",          "#",            "CHER"  },
+       {Anything,      "TU",           "A",            "CHUW"  },
+       {Nothing,       "TWO",          Anything,       "tUW"   },
+       {Anything,      "T",            Anything,       "t"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule U_rules[] =
+       {
+       {Nothing,       "UN",           "I",            "yUWn"  },
+       {Nothing,       "UN",           Anything,       "AHn"   },
+       {Nothing,       "UPON",         Anything,       "AXpAOn"},
+       {"T",           "UR",           "#",            "UHr"   },
+       {"S",           "UR",           "#",            "UHr"   },
+       {"R",           "UR",           "#",            "UHr"   },
+       {"D",           "UR",           "#",            "UHr"   },
+       {"L",           "UR",           "#",            "UHr"   },
+       {"Z",           "UR",           "#",            "UHr"   },
+       {"N",           "UR",           "#",            "UHr"   },
+       {"J",           "UR",           "#",            "UHr"   },
+       {"TH",          "UR",           "#",            "UHr"   },
+       {"CH",          "UR",           "#",            "UHr"   },
+       {"SH",          "UR",           "#",            "UHr"   },
+       {Anything,      "UR",           "#",            "yUHr"  },
+       {Anything,      "UR",           Anything,       "ER"    },
+       {Anything,      "U",            "^ ",           "AH"    },
+       {Anything,      "U",            "^^",           "AH"    },
+       {Anything,      "UY",           Anything,       "AY"    },
+       {" G",          "U",            "#",            Silent  },
+       {"G",           "U",            "%",            Silent  },
+       {"G",           "U",            "#",            "w"     },
+       {"#N",          "U",            Anything,       "yUW"   },
+       {"T",           "U",            Anything,       "UW"    },
+       {"S",           "U",            Anything,       "UW"    },
+       {"R",           "U",            Anything,       "UW"    },
+       {"D",           "U",            Anything,       "UW"    },
+       {"L",           "U",            Anything,       "UW"    },
+       {"Z",           "U",            Anything,       "UW"    },
+       {"N",           "U",            Anything,       "UW"    },
+       {"J",           "U",            Anything,       "UW"    },
+       {"TH",          "U",            Anything,       "UW"    },
+       {"CH",          "U",            Anything,       "UW"    },
+       {"SH",          "U",            Anything,       "UW"    },
+       {Anything,      "U",            Anything,       "yUW"   },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule V_rules[] =
+       {
+       {Anything,      "VIEW",         Anything,       "vyUW"  },
+       {Anything,      "V",            Anything,       "v"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule W_rules[] =
+       {
+       {Nothing,       "WERE",         Anything,       "wER"   },
+       {Anything,      "WA",           "S",            "wAA"   },
+       {Anything,      "WA",           "T",            "wAA"   },
+       {Anything,      "WHERE",        Anything,       "wEHr"  },
+       {Anything,      "WHAT",         Anything,       "wAAt"  },
+       {Anything,      "WHOL",         Anything,       "hOWl"  },
+       {Anything,      "WHO",          Anything,       "hUW"   },
+       {Anything,      "WH",           Anything,       "w"     },
+       {Anything,      "WAR",          Anything,       "wAOr"  },
+       {Anything,      "WOR",          "^",            "wER"   },
+       {Anything,      "WR",           Anything,       "r"     },
+       {Anything,      "W",            Anything,       "w"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule X_rules[] =
+       {
+       {Anything,      "X",            Anything,       "ks"    },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule Y_rules[] =
+       {
+       {Anything,      "YOUNG",        Anything,       "yAHNG" },
+       {Nothing,       "YOU",          Anything,       "yUW"   },
+       {Nothing,       "YES",          Anything,       "yEHs"  },
+       {Nothing,       "Y",            Anything,       "y"     },
+       {"#:^",         "Y",            Nothing,        "IY"    },
+       {"#:^",         "Y",            "I",            "IY"    },
+       {" :",          "Y",            Nothing,        "AY"    },
+       {" :",          "Y",            "#",            "AY"    },
+       {" :",          "Y",            "^+:#",         "IH"    },
+       {" :",          "Y",            "^#",           "AY"    },
+       {Anything,      "Y",            Anything,       "IH"    },
+       {Anything,      0,              Anything,       Silent  },
+       };
+\f
+/*
+**     LEFT_PART       MATCH_PART      RIGHT_PART      OUT_PART
+*/
+static Rule Z_rules[] =
+       {
+       {Anything,      "Z",            Anything,       "z"     },
+       {Anything,      0,              Anything,       Silent  },
+       };
+
+Rule *Rules[] =
+       {
+       punct_rules,
+       A_rules, B_rules, C_rules, D_rules, E_rules, F_rules, G_rules, 
+       H_rules, I_rules, J_rules, K_rules, L_rules, M_rules, N_rules, 
+       O_rules, P_rules, Q_rules, R_rules, S_rules, T_rules, U_rules, 
+       V_rules, W_rules, X_rules, Y_rules, Z_rules
+       };
diff --git a/TIesr_Tools/dictproc/src/map.c b/TIesr_Tools/dictproc/src/map.c
new file mode 100644 (file)
index 0000000..41639d0
--- /dev/null
@@ -0,0 +1,62 @@
+/*=======================================================================
+ map.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+#include   "dictproc.h"
+
+#define    N_PAIR     8
+
+struct mapping_pair {
+  char  *from;
+  char  *to;
+} mapping_pair[ N_PAIR ] = {
+  { "b", "bcl b" },
+  { "d", "dcl d" },
+  { "g", "gcl g" },
+  { "jh", "dcl jh" },
+  { "p", "pcl p" },
+  { "t", "tcl t" },
+  { "k", "kcl k" },
+  { "ch", "tcl ch" }
+};
+
+
+
+void
+map_phone(char *iphone, char *ophone)
+{
+  int   i;
+
+  for ( i = 0; i < N_PAIR; i++ ) {
+    if ( strcmp( iphone, mapping_pair[i].from ) == 0 ) {
+      strcpy( ophone, mapping_pair[i].to );
+      return;
+    }
+  }
+
+  strcpy( ophone, iphone );
+}
+
+void
+map_pron(char *ipron, char *opron)
+{
+  char  *ptr;
+  char  buf[ MAX_STR ], ophone[ MAX_STR ];
+
+  *opron = '\0';
+  strcpy( buf, ipron );
+
+  ptr = (char *) strtok( buf, DELIMIT );
+
+  while ( ptr ) {
+
+    map_phone( ptr, ophone );
+    strcat( opron, ophone );
+    strcat( opron, " " );
+
+    ptr = (char *) strtok( NULL, DELIMIT );
+  }
+}
diff --git a/TIesr_Tools/dictproc/src/parse.c b/TIesr_Tools/dictproc/src/parse.c
new file mode 100644 (file)
index 0000000..a180beb
--- /dev/null
@@ -0,0 +1,435 @@
+/*=======================================================================
+ parse.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+/*-------------------------------------------------------------
+ This source code is derived from the public domain code ENGLISH
+ TO PHONEME TRANSLATION written by John A. Wasser, 4/15/85.
+ --------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+#include <string.h>
+#include "dmakeup.h"
+
+#define MAX_LENGTH 128
+
+static FILE *In_file = NULL;
+static char *buff_in;
+static char buff_out[MAX_BUF];
+static int bout_idx = 0;
+static int bin_idx = 0;
+
+static int Char, Char1, Char2, Char3;
+
+static void outchar(int chr);
+static int  inchar(FILE *fp);
+static int  new_char(void);
+static void have_dollars(void);
+static void have_special(void);
+static void have_number(void);
+static void have_letter(void);
+static void abbrev(char *buff);
+
+void
+dmk_outstring(char *string)
+{
+  while (*string != '\0')
+    outchar(*string++);
+}
+
+static void
+outchar(int chr)
+{
+  if (chr == '\n') {
+    buff_out[bout_idx] = '\0';
+    bout_idx = 0;
+  }
+  else if (bout_idx < MAX_BUF - 1) {
+    buff_out[bout_idx++] = chr;
+    buff_out[bout_idx] = '\0';
+  }
+  else 
+    fprintf(stderr, "Warning: buffer size exceeded (%d)\n", MAX_BUF);
+}
+
+
+static int
+inchar(FILE *fp)
+{
+  if (buff_in[bin_idx])
+    return buff_in[bin_idx++];
+  else
+    return EOF;
+}
+
+static int
+makeupper(int character)
+{
+  if (islower(character))
+    return toupper(character);
+  else
+    return character;
+}
+
+static int
+new_char(void)
+{
+  /*
+     If the cache is full of newline, time to prime the look-ahead
+     again.  If an EOF is found, fill the remainder of the queue with
+     EOF's.
+     */
+  if (Char == '\n'  && Char1 == '\n' && Char2 == '\n' && Char3 == '\n')
+    {                          /* prime the pump again */
+      Char = inchar(In_file);
+      if (Char == EOF)
+       {
+         Char1 = EOF;
+         Char2 = EOF;
+         Char3 = EOF;
+         return Char;
+       }
+      else if (Char == '\n')
+       return Char;
+
+      Char1 = inchar(In_file);
+      if (Char1 == EOF)
+       {
+         Char2 = EOF;
+         Char3 = EOF;
+         return Char;
+       }
+      else if (Char1 == '\n')
+       return Char;
+
+      Char2 = inchar(In_file);
+      if (Char2 == EOF)
+       {
+         Char3 = EOF;
+         return Char;
+       }
+      else if (Char2 == '\n')
+       return Char;
+
+      Char3 = inchar(In_file);
+    }
+  else
+    {
+      /*
+        Buffer not full of newline, shuffle the characters and
+        either get a new one or propagate a newline or EOF.
+        */
+      Char = Char1;
+      Char1 = Char2;
+      Char2 = Char3;
+      if (Char3 != '\n' && Char3 != EOF) {
+       Char3 = inchar(In_file);
+      }                
+    }
+  return Char;
+}
+
+int
+epd_make_string(char *lexeme, char *lx_entry, size_t max_buf)
+/* Make up the textual lexical entry LX_ENTRY with maximum size
+   MAX_BUF for string LEXEME. */
+{
+  char *map_buff;
+
+  buff_in = lexeme;
+  bin_idx = 0;
+  bout_idx = 0;
+
+  /* Prime the queue */
+  Char = '\n';
+  Char1 = '\n';
+  Char2 = '\n';
+  Char3 = '\n';
+  new_char();                  /* Fill Char, Char1, Char2 and Char3 */
+
+  while (Char != EOF) {                /* All of the words in the file */
+    if (isdigit(Char))
+      have_number();
+    else if (isalpha(Char) || Char == '\'')
+      have_letter();
+    else if (Char == '$' && isdigit(Char1))
+      have_dollars();
+    else
+      have_special();
+  }
+
+  
+  map_buff = dmk_map_phones(buff_out);
+  if (map_buff[0])
+    sprintf(lx_entry, "%s", map_buff);
+  else {
+    fprintf(stderr, "WARNING: bogus dmakeup pronunciation (%s).\n", lexeme);
+    sprintf(lx_entry, "%s", "_FAIL_");
+  }
+
+  return 1;
+}
+
+static void
+have_dollars(void)
+{
+  long int value;
+
+  value = 0L;
+  for (new_char() ; isdigit(Char) || Char == ',' ; new_char())
+    {
+      if (Char != ',')
+       value = 10 * value + (Char-'0');
+    }
+
+  dmk_say_cardinal(value);             /* Say number of whole dollars */
+
+  /* Found a character that is a non-digit and non-comma */
+
+  /* Check for no decimal or no cents digits */
+  if (Char != '.' || !isdigit(Char1))
+    {
+      if (value == 1L)
+       dmk_outstring("dAAlER ");
+      else
+       dmk_outstring("dAAlERz ");
+      return;
+    }
+
+  /* We have '.' followed by a digit */
+
+  new_char();                  /* Skip the period */
+
+  /* If it is ".dd " say as " DOLLARS AND n CENTS " */
+  if (isdigit(Char1) && !isdigit(Char2))
+    {
+      if (value == 1L)
+       dmk_outstring("dAAlER ");
+      else
+       dmk_outstring("dAAlERz ");
+      if (Char == '0' && Char1 == '0')
+       {
+         new_char();           /* Skip tens digit */
+         new_char();           /* Skip units digit */
+         return;
+       }
+
+      dmk_outstring("AEnd ");
+      value = (Char-'0')*10 + Char1-'0';
+      dmk_say_cardinal(value);
+
+      if (value == 1L)
+       dmk_outstring("sEHnt ");
+      else
+       dmk_outstring("sEHnts ");
+      new_char();              /* Used Char (tens digit) */
+      new_char();              /* Used Char1 (units digit) */
+      return;
+    }
+
+  /* Otherwise say as "n POINT ddd DOLLARS " */
+
+  dmk_outstring("pOYnt ");
+  for ( ; isdigit(Char) ; new_char())
+    {
+      dmk_say_ascii(Char);
+    }
+
+  dmk_outstring("dAAlERz ");
+
+  return;
+}
+
+static void
+have_special(void)
+       {
+       if (Char == '\n')
+               outchar('\n');
+       else
+       if (!isspace(Char))
+               dmk_say_ascii(Char);
+
+       new_char();
+       return;
+       }
+
+
+static void
+have_number(void)
+{
+  long int value;
+  int lastdigit;
+
+  value = Char - '0';
+  lastdigit = Char;
+
+  for (new_char() ; isdigit(Char) ; new_char())
+    {
+      value = 10 * value + (Char-'0');
+      lastdigit = Char;
+    }
+
+  /* Recognize ordinals based on last digit of number */
+  switch (lastdigit)
+    {
+    case '1':                  /* ST */
+      if (makeupper(Char) == 'S' && makeupper(Char1) == 'T' &&
+         !isalpha(Char2) && !isdigit(Char2))
+       {
+         dmk_say_ordinal(value);
+         new_char();           /* Used Char */
+         new_char();           /* Used Char1 */
+         return;
+       }
+      break;
+
+    case '2':                  /* ND */
+      if (makeupper(Char) == 'N' && makeupper(Char1) == 'D' &&
+         !isalpha(Char2) && !isdigit(Char2))
+       {
+         dmk_say_ordinal(value);
+         new_char();           /* Used Char */
+         new_char();           /* Used Char1 */
+         return;
+       }
+      break;
+
+    case '3':                  /* RD */
+      if (makeupper(Char) == 'R' && makeupper(Char1) == 'D' &&
+         !isalpha(Char2) && !isdigit(Char2))
+       {
+         dmk_say_ordinal(value);
+         new_char();           /* Used Char */
+         new_char();           /* Used Char1 */
+         return;
+       }
+      break;
+
+    case '0':                  /* TH */
+    case '4':                  /* TH */
+    case '5':                  /* TH */
+    case '6':                  /* TH */
+    case '7':                  /* TH */
+    case '8':                  /* TH */
+    case '9':                  /* TH */
+      if (makeupper(Char) == 'T' && makeupper(Char1) == 'H' &&
+         !isalpha(Char2) && !isdigit(Char2))
+       {
+         dmk_say_ordinal(value);
+         new_char();           /* Used Char */
+         new_char();           /* Used Char1 */
+         return;
+       }
+      break;
+    }
+
+  dmk_say_cardinal(value);
+
+  /* Recognize decimal points */
+  if (Char == '.' && isdigit(Char1))
+    {
+      dmk_outstring("pOYnt ");
+      for (new_char() ; isdigit(Char) ; new_char())
+       {
+         dmk_say_ascii(Char);
+       }
+    }
+
+  /* Spell out trailing abbreviations */
+  if (isalpha(Char))
+    {
+      while (isalpha(Char))
+       {
+         dmk_say_ascii(Char);
+         new_char();
+       }
+    }
+
+  return;
+}
+
+
+static void
+have_letter(void)
+{
+  char buff[MAX_LENGTH];
+  int count;
+
+  count = 0;
+  buff[count++] = ' ';         /* Required initial blank */
+
+  buff[count++] = makeupper(Char);
+
+  for (new_char() ; 
+       isalpha(Char) || Char == '\'' || Char == '_'; 
+       new_char())
+    {
+      buff[count++] = makeupper(Char);
+      if (count > MAX_LENGTH-2)
+       {
+         buff[count++] = ' ';
+         buff[count++] = '\0';
+         dmk_word(buff);
+         count = 1;
+       }
+    }
+
+  buff[count++] = ' ';         /* Required terminating blank */
+  buff[count++] = '\0';
+
+  /* Check for AAANNN type abbreviations */
+  if (isdigit(Char))
+    {
+      dmk_spell_word(buff);
+      return;
+    }
+  else
+    if (strlen(buff) == 3)     /* one character, two spaces */
+      dmk_say_ascii(buff[1]);
+    else
+      if (Char == '.')         /* Possible abbreviation */
+       abbrev(buff);
+      else
+       dmk_word(buff);
+
+  if (Char == '-' && isalpha(Char1))
+    new_char();                        /* Skip hyphens */
+
+}
+
+static void
+abbrev(char *buff)
+/* Handle abbreviations.  Text in buff was followed by '.' */
+{
+  if (strcmp(buff, " DR ") == 0)
+    {
+      dmk_word(" DOCTOR ");
+      new_char();
+    }
+  else
+    if (strcmp(buff, " MR ") == 0)
+      {
+       dmk_word(" MISTER ");
+       new_char();
+      }
+    else
+      if (strcmp(buff, " MRS ") == 0)
+       {
+         dmk_word(" MISSUS ");
+         new_char();
+       }
+      else
+       if (strcmp(buff, " PHD ") == 0)
+         {
+           dmk_spell_word(" PHD ");
+           new_char();
+         }
+       else
+         dmk_word(buff);
+}
diff --git a/TIesr_Tools/dictproc/src/phoneme.c b/TIesr_Tools/dictproc/src/phoneme.c
new file mode 100644 (file)
index 0000000..8440007
--- /dev/null
@@ -0,0 +1,346 @@
+/*=======================================================================
+ phoneme.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+/*-------------------------------------------------------------
+ This source code is derived from the public domain code ENGLISH
+ TO PHONEME TRANSLATION written by John A. Wasser, 4/15/85.
+ --------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include "dmakeup.h"
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+#ifndef TRUE
+#define TRUE (!0)
+#endif
+
+/*
+**     English to Phoneme translation.
+**
+**     Rules are made up of four parts:
+**     
+**             The left context.
+**             The text to match.
+**             The right context.
+**             The phonemes to substitute for the matched text.
+**
+**     Procedure:
+**
+**             Seperate each block of letters (apostrophes included) 
+**             and add a space on each side.  For each unmatched 
+**             letter in the word, look through the rules where the 
+**             text to match starts with the letter in the word.  If 
+**             the text to match is found and the right and left 
+**             context patterns also match, output the phonemes for 
+**             that rule and skip to the next unmatched letter.
+**
+**
+**     Special Context Symbols:
+**
+**             #       One or more vowels
+**             :       Zero or more consonants
+**             ^       One consonant.
+**             .       One of B, D, V, G, J, L, M, N, R, W or Z (voiced 
+**                     consonants)
+**             %       One of ER, E, ES, ED, ING, ELY (a suffix)
+**                     (Right context only)
+**             +       One of E, I or Y (a "front" vowel)
+*/
+
+typedef char *Rule[4]; /* A rule is four character pointers */
+
+extern Rule *Rules[];  /* An array of pointers to rules */
+
+static int  isvowel(char chr);
+static int  isconsonant(char chr);
+static int  find_rule(char *word, int index, Rule *rules);
+static int  leftmatch(char *pattern, char *context);
+static int  rightmatch(char *pattern, char *context);
+
+static int
+isvowel(char chr)
+{
+  return (chr == 'A' || chr == 'E' || chr == 'I' || 
+         chr == 'O' || chr == 'U');
+}
+
+static int
+isconsonant(char chr)
+{
+  return (isupper((int)chr) && !isvowel(chr));
+}
+
+void
+dmk_word(char *word)
+{
+  int index;                   /* Current position in word */
+  int type;                    /* First letter of match part */
+
+  index = 1;                   /* Skip the initial blank */
+  do
+    {
+      if (isupper((int)word[index]))
+       type = word[index] - 'A' + 1;
+      else
+       type = 0;
+
+      index = find_rule(word, index, Rules[type]);
+    }
+  while (word[index] != '\0');
+}
+
+static int
+find_rule(char *word, int index, Rule *rules)
+{
+  Rule *rule;
+  char *left, *match, *right, *output;
+  int remainder;
+
+  for (;;)                     /* Search for the rule */
+    {
+      rule = rules++;
+      match = (*rule)[1];
+
+      if (match == 0)          /* bad symbol! */
+       {
+         fprintf(stderr,
+                 "Error: Can't find rule for: '%c' in \"%s\"\n", word[index], word);
+         return index+1;       /* Skip it! */
+       }
+
+      for (remainder = index; *match != '\0'; match++, remainder++)
+       {
+         if (*match != word[remainder])
+           break;
+       }
+
+      if (*match != '\0')      /* found missmatch */
+       continue;
+      /*
+        printf("\nWord: \"%s\", Index:%4d, Trying: \"%s/%s/%s\" = \"%s\"\n",
+        word, index, (*rule)[0], (*rule)[1], (*rule)[2], (*rule)[3]);
+        */
+      left = (*rule)[0];
+      right = (*rule)[2];
+
+      if (!leftmatch(left, &word[index-1]))
+       continue;
+      /*
+        printf("leftmatch(\"%s\",\"...%c\") succeded!\n", left, word[index-1]);
+        */
+      if (!rightmatch(right, &word[remainder]))
+       continue;
+      /*
+        printf("rightmatch(\"%s\",\"%s\") succeded!\n", right, &word[remainder]);
+        */
+      output = (*rule)[3];
+      /*
+        printf("Success: ");
+        */
+      dmk_outstring(output);
+      return remainder;
+    }
+}
+
+
+static int
+leftmatch(char *pattern,       /* first char of pattern to match in text */
+         char *context)        /* last char of text to be matched */
+{
+  char *pat;
+  char *text;
+  int count;
+
+  if (*pattern == '\0')                /* null string matches any context */
+    {
+      return TRUE;
+    }
+
+  /* point to last character in pattern string */
+  count = strlen(pattern);
+  pat = pattern + (count - 1);
+
+  text = context;
+
+  for (; count > 0; pat--, count--)
+    {
+      /* First check for simple text or space */
+      if (isalpha((int)(*pat)) || *pat == '\'' || *pat == ' ')
+       if (*pat != *text)
+         return FALSE;
+       else
+         {
+           text--;
+           continue;
+         }
+
+      switch (*pat)
+       {
+       case '#':               /* One or more vowels */
+         if (!isvowel(*text))
+           return FALSE;
+
+         text--;
+
+         while (isvowel(*text))
+           text--;
+         break;
+
+       case ':':               /* Zero or more consonants */
+         while (isconsonant(*text))
+           text--;
+         break;
+
+       case '^':               /* One consonant */
+         if (!isconsonant(*text))
+           return FALSE;
+         text--;
+         break;
+
+       case '.':               /* B, D, V, G, J, L, M, N, R, W, Z */
+         if (*text != 'B' && *text != 'D' && *text != 'V'
+             && *text != 'G' && *text != 'J' && *text != 'L'
+             && *text != 'M' && *text != 'N' && *text != 'R'
+             && *text != 'W' && *text != 'Z')
+           return FALSE;
+         text--;
+         break;
+
+       case '+':               /* E, I or Y (front vowel) */
+         if (*text != 'E' && *text != 'I' && *text != 'Y')
+           return FALSE;
+         text--;
+         break;
+
+       case '%':
+       default:
+         fprintf(stderr, "Bad char in left rule: '%c'\n", *pat);
+         return FALSE;
+       }
+    }
+
+  return TRUE;
+}
+
+
+static int
+rightmatch(char *pattern,      /* first char of pattern to match in text */
+          char *context)       /* last char of text to be matched */
+{
+  char *pat;
+  char *text;
+
+  if (*pattern == '\0')                /* null string matches any context */
+    return TRUE;
+
+  pat = pattern;
+  text = context;
+
+  for (pat = pattern; *pat != '\0'; pat++)
+    {
+      /* First check for simple text or space */
+      if (isalpha((int)(*pat)) || *pat == '\'' || *pat == ' ')
+       if (*pat != *text)
+         return FALSE;
+       else
+         {
+           text++;
+           continue;
+         }
+
+      switch (*pat)
+       {
+       case '#':               /* One or more vowels */
+         if (!isvowel(*text))
+           return FALSE;
+
+         text++;
+
+         while (isvowel(*text))
+           text++;
+         break;
+
+       case ':':               /* Zero or more consonants */
+         while (isconsonant(*text))
+           text++;
+         break;
+
+       case '^':               /* One consonant */
+         if (!isconsonant(*text))
+           return FALSE;
+         text++;
+         break;
+
+       case '.':               /* B, D, V, G, J, L, M, N, R, W, Z */
+         if (*text != 'B' && *text != 'D' && *text != 'V'
+             && *text != 'G' && *text != 'J' && *text != 'L'
+             && *text != 'M' && *text != 'N' && *text != 'R'
+             && *text != 'W' && *text != 'Z')
+           return FALSE;
+         text++;
+         break;
+
+       case '+':               /* E, I or Y (front vowel) */
+         if (*text != 'E' && *text != 'I' && *text != 'Y')
+           return FALSE;
+         text++;
+         break;
+
+       case '%':               /* ER, E, ES, ED, ING, ELY (a suffix) */
+         if (*text == 'E')
+           {
+             text++;
+             if (*text == 'L')
+               {
+                 text++;
+                 if (*text == 'Y')
+                   {
+                     text++;
+                     break;
+                   }
+                 else
+                   {
+                     text--;   /* Don't gobble L */
+                     break;
+                   }
+               }
+             else
+               if (*text == 'R' || *text == 'S' 
+                   || *text == 'D')
+                 text++;
+             break;
+           }
+         else
+           if (*text == 'I')
+             {
+               text++;
+               if (*text == 'N')
+                 {
+                   text++;
+                   if (*text == 'G')
+                     {
+                       text++;
+                       break;
+                     }
+                 }
+               return FALSE;
+             }
+           else
+             return FALSE;
+
+       default:
+         fprintf(stderr, "Bad char in right rule:'%c'\n", *pat);
+         return FALSE;
+       }
+    }
+
+  return TRUE;
+}
diff --git a/TIesr_Tools/dictproc/src/phones.c b/TIesr_Tools/dictproc/src/phones.c
new file mode 100644 (file)
index 0000000..005bde4
--- /dev/null
@@ -0,0 +1,67 @@
+/*=======================================================================
+ phones.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include "dmakeup.h"
+
+#define MAX_BUF 1024
+
+char *
+dmk_map_phones(char *buff_in)
+/* Map from the original set to a local set.  Some of this amounts to
+   post processing.  Could be embedded some day, but that's a lot of
+   work. */
+{
+  static char buff_out[MAX_BUF];
+  int j;
+  
+  for (j = 0; *buff_in; buff_in++) {
+    if (j > MAX_BUF - 5) {     /* max amount put in */
+      fprintf(stderr, "Error: exceeded output buffer size (%d)\n", MAX_BUF);
+      break;
+    }      
+    if (strchr("ptkbdgnm", *buff_in) && buff_in[0] == buff_in[1]) { /* e.g. s/tt/t/g */
+      buff_out[j++] = *buff_in++;
+    }
+    else if (buff_in[0] == 'A' && buff_in[1] == 'H') {
+      buff_in++;
+      strcpy(&buff_out[j], "ah");
+      j += 2;
+    }
+    else if (buff_in[0] == 'I' && buff_in[1] == 'H') {
+      buff_in++;
+      strcpy(&buff_out[j], "ih");
+      j += 2;
+    }
+    else if (*buff_in == 'h') {
+      strcpy(&buff_out[j], "hh");
+      j += 2;
+    }
+    else if (*buff_in == 'j') {
+      strcpy(&buff_out[j], "jh");
+      j += 2;
+    }
+    else if (isupper((int)(*buff_in))) { /* e.g., s/IY/IY /g */
+      buff_out[j++] = tolower(*buff_in++);
+      buff_out[j++] = tolower(*buff_in);
+    }
+    else if (*buff_in != ' ')
+      buff_out[j++] = *buff_in;
+
+    
+    if (buff_in[1] != '\0')
+      if (!(buff_in[1] == ' ' && buff_in[2] == '\0'))
+       buff_out[j++] = ' ';
+  }
+
+  
+  buff_out[j] = '\0';
+  return buff_out;
+}
diff --git a/TIesr_Tools/dictproc/src/saynum.c b/TIesr_Tools/dictproc/src/saynum.c
new file mode 100644 (file)
index 0000000..4af18d2
--- /dev/null
@@ -0,0 +1,224 @@
+/*=======================================================================
+ saynum.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+/*-------------------------------------------------------------
+ This source code is derived from the public domain code ENGLISH
+ TO PHONEME TRANSLATION written by John A. Wasser, 4/15/85.
+ --------------------------------------------------------------*/
+
+#include <stdio.h>
+#include "dmakeup.h"
+
+/*
+**              Integer to Readable ASCII Conversion Routine.
+**
+** Synopsis:
+**
+**      dmk_say_cardinal(value)
+**             long int     value;          -- The number to output
+**
+**     The number is translated into a string of phonemes
+**
+*/
+
+static char *Cardinals[] = 
+       {
+       "zIHrOW ",      "wAHn ",        "tUW ",         "THrIY ",
+       "fAOr ",        "fAYv ",        "sIHks ",       "sEHvAXn ",
+       "EYt ",         "nAYn ",                
+       "tEHn ",        "IYlEHvAXn ",   "twEHlv ",      "THERtIYn ",
+       "fAOrtIYn ",    "fIHftIYn ",    "sIHkstIYn ",   "sEHvAXntIYn ",
+       "EYtIYn ",      "nAYntIYn "
+       } ;
+
+static char *Twenties[] = 
+       {
+       "twEHntIY ",    "THERtIY ",     "fAOrtIY ",     "fIHftIY ",
+       "sIHkstIY ",    "sEHvEHntIY ",  "EYtIY ",       "nAYntIY "
+       } ;
+
+static char *Ordinals[] = 
+       {
+       "zIHrOWEHTH ",  "fERst ",       "sEHkAHnd ",    "THERd ",
+       "fAOrTH ",      "fIHfTH ",      "sIHksTH ",     "sEHvAXnTH ",
+       "EYtTH ",       "nAYnTH ",              
+       "tEHnTH ",      "IYlEHvAXnTH ", "twEHlvTH ",    "THERtIYnTH ",
+       "fAOrtIYnTH ",  "fIHftIYnTH ",  "sIHkstIYnTH ", "sEHvAXntIYnTH ",
+       "EYtIYnTH ",    "nAYntIYnTH "
+       } ;
+
+static char *Ord_twenties[] = 
+       {
+       "twEHntIYEHTH ","THERtIYEHTH ", "fOWrtIYEHTH ", "fIHftIYEHTH ",
+       "sIHkstIYEHTH ","sEHvEHntIYEHTH ","EYtIYEHTH ", "nAYntIYEHTH "
+       } ;
+
+
+void
+dmk_say_cardinal(long int value)
+/*
+   Translate a number to phonemes.  This version is for CARDINAL numbers.
+   Note: this is recursive.
+*/
+{
+  if (value < 0)
+    {
+      dmk_outstring("mAYnAHs ");
+      value = (-value);
+      if (value < 0)           /* Overflow!  -32768 */
+       {
+         dmk_outstring("IHnfIHnIHtIY ");
+         return;
+       }
+    }
+
+  if (value >= 1000000000L)    /* Billions */
+    {
+      dmk_say_cardinal(value/1000000000L);
+      dmk_outstring("bIHlIYAXn ");
+      value = value % 1000000000;
+      if (value == 0)
+       return;                 /* Even billion */
+      if (value < 100)         /* as in THREE BILLION AND FIVE */
+       dmk_outstring("AEnd ");
+    }
+
+  if (value >= 1000000L)       /* Millions */
+    {
+      dmk_say_cardinal(value/1000000L);
+      dmk_outstring("mIHlIYAXn ");
+      value = value % 1000000L;
+      if (value == 0)
+       return;                 /* Even million */
+      if (value < 100)         /* as in THREE MILLION AND FIVE */
+       dmk_outstring("AEnd ");
+    }
+
+  /* Thousands 1000..1099 2000..99999 */
+  /* 1100 to 1999 is eleven-hunderd to ninteen-hunderd */
+  if ((value >= 1000L && value <= 1099L) || value >= 2000L)
+    {
+      dmk_say_cardinal(value/1000L);
+      dmk_outstring("THAWzAEnd ");
+      value = value % 1000L;
+      if (value == 0)
+       return;                 /* Even thousand */
+      if (value < 100)         /* as in THREE THOUSAND AND FIVE */
+       dmk_outstring("AEnd ");
+    }
+
+  if (value >= 100L)
+    {
+      dmk_outstring(Cardinals[value/100]);
+      dmk_outstring("hAHndrEHd ");
+      value = value % 100;
+      if (value == 0)
+       return;                 /* Even hundred */
+    }
+
+  if (value >= 20)
+    {
+      dmk_outstring(Twenties[(value-20)/ 10]);
+      value = value % 10;
+      if (value == 0)
+       return;                 /* Even ten */
+    }
+
+  dmk_outstring(Cardinals[value]);
+  return;
+} 
+
+
+void
+dmk_say_ordinal(long int value)
+/*
+   Translate a number to phonemes.  This version is for ORDINAL numbers.
+   Note: this is recursive.
+*/
+{
+
+  if (value < 0)
+    {
+      dmk_outstring("mAHnAXs ");
+      value = (-value);
+      if (value < 0)           /* Overflow!  -32768 */
+       {
+         dmk_outstring("IHnfIHnIHtIY ");
+         return;
+       }
+    }
+
+  if (value >= 1000000000L)    /* Billions */
+    {
+      dmk_say_cardinal(value/1000000000L);
+      value = value % 1000000000;
+      if (value == 0)
+       {
+         dmk_outstring("bIHlIYAXnTH ");
+         return;               /* Even billion */
+       }
+      dmk_outstring("bIHlIYAXn ");
+      if (value < 100)         /* as in THREE BILLION AND FIVE */
+       dmk_outstring("AEnd ");
+    }
+
+  if (value >= 1000000L)       /* Millions */
+    {
+      dmk_say_cardinal(value/1000000L);
+      value = value % 1000000L;
+      if (value == 0)
+       {
+         dmk_outstring("mIHlIYAXnTH ");
+         return;               /* Even million */
+       }
+      dmk_outstring("mIHlIYAXn ");
+      if (value < 100)         /* as in THREE MILLION AND FIVE */
+       dmk_outstring("AEnd ");
+    }
+
+  /* Thousands 1000..1099 2000..99999 */
+  /* 1100 to 1999 is eleven-hunderd to ninteen-hunderd */
+  if ((value >= 1000L && value <= 1099L) || value >= 2000L)
+    {
+      dmk_say_cardinal(value/1000L);
+      value = value % 1000L;
+      if (value == 0)
+       {
+         dmk_outstring("THAWzAEndTH ");
+         return;               /* Even thousand */
+       }
+      dmk_outstring("THAWzAEnd ");
+      if (value < 100)         /* as in THREE THOUSAND AND FIVE */
+       dmk_outstring("AEnd ");
+    }
+
+  if (value >= 100L)
+    {
+      dmk_outstring(Cardinals[value/100]);
+      value = value % 100;
+      if (value == 0)
+       {
+         dmk_outstring("hAHndrEHdTH ");
+         return;               /* Even hundred */
+       }
+      dmk_outstring("hAHndrEHd ");
+    }
+
+  if (value >= 20)
+    {
+      if ((value%10) == 0)
+       {
+         dmk_outstring(Ord_twenties[(value-20)/ 10]);
+         return;               /* Even ten */
+       }
+      dmk_outstring(Twenties[(value-20)/ 10]);
+      value = value % 10;
+    }
+
+  dmk_outstring(Ordinals[value]);
+  return;
+} 
diff --git a/TIesr_Tools/dictproc/src/spellword.c b/TIesr_Tools/dictproc/src/spellword.c
new file mode 100644 (file)
index 0000000..cbea5cf
--- /dev/null
@@ -0,0 +1,64 @@
+/*=======================================================================
+ spellword.c
+
+ Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/
+ ALL RIGHTS RESERVED
+======================================================================*/
+
+/*-------------------------------------------------------------
+ This source code is derived from the public domain code ENGLISH
+ TO PHONEME TRANSLATION written by John A. Wasser, 4/15/85.
+ --------------------------------------------------------------*/
+
+#include <stdio.h>
+#include "dmakeup.h"
+
+static char *Ascii[] =
+       {
+"nUWl ","stAArt AXv hEHdER ","stAArt AXv tEHkst ","EHnd AXv tEHkst ",
+"EHnd AXv trAEnsmIHSHAXn",
+"EHnkwAYr ","AEk ","bEHl ","bAEkspEYs ","tAEb ","lIHnIYfIYd ",
+"vERtIHkAXl tAEb ","fAOrmfIYd ","kAErAYj rIYtERn ","SHIHft AWt ",
+"SHIHft IHn ","dIHlIYt ","dIHvIHs kAAntrAAl wAHn ","dIHvIHs kAAntrAAl tUW ",
+"dIHvIHs kAAntrAAl THrIY ","dIHvIHs kAAntrAAl fOWr ","nAEk ","sIHnk ",
+"EHnd tEHkst blAAk ","kAEnsEHl ","EHnd AXv mEHsIHj ","sUWbstIHtUWt ",
+"EHskEYp ","fAYEHld sIYpERAEtER ","grUWp sIYpERAEtER ","rIYkAOrd sIYpERAEtER ",
+"yUWnIHt sIYpERAEtER ","spEYs ","EHksklAEmEYSHAXn mAArk ","dAHbl kwOWt ",
+"nUWmbER sAYn ","dAAlER sAYn ","pERsEHnt ","AEmpERsAEnd ","kwOWt ",
+"OWpEHn pEHrEHn ","klOWz pEHrEHn ","AEstEHrIHsk ","plAHs ","kAAmmAX ",
+"mIHnAHs ","pIYrIYAAd ","slAESH ",
+
+"zIHrOW ","wAHn ","tUW ","THrIY ","fAOr ",
+"fAYv ","sIHks ","sEHvAXn ","EYt ","nAYn ",
+
+"kOWlAXn ","sEHmIHkOWlAXn ","lEHs DHAEn ","EHkwAXl sAYn ","grEYtER DHAEn ",
+"kwEHsCHAXn mAArk ","AEt sAYn ",
+
+"EY ","bIY ","sIY ","dIY ","IY ","EHf ","jIY  ",
+"EYCH ","AY ","jEY ","kEY ","EHl ","EHm ","EHn ","OW ","pIY ",
+"kyUW ","AAr ","EHs ","tIY ","yUW ","vIY ",
+"dAHblyUW ","EHks ","wAY ","zIY ",
+
+"lEHft brAEkEHt ","bAEkslAESH ","rAYt brAEkEHt ","kAErEHt ",
+"AHndERskAOr ","AEpAAstrAAfIH ",
+
+"EY ","bIY ","sIY ","dIY ","IY ","EHf ","jIY  ",
+"EYtCH ","AY ","jEY ","kEY ","EHl ","EHm ","EHn ","AA ","pIY ",
+"kw ","AAr ","EHz ","tIY ","AHw ","vIY ",
+"dAHblyUWw ","EHks ","wAYIY ","zIY ",
+
+"lEHft brEYs ","vERtIHkAXl bAAr ","rAYt brEYs ","tAYld ","dEHl ",
+       };
+
+void
+dmk_say_ascii(int character)
+{
+  dmk_outstring(Ascii[character&0x7F]);
+}
+
+void
+dmk_spell_word(char *word)
+{
+  for (word++ ; word[1] != '\0' ; word++)
+    dmk_outstring(Ascii[(*word)&0x7F]);
+}
diff --git a/TIesr_Tools/htk_dict_to_mlf.pl b/TIesr_Tools/htk_dict_to_mlf.pl
new file mode 100755 (executable)
index 0000000..91b0254
--- /dev/null
@@ -0,0 +1,235 @@
+#!/usr/bin/perl
+#-------------------------------------------------------------
+#  htk_dict_to_mlf.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+htk_dict_to_mlf -d dictfile -m mlffile [-l letterfile -p phonefile -v vqdir -t
+teeskips]";
+
+
+$DOCUMENTATION = "
+This script creates a word spelling MLF file from a simple HTK
+dictionary for use in letter-to-phone dictionary training. The
+input dictionary is of the form:
+
+ word [output] phn1 phn2 ...
+
+ It outputs an MLF file with entries of the form:
+
+#!MLF!#
+*/WORD_i
+_NUL
+W
+_NUL
+O
+_NUL
+R
+_NUL
+D
+_NUL
+# .
+
+Here the '_i' represents underscore followed by an integer,
+representing the possible alternate pronunciations of a word.  Note
+the capitalization.  We assume letters of a word will be represented
+in capitals, and phones will be represented as lower case strings.
+The idea here is that each letter will be represented by a discrete
+HMM. Note that there are lines with _NUL in them.  This refers to a
+special model _NUL which is a generic non-tee model.  Since each
+letter HMM may be a tee model, and HTK does not allow successive tee
+models, we must provide non-tee models inbetween each letter HMM.
+Also, in order to output the training phone index data files, you must
+specify the maximum number of letters that can be silent in a word in
+order to put the skip phones in the data files to implement skipping
+of letters in a spelling.
+
+This script can also output a listing of letters and phones
+it found in the dictionary.  The special non-tee model NUL and
+its corresponding phone state 'nul' are also output.
+
+This script can also output HTK style data files that contain vq 
+indices for each word in the training dictionary.  This creates the
+training and testing data for doing the letter- to-phone alignment
+training. This utility does filtering on the dictionary ensuring that
+there are not multiple duplicate pronunciations of the same word.";
+
+#----------------------------------------------------------------
+use Getopt::Long;
+
+
+GetOptions( "Help" => \$help,
+           "d=s" => \$dictionary,
+           "m=s" => \$mlffile,
+           "l:s" => \$letterfile,
+           "p:s" => \$phonefile,
+           "v:s" => \$vqdirectory,
+           "t:i" => \$teeskips
+           );
+
+if( $help )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    exit 1;
+}
+
+
+if( !($dictionary && $mlffile) or $help )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    die "htk_dict_to_mlf: Invalid input\n";
+}
+
+
+die "htk_dict_to_mlf: Invalid dictionary $dictionary\n" if( ! -f $dictionary );
+
+$teeskips = 0 unless defined $teeskips;
+
+open( DICT, "$dictionary" ) or die "htk_dict_to_mlf: Can not open $dictionary\n";
+
+open(MLF, ">$mlffile" ) or die "htk_dict_to_mlf: Can not open $mlffile for output\n";
+print MLF "#!MLF!#\n";
+
+# Include the non-tee _NUL HMM model in letter hash,
+# and the _nul phone in the phone hash.
+$lhash{"_NUL"} = "_NUL";
+$phash{"_nul"} = "_nul";
+
+DICTLOOP: while( <DICT> )
+{
+    chomp;
+
+    # do not process comments and blank lines
+    next if( /^\s*$|^\s*\#/ );
+
+    # parse a dictionary entry
+    @parse =  /^\s*([^\s]+)(?:\s+\[.*\])?\s+(.*?)\s*$/;
+
+    # Extract the word and pronunciation
+    $word = shift @parse;
+    $word = uc $word;
+    $word =~ s/\s//g;
+    $pron = shift  @parse;
+    $pron = lc $pron;
+    $pron =~ s/\s+/ /g;
+
+
+    # Update hash that tracks number of dictionary entries of this word,
+    # and the different pronunciations
+    if( exists $whash{$word} )
+    {
+       foreach $wpron ( @{$whash{$word}{PRON}} )
+       {
+           next DICTLOOP if $wpron eq $pron;
+       }
+       $whash{$word}{COUNT}++;
+       push( @{$whash{$word}{PRON}}, $pron );
+    }
+    else
+    {
+       $whash{$word}{COUNT} = 1;
+       push( @{$whash{$word}{PRON}}, $pron );
+    }
+
+    # Update letter hash list
+    @letters = split( //, $word );
+    @lhash{@letters} = @letters;
+
+    # Update the phone hash list
+    @phones = split( " ", $pron );
+    @phash{@phones} = @phones;
+
+
+    # Output the MLF entry for this word. Since the  HTK word 
+    # can not have "." in the name, substitute "p" for "."
+    $htkword = $word;
+    $htkword =~ s/\./p/g;
+    print MLF "\"*/${htkword}_$whash{$word}{COUNT}.lab\"\n";
+    foreach $let (@letters)
+    {
+       print MLF "\"_NUL\"\n\"$let\"\n";
+    }
+    print MLF "\"_NUL\"\n.\n";
+}
+
+close(MLF);
+close(DICT);
+
+# Output letter list
+if( $letterfile )
+{
+    open(LET, ">$letterfile") or die "htk_dict_to_mlf: Can not open $letterfile\n";
+    foreach $let (sort keys(%lhash) )
+    {
+       print LET "\"$let\"\n";
+    }
+    close(LET);
+}
+
+# Output phone list
+if( $phonefile )
+{
+    open(PHONE, ">$phonefile") or die "htk_dict_to_mlf: Can not open $phonefile\n";
+
+    foreach $phone (sort keys(%phash) )
+    {
+       print PHONE "$phone\n";
+    }
+    close(PHONE);
+}
+
+
+exit 0  if( !defined $vqdirectory || ! -d $vqdirectory );
+
+# Make a hash that contains the indices for each phone
+@pindex{ sort keys %phash} = ( 1 .. scalar(keys(%phash)) );
+
+
+# Make all of the phone-based training/recognition HTK 
+# data files.
+chdir $vqdirectory;
+
+$ntphoneidx = $pindex{"_nul"};
+
+foreach $wrd ( sort keys(%whash) )
+{
+    $npron = $whash{$wrd}{COUNT};
+
+    for( $pron=1; $pron<=$npron; $pron++ )
+    {
+       $fname = "${wrd}_$pron";
+       @phones = split(" ", $whash{$wrd}{PRON}[$pron-1] );
+       $nphones = @phones;
+
+       # HTK file name can not contain ".", substitute "p"
+       $htkfname = $fname;
+       $htkfname =~ s/\./p/g;
+
+       #Open HTK data file and write header (discrete data)
+       open( DATA, ">$htkfname" );
+       print DATA pack "IISS", $nphones + ($nphones+1)*$teeskips, 1, 2, 10;
+
+       # Output all phone indices
+       foreach $phn ( @phones )
+       {
+           for( $tee = 0; $tee < $teeskips; $tee++ )
+           {
+               print DATA pack "S",  $ntphoneidx;
+           }
+
+           print DATA pack "S",  $pindex{$phn};
+       }
+
+       for( $tee = 0; $tee < $teeskips; $tee++ )
+       {
+           print DATA pack "S",  $ntphoneidx;
+       }
+
+       close(DATA);
+    }
+}
diff --git a/TIesr_Tools/htk_letter_mmf.pl b/TIesr_Tools/htk_letter_mmf.pl
new file mode 100755 (executable)
index 0000000..abb3065
--- /dev/null
@@ -0,0 +1,349 @@
+#!/usr/bin/perl
+
+#----------------------------------------------------------------
+#  htk_letter_mmf.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+htk_letter_mmf -p phonefile -h letterhmmfile -o outputmmf -m modelmapfile";
+
+
+$DOCUMENTATION = " 
+This script creates an HTK MMF file for letters. The -p option is a
+file containing the ordered list of phones in the language, the -h
+option specifies a file containing a description of each letter hmm.
+The format of the latter file is one line for each letter hmm.  The
+line consists of the letter followed by a ':' followed by phone lists
+and probabilities for the phone list separated by ','. Arbitrary
+numbers of spaces may be included in the file.  Lines beginning with
+'#' are comment lines.  The special phone '_sil' indicates a tee
+transition directly from the starting state to the ending state. An
+example is the letter X:
+
+X : z 0.7 , k s 0.2 , _sil 0.1
+
+This states that the letter hmm X should consist of a state z with
+entry probability 0.7, a two state sequence k s with entry into the k
+state of 0.2, and a tee probability of 0.1 (going directly from the
+starting to ending state). The -o option specifies where to output the
+mmf file. The -m option specifies where to output a map file that
+defines the phone for each state of each letter HMM for use in subsequent
+recognition to determine letter-to-phone mapping.";
+
+#----------------------------------------------------------------
+use Getopt::Long;
+
+
+GetOptions( "Help" => \$help,
+           "p=s" => \$phonefile,
+           "h=s" => \$lethmmfile,
+           "o=s" => \$outputmmf,
+           "m=s" => \$modelmap
+           );
+
+if( $help )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    exit 1;
+}
+
+
+if( ! -f $phonefile ||
+    ! -f $lethmmfile ||
+    ! $outputmmf ||
+    ! $modelmap )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    die "htk_letter_mmf: Invalid input\n";
+}
+
+
+# Get the ordered phone listing file
+open(PHN, "$phonefile") or die "htk_letter_mmf: Can not open $phonefile\n";
+while( <PHN> )
+{
+    chomp;
+
+    # Bypass empty or comment lines
+    next if( /^\s*$|^\s*\#/ );
+
+    # Remove spaces in phone name
+    s/\s+//g;
+
+    push(@phones, $_);
+}
+close(PHN);
+
+
+# Make a phone index hash
+$nphones = @phones;
+@pindex{@phones} = ( 1 .. $nphones );
+
+
+# Open the modelmap file that tracks phone/state mapping
+open(MMAP, ">$modelmap" ) or die "htk_letter_mmf: Can not open $modelmap\n";
+
+
+# Construct the mmf file header
+open( MMF, ">$outputmmf" ) or die "htk_letter_mmf: Can not open $outputmmf\n";
+
+print MMF "~o <DISCRETE> <STREAMINFO> 1 1\n";
+
+
+# Create state macros for all phones.  Each state macro has the
+# name of the phone, and that state has probability of 1.0 of that
+# phone VQ index occurring.  All other indices have lowest probability.
+foreach $phone ( @phones )
+{
+    print MMF "~s \"$phone\"\n";
+    print MMF "<NUMMIXES> $nphones\n";
+
+    $idx = $pindex{$phone};
+
+    if( $idx == 1 )
+    {
+       $nafter = $nphones - 1;
+       print MMF "<DProb> 0 32767\*$nafter\n";
+    }
+    elsif( $idx == $nphones )
+    {
+       $nbefore = $nphones - 1;
+       print MMF "<DProb> 32767\*$nbefore 0\n";
+    }
+    else
+    {
+       $nbefore = $idx - 1;
+       $nafter = $nphones - $idx;
+       print MMF "<DProb> 32767\*$nbefore 0 32767\*$nafter\n";
+    }
+}
+
+
+# Output the non-tee null phone model
+print MMF "~h \"_NUL\"\n";
+print MMF "\<BeginHMM\>\n";
+print MMF "\<NumStates\> 3\n";
+print MMF "\<State\> 2\n";
+print MMF "~s \"_nul\"\n";
+printf MMF "\<TransP\> 3\n";
+print MMF " 0.0 1.0 0.0\n";
+print MMF " 0.0 0.9 0.1\n";
+print MMF " 0.0 0.0 0.0\n";
+print MMF "<ENDHMM>\n";
+
+print MMAP "_NUL _nul\n";
+
+# Read in all HMM descriptions and write out the hmm macros
+open( HMM, "$lethmmfile" ) or die "htk_letter_mmf: Can not open $lethmmfile\n";
+
+while( <HMM> )
+{
+
+    next if /^(\s*|\s*\#.*)$/;
+
+
+    $rlethash = parse_letter($_);
+    
+    # Begin the letter hmm
+    print MMF "~h \"$rlethash->{LETTER}\"\n";
+    print MMF "\<BeginHMM\>\n";
+    print MMF "\<NumStates\> $rlethash->{NUMSTATES}\n";
+    
+    print MMAP "$rlethash->{LETTER}";
+
+    # Print emitting state phone state macros 
+    for( $st = 2; $st < $rlethash->{NUMSTATES}; $st++ )
+    {
+       $refst = $rlethash->{STATE}[$st];
+
+       die "htk_letter_mmf: Invalid phone $refst->{NAME}\n" unless exists $pindex{$refst->{NAME}};
+
+       print MMF "\<State\> $st\n";
+       print MMF "~s \"$refst->{NAME}\"\n";
+
+       print MMAP " $refst->{NAME}";
+    }
+
+    print MMAP "\n";
+
+
+    # Transition probabilities
+    printf MMF "\<TransP\> $rlethash->{NUMSTATES}\n";
+    for($st=1; $st<= $rlethash->{NUMSTATES}; $st++ )
+    {
+       $refst = $rlethash->{STATE}[$st];
+       for( $pidx = 1; $pidx <= $rlethash->{NUMSTATES}; $pidx++ )
+       {
+           print MMF " $refst->{TRPROB}[$pidx]";
+       }
+       print MMF "\n";
+    }
+
+    print MMF "\<EndHMM\>\n";
+}
+
+
+close( HMM );
+
+close( MMF );
+
+close( MMAP );
+
+exit 0;
+
+
+
+#----------------------------------------------------------------
+sub parse_letter
+{
+    my($line) = $_[0];
+
+    # The letter hash
+    my(%lethash);
+
+    # Get letter and its corresponding phone sequences
+    ($let, $seqinfo) = ( $line =~ /^\s*([^\s]+)\s*:\s*(.*?)\s*$/ );
+
+    $lethash{LETTER} = $let;
+
+
+    # Default tee probability
+    $teeprob = 0.0;
+
+    # Initialize total entry probability to first emitting states
+    $totalprob = 0;
+
+    # Define the starting state
+    $state = 1;
+    $lethash{STATE}[$state]{NAME} = "STARTSTATE";
+    $lethash{STATE}[$state]{TRPROB}[1] = 0.0;
+
+
+    # Extract each sequence as a string and put it as a path on the HMM
+    # from starting to ending state
+    @seqs = split( /\s*,\s*/, $seqinfo );
+
+SEQS:
+    foreach $seq (@seqs)
+    {
+
+       # extract sequence elements that make a path from start to end state
+       @path = split( " ", $seq );
+       die "htk_letter_mmf: Invalid path sequence $seq\n" unless $#path > 0;
+       
+       # last path element is the entry probability from start state to first phone
+       $prob = pop @path;
+
+       die "htk_letter_mmf: Invalid path sequence $seq\n" 
+           unless $prob =~ /^(\d*\.\d+|\d+\.?\d*)((E|e)(\+|-)(\d){1,3})?$/;
+       $totalprob += $prob;
+
+       # process each phone in the path
+       $first = 1;
+       foreach $phname (@path)
+       {
+           # handle _sil uniquely; it is not a state, but indicates tee probability
+           if( $phname =~ /_sil/ )
+           {
+               die "htk_letter_mmf: Invalid tee spec\n" if( $#path > 0 );
+               $teeprob = $prob;
+               next SEQS;
+           }
+
+           # handle forced null state that is not a skip
+           if( $phname =~ /_nul/ )
+           {
+               $phname = "_nul";
+           }
+
+           # First phone in the path has entry probability from start state
+           if( $first )
+           {
+               $state++;
+               $lethash{STATE}[$state]{NAME} = $phname;
+
+               #Transition from start state to this first state of path
+               $lethash{STATE}[1]{TRPROB}[$state] = $prob;
+               $first = 0;
+           }
+
+           # all other phones in sequence chain from the preceding path phone
+           # and need to explain possible intervening non-tee observations
+           else
+           {
+               # Transition from prior state to a new non-tee state
+               $state++;
+               $lethash{STATE}[$state]{NAME} = "_nul";
+               $lethash{STATE}[$state-1]{TRPROB}[$state] = 0.5;
+
+               # Non-tee state loop probability
+               $lethash{STATE}[$state]{TRPROB}[$state] = 0.5;
+               
+
+               # Next phone state in path
+               $state++;
+               $lethash{STATE}[$state]{NAME} = $phname;
+
+               # Transition from prior phone state in sequence to this state
+               $lethash{STATE}[$state-2]{TRPROB}[$state] = 0.5;
+
+               #Transition from new non-tee state to this state
+               $lethash{STATE}[$state-1]{TRPROB}[$state] = 0.5;
+           }
+       }
+
+       # last phone on the sequence path ties to end state.  Since we don't 
+       # know end state yet, tag this by a self transition of -1.0
+       $lethash{STATE}[$state]{TRPROB}[$state] = -1.0;
+    }
+
+    die "htk_letter_mmf: Invalid probabilities for $let\n" 
+       if( $totalprob < .9999 || $totalprob > 1.0001 );
+
+
+    # Add the ending state
+    $state++;
+
+    $lethash{NUMSTATES} = $state;
+
+    $lethash{STATE}[$state]{NAME} = "ENDSTATE";
+    for( $st = 1; $st <= $state; $st++ )
+    {
+       $lethash{STATE}[$state]{TRPROB}[$st] = 0.0;
+    }  
+
+
+    # Complete the transition probabilities
+
+    # The tee probability from first to last state
+    $lethash{STATE}[1]{TRPROB}[$state] = $teeprob;
+
+    # Transitions from last path state to ending state
+    for( $st = 2; $st < $state; $st++ )
+    {
+       if( $lethash{STATE}[$st]{TRPROB}[$st] == -1.0 )
+       {
+           $lethash{STATE}[$st]{TRPROB}[$state] = 1.0;
+           $lethash{STATE}[$st]{TRPROB}[$st] = 0.0;
+       }       
+    }
+
+    # All other undefined trans prob. are zero 
+    for( $srcst = 1; $srcst < $state; $srcst++ )
+    {
+       for( $dstst = 1; $dstst <= $state; $dstst++ )
+       {
+           if( ! defined $lethash{STATE}[$srcst]{TRPROB}[$dstst] )
+           {
+               $lethash{STATE}[$srcst]{TRPROB}[$dstst] = 0.0;
+           }
+       }
+    }
+
+    return \%lethash;
+}
diff --git a/TIesr_Tools/htk_mmf_to_tiesr.pl b/TIesr_Tools/htk_mmf_to_tiesr.pl
new file mode 100755 (executable)
index 0000000..ac0cab0
--- /dev/null
@@ -0,0 +1,1654 @@
+#!/usr/local/bin/perl
+#---------------------------------------------------------------- 
+#  htk_mmf_to_tiesr.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+htk_mmf_to_tiesr [-Help] -H mmffile [-H mmffile ...]  [-l listfile]
+  [ -r regexp ] [-g genders] [-f features] [-bmean] [-bvar] [-le]
+  [-sb] [-notrees] [-cw clusterwgt] -bwgt -d outdir";
+
+
+$DOCUMENTATION = " 
+
+This perl script is used to interface with ASCII HTK MMF model files
+containing HMM data, and output the MMF file data in a set of binary
+files compatible with TIesrFlex.  Options are provided to allow
+flexible output for a variety of model types, including the ability
+to output either triphone or monophone data.  The MMF file must meet
+certain formatting criteria to be used in this script.  The
+requirements are:
+
+- All HMMs must be represented with ~h macro names.  They may all be
+  gender-independent (GI) or all gender-dependent (GD), but not a
+  mix. Genders are marked by gender tags appended to monophone names
+  which must make a monophone name unique for a gender, preferably
+  ':*', such as iy:m. Triphone names must be of the form
+  *-<monophone>[<gendertag>]+* where * indicates leading and trailing
+  monophone context, such aas p-er:m+l.  Note that there may be more
+  than two 'genders', such as children, etc.
+
+- There must be a silence model, denoted by the model name 'sil',
+  which is gender-independent.
+
+- All data in the active HMM set (see definition of active HMM set
+  below) with the exception of the sil model must correspond to either
+  triphones or monophones.  They can not be mixed.
+
+- All triphone HMMs must have transition matrices defined in macros.
+  Monophone HMMs may choose not to use macros for transition matrices,
+  but then the transition matrices will automatically be given the
+  macro name HMM_<phone>_TRANSP. The transition matrix macros may all
+  be GD or GI, but not a mix of both.  GD HMMs may use either GI or GD
+  transition macros, but GI HMMs may only use GI transition macros. A
+  macro name must be of the form *<phone>[<gendertag>][_TRANSP], for
+  example, T_aa or T_aa:m, or HMM_aa:m_TRANSP.  (This is not a
+  requirement for the silence model.)  The transition matrix used by a
+  triphone must be tied to the center monophone of the triphone. For
+  example, the triphone *-aa:m+* uses the transition matrix macro T_aa
+  if GI transitions, or T_aa:m if GD.
+
+- All triphone HMM state acoustic distributions must be defined by ~s
+  macros, which are the result of HTK decision tree clustering.
+  Otherwise, it is not possible for TIesrFlex to synthesize the
+  triphone using decision trees alone. (The binary data that TIesrFlex
+  uses does not include the triphone HMM information from the MMF file
+  since that would take too much space.  Instead, TIesrFlex
+  synthesizes each needed triphone from decision trees.)  
+
+- Gender-dependent state macro tags in triphones must have the gender
+  tag in the state macro name, for example aa_s2_1:m or aa:m_s2_1.
+
+The user specifies MMF files using the -H option.  Multiple MMF files
+may be specified and loaded, but they must be consistent, such as
+having the same feature size, etc.
+
+The user may select a set of HMMs to be considered as the active HMM
+set, from which the binary data is output.  The -l option is used to
+specify a list of HMMs that are considered part of the active HMM
+model set.  The list file contains one or more hmm names per text line
+separated by spaces.  The -r option specifies a regular expression
+that can be used to select HMMs in the active HMM set by regular
+expression match.  Additional HMM names to be added to the HMM set can
+be specified on the command line after options.
+
+The -g option is used to specify genders that will be output.  This
+should be a string that specifies the individual gender tags on the
+models, separated by commas, for example \":m,:f\".  It is assumed that
+these tags are appended to the center monophone of each triphone name,
+such as p-er:m+l.  Note that if gender tagging is specified, then you
+must ensure that the active HMM set selected by -l and/or -r includes
+all of the gender-specific models desired.  If no gender tags are
+specified, it is assumed that the HMMs are gender-independent.
+
+The -f option specifies how many features each for static, dynamic,
+and acceleration (if contained in the MMF) will be output.  It should
+be an integer.
+
+The -bmean option causes byte mean vectors to be output. Output byte
+mean vectors must not be CMN, so if the input vectors are CMN, and
+the -sb option is selected, the conversion will fail with an error
+message. 
+
+The -bvar option causes byte inverse variance vectors to be output.
+
+The -le option causes output in little endian format. 
+
+The -d option specifies the output directory, which must be specified.
+If it does not exist, an attempt will be made to create it. 
+
+The -sb option specifies to skip the bias addition on static features.
+This is present since bias was not originally added to the static
+features until flexphone added it during conversion of 16-bit features
+to 8-bit features.
+
+The -notrees option states that the set of models is not a triphone
+model set that needs acoustic decision trees.  This will cause this
+tool to output all configuration file information, where the tree
+information is dummy placeholder data.
+
+The -cw option will cluster the Gaussian weight vectors of the HMM
+state pdfs, and create a VQ clustered weights file,
+fxweight.cb. Separate VQ clusters are formed for each set of states
+containing a specific number of Gaussian mixture components. The
+clusterwgt parameter defines how clustering will be performed. If 
+0 < clusterwgt < 1, then clusterwgt is the fraction of original
+weight vectors that should be in the VQ clusters. For example,
+if 1000 HMM states contain two mixture components and clusterwgt is
+set to .01, then the 1000 weight vectors will be clustered to 
+10 VQ vectors. If clusterwgt is >= 1, then it should be an integer,
+and it defines the requested number of clustered VQ vectors. The
+number of VQ vectors may be less than the requested number if the
+original number of weight vectors is less than the requested number.
+Clustering weight vectors allows significant compression of the pdf
+codebook file fxclust.cb by encoding each vector as a VQ index.
+The -bwgt parameter will pack the pdf clustered weight index
+and number of gaussians in the pdf into a byte format. This will
+limit the HMM state to a  maximum of 256 clustered weight vectors, 
+and 256 mixture components in a pdf.
+";
+
+#----------------------------------------------------------------
+use Getopt::Long;
+
+# This tool uses the HTKdata module to parse the MMF file
+use HTKdata;
+
+use Algorithm::Cluster;
+
+
+# Global variables used by the script
+
+# Scaling for mfcc mean and variance, up to 16 dimensions.  
+@MU_SCALE_STATIC = ( 16,4,4,2,2,2,1,1,1,1,1,1,1,1,1,1 );
+@MU_SCALE_DYNAMIC = ( 4,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1 );
+@MU_SCALE_ACC = ( 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 );
+@MU_BIAS = ( 14951, -2789, -811, 1563, -3013, -1346, 973, -884, 355, -496, 
+            0, 0, 0, 0, 0, 0 );
+
+
+
+# read mmf files and a file containing a list of hmms to load
+GetOptions('Help' => \$outdoc,
+          'H=s@' => \@mmffil,
+          'l=s' => \$lstfil,
+          'r=s' => \$regexp,
+          'g=s' => \$genders,
+          'f=s' => \$features,
+          'bmean'   => \$bytemean,
+          'bvar'   => \$bytevar,
+          'le'  => \$littleendian,
+          'sb'  => \$skipbias,
+          'notrees' => \$notrees,
+          'd=s' => \$outdir,
+          'cw=f' => \$clusterwgt,
+          'bwgt' => \$bytewgt );
+
+
+# Output only the documentation if requested
+
+if( $outdoc )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+
+# The list of MMF files must not be empty, and 
+# the output directory must be specified
+
+if( !defined $mmffil[0] or
+    ! defined $outdir )
+{
+    print "$USAGE\n";
+    exit 1;
+v}
+
+
+# Create outdir if it does not exist
+
+if( ! -d $outdir )
+{
+    mkdir $outdir, 0770 or die "Could not make $outdir\n";
+}
+
+
+# Initialize regular expression if needed
+
+( defined $regexp ) or $regexp = "";
+
+
+# make a list of hmms to load from the mmf file
+
+@hmmnames = ();
+
+if( defined $lstfil )
+{
+    open( LST, "$lstfil") or die "Invalid list of hmms $lstfil\n";
+
+    while( $lin = <LST> )
+    {
+       chomp($lin);
+       push @hmmnames,  split( " ", $lin );
+    }
+
+    close( LST );
+}
+
+
+# add command line names to hmmname list
+
+if( @ARGV && length(@ARGV) > 0 )
+{
+    push @hmmnames, @ARGV;
+}
+
+
+# Load in all MMF file data.  Create a new instance of 
+# an HTKdata object. $hmms is a reference to the object.
+
+print "Parsing MMF files\n";
+
+$hmms = HTKdata->new();
+
+foreach $filename (@mmffil)
+{
+    $hmms->parsemmf($filename, $regexp, @hmmnames );
+}
+
+
+# if there is a list, then check to ensure that all
+# hmms in the list are loaded
+
+if( @hmmnames )
+{
+    $hmms->checklist( @hmmnames );
+}
+
+
+# Mark the active data corresponding to the active models.  No macros
+# will be marked to be expanded into their own items.  We want macros
+# to be shared maximally for TIesrFlex.
+
+$mexpand = "";
+$hmms->markusagehmm( $mexpand );
+
+
+# Check for conflicts using -sb option
+die "Output CMN byte mean not allowed, invalid use of -sb option\n" 
+    if ( $skipbias and $bytemean and $hmms->{PARMKIND} =~ /_Z/ );
+
+die "Non-CMN input means require -sb option\n"
+    if ( ! $skipbias and  $hmms->{PARMKIND} !~ /_Z/ );
+
+
+# Generate an ordered list of monophones in the active hmm set,
+# checking that there are the same number for each gender tag, if
+# gender tags are defined.
+print "Generating monophone list\n";
+
+@monophones = monophone_list( $hmms, $genders, $outdir );
+
+
+# Generate the fixed point PDF (cluster) codebook and the mean,
+# variance, and gconst codebooks.  This will also output a file
+# containing a list of all of the cluster macros so the order of
+# PDFs in the codebook is known.  This will be needed in coding
+# the acoustic decision trees files.
+print "Creating cluster, mean, variance, and gconst codebooks\n";
+
+@pdfs = create_pdf_cb( $hmms, $genders, $outdir, 
+                      $features,
+                      $bytemean, $bytevar,
+                      $littleendian,
+                      $skipbias, $clusterwgt, $bytewgt );
+
+# Generate the fixed point transition matrix codebook and offset files
+# in monophone order.  The transition codebooks are in monophone order
+# according to the above generated list.  There may be
+# gender-dependent transition matrices or gender independent matrices.
+# If there are gender-dependent matrices then a check is made to
+# ensure that transition matrices for all genders and monophones are
+# covered.  This will also output a file containing a list of all
+# ordered transition macros so you can see their sequence of
+# organization in the codebook.  The last transition matrix is for the
+# "sil" model.
+print "Creating transition codebook\n";
+
+
+@transitions = create_trans_cb( $hmms, $genders, $outdir,
+                               $littleendian,
+                               @monophones );
+
+
+
+# Generate the specific file for the 'sil' HMM model.
+print "Generating silence hmm information file\n";
+
+create_sil_hmm( $hmms, $outdir, $littleendian );
+
+
+# Output dummy tree configuration information if requested when data is
+# monophones, or if needed since pdf weights are clustered and this info
+# must be in the configuration file.
+if( $notrees or $clusterwgt )
+{
+    print "Caution: Dummy tree information written to configuration file\n";
+    $ptype = $littleendian ? "V" : "N";
+    open(CFG, ">>$outdir/fxconfig.bin" ) or die "Can not open fxconfig.bin\n";
+    print CFG pack $ptype, 0;
+
+    print CFG pack $ptype, 1 if ( $clusterwgt );
+    print CFG pack $ptype, $bytewgt ? 1 : 0 if ( $clusterwgt );
+
+    close( CFG );
+}
+
+
+#----------------------------------------------------------------
+# monophone_list
+
+# Create a list of gender-independent monophones.  If genders are 
+# specified, ensure that triphones cover all monophones for all
+# genders
+
+sub monophone_list
+{
+    use strict;
+
+    my($mmfref) = shift;
+    my($genders)  = shift;
+    my($outdir) = shift;
+
+
+    # If a gender string is defined, then determine genders needed
+    my(@genderlist);
+    my($genderre);
+    if( $genders )
+    {
+       @genderlist = sort( split /\s+|\s*,\s*/ , $genders );
+       $genderre = join '|', @genderlist ;
+    }
+
+    # Loop over all HMMs, determining phone names from triphone
+    # names, and adding their phonenames to the phone hash.
+    # Create a GI monophone list too.
+    # Ignore silence HMM.
+    my(%phonehash) = ();
+    my(%monohash) = ();
+    foreach my $hmmname ( keys %{$mmfref->{HMM}}  )
+    {
+       my($phonename);
+
+       # Extract center phone name from triphones
+       if ( $hmmname =~ /^\S+-(\S+)\+\S+$/ )
+       {
+           $phonename = $1;
+       }
+
+       # ignore sp and sil models
+       elsif ( $hmmname =~ /^sil|^sp/ )
+       {
+           next;
+       }
+       else
+       {
+           $phonename = $hmmname;
+       }
+
+       $phonehash{$phonename} = 0;
+           
+       if( $genders )
+       {
+           # Get monophone name from GD phone name
+           $phonename =~ /^(.+)($genderre)$/ 
+               or die "Missing gender tag in HMM $hmmname\n";
+           $monohash{$1} = 0;
+       }
+       else
+       {
+           # phone name is GI
+           $monohash{$phonename} = 0;
+       }
+    }
+
+    # Check that all GD monophones are represented if necessary
+    if( $genders )
+    {
+       foreach my $mononame ( keys %monohash )
+       {
+           foreach my $gender (@genderlist)
+           {
+               die "Gender dependent HMMs missing for ${mononame}${gender}\n"
+                   unless exists $phonehash{ "${mononame}${gender}" };
+           }
+       }
+    }
+
+    # Output the monophone list
+    my($outfile) = "${outdir}/monophone.list";
+    open( OUT, ">$outfile" ) or die "Can not open $outfile\n";
+    foreach my $mononame ( sort keys %monohash )
+    {
+       print OUT "$mononame\n";
+    }
+
+    close(OUT);
+    return sort keys %monohash;
+}
+
+
+
+#----------------------------------------------------------------
+# create_trans_cb
+
+# Create the transition codebook, offset, and list file.  The
+# transition matrices will be output in the order specified by the
+# monophone list.  If genders are specified, and gender-specific
+# transition matrices exist, this function will check that there are
+# gender-specific transition matrices for all monophones, and that
+# they are output in proper order, with all transition matrices for
+# each gender output together as a set.  This is required in order
+# to look up the GD transitions easily within TIesrFlex.
+
+sub create_trans_cb
+{
+    use strict;
+
+    # Arguments to the subroutine
+    my( $mmfref ) = shift;
+    my( $genders ) = shift;
+    my( $outdir ) = shift;
+    my( $littleendian ) = shift;
+    my( @monophones) = @_;
+
+
+    # Transition names in triphones
+    my( %tranhash ) = ();
+
+    my $ptype = $littleendian ? "V" : "N";
+
+    # Regular expression defining monophone context
+    my( $monore ) = join '|', @monophones;
+
+
+    # If a gender string is defined, then determine genders needed
+    my(@genderlist);
+    my($genderre);
+    if( $genders )
+    {
+       @genderlist = sort split( /\s+|\s*,\s*/ , $genders);
+       $genderre = join '|', @genderlist ;
+    }
+    else
+    {
+       $genderre = "";
+    }
+    
+
+    # Loop over all triphones, gathering transition macro names.
+    # Check for type of transitions - GD or GI monophone.
+    # Guarantee no mix of both.
+    my($gdtrans) = 0;
+    my($gitrans) = 0;
+    foreach my $hmmname ( keys %{$mmfref->{HMM}}  )
+    {
+       my($tranname);
+
+       # Only consider (tri)phones but not sil or sp
+       if ( ( $hmmname =~ /^\S+-(\S+)\+\S+$/ ) or
+            ( $hmmname !~ /^(sil|sp)($genderre)?$/ ) )
+       {
+           $tranname = $mmfref->{HMM}{$hmmname}{TRANSP};
+
+           if( $tranname =~ /.*?($monore)(?:_TRANSP)?$/ )
+           {
+               # This is a GI transition
+               $gitrans = 1;
+
+               die "Duplicate GI transition for $tranname\n"
+                   if( exists $tranhash{$1} and $tranname ne $tranhash{$1} );
+
+               $tranhash{$1} = $tranname;
+           }
+           elsif( $genders && $tranname =~ /.*?($monore)($genderre)(?:_TRANSP)?$/ )
+           {
+               # This is a GD transition
+               $gdtrans = 1;
+               die "Duplicate GD transition $tranname\n"
+                   if( exists $tranhash{ "$1$2" } and  
+                       $tranname ne $tranhash{"$1$2"} );
+               $tranhash{ "$1$2" } = $tranname;
+           }
+           else
+           {
+               die "Invalid transition name $tranname\n";
+           }
+
+           die "Mixed GD/GI transition macro $tranname\n"
+               if( $gdtrans and $gitrans );
+       }
+    }
+    
+
+    # Guarantee all GI or GD transitions are covered for all monophones
+    foreach my $monophone (@monophones)
+    {
+       if( $gdtrans )
+       {
+           foreach my $gender (@genderlist )
+           {
+               die "Missing transition for $monophone$gender\n" 
+                   unless exists $tranhash{ "$monophone$gender" };
+           }
+       }
+       else
+       {
+           die "Missing transition for $monophone\n" 
+               unless exists $tranhash{ $monophone };
+       }
+    }
+
+
+    # Output the codebook, offset and list files
+
+    # Open transition codebook, offset, and list files
+    open(CB, ">${outdir}/fxtran.cb" ) or die "Can not open fxtran.cb\n";
+    open(OFF, ">${outdir}/fxtran.off" ) or die "Can not open fxtran.off\n";
+    open(LIST, ">${outdir}/fxtran.list" ) or die "Can not open fxtran.list\n";
+
+
+    # Dummy sizes to start
+    print CB  pack $ptype, 0;
+    print OFF  pack $ptype, 0;
+
+
+    # Offset of transition matrix data in 16-bit words.  
+    # Number of transition matrices.
+    my $offset = 0;
+    my $ntrans = 0;
+    my @tranlist = ();
+    my $size;
+    my $tranname;
+
+    my @gdrset = $gdtrans ?  @genderlist  :  ("");
+
+    foreach my $gender (@gdrset)
+    {
+       foreach my $monophone (@monophones)
+       {
+           $tranname = $tranhash{"$monophone$gender"};
+           $size = output_trans( $mmfref, 
+                                 $tranname,
+                                 $littleendian,
+                                 *CB );
+
+           print LIST "$tranname\n";
+           push @tranlist, $tranname;
+
+           print OFF pack $ptype, $offset;
+           $offset += $size;
+
+           $mmfref->{TRANSP}{$tranname}{INDEX} = $ntrans++;
+       }    
+    }
+
+
+    # Output the transition matrix for the sil model as the
+    # last transition information
+
+    $tranname = $mmfref->{HMM}{"sil"}{TRANSP};
+    die "Missing sil HMM\n" unless $tranname;
+    $size = output_trans( $mmfref, 
+                         $tranname,
+                         $littleendian,
+                         *CB );
+
+    print LIST "$tranname\n";
+    push @tranlist, $tranname;
+    
+    print OFF pack $ptype, $offset;
+    $offset += $size;
+
+    $mmfref->{TRANSP}{$tranname}{INDEX} = $ntrans++;
+
+
+    # Output codebook size
+    seek CB, 0, 0;
+    print CB pack $ptype, $offset;
+    close(CB);
+
+
+    # Output offsets size
+    seek OFF, 0, 0;
+    print OFF pack $ptype, $ntrans;
+    close(OFF);
+
+    close(LIST);
+
+
+    # Output further part of the configuration file, indicating whether or not
+    # transition information sd GD or GI, that is, whether or not there are 
+    # multiple transition matrix sets, one for each "gender".
+    open(CFG, ">>$outdir/fxconfig.bin" ) or die "Can not open fxconfig.bin\n";
+    print CFG pack $ptype, ($gdtrans ? 1 : 0 );
+    close( CFG );
+
+    return @tranlist;
+}
+
+#----------------------------------------------------------------
+# output_trans
+
+# This is a helper function that outputs information about one HTK
+# transition structure to the codebook file.  Probabilities are 
+# output as logs in Q6.
+
+sub output_trans
+{
+    use strict;
+
+    # Arguments
+    my $mmfref = shift;
+    my $tranname = shift;
+    my $littleendian = shift;
+    local(*CB) = @_;
+
+    # Number of output shorts and type of output
+    my $size = 0;
+    my $ptype = $littleendian ? "v" : "n";
+
+
+    # Access the transition information
+    my $tranref = $mmfref->{TRANSP}{$tranname};
+    my $tranprob = $tranref->{MATRIX};
+
+    # Number of GMHMM states ( # HTK states - 1 )
+    print CB pack $ptype, $tranref->{SIZE} - 1;
+    $size++;
+
+    # Entry probabilities in Ln
+    foreach my $dst ( 1 .. $tranref->{SIZE}-2 )
+    {
+       my $logprob;
+       $logprob = $tranprob->[0][$dst];
+       $logprob = $logprob < 1E-5 ? -1E5 : log( $logprob );
+       $logprob = qtruncate( $logprob, 6, 16 );
+
+       print CB pack $ptype, $logprob;
+       $size++;
+    }
+
+    # Transition probabilities, emitting states to emitting plus ending state
+    # In Ln
+    foreach my $src ( 1 .. $tranref->{SIZE}-2 )
+    {
+       foreach my $dst ( 1 .. $tranref->{SIZE}-1 )
+       {
+           my $logprob;
+           $logprob = $tranprob->[$src][$dst];
+           $logprob = $logprob < 1E-5 ? -1E5 : log($logprob);
+           $logprob = qtruncate( $logprob, 6, 16);
+
+           print CB pack $ptype, $logprob;
+           $size++;
+       }
+    }
+
+    return $size;
+}
+
+
+#----------------------------------------------------------------
+# qtruncate
+
+# Helper function that converts a number or an array of numbers
+# specified by a reference, to given signed fixed Q point numbers and
+# truncates to a number of bits.  The number of bits must be greater
+# than one.
+
+sub qtruncate
+{
+    use strict;
+
+    #Arguments
+    # $data is either a number or a reference to an array of numbers
+    my $data = shift;
+    my $qpoint = shift;
+    my $bits = shift;
+
+
+    # Min and max values for signed binary truncation
+    my $min = -( 2**($bits-1) );
+    my $max = -$min - 1;
+
+    my $qmult = 2**$qpoint;
+
+
+    my $number;
+    my @anumbers;
+    if( ref($data) eq "ARRAY" )
+    {
+       @anumbers= @{$data};
+    }
+    else
+    {
+       $anumbers[0] = $data;
+    }
+
+    foreach $number (@anumbers)
+    {      
+       $number *= $qmult;
+
+       # Round number to nearest integer
+       $number +=  ( $number > 0 )  ?  0.5  : -0.5;
+       $number = int  $number;
+
+       $number = $min if $number < $min;
+       $number = $max if $number > $max;
+    }
+       
+    return wantarray ? @anumbers : $anumbers[0];
+}
+
+
+#----------------------------------------------------------------
+# create_pdf_cb
+
+# This subroutine creates the fixed point PDF (cluster) codebook and
+# the mean, variance, and gconst codebooks.  This will also output a
+# file containing a list of all of the cluster macros so you can
+# observe their sequence in the organization of the codebook.
+
+sub create_pdf_cb
+{
+    use strict;
+
+    # Input arguments
+    my $mmfref = shift;
+    my $genders  = shift;
+    my $outdir = shift;
+    my $features = shift;
+    my $bytemean = shift;
+    my $bytevar = shift;
+    my $littleendian = shift;
+    my $skipbias = shift;
+    my $clusterwgt = shift;
+    my $bytewgt = shift;
+
+    # Pack types for printing long and short
+    my $plong = $littleendian ? "V" : "N";
+    my $pshort = $littleendian ? "v" : "n";
+
+    # PDF names used in triphones
+    my( %pdfhash ) = ();
+
+    # This holds the mean and variance vector components
+    my( @meanvectors ) = ();
+    my( @varvectors ) = ();
+    
+    # Determine the output features desired
+    die "Can only handle one stream\n"
+       unless $mmfref->{STREAMINFO}{SIZE} == 1;
+
+    my $vecsize = $mmfref->{STREAMINFO}{VECTOR}[0];
+    
+
+    # Determine if mean vectors are CMN
+    my $cmnmeans = ( $mmfref->{PARMKIND} =~ /_Z/ );
+    
+    # Output mean vectors are cmn if input is cmn and 
+    # no bias is added
+    my $cmnoutput = ( $cmnmeans and $skipbias );
+
+    my $subvectors = 1;
+    my $havedelta = 0;
+    my $haveacc = 0;
+    if( $mmfref->{PARMKIND} =~ /_D/ )
+    {
+       $subvectors++;
+       $havedelta = 1;
+    }
+    if( $mmfref->{PARMKIND} =~ /_A/ )
+    {
+       $subvectors++;
+       $haveacc = 1;
+    }
+
+    my $featsize = $vecsize/$subvectors;
+
+    $features = $featsize unless defined $features;
+
+    die "Feature dimension requested too large\n"
+       unless $features <= $featsize;
+
+    my @featselect = ();
+    push @featselect, (0 .. $features-1);
+    push @featselect, ( $featsize .. $featsize+$features-1) if $subvectors >= 2;
+    push @featselect, ( 2*$featsize .. 2*$featsize+$features-1) if $subvectors >= 3;
+
+
+    # If a gender string is defined, then determine genders needed
+    my(@genderlist);
+    my($genderre);
+    if( $genders )
+    {
+       @genderlist = sort split( /\s+|\s*,\s*/ , $genders);
+       $genderre = join '|', @genderlist ;
+    }
+    else
+    {
+       $genderre = "";
+    }
+
+    # Find all (tri)phone PDFs used in model set
+    foreach my $hmmname ( keys %{$mmfref->{HMM}}  )
+    {
+       # Only consider (tri)phones but not sil or sp
+       if ( ($hmmname =~ /^\S+-(\S+)\+\S+$/) or
+            ($hmmname !~ /^(sil|sp)($genderre)?$/) )
+       {
+           my $hmmref = $mmfref->{HMM}{$hmmname};
+           my $nstates = $hmmref->{NUMSTATES};
+           foreach my $state (0 .. $nstates-3)
+           {
+               my $pdfname = $hmmref->{STATE}[$state];
+
+               # If genders specified, check state macro names are GD
+               if( $genderre )
+               {
+                   warn "No gender in state macro name $pdfname\n"
+                       unless $pdfname =~ /($genderre)/;
+               }
+
+               $pdfhash{$pdfname} = 0;
+           }
+       }
+    }
+
+    # List of pdf macro tag names sorted in alphabetic order for output
+    my @pdflist = sort keys %pdfhash;
+
+
+    # Add silence PDF state macro tag names at end of the pdflist
+    {
+       my $hmmref = $mmfref->{HMM}{"sil"};
+       my $nstates = $hmmref->{NUMSTATES};
+       foreach my $state (0 .. $nstates-3)
+       {
+           my $pdfname = $hmmref->{STATE}[$state];
+           push @pdflist, $pdfname unless exists $pdfhash{$pdfname};
+           $pdfhash{$pdfname} = 0;
+       }
+    }
+    
+
+    # If weight clustering requested, cluster the weights of each pdf
+    # and return an array of the weight index of each pdf. This is stored 
+    # in %pdfhash.
+    if( defined $clusterwgt )
+    {
+       my @pdfclusteridx;
+       @pdfclusteridx = cluster_weights( $mmfref, \@pdflist, $clusterwgt,
+                                         $outdir, $littleendian, $bytewgt );
+       @pdfhash{@pdflist} = @pdfclusteridx;
+    }
+
+
+    # Open the pdf cluster and offset files, and cluster list file
+    open(CCB, ">${outdir}/fxclust.cb" ) or die "Can not open fxclust.cb\n";
+    open(OFF, ">${outdir}/fxclust.off" ) or die "Can not open fxclust.off\n";
+    open(LIST, ">${outdir}/fxclust.list" ) or die "Can not open fxclust.list\n";
+
+    # Dummy sizes to start
+    print CCB  pack $plong, 0;
+    print OFF  pack $plong, 0;
+
+    my $offset = 0;
+    my $npdf = 0;
+    my $nmean = 0;
+    my $nvar = 0;
+
+
+    my $pdfsize;
+    # Output the data for each state
+    foreach my $state (@pdflist)
+    {
+       print LIST "$state\n";
+
+       $pdfsize = 0;
+
+       # reference to state hash information for this state
+       my $stateref = $mmfref->{STATE}{$state};
+
+       # Assign index for this pdf
+       $stateref->{INDEX} = $npdf++;
+
+       # Number of Gaussian mixture components for this state PDF
+       my $nmixes = $stateref->{NUMMIXES}[0];  
+       
+       # Output pdf num mixture and weight index if clustering weights
+       if( $clusterwgt )
+       {
+           if( $bytewgt )
+           {
+               die "Too many mixtures in pdf $state\n" if $nmixes > 255;
+               die "Too many clusters in pdf $state\n" if $pdfhash{$state} > 255;
+               my $clustandmix = ( $pdfhash{$state} << 8 ) + ( $nmixes & 0xff );
+               print CCB pack $pshort, $clustandmix;
+               $pdfsize++;
+           }
+           else
+           {
+               print CCB pack $pshort, $nmixes;
+               print CCB pack $pshort, $pdfhash{$state};
+               $pdfsize += 2;
+           }
+       }
+
+       else
+       {
+           print CCB pack $pshort, $nmixes;
+           $pdfsize++;
+       }
+
+       # Sort mixes by probability
+       my @mixprob = ();
+       foreach my $mix (0 .. $nmixes-1)
+       {
+           $mixprob[$mix] = $stateref->{STREAMMIX}[0][$mix]{PROB};
+       }
+       my @sortedmixes = sort { $mixprob[$a] <=> $mixprob[$b] } (0 .. $nmixes-1);
+           
+       
+       # Output information for each mixture component of this PDF by
+       # probability from lower to higher. This is required by 
+       # clustered weights.
+       foreach my $mix ( @sortedmixes )
+       {
+           if( ! $clusterwgt )
+           {
+               # Output log probability of mixture component
+               my $logprob = $mixprob[$mix];
+               $logprob = $logprob < 1E-5 ? -1E5 : log( $logprob );
+               $logprob = qtruncate( $logprob, 6, 16 );
+               print CCB pack $pshort, $logprob;
+               $pdfsize++;
+           }
+
+           # Mixture component macro tag name and reference
+           my $mixname = $stateref->{STREAMMIX}[0][$mix]{MIXPDF};
+           my $mixref = $mmfref->{MIXPDF}{$mixname};
+
+           # Output index of mean component
+           # Assign index and save mean vector if no index for this mean yet
+           my $meanname = $mixref->{MEAN};
+           my $meanref = $mmfref->{MEAN}{$meanname};
+           if( ! exists $meanref->{INDEX} )
+           {
+               $meanref->{INDEX} = $nmean++;
+               push @meanvectors, @{ $meanref->{VECTOR} }[@featselect];
+           }
+           print CCB pack $pshort, $meanref->{INDEX};
+           $pdfsize++;
+
+
+           # Output index of variance component
+           my $varname = $mixref->{VARIANCE};
+           my $varref = $mmfref->{VARIANCE}{$varname};
+           if( ! exists $varref->{INDEX} )
+           {
+               die "Can only handle variance vectors\n"
+                   unless $varref->{TYPE} eq "v";
+
+               $varref->{INDEX} = $nvar++;
+               push @varvectors, @{ $varref->{VECTOR} }[@featselect];
+           }
+           print CCB pack $pshort, $varref->{INDEX};
+           $pdfsize++;
+       }
+
+       # Offset is now dynamically calculated in TIesrFlex API
+       # print OFF pack $plong, $offset;
+       $offset += $pdfsize;
+    }
+
+
+    seek CCB, 0 , 0;
+    print CCB pack $plong, $offset;
+    close(CCB);
+
+    seek OFF, 0, 0;
+    print OFF pack $plong, $npdf;
+    close(OFF);
+
+
+    # Output mean codebook
+    my @meanshift = output_mean( \@meanvectors, $features, 
+                                $havedelta, $haveacc,
+                                $nmean, $bytemean, 
+                                $littleendian, $skipbias, $outdir );
+
+
+    # Output variance codebook and gconst codebook
+    my @varshift = output_var( \@varvectors, $features, 
+                              $havedelta, $haveacc,
+                              $nvar, $bytevar, 
+                              $littleendian, $outdir );
+
+    
+    # Output scales if byte features output
+    if( $bytemean || $bytevar )
+    {
+       open(SCA, ">$outdir/scale.bin" ) or die "Can not open scale.bin\n";
+       print SCA pack "${pshort}*", @meanshift;
+       print SCA pack "${pshort}*", @varshift;
+       close(SCA);
+    }
+
+
+
+    # Output first portion of the configuration file
+    open(CFG, ">$outdir/fxconfig.bin" ) or die "Can not open fxconfig.bin\n";
+    # mfcc vector size in number of elements
+    print CFG pack $plong, $features*$subvectors;
+    # size of static portion of mfcc vector
+    print CFG pack $plong, $features;
+    # boolean flag indicating if feature means output as bytes
+    print CFG pack $plong, ( $bytemean ?  1 : 0 );
+    # boolean flag indicating if feature vars output as bytes
+    print CFG pack $plong, ( $bytevar ?  1 : 0 );
+    # boolean flag indicating if static mfcc vector is mean normalized
+    print CFG pack $plong, ( $cmnoutput ?  1 : 0 );
+    # boolean flag indicating output data is in little endian format
+    print CFG pack $plong, ( $littleendian ?  1 : 0 );
+    # number of "gender" hmm model sets 
+    print CFG pack $plong, ( $genders ?  scalar(@genderlist) : 1 );
+    close( CFG );
+    
+    return @pdflist;
+}
+
+
+#----------------------------------------------------------------
+# output_mean
+
+# This subroutine outputs the mean vectors to the mean codebook
+
+sub output_mean
+{
+    use strict;
+
+    # Arguments
+    my $meansref = shift;
+    my $features = shift;
+    my $havedelta = shift;
+    my $haveacc = shift;
+    my $nmean = shift;
+    my $bytefeatures = shift;
+    my $littleendian = shift;
+    my $skipbias = shift;
+    my $outdir = shift;
+
+
+    die "Vector size exceeds scale size\n"
+       if $features > scalar( @main::MU_SCALE_STATIC );
+
+    # Output element type
+    my $plong = $littleendian ? "V" : "N";
+    my $pshort =  $littleendian ? "v" : "n";
+    my $ptype = $bytefeatures ? "c" : $pshort;
+
+
+    # Open the output file, and initialize number of mean vectors
+    open( MCB, ">$outdir/fxmean.cb") or die "Can not open mean CB\n";
+    print MCB pack $plong, $nmean;
+
+    # Feature configuration determining vector size and delta/acc available
+    my $numfeats = $features;
+    my $delta = 0;
+    my $acc = 0;
+    if( $havedelta )
+    {
+       $delta = $features;
+       $numfeats += $features;
+    }
+    if( $haveacc )
+    {
+       $acc = $delta + $features;
+       $numfeats += $features;
+    }
+
+    # Initialize maximum absolute values of each feature
+    # and shift value for use if byte features
+    my @absmax = (0) x $numfeats;
+    my @max_shift = (0) x $numfeats;
+    
+    # Process each mean vector
+    foreach my $mindex (0 .. $nmean-1)
+    {
+       my $startix = $mindex*$numfeats;
+       my $endix = $startix + $numfeats -1;
+       my @meanvec =  @{$meansref}[$startix .. $endix];
+
+       # Scale the mean vector according to global values of scaling
+       for( my $feat = 0; $feat < $features; $feat++ )
+       {
+           $meanvec[$feat] /= $main::MU_SCALE_STATIC[$feat];
+
+           $meanvec[$delta+$feat] /= $main::MU_SCALE_DYNAMIC[$feat] 
+               if $havedelta;
+
+           $meanvec[$acc+$feat] /= $main::MU_SCALE_ACC[$feat] 
+               if $haveacc;
+       }
+
+       # Convert to fixed point shorts
+       @meanvec = qtruncate( \@meanvec, 11, 16 );
+
+
+       # Add bias to static vector elements, and limit
+       unless( $skipbias )
+       {
+           for( my $feat=0; $feat < $features; $feat++ )
+           {
+               $meanvec[$feat] += $main::MU_BIAS[$feat];
+           }
+           @meanvec = qtruncate( \@meanvec, 0, 16);
+       }
+
+
+       # If doing byte features, then find maximum magnitude features
+       if( $bytefeatures )
+       {
+           # Find maximum absolute value of each feature
+           for( my $el=0; $el < $numfeats; $el++ )
+           {
+               my $absval = abs( $meanvec[$el] );
+               $absmax[$el]  = $absval if $absval > $absmax[$el];
+           }
+       }
+           
+       # Put scaled fixed point vector back into meansref
+       @{$meansref}[$startix .. $endix] = @meanvec;
+    }
+    
+    # Output means immediately if conversion to byte not necessary
+    if( ! $bytefeatures )
+    {
+       print MCB pack "${ptype}*", @{$meansref};
+       close( MCB );
+       return @max_shift;
+    }
+
+    # Conversion of mean vector to bytes needed 
+    
+
+    # Scaling factors
+    my $ix = 0;
+    foreach my $amax (@absmax)
+    {
+       $max_shift[$ix] = 0;
+       while( $amax < 0x4000 )
+       {
+           $amax *= 2;
+           $max_shift[$ix]++;
+       }
+       $ix++;
+    }
+
+    foreach my $mindex (0 .. $nmean-1)
+    {
+       my $startix = $mindex*$numfeats;
+       my $endix = $startix + $numfeats -1;
+       my @meanvec =  @{$meansref}[$startix .. $endix];
+
+       # Convert to byte elements
+       @meanvec = tobyte( \@meanvec, \@max_shift );
+
+       # Output to file
+       print MCB pack "${ptype}*", @meanvec;
+    }
+
+    close(MCB);
+
+    return @max_shift;
+}
+       
+
+#----------------------------------------------------------------
+# tobyte
+
+# This subroutine implements converting a 16 bit integer value to
+# a byte value for a scalar or array
+
+sub tobyte
+{
+    use strict;
+
+    # Arguments
+    my $data = shift;
+    my $max_shift = shift;
+    
+    my $shbyte = 2**8;
+
+    my @data;
+    my @sh;
+    if( ref($data) eq "ARRAY" and ref($max_shift) eq "ARRAY" )
+    {
+       # If input is references to arrays, store array data locally
+       @data = @{$data};
+       @sh = @{$max_shift};
+    }
+    else
+    {
+       # Otherwise data is scalar, store as one element array
+       $data[0] = $data;
+       $sh[0] = $max_shift;
+    }
+
+    foreach my $ix (0 .. $#data)
+    {
+       my $sign = 0;
+       
+       # Work with positive numbers
+       if( $data[$ix] < 0 )
+       {
+           $data[$ix] = -$data[$ix];
+           $sign = 1;
+       }
+       
+       # Shift data so that it is maximum representable in 8 bits
+       $data[$ix] *= (2**$sh[$ix]);
+
+       # Round top byte
+       $data[$ix] += 0x80 if $data[$ix] < 0x7f00;
+
+       # shift to form number represented in single byte
+       $data[$ix]  = int ( $data[$ix]/$shbyte );
+
+       $data[$ix] = -$data[$ix] if $sign;
+    }
+
+    return  wantarray ? @data : $data[0];
+}
+
+
+#----------------------------------------------------------------
+# output_var
+
+# This subroutine outputs the variance vectors to the variance codebook,
+# and outputs the gconst codebook.
+
+sub output_var
+{
+    use strict;
+
+    # Arguments
+    my $varsref = shift;
+    my $features = shift;
+    my $havedelta = shift;
+    my $haveacc = shift;
+    my $nvar = shift;
+    my $bytefeatures = shift;
+    my $littleendian = shift;
+    my $outdir = shift;
+
+
+    my $ln2pi = log( 2*3.1415926);
+
+
+    die "Vector size exceeds scale size\n"
+       if $features > scalar( @main::MU_SCALE_STATIC );
+
+    # Output element type
+    my $plong = $littleendian ? "V" : "N";
+    my $pshort = $littleendian ? "v" : "n";
+    my $ptype = $bytefeatures ? "c" : $pshort;
+
+
+    # Open the codebook file, and initialize number of mean vectors
+    open( VCB, ">$outdir/fxvar.cb") or die "Can not open fxvar.cb\n";
+    print VCB pack $plong, $nvar;
+
+    # Open gconst file, and initialize number of elements
+    open( GCB, ">$outdir/fxgconst.cb") or die "Can not open fxgconst.cb\n";
+    print GCB pack $plong, $nvar;
+
+
+    # Feature configuration determining vector size and delta/acc available
+    my $numfeats = $features;
+    my $delta = 0;
+    my $acc = 0;
+    if( $havedelta )
+    {
+       $delta = $features;
+       $numfeats += $features;
+    }
+    if( $haveacc )
+    {
+       $acc = $delta + $features;
+       $numfeats += $features;
+    }
+
+    # For finding maximum values if byte features;
+    my @absmax = (0) x $numfeats;
+    my @max_shift = (0) x $numfeats;
+
+    # Process each variance vector
+    foreach my $vindex (0 .. $nvar-1)
+    {
+       my $startix = $vindex*$numfeats;
+       my $endix = $startix + $numfeats -1;
+       my @varvec =  @{$varsref}[$startix .. $endix];
+
+
+       # Output gconst value prior to conversion and scaling
+       my $gconst = $ln2pi*$numfeats;
+       foreach my $var (@varvec)
+       {
+           $gconst += log( $var );
+       }
+       $gconst = qtruncate( $gconst, 6, 16 );
+       print GCB pack $pshort, $gconst;
+
+
+       # Scale the variance vector into an inverse variance vector
+       # according to global values of scaling
+       for( my $feat = 0; $feat < $features; $feat++ )
+       {
+           my $norm = $main::MU_SCALE_STATIC[$feat];
+           $varvec[$feat] = ($norm*$norm)/$varvec[$feat];
+
+           if( $havedelta )
+           {
+               $norm = $main::MU_SCALE_DYNAMIC[$feat];
+               $varvec[$delta+$feat] = ($norm*$norm)/$varvec[$delta+$feat];
+           }
+
+           if( $haveacc )
+           {
+               $norm = $main::MU_SCALE_ACC[$feat];
+               $varvec[$acc+$feat] = ($norm*$norm)/$varvec[$acc+$feat];
+           }
+       }
+
+       # Convert to fixed point Q9 shorts
+       @varvec = qtruncate( \@varvec, 9, 16 );
+
+
+       # If doing byte features, then 
+       if( $bytefeatures )
+       {
+           # Find maximum absolute value of each feature
+           for( my $el=0; $el < $numfeats; $el++ )
+           {
+               my $absval = abs( $varvec[$el] );
+               $absmax[$el]  = $absval if $absval > $absmax[$el];
+           }
+       }
+           
+       # Put scaled fixed point vector back into varsref
+       @{$varsref}[$startix .. $endix] = @varvec;
+    }
+    
+
+    # Finished with gconst codebook
+    close( GCB );
+
+
+    # Output inverse variances immediately if conversion to byte not necessary
+    if( ! $bytefeatures )
+    {
+       print VCB pack "${ptype}*", @{$varsref};
+       close( VCB );
+       return @max_shift;
+    }
+
+    # Conversion of mean vector to bytes needed 
+    
+
+    # Scaling factors
+    my $ix = 0;
+    foreach my $amax (@absmax)
+    {
+       $max_shift[$ix] = 0;
+       while( $amax < 0x4000 )
+       {
+           $amax *= 2;
+           $max_shift[$ix]++;
+       }
+       $ix++;
+    }
+
+
+    foreach my $vindex (0 .. $nvar-1)
+    {
+       my $startix = $vindex*$numfeats;
+       my $endix = $startix + $numfeats -1;
+       my @varvec =  @{$varsref}[$startix .. $endix];
+
+       # Convert to byte elements
+       @varvec = tobyte( \@varvec, \@max_shift );
+
+       # Output to file
+       print VCB pack "${ptype}*", @varvec;
+    }
+
+    close(VCB);
+
+    return @max_shift;
+}
+
+
+#----------------------------------------------------------------
+# create_sil_hmm
+
+# This subroutine simply outputs the information required for the 
+# silence hmm.  This information has already been encoded in the
+# parsed mmf structure information.
+
+sub create_sil_hmm
+{
+    use strict;
+
+    # Arguments
+    my $mmfref = shift;
+    my $outdir = shift;
+    my $littleendian = shift;
+
+    # Output pack type
+    my $pshort = $littleendian ? "v" : "n";
+
+
+    open( SIL, ">$outdir/fxsil.hmm" ) or die "Can not open fxsil.hmm\n";
+
+    my $silref = $mmfref->{HMM}{"sil"};
+    my $nstates = $silref->{NUMSTATES};
+
+    # Output number of GMHMM states
+    print SIL pack $pshort, $nstates-1;
+
+    foreach my $state (0 .. $nstates-3)
+    {
+       my $statename = $silref->{STATE}[$state];
+       my $stateref = $mmfref->{STATE}{$statename};
+       print SIL pack $pshort, $stateref->{INDEX};
+    }
+
+    my $tranname = $silref->{TRANSP};
+    my $tranref = $mmfref->{TRANSP}{$tranname};
+    print SIL pack $pshort, $tranref->{INDEX};
+
+    close(SIL);
+}
+
+
+#-----------------------------------------------------------------
+# cluster_weights
+
+# Cluster the mixture weights of each pdf. That way instead of storing
+# all weights for all pdfs, only the weight vector index needs to be
+# stored in fxclust.cb.
+# ----------------------------------------------------------------------- 
+sub cluster_weights
+{
+    use strict;
+
+    my $mmfref = shift;
+    my $pdfref = shift;
+    my $clusterwgt = shift;
+    my $outdir = shift;
+    my $littleendian = shift;
+
+    my %pdfwgtindex;
+    my $state;
+    my $pdfindex = 0;
+    my @weightvecs;
+    my @pdfindices;
+    my $nummixes;
+    my %numvectors;
+    my $maxmixes = 0;
+    my @pdfclusterindex;
+
+    # Pack types for printing long and short
+    my $plong = $littleendian ? "V" : "N";
+    my $pshort = $littleendian ? "v" : "n";
+
+
+    # Gather the weight vectors for each pdf into arrays of weights categorized
+    # by number of mixtures in the pdfs
+    foreach $state ( @{$pdfref} )
+    {
+       # Determine the number of mixtures in the pdf for
+       # only the first stream. Not handling multiple streams.
+       $nummixes = $mmfref->{STATE}{$state}{NUMMIXES}[0];
+       $numvectors{$nummixes} = 0 if ! exists $numvectors{$nummixes};
+       $maxmixes = $nummixes if $nummixes > $maxmixes;
+       
+       # Get the weight vector, sorted from lower to higher probability
+       my @wgt = ();
+       for( my $mix = 0; $mix < $nummixes; $mix++ )
+       {
+           $wgt[$mix] =  $mmfref->{STATE}{$state}{STREAMMIX}[0][$mix]{PROB};
+       }
+       @wgt = sort { $a <=> $b } @wgt;
+       
+       # Store the weight vector categorized by mixture size,
+       # and keep track of pdf indices used
+       push @{$pdfindices[$nummixes]}, $pdfindex;
+       $weightvecs[ $nummixes ]->[ $numvectors{$nummixes}++ ] = [ @wgt ] ;
+
+       $pdfindex++;
+
+    }
+
+    # Open the weight cluster file
+    open( WCB, ">${outdir}/fxweight.cb" ) or 
+       die "Can not open ${outdir}/fxweight.cb\n";
+
+    # Write dummy number of weight values, and vector size
+    print WCB pack $plong, 0;
+    print WCB pack $pshort, $maxmixes;
+    
+    # Loop to cluster the weight vectors categorized by mixture size
+    my $numclusters = 0;
+    foreach $nummixes ( sort {$a <=> $b } keys %numvectors )
+    {
+       # Special case for only one mixture, no clustering 
+       # necessary
+       if( $nummixes == 1 )
+       {
+           # VQ weight vector for one mixture is all zeros
+           print WCB pack "${pshort}*", (0) x $maxmixes;
+           
+           # All pdf's with only one mixture use the first VQ weight vector
+           foreach my $index ( @{$pdfindices[$nummixes]} )
+           {
+               $pdfclusterindex[$index] = 0;
+           }
+
+           $numclusters++;
+           next;
+       }
+
+
+       # Determine number of clusters requested
+       my $numcl;
+       if ( $clusterwgt >= 1 )
+       {
+           $numcl = int $clusterwgt;
+           $numcl =  ( $numvectors{$nummixes} < $numcl ) ?
+               $numvectors{$nummixes} : $numcl;
+       }
+       elsif ( $clusterwgt > 0 && $clusterwgt < 1 )
+       {
+           $numcl = int ( $clusterwgt * $numvectors{$nummixes} + 0.5 );
+           $numcl = 1 if $numcl < 1;
+       }
+       else
+       {
+           die "Invalid clusterwgt value\n";
+       }
+
+
+       # Cluster all weight vectors of size $nummixes
+       my %params = ();
+       %params = ( 'nclusters' => $numcl,
+                   'data' => $weightvecs[$nummixes],
+                   'mask' => '',
+                   'weight' => '',
+                   'transpose' => 0,
+                   'npass' => 5,
+                   'method' => 'a',
+                   'dist' => 'e'
+                   );
+       
+
+       my ($clusters, $error, $nfound) = Algorithm::Cluster::kcluster(%params);
+       
+       scalar( @{$clusters} ) == $numvectors{$nummixes} or
+           die "Cluster count mismatch for vector size $nummixes\n";
+
+       # Map the cluster indices to the pdfs. Indices are offset by number
+       # of already existing clusters
+       for( my $index = 0; $index < $numvectors{$nummixes}; $index++ )
+       {
+           $pdfindex = $pdfindices[$nummixes][$index];
+
+           $pdfclusterindex[$pdfindex] = $clusters->[$index] + $numclusters;
+       }
+
+
+       # Find and output the cluster centroids for this number of mixes
+       %params = ();
+       %params = ( 'data' => $weightvecs[$nummixes],
+                   'mask' => '',
+                   'clusterid' => $clusters,
+                   'method' => 'a',
+                   'transpose' => 0 );
+
+       my ($vqvectors, $vqmask) = Algorithm::Cluster::clustercentroids( %params );
+
+       # Normalize all vq centroids so they sum to one, and convert to 
+       # integer log, and output the weight centroids in log probability form.
+       # They should already be normalized, since the centroids are currently
+       # found by arithmetic averaging.
+       foreach my $vqref ( @{$vqvectors} )
+       {
+           my $probsum = 0;
+           foreach my $prob ( @{$vqref} )
+           {
+               $probsum += $prob;
+           }
+
+           foreach my $prb ( @{$vqref} )
+           {
+               $prb /= $probsum;
+               $prb =  ($prb < 1E-5) ?  -1E5 : log( $prb );
+               $prb = qtruncate( $prb, 6, 16 );
+           }
+
+           # Output centroid vectors, padding to length of maxmixes
+           print WCB pack "${pshort}*", @{$vqref};
+           print WCB pack "${pshort}*", (0) x ($maxmixes - $nummixes) 
+               if $maxmixes > $nummixes;
+       }
+
+
+       # Increment cluster count by number of clusters for this 
+       # number of mixture components
+       $numclusters += $numcl;
+    }
+
+    # Output number of cluster weight values
+    seek WCB, 0, 0;
+    print WCB pack $plong, $numclusters*$maxmixes;
+    close( WCB );
+
+    return @pdfclusterindex;
+}
diff --git a/TIesr_Tools/htk_model_compare.pl b/TIesr_Tools/htk_model_compare.pl
new file mode 100755 (executable)
index 0000000..9eb9c8f
--- /dev/null
@@ -0,0 +1,507 @@
+#!/usr/local/bin/perl
+#---------------------------------------------------------------- 
+#  htk_model_compare.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+htk_model_compare [-Help] -H mmf_file [-l model_list] [-n] [-w workdir] [ -s] -o out_file [model ...]";
+
+
+$DOCUMENTATION = " 
+
+This perl script is used to compare the acoustic match of a list of
+models in a set of HTK MMF files.  This is done by successively using
+each model in the list as the recognition model, and using the mean
+vector data of each model as the input data to recognize.  A
+list of likelihood scores is output to show comparison of each
+recognition model with all model's state feature vectors.
+
+Since model states may contain multiple Gaussian components, there are
+two methods by which the model state mean vectors are used to generate
+features.  Either the vector with the highest weight is used
+(default), or the -n option can be used to form a mean vector by
+weighting all of the means by their weights.
+
+The user must specify the HTK MMF files in multiple -H options.
+Further, the user must supply a list of HMMs to compare.  This listing
+may be in a list file specified by the -l option, or on the command
+line.  Usually one method or the other should be used.  If both -l and
+command line model names are supplied, the command line names will
+follow at the end of the list model names. The order of the models
+input in the list or/and command line is the order of the likelihood
+scoring of models that will be output.
+
+The user should supply a unique working directory to use for this
+script, since the script generates quite a few working files.  The
+default is to use the present working directory.  The output file is
+not relative to the specified working directory.  Upon successful
+creation of the scoring list, all working directory files will be
+removed.
+
+-Help : Output this help info.
+-H : HTK MMF file.  This option may be repeated.
+-l : File list of models to compare
+-n : Normalize vectors by a sum of weighted means of state Gaussian mean components.
+-o : Output file
+-w : Working directory, default none.
+-s : use only HMM static parameters as input data. 
+";
+
+#----------------------------------------------------------------
+
+use Getopt::Long;
+
+use HTKdata;
+
+# Global variables used in the script
+
+# configuration file 
+
+GetOptions( 'H=s@' => \@mmffiles,
+            'Help' => \$outdoc,
+            'l=s' => \$modlist,
+            'n'   => \$normalize,
+            'o=s' => \$outfile,
+            'w=s' => \$workdir,
+            's' => \$staticfeats
+           );
+
+
+if( $outdoc )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+
+if( !defined $mmffiles[0] or ! defined $outfile )
+{
+    print "$USAGE\n";
+    exit 1;
+}
+
+if( defined $workdir )
+{
+    if( ! -d $workdir )
+    {
+       mkdir $workdir, 0770 or die "Could not make working directory\n";
+    }
+
+    $workdir .= "/" if( $workdir !~ /\/$/ );
+}
+else
+{
+    $workdir="";
+}
+
+$CONFIGFILE = "${workdir}HTKCONFIG$$.config";
+$SCRIPTFILE = "${workdir}HTKSCRIPT$$.scp";
+$RECFILE = "${workdir}HTKREC$$.mlf";
+$GRAMFILE = "${workdir}HTKGRAM$$.grm";
+$NETFILE = "${workdir}HTKNET$$.net";
+$HMMFILE = "${workdir}HTKHMMS$$.lst";
+$DICTFILE = "${workdir}HTKDICT$$.dict";
+
+
+# make a list of hmms to compare
+@hmmnames = ();
+
+if( defined $modlist )
+{
+    open( LST, "$modlist") or die "Invalid list of models $modlist\n";
+
+    while( $lin = <LST> )
+    {
+        chomp($lin);
+        push @hmmnames,  split( " ", $lin );
+    }
+
+    close( LST );
+}
+
+# Add command line names to the list
+if( @ARGV && length(@ARGV) > 0 )
+{
+    push @hmmnames, @ARGV;
+}
+
+
+# Make a listing file of the names
+open LST, ">$HMMFILE" or die "Failed to open hmm listing output\n";
+foreach $name (@hmmnames)
+{
+    print LST "$name\n";
+}
+close LST;
+
+# Make a dictionary, which is just the hmm names
+open DICT, ">$DICTFILE" or die "failed to open dict output\n";
+foreach $name ( sort @hmmnames )
+{
+    print DICT "$name [$name] $name\n";
+}
+close DICT;
+
+
+# Load in all MMF file data.  Create a new instance of 
+# an HTKdata object. $hmms is a reference to the object.
+$hmms = HTKdata->new();
+
+foreach $filename (@mmffiles)
+{
+    $hmms->parsemmf($filename, undef, @hmmnames );
+}
+
+
+die "Can not support multiple streams now\n" if $hmms->{STREAMINFO}{SIZE} != 1;
+
+
+
+# If there is a list, then check to ensure that all
+# hmms in the list are loaded
+if( @hmmnames )
+{
+    $hmms->checklist( @hmmnames );
+}
+
+
+# Mark the active data corresponding to the active models. 
+$mexpand = "";
+$hmms->markusagehmm( $mexpand );
+
+
+
+
+# Create a script file and all model data test files from the hmms
+ make_test_files();
+
+
+# Create an MMF copy and remove deltas if needed for static feature only analysis
+if( $staticfeats && $hmms->{PARMKIND} =~ /_D/ )
+{
+    @mmffiles = delete_deltas( @mmffiles );
+}
+
+
+# Make a list of MMF files for HVite command line
+foreach $mmf (@mmffiles )
+{
+    $mmfs .= "-H $mmf ";
+}
+
+# Prepare configuration file for comparison testing
+$config = $hmms->{PARMKIND};
+$config =~ s/_D// if $staticfeats;
+open( CFG, ">$CONFIGFILE" ) or die "Could not open config file\n";
+print CFG "TARGETKIND = $config\n";
+print CFG "NATURALREADORDER = T\n";
+close(CFG);
+
+
+# Loop over models, recognizing model "data"
+$firstmodel = 1;
+foreach $model (@hmmnames )
+{
+    # Create the supervision grammar, which is the model name
+    open  GRM, ">$GRAMFILE";
+    print GRM "( $model )\n";
+    close GRM;
+    
+    
+    `HParse $GRAMFILE $NETFILE`;
+
+    `HVite -i $RECFILE -o NT -w $NETFILE -S $SCRIPTFILE -C $CONFIGFILE $mmfs $DICTFILE $HMMFILE`;
+
+    # Output the scores for the model from the recognized mlf file
+    open REC, "<$RECFILE" or die "Recognition file for $model not generated\n";
+
+    # Open the output file
+    if( $firstmodel )
+    {
+       open OUT, ">$outfile" or die "Could not open $outfile\n";
+       $firstmodel = 0;
+    }
+    else
+    {
+       open OUT, ">>$outfile" or die "Could not open $outfile\n";
+    }
+    
+    # Keep track of model that should be recognized next
+    $recidx = 0;
+
+    # Find all recognized models
+    while( $line = <REC> )
+    {
+       chomp $line;
+       if( $line =~ /MODEL_(.*)$$/ )
+       {
+           $testmodel = $1;
+
+           # If some models skipped, they could not be recognized, set
+           # default score to -100.0
+           while( $testmodel ne $hmmnames[$recidx] )
+           {
+               print OUT "${hmmnames[$recidx]} rec as $model score: -100.0\n";
+               $recidx++;
+           }
+
+           # output recognized model score
+           $line = <REC>;
+           chomp $line;
+           $line =~ /${model}\s+([\S]+)/;
+           print OUT "$testmodel rec as $model score: $1\n";
+           $recidx++;
+       }
+    }
+       
+
+    # Set default score for any models not recognized by the end of the MLF file
+    while( $recidx <= $#hmmname )
+    {
+       print OUT "${hmmnames[$recidx]} rec as $model score: -100.0\n";
+       $recidx++;
+       
+    }
+
+
+    close REC;
+    close OUT;
+}
+
+# Remove all temp files 
+unlink $CONFIGFILE;
+unlink $SCRIPTFILE;
+unlink $RECFILE;
+unlink $GRAMFILE;
+unlink $NETFILE;
+unlink $HMMFILE;
+unlink $DICTFILE;
+unlink <${workdir}MODEL*.data>;
+unlink <${workdir}HTK*$$.*>;
+
+#----------------------------------------------------------------
+# make_test_files
+#
+# This sub creates test files for each model to be compared. It puts
+# the name of all the files in a scriptfile.
+#--------------------------------
+sub make_test_files
+{
+    open( SCP, ">$SCRIPTFILE" ) or die "Failed to open script file\n";
+    foreach $model (@hmmnames)
+    {
+
+       my $rhmm = $hmms->{HMM}{$model};
+       
+       my $datafile = "${workdir}MODEL_${model}$$.data";
+        
+
+        make_file( $rhmm, $datafile ) or die "Failed to make data for $model\n";
+
+       print SCP "$datafile\n";
+    }
+
+    close( SCP );
+}
+
+
+#----------------------------------------------------------------
+#  make file
+#
+#  This sub makes an HTK compatible data file from the state Gaussian vectors
+#  in a model
+#--------------------------------
+sub make_file
+{
+    my $rhmm = shift;
+    my $datafile = shift;
+
+    open( DATA, ">$datafile" ) or die "Could not open data file\n";
+
+
+    # Output the number of vectors in the data file
+    my $nstates = $rhmm->{NUMSTATES};
+    $nstates -= 2;
+    print DATA pack "i", $nstates;
+
+    #Output the sampPeriod, which is dummy
+    print DATA pack "i", 100;
+
+    # Output the number of bytes per sample - each sample is a 4 byte float
+    if( $staticfeats and $hmms->{PARMKIND} =~ /_D/ )
+    {
+       print DATA pack "s", 2*$hmms->{STREAMINFO}{VECTOR}[0];
+    }
+    else
+    {
+       print DATA pack "s", 4*$hmms->{STREAMINFO}{VECTOR}[0];
+    }
+
+    # Output the parameter kind code, which matches the input parameter code
+    my $pkind = $hmms->{PARMKIND};
+    $pkind =~ s/_D// if $staticfeats;
+
+    my $kindCode = get_parmkind_code( $pkind );
+    print DATA pack "S", $kindCode;
+
+    # Fetch all vectors for the model, and output the vector
+    my @vec;
+    for( $state = 0; $state < $nstates; $state++ )
+    {    
+       @vec = get_vector( $rhmm, $state, $normalize );
+       
+       @vec = @vec[0 .. scalar(@vec)/2 - 1] if $staticfeats and $hmms->{PARMKIND} =~ /_D/;
+       print DATA pack "f*", @vec;
+    }
+
+    close( DATA );
+}
+
+
+#----------------------------------------------------------------
+#   get_parmkind_code
+#
+
+#   This sub returns the integer value of the code for a parmKind text
+#   string, such as USER_D_Z.
+#--------------------------------
+sub get_parmkind_code
+{
+    my $kindString = shift;
+    my $kindCode = 0;
+
+    # Type array and hash
+    my @types = qw( WAVEFORM LPC LPCREFC LPCCEPSTRA LPDELCEP IREFC MFCC FBANK MELSPEC USER DISCRETE );
+    my %typehash;
+    @typehash{@types} = ( 0 .. $#types );
+
+    # Qualifier array and hash
+    my @qualifiers = qw( E N D A C Z K O );
+    my %qualhash;
+    @qualhash{@qualifiers} = ( 0100, 0200, 0400, 01000, 02000, 04000, 010000, 020000 );
+
+    # Determine the code for the type
+    $kindString =~ /^([a-zA-Z]+)_?/;
+    $kindCode = $typehash{$1};
+
+    # Set any qualifiers in the code
+    foreach $qual (@qualifiers)
+    {
+       if( $kindString =~ /^[a-zA-Z]+.*_${qual}/ )
+       {
+           $kindCode |= $qualhash{$qual};
+       }
+    }
+
+    return $kindCode;
+}
+
+
+
+#----------------------------------------------------------------
+# get_vector
+#
+# This sub gets a vector that represents the data from a state.
+# The vector is either the weighted sum of the Gaussian components,
+# or the maximum magnitude Gaussian component.
+#--------------------------------
+sub get_vector
+{
+    my $rhmm = shift;
+    my $state = shift;
+    my $normalize = shift;
+
+
+    # HMM state macro name
+    my $stmacro = $rhmm->{STATE}[$state];
+    my $rstate = $hmms->{STATE}{$stmacro};
+
+    # Number of mixtures for this state (only one stream allowed now)
+    my $nummix = $rstate->{NUMMIXES}[0];
+
+
+    my $mix;
+    my @vec;
+    my $maxprob = 0;
+
+    # Loop over all mixtures picking max or making weighted mean vector
+    for( $mix = 0; $mix < $nummix; $mix++ )
+    {
+       my $prob = $rstate->{STREAMMIX}[0][$mix]{PROB};
+       my $mixname = $rstate->{STREAMMIX}[0][$mix]{MIXPDF};
+       my $mnname = $hmms->{MIXPDF}{$mixname}{MEAN};
+       my $rmean = $hmms->{MEAN}{$mnname}{VECTOR};
+       my $vsize = $hmms->{MEAN}{$mnname}{SIZE};
+
+       my $el;
+       for( $el = 0; $el < $vsize; $el++ )
+       {
+           if( $normalize )
+           {
+               $vec[$el] += $prob * ${$rmean}[$el];
+           }
+           else
+           {
+               if( $mix == 0 )
+               {
+                   $vec[$el] = ${$rmean}[$el];
+               }
+               elsif( $prob > $lastprob )
+               {
+                   $vec[$el] = ${$rmean}[$el];
+               }
+
+           }
+       }
+
+       $lastprob = $prob;
+    }
+
+    return @vec;
+}
+
+
+#------------------------------------------------------------
+# delete_deltas
+
+# Delete deltas from HMM files if the comparison will only 
+# compare static features.
+#----------------------------
+sub delete_deltas
+{
+    my @mmffiles = @_;
+
+
+    # Create list of MMF files for removing deltas
+    my $mmf;
+    my ( $mmf, $mmfs );
+    foreach $mmf (@mmffiles )
+    {
+       $mmfs .= "-H $mmf ";
+    }
+
+    # New parameter kind omitting deltas
+    my $skind = $hmms->{PARMKIND};
+    $skind =~ s/_D//;
+
+
+    my $vecsize = $hmms->{STREAMINFO}{VECTOR}[0] / 2;
+
+    # HHEd command to remove deltas
+    my $HHEDFILE = $workdir . "HTKHED$$.hed";
+    open( HHED, ">$HHEDFILE" ) or die "$0 : Could not open $HHEDFILE\n";
+    print HHED "SW 1 ${vecsize}\n";
+    print HHED "SK ${skind}\n";
+    close( HHED );
+
+    # Create new MMF file with deltas removed
+    my $MMFFILE = $workdir . "HTKMMF$$.mmf";
+    `HHEd -w $MMFFILE $mmfs $HHEDFILE $HMMFILE`;
+
+    return ($MMFFILE);
+}
+    
diff --git a/TIesr_Tools/htk_trees_to_tiesr.pl b/TIesr_Tools/htk_trees_to_tiesr.pl
new file mode 100755 (executable)
index 0000000..d706091
--- /dev/null
@@ -0,0 +1,605 @@
+#!/usr/local/bin/perl
+#---------------------------------------------------------------- 
+#  htk_trees_to_tiesr.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+htk_trees_to_tiesr [-Help] -T treefile -C clusterdir  [-g genders] -le -d outdir";
+
+
+$DOCUMENTATION = " 
+
+This perl script is used to interface with an ASCII HTK Tree cluster
+file.  It outputs binary files of questions and acoustic decision
+trees that TIesrFlex can use along with the binary HMM file
+information created using htk_mmf_to_tiesr to synthesize HMM models.
+
+Use the -help option by itself to print this documentation and usage.
+
+The -T option specifies the name of the HTK tree file.  
+
+The -C option specifies the name of the directory containing all of
+the fixed-point binary files, such as fxclust.list, that have been
+created by the utility htk_mmf_to_tiesr.  Note that this implies that
+htk_mmf_to_tiesr must be successfully run prior to using this tool.
+
+If the trees will be gender-dependent then the -g option is used to
+specify the gender tags separated by commas as a string, such as
+':f,:m'.  This allows this tool to check for gender consistency.
+
+The -le option specifies to output binary files in littleendian format.
+
+The -d option specifies the output directory that will hold all of the
+binary files.  It should normally be the same as the -C option. ";
+
+#----------------------------------------------------------------
+
+use Getopt::Long;
+
+# This tool uses the HTKtrees module to parse the HTK trees file
+use HTKtrees;
+
+# read mmf files and a file containing a list of hmms to load
+GetOptions('Help' => \$outdoc,
+           'T=s' => \$treesfile,
+          'C=s' => \$clusterdir,
+           'g=s' => \$genders,
+          'le' => \$littleendian,
+           'd=s' => \$outdir );
+
+
+if( defined $outdoc )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+
+if( ! -f $treesfile or ! -d $clusterdir or ! defined $outdir )
+{
+    print "Invalid file/directory names\n";
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+if( ! -d $outdir )
+{
+    mkdir $outdir, 0770
+       or die "Could not create $outdir\n";
+}
+
+
+# Parse the HTK trees file
+$trees = HTKtrees->new();
+$trees->parsetrees( $treesfile );
+
+
+# Output binary tree question information
+@questionlist = output_questions( $trees, $clusterdir, $genders, 
+                                 $littleendian, $outdir );
+
+
+# Output binary trees information
+@treelist = output_trees( $trees, $clusterdir, $genders,
+                         \@questionlist, 
+                         $littleendian, $outdir );
+
+
+#----------------------------------------------------------------
+# output_questions
+
+# This subroutine outputs a set of questions files, and also a list of
+# questions, so that the user knows the order of questions within the
+# binary files.  The following files are output:
+
+# _qs.list : This is a text listing of each question name as a text
+# string on a line. The order of the questions output is the order in
+# which the questions are coded in the binary files.
+
+# _qs.bin : This is a binary file containing 1) 32-bit, number of
+# bytes of data in the file. 2) Definitions of each question
+# containing for each question a) an unsigned byte indicating number
+# of phone contexts in the question, b) a byte representing each phone
+# context consisting of the phone index (from the monophone list) ored
+# with 0x00 if left context or 0x80 if right context.
+
+# _qstbl.bin: This is a binary file containing 1) 32-bit, number of
+# questions in the _qs.bin file.  2) For each question in _qs.bin an
+# offset in number of data bytes in _qs.bin to the question (excluding
+# the initial 32-bit number in _qs.bin).
+
+sub output_questions
+{
+    use strict;
+
+    # Arguments
+    my $treeref = shift;
+    my $clusterdir = shift;
+    my $genders = shift;
+    my $littleendian = shift;
+    my $outdir = shift;
+
+
+    my $plong = $littleendian ? "V" : "N";
+    my $pusbyte = "C";
+
+
+    # If a gender string is defined, then determine genders needed
+    my(@genderlist);
+    my($genderre);
+    if( $genders )
+    {
+       @genderlist = sort( split /\s+|\s*,\s*/ , $genders );
+       $genderre = join '|', @genderlist ;
+    }
+
+
+    # Make hash containing monophones and their indices, include
+    # "sp" as last phone
+    open( MONO, "$clusterdir/monophone.list" ) or
+       die "Can not open monophone list\n";
+
+    my $phonect = 0;
+    my %monophone = ();
+    while( <MONO> )
+    {
+       chomp;
+       $monophone{$_} = $phonect++;
+    }
+    $monophone{"sp"} = $phonect++ if ! exists $monophone{"sp"};
+    close(MONO);
+
+
+    # Read the configuration file, check for consistency and update it to output
+    # whether GD trees are generated or not.
+    open(CFG, "$clusterdir/fxconfig.bin" ) or die "Can not open fxconfig.bin\n";
+    my $cfgstr;
+
+    # slurp all bytes.  
+    my $cread = read CFG, $cfgstr, 1e6;
+    close(CFG);
+
+    # Config file may now include dummy GD tree info and clustered weight info
+    #die "Invalid fxconfig size\n" unless $cread == 32;
+    die "Invalid fxconfig size\n" unless $cread >= 32;
+
+    # Get number of sets of hmms 
+    my @config = unpack "${plong}*", $cfgstr;
+    my $configsets = $config[6];
+    if( $genders && $configsets != scalar(@genderlist) )
+    {
+       die "Config file mismatch to trees\n";
+    }
+
+    # Write out the GD trees flag
+    $config[8] = ( $genders ?  1 : 0 );
+
+
+    open( CFG, ">$clusterdir/fxconfig.bin" ) or die "Can not open fxconfig.bin\n";
+    print CFG pack "${plong}*", @config;
+    close(CFG);
+
+
+    # Open output files
+    open( LIST, ">$outdir/_qs.list") or die "Can not open _qs.list\n";
+    open( QS, ">$outdir/_qs.bin" ) or die "Can not open _qs.bin\n";
+    open( TBL, ">$outdir/_qstbl.bin" ) or die "Can not open _qstbl.bin\n";
+
+
+    # Pad sizes with dummy to start
+    print QS pack $plong, 0;
+    print TBL pack $plong, 0;
+
+
+    # Output all questions in alphabetic order
+    my $offset = 0;
+    my $nquestions = 0;
+    my @qlist;
+    foreach my $qname ( sort keys %{ $treeref->{QS} } )
+    {
+       my $qssize = 0;
+
+
+       # Determine gender consistency if using GD question names
+       my $gender = "";
+       if( $genders )
+       {
+           my $gdname = $qname =~ /^.*?($genderre)$/;
+           $gender = $1;
+           
+           die "Invalid GD question $qname\n" unless $gdname;
+       }
+       else
+       {
+           $gender = "";
+       }
+
+       print LIST "$qname\n";
+
+       print QS pack $pusbyte, scalar( @{ $treeref->{QS}{$qname} } ); 
+       $qssize++;
+
+
+       # For each phonetic context, output the index.
+       foreach my $context ( @{ $treeref->{QS}{$qname} } )
+       {
+           $context =~ /^(?:(\w+?)-\*($gender)\+\*|\*($gender)\+(\w+))$/
+               or die "Invalid context $context for $qname\n";
+           my $lphone = $1;
+           my $rphone = $4;
+
+           if( $lphone )
+           {
+               die "Invalid phone in $context for $qname\n"
+                   unless exists $monophone{$lphone};
+               print QS pack $pusbyte, $monophone{$lphone} | 0x00;
+           }
+           elsif( $rphone )
+           {
+               die "Invalid phone in $context for $qname\n"
+                   unless exists $monophone{$rphone};
+               print QS pack $pusbyte, $monophone{$rphone} | 0x80;
+           }           
+           else
+           {
+               die "Invalid L/R context $context for $qname\n";
+           }
+           $qssize++;
+       }
+
+       print TBL pack $plong, $offset;
+       $offset += $qssize;
+       $qssize = 0;
+
+       $nquestions++;
+       push @qlist, $qname;
+    }
+
+    seek QS, 0, 0;
+    print QS pack $plong, $offset;
+    close(QS);
+
+    seek TBL, 0, 0;
+    print TBL pack $plong, $nquestions;
+    close(TBL);
+
+    close(LIST);
+
+    return @qlist;
+}
+
+
+#----------------------------------------------------------------
+# output_trees
+
+# This subroutine outputs a set of trees making up the acoustic
+# decision trees for all states of all phones.  Each decision tree
+# uses the cluster indices as produced by htk_mmf_to_tiesr, and the
+# question indices just produced by the output_questions subroutine.
+# The subroutine outputs several files representing the trees.  Trees
+# are output in a recursive method in order to know the structure of
+# the tree.  The files are output as follows:
+
+# _tree.bin: This file contains the tree information.  It contains 1)
+# a 32-bit int size of the data in the file in bytes. 2) For each
+# tree, a set of ordered 16-bit values indicating question indices
+# (MSB=0) or leaf node pdf cluster indices (MSB=1).  The ordering of
+# the values for the binary tree is such that "yes" paths are followed
+# first, until a leaf node is found, then "no paths are followed.
+
+# _treetbl.bin: This file contains a table for finding the tree
+# associated with each phone, state, and possibly gender.  The file
+# contains 1) a 32-bit int defining the number of bytes in the file
+# (even though everything in the file is written as 4-byte ints). 2)
+# For each phone, and possibly each gender, in monophone order with
+# male/female interlaced with female first and male second, a 32-bit
+# int value representing a 32-bit value offset in this _treetbl.bin
+# file to the offset information to locate tree information for each
+# phone and gender. 3) For each, possibly gender-dependent, phone the
+# tree information data consisting of, a) a 32-bit int containing the
+# number of emitting states in the phone, b) for each emitting state,
+# a 32-bit value representing the offset in 16-bit ints to the tree
+# information assocated with each state of this possibly
+# gender-dependent phone in _tree.bin.
+
+sub output_trees
+{
+    use strict;
+
+    # Arguments
+    my $treesref = shift;
+    my $clusterdir = shift;
+    my $genders = shift;
+    my $qlistref = shift;
+    my $littleendian = shift;
+    my $outdir = shift;
+
+    my $plong = $littleendian ? "V" : "N";
+    my $pshort = $littleendian ? "v" : "n";
+
+    my @treelist = ();
+
+    # Make a hash containing questions in question files
+    # and their respective indices
+    my %qhash;
+    @qhash{ @{$qlistref} } = ( 0 .. $#{$qlistref} );
+
+
+    # Make a list of the monophones.
+    # Make a monophone regular expression for matching.
+    open( MONO, "$clusterdir/monophone.list" ) or
+       die "Can not open monophone list\n";
+    my $phonect = 0;
+    my @monolist = ();
+    while( <MONO> )
+    {
+       chomp;
+       push @monolist, $_;
+    }
+    my $monore = join "|", @monolist;
+    close(MONO);
+
+
+    # Make hash containing cluster pdf names and their indices
+    open( CLUST, "$clusterdir/fxclust.list" )
+       or die "Can not open fxclust.list\n";
+
+    my $clcount = 0;
+    my %cluster = ();
+    while( <CLUST> )
+    {
+       chomp;
+       $cluster{$_} = $clcount++;
+    }
+    close(CLUST);
+
+
+    # If a gender string is defined, then determine genders needed
+    my(@genderlist) = ("");
+    my($genderre) = "";
+    if( $genders )
+    {
+       @genderlist = sort( split /\s+|\s*,\s*/ , $genders );
+       $genderre = join '|', @genderlist ;
+    }
+
+
+    # Make a listing of all phones in the trees
+    # Determine alphabetic index
+    # Ensure all phones match phone list
+    my %treephones;
+    foreach my $treename ( keys %{ $treesref->{TREE} } )
+    {
+       my $phname = $treesref->{TREE}{$treename}{PHONE};
+       $treephones{ $phname } = -1;
+
+       die "Invalid tree phone $phname\n" 
+           unless $phname =~ /^($monore)($genderre)$/;
+    }
+
+
+    # Check that all phones in the monophone list and genders
+    # are represented by trees
+    foreach my $phone ( @monolist )
+    {
+       foreach my $gender (@genderlist)
+       {
+           die "Missing tree phone for $phone$gender\n"
+               unless exists $treephones{"$phone$gender"};
+       }
+    }
+           
+
+    # Open the tree binary files
+    open(TREE, ">$outdir/_tree.bin" ) or die "Can not open _tree.bin\n";
+    open(TBL, ">$outdir/_treetbl.bin" ) or die "Can not open _treetbl.bin\n";
+    open(LIST, ">$outdir/_tree.list" ) or die "Can not open _tree.list\n";
+    open(PLIST, ">$outdir/_treetbl.list" ) or die "Can not open _treetbl.list\n";
+
+    # Dummy sizes to start    
+    print TREE pack $plong, 0;
+    print TBL pack $plong, 0;
+
+    # Placeholder for each phone in table
+    my $tbloffset = 0;
+    foreach my $phname ( keys %treephones )
+    {
+       print TBL pack $plong, 0;
+       $tbloffset++;
+    }
+
+
+    # Output each tree in monophone and gender list order.
+    # Output the list of trees so user can know order of trees.
+    my $treeoffset = 0;
+    my $ntrees = 0;
+    my $phcount = 0;
+    foreach my $phone (@monolist)
+    {
+       foreach my $gender (@genderlist)
+       {
+           my $phname = "$phone$gender";
+           $phcount++;
+           print PLIST "$phname\n";
+
+           # Offset of phone in table in 32-bit offset
+           seek TBL, $phcount*4, 0;
+           print TBL pack $plong, $tbloffset;
+           # Go to end of table
+           seek TBL, 0, 2;
+
+           # Find number of emitting states for this phone
+           my $nemit = 0;
+           my $state = 2;
+           my $treename = $phname . "[${state}]";
+           while( exists $treesref->{TREE}{$treename} )
+           {
+               $nemit++;
+               $state++;
+               $treename = $phname . "[${state}]";
+           }
+
+           die "Invalid tree $treename\n" if $nemit == 0;
+
+           # Number of emitting states in the phone
+           print TBL pack $plong, $nemit;
+           $tbloffset++;
+           
+           foreach $state (2 .. $nemit+1)
+           {
+               # size is in 16-bit words written to TREE file
+               $treename = $phname . "[${state}]";
+               my $size = output_tree( $treesref, $treename, 
+                                       \%qhash, \%cluster, 
+                                       $littleendian, *TREE );
+           
+               print TBL pack $plong, $treeoffset;
+               $tbloffset++;
+
+               $treeoffset += $size;
+
+               print LIST "$treename\n";
+               push @treelist, $treename;
+               $ntrees++;
+           }
+       }
+    }
+
+    close(LIST);
+    close(PLIST);
+
+    # Size of data in TBL, in bytes.  $tbloffset is in 32-bit longs.
+    seek TBL, 0, 0;
+    print TBL pack $plong, $tbloffset*4;
+    close(TBL);
+
+    # Size of data in TREE in bytes.  $treeoffset is in 16-bit words.
+    seek TREE, 0, 0;
+    print TREE pack $plong, $treeoffset*2;
+    close(TREE);
+
+    return @treelist;
+
+}
+
+
+#----------------------------------------------------------------
+# output_tree
+
+# This subroutine outputs a single tree to a file and returns the
+# number of shorts written.  The tree is written recursively, following
+# the "yes" answers first until a terminal node is found then, following
+# no answers.
+
+sub output_tree
+{
+    use strict;
+
+    my $treesref = shift;
+    my $treename = shift;
+    my $questref = shift;
+    my $clustref = shift;
+    my $littleendian = shift;
+    local *TREE = shift;
+
+    # Reference to the node array structure of this tree
+    my $tnodes = $treesref->{TREE}{$treename}{NODE};
+
+    # Recursively call output_nodes to output all nodes for the tree
+    # starting with node 0 and 0 tree size.
+    my $tsize = output_nodes( $tnodes, $questref, $clustref, 0, 0,
+                             $littleendian, *TREE );
+
+    return $tsize;
+}
+
+
+#----------------------------------------------------------------
+# output_nodes
+
+# This subroutine is a recursive call to output all nodes of a tree to
+# the tree file.  First, the question index is output for the node, if
+# this node is not singleton.  Then "Yes" child non-terminal nodes are
+# followed first, followed by "no" child non-terminal nodes.  Cluster
+# indices are output upon finding terminal leaf child nodes for the
+# "Yes" or "No" child nodes.  This is a depth-first arrangement of 
+# nodes and clusters with yes nodes followed first.
+
+sub output_nodes
+{
+    use strict;
+
+    # Arguments
+    my $tnodes = shift;
+    my $questref = shift;
+    my $clustref = shift;
+    my $node = shift;
+    my $tsize = shift;
+    my $littleendian = shift;
+    local *TREE = shift;
+
+    my $pshort = $littleendian ? "v" : "n";
+
+    # Check if this node indicates a singleton tree,
+    # that is, no question for node.  If so,
+    # yes and no child nodes are the cluster name,
+    # and there exists no tree, so we are done.
+    my $question = $tnodes->[$node]{QUESTION};
+    if( ! defined $question )
+    {
+       my $clustername = $tnodes->[$node]{YES};
+       exists $clustref->{$clustername} or 
+           die "Invalid tree terminal node $clustername\n";
+       
+       my $clusterindex = $clustref->{$clustername};
+       print TREE pack $pshort, ($clusterindex | 0x8000);
+       $tsize++;
+
+       return $tsize;
+    }
+    else
+    {
+       # This node has a question, and is a non-terminal
+       # question node.  Output the question.
+       exists $questref->{$question} or
+           die "Invalid question $question in trees\n";
+
+       my $questindex = $questref->{$question};
+       print TREE pack $pshort, $questindex;
+       $tsize++;
+    }
+
+
+    # Now we must handle the child nodes for this question node.
+    # These are either terminal cluster names or question node indices.
+    my $yesnode =  $tnodes->[$node]{YES};
+    my $nonode = $tnodes->[$node]{NO};
+
+
+    # Process "Yes" child node first, followed by "No" child node
+    foreach my $childnode ( $yesnode, $nonode )
+    {
+       # Check if child node is not a terminal.  If so, follow it.
+       if( ! exists $clustref->{ $childnode } )
+       {
+           $childnode =~ /^\d+$/ or 
+               die "Invalid tree node $childnode in trees\n";
+           $tsize = output_nodes( $tnodes, $questref, $clustref, 
+                              $childnode, $tsize, $littleendian, *TREE );
+       }
+       else
+       {
+           # Child node is a terminal, output it
+           my $childindex =  $clustref->{ $childnode };
+           print TREE pack $pshort, ( $childindex | 0x8000 );
+           $tsize++;
+       }
+    }
+
+    return $tsize;
+}
diff --git a/TIesr_Tools/htk_ttp_map.pl b/TIesr_Tools/htk_ttp_map.pl
new file mode 100755 (executable)
index 0000000..d5ccdbb
--- /dev/null
@@ -0,0 +1,173 @@
+#!/usr/bin/perl
+#----------------------------------------------------------------
+#  htk_ttp_map.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+htk_ttp_map [-C config] -d dictionary -l letterhmms -w workingdir
+             -n numnophone -t trainingpasses -o outputdict";
+
+
+$DOCUMENTATION = "
+This script creates a dictionary where each letter of each word is aligned
+one-to-one with a phone, a pseudo-phone such as k_s indicating the k s phone
+sequence, or the '_' symbol indicating null output corresponding to the
+letter. The script uses the HTK training tool HERest and recognition tool
+HVite to create a maximum likelihood estimate of the best letter-to-phone
+alignment. The input dictionary specified by the -d option must be in the form
+of a simple HTK dictionary with lines of the form 'word [pron] phone
+phone...', with '[pron]' optional. The user must specify a file using the -l
+option that encodes the structure of a set of letter HMMs that define the
+possible phonetic transcriptions corresponding to a letter. The format of this
+file is one letter per line.  The line starts with the letter followed by ':'
+and then sequences of phones followed by probabilities and separated by
+commas.  The special phone '_sil' indicates the probability that the letter is
+silent (has no phone output).  For example the line 'X: g s .2, z .3, k s .2,
+_sil .3' means that the letter 'X' in a word may generate the phone string 'g
+s' with a probability 0.2, the phone 'z' with probability 0.3, the string 'k
+s' with probability 0.2, or no phone at all with probability 0.3.  These
+probabilities must add to 1.0.  This script will create the HTK MMF file from
+this input.  The -w option is used to specify a working directory. The -n
+option specifies the maximum number of sequential letters that may be silent
+in a word. The -t option specifies the number of HTK training passes. The -o
+option specifies name of the output dictionary file, and the optional -C
+option can be used to specify configuration parameters for the HTK tools.";
+
+#----------------------------------------------------------------
+use Getopt::Long;
+
+GetOptions( "Help" => \$help,
+           "d=s" => \$dictionary,
+           "l=s" => \$letterhmms,
+           "w=s" => \$wkdir,
+           "n=i" => \$numnophone,
+           "t=i" => \$numtrain,
+           "o=s" => \$outputdict,
+           "C=s" => \$config );
+
+if( $help )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    exit 1;
+}
+
+
+# Check for reasonable input
+if( ! defined $numnophone ||
+    ! defined $numtrain || 
+    ! defined $outputdict ||
+    ! -f $dictionary ||
+    ! -f $letterhmms )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    die "htk_ttp_map: Invalid input\n";
+}
+
+# Create working directory if it does not exist
+if( ! -d $wkdir )
+{
+    mkdir $wkdir, 0770 or die "htk_ttp_map: Can not make $wkdir\n";
+}
+
+
+
+# Create the dictionary mlf file, letter list, phone list, and HTK data files
+print "Making HTK word mlf and data files, and support files\n";
+if( ! -d "${wkdir}/htkdata" )
+{
+    mkdir "${wkdir}/htkdata", 0770 or die "htk_ttp_map: Can not make data directory\n";
+}
+
+$numnophone++;
+$cmd = "htk_dict_to_mlf.pl -d $dictionary -m ${wkdir}/words.mlf -l ${wkdir}/words.let"
+    . " -p ${wkdir}/words.phn -v ${wkdir}/htkdata -t $numnophone";
+
+system( $cmd ) == 0 or die "htk_ttp_map: Could not create mlf, letter, phone, and/or data files\n";
+
+
+# Dummy letter dictionary
+open( LET, "${wkdir}/words.let" ) or die "htk_ttp_map: Can not open words.let\n";
+@letters = <LET>;
+close(LET);
+open( LDICT, ">${wkdir}/letters.dict" ) or die "htk_ttp_map: Can not open letters.dict\n";
+foreach $letter (sort @letters)
+{
+    chomp $letter;
+    print LDICT "$letter $letter\n";
+}
+close(LDICT);
+
+
+# Script file of all HTK data files to train and recognize
+open( SCP, ">${wkdir}/words.scp" ) or die "htk_ttp_map: Can not open words.scp\n";
+opendir( DIR, "${wkdir}/htkdata" ) or die "htk_ttp_map: Can not open htkdata\n";
+while( $file = readdir DIR )
+{
+    next if $file =~  /^\.\.?$/;
+    chomp $file;
+    print SCP "\"${wkdir}/htkdata/$file\"\n";
+}
+close(SCP);
+closedir(DIR);
+
+
+# Create the hmm models for each letter
+print "Creating HTK letter HMM models\n";
+if( ! -d "${wkdir}/hmm0" )
+{
+    mkdir "${wkdir}/hmm0", 0770 or die "htk_ttp_map: Can not make hmm directory\n";
+}
+$cmd = "htk_letter_mmf.pl -p ${wkdir}/words.phn -h ${letterhmms}"
+    . " -o ${wkdir}/hmm0/letters.mmf -m ${wkdir}/letters.map";
+
+system( $cmd ) == 0 or die "htk_ttp_map: Could not create letter hmms and map\n";
+
+
+# Run multiple passes of training
+for( $pass = 1; $pass <= $numtrain; $pass++ )
+{
+    print "Running HERest pass $pass\n";
+    $hmmdir = "${wkdir}/hmm${pass}";
+
+    if( ! -d $hmmdir )
+    {
+       mkdir $hmmdir, 0770 or die "htk_ttp_map: Can not make data directory\n";
+    }
+    
+    $lastpass = $pass - 1;
+    $lasthmmdir="${wkdir}/hmm${lastpass}";
+
+
+    $cmd = "HERest -C $config -T 1 -u t -m 1 -s ${wkdir}/letters${pass}.stats"
+       . " -I ${wkdir}/words.mlf " 
+       . " -H ${lasthmmdir}/letters.mmf -M $hmmdir" 
+       . " -S ${wkdir}/words.scp  ${wkdir}/words.let"
+       . " 1> ${wkdir}/herest.log 2> ${wkdir}/herest.err";
+
+    system( $cmd ) == 0 or die "htk_ttp_map: Failed HERest pass\n";
+}
+
+
+# Do the recognition to determine letter to phone mapping
+print "Running HVite word letter to phone alignment\n";
+$cmd = "HVite -C $config -a -f -i ${wkdir}/words.reco -l '*' -m -o TW"
+    . " -H ${hmmdir}/letters.mmf"
+    . " -I ${wkdir}/words.mlf -S ${wkdir}/words.scp"
+    . " ${wkdir}/letters.dict ${wkdir}/words.let"
+    . " 1>${wkdir}/hvite.log 2>${wkdir}/hvite.err";
+
+system( $cmd ) == 0 or die "htk_ttp_map: Failed HVite\n";
+
+
+# Write out the final letter to phone dictionary
+print "Parsing HTK HVite alignment into output letter to phone dictionary\n";
+$cmd = "htk_ttp_parse.pl -r ${wkdir}/words.reco -m ${wkdir}/letters.map -o $outputdict";
+system( $cmd ) == 0 or die "htk_ttp_map: Failed to parse recognition output\n";
+
+
+print "Processing complete\n";
diff --git a/TIesr_Tools/htk_ttp_parse.pl b/TIesr_Tools/htk_ttp_parse.pl
new file mode 100755 (executable)
index 0000000..be83046
--- /dev/null
@@ -0,0 +1,209 @@
+#!/usr/bin/perl
+#----------------------------------------------------------------
+#  htk_ttp_parse.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+htk_ttp_parse -r recofile -m modelmapfile -o outputdict";
+
+
+$DOCUMENTATION = "
+This script processes the output of the HVite recognition to determine
+the mapping of letters to phones and pseudo-phones.  The -r option
+specifies the recognition output file. The -m option specifies the
+state to phone mapping file which allows each state recognized to be
+mapped to a phone. The -o option specifies the output letter-to-phone
+dictionary.";
+
+#----------------------------------------------------------------
+
+use Getopt::Long;
+
+
+GetOptions( "Help" => \$help,
+           "r=s" => \$recofile,
+           "m=s" => \$modelmap,
+           "o=s" => \$outputfile
+           );
+
+if( $help )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    exit 1;
+}
+
+
+if( ! -f $modelmap ||
+    ! -f $recofile ||
+    ! $outputfile )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    die "htk_ttp_parse: Invalid input\n";
+}
+
+
+# Read in the model map file which gives the name of the phone
+# corresponding to each emitting state.  Create hash of state
+# arrays.
+open( MMAP, "$modelmap" ) or die "htk_ttp_parse: Could not open $modelmap\n";
+
+while( <MMAP> )
+{
+    @mdlarr = split(" ");
+    $mname = shift @mdlarr;
+    $mhash{$mname} = [ @mdlarr ];
+}
+
+close( MMAP );
+
+# Open the output file and the HVite recognition file
+open( OUT, ">$outputfile" ) or die "htk_ttp_parse: Could not open $outputfile\n";
+open( REC, "$recofile" ) or die "htk_ttp_parse: Could not open $recofile\n";
+
+
+# Parse reco file
+while( <REC> )
+{
+
+    # Skip first line 
+    next if /^\#!MLF!\#$/;
+
+
+    # If word line, extract word
+    if( /^\"(?:.*\/)?([^\/]+)_\d+\.rec/ )
+    {
+       $word = $1;
+
+       parse_reco( *REC, *OUT, $word, \%mhash );
+    }
+
+    else
+    {
+       die "htk_ttp_parse: Unknown line: $_\n";
+    }
+}
+
+close( REC );
+close( OUT );
+
+
+sub parse_reco
+{
+    local( *REC ) = shift;
+    local( *OUT ) = shift;
+    my( $htkword ) = shift;
+    my( $rmhash ) = shift;
+
+    # Convert HTK word back to original word
+    my $word = $htkword;
+    $word =~ s/p/\./g;
+
+    # Output the word to the dictionary
+    printf OUT "%-20s", "\"${word}\"";
+
+    chomp($word);
+
+    @chars = split( //, $word );
+    $wmodels = "_NUL " . join(' _NUL ', @chars) . " _NUL";
+    @wmodels = split( " ", $wmodels );
+    
+    # Parse each recognized state for the word
+    $model = shift @wmodels;
+    $endparse = 0;
+    while( ($lin = <REC>) !~ /^\.$/ )
+    {
+
+       # if end of parse requested then abandon the parse
+       next if $endparse;
+
+       # Determine reco state and model
+       ($rstate, $rscore, $rmodel) = 
+           $lin =~ /^s([0-9]+)\s+([-.0-9]+)\s*\"?([^\s\"]*)\"?/;
+       $savmodel = $rmodel if $rmodel;
+
+       # Determine model phone
+       $rphone = $rmhash->{$savmodel}[$rstate-2] if $savmodel;
+
+
+       # If score is too low, then we have a misalignment due
+       # to improper modeling of the word
+       if( $rscore < -7.0 )
+       {
+           print "Misaligned word: $word\n";
+           print OUT " *";
+           $endparse = 1;
+
+           # Undefine $model only so the 
+           # "Premature reco end..."  error message is not output
+           undef $model;
+           next;
+       }           
+
+
+       # If whole model has been parsed, but recognition
+       # output remains, end this parse
+       if( ! $model )
+       {
+           print "Premature end of $word\n";
+           print OUT "\n";
+           $endparse = 1;
+           next;
+       }
+
+       # Ignore non-tee matches
+       if( $model eq '_NUL' && $rmodel eq '_NUL' )
+       {
+           $model = shift @wmodels;
+           next;
+       }
+
+       # Model for this letter used tee to bypass phonetic output
+       if( $model ne '_NUL' && $rmodel eq '_NUL' )
+       {
+           print OUT " _";
+           # shift past the subsequent non-tee
+           $model = shift @wmodels;
+           $model = shift @wmodels;
+           next;
+       }
+
+       # If model matches recognized model first state
+       # output first state
+       if( $model eq $rmodel )
+       {
+           $rphone = "_" if $rphone eq "_nul";
+           print OUT " $rphone";
+           $model = shift @wmodels;
+           next;
+       }
+
+       
+
+       # If this is a continuation of a pseudo-phone for a model
+       # output the next phone. A "_nul" phone is output as "_"
+       if( ! $rmodel )
+       {
+           $rphone = "_" if $rphone eq "_nul";
+           print OUT "$rphone";
+           next;
+       }
+
+       # The output does not parse properly, so end the parse
+       print OUT "\n";
+       print "Invalid parse for $word\n";
+       $endparse = 1;
+    }
+
+    #Ensure that parse completed normally
+    if( $model )
+    {
+       print "Premature reco end for $word\n";
+    }
+
+    print OUT "\n";
+}
diff --git a/TIesr_Tools/odtcompress.pl b/TIesr_Tools/odtcompress.pl
new file mode 100755 (executable)
index 0000000..bb8e1c1
--- /dev/null
@@ -0,0 +1,682 @@
+#!/usr/bin/perl
+#---------------------------------------------------------------
+#  odtcompress.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+odtcompress -Help -D treedir -CF conflevel -o outdir [-B]";
+
+
+$DOCUMENTATION = "
+This script generates compressed binary decision trees based on the 
+output of the C4.5 log files that contain the text version of
+the trees.
+
+The -D option specifies the directory which holds the c4.5 log files
+needed for compression. The -CF option specifies the confidence level
+used during c4.5 program processing, and this indicates which set of
+*.CF*log files will be compressed. The -o option specifies the output
+directory for the final compressed decision trees. This directory must
+also contain the three files cAttType.txt, cAttValue.txt, and
+onewphone.lst, which should have been created by prior steps of
+processing. The compressed *.olmdtpm files will also be output to this
+directory. If the -B option is selected, output will be in big-endian
+format.";
+
+#---------------------------------------------------------------
+
+use Getopt::Long;
+
+GetOptions( "Help" => \$help, 
+            "D=s" => \$treedir,
+            "o=s" => \$outdir,
+            "CF=i" => \$conflevel,
+           "B" => \$bigendian );
+
+if( $help )
+{
+    print "$USAGE\n\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+
+if( ! -d $outdir or ! -d $treedir or 
+    ($conflevel < 1 or $conflevel > 100 ) )
+{
+    print "$USAGE\n\n";
+    print "$DOCUMENTATION\n";
+    die "odtcompress: Invalid outdir\n";
+}
+
+
+# Read the decision tree attribute names
+open( ATT, "<$outdir/cAttType.txt" ) or die "odtcompress: Missing file cAttType.txt\n";
+@attributes = <ATT>;
+close( ATT );
+foreach $att (@attributes)
+{
+    chomp $att;
+    $att =~ s/\s*//g;
+}
+
+# Form hash used to look up index corresponding to attribute name
+@attributes{@attributes} = (0..$#attributes);
+$attributes{NULL_ATTRIBUTE} = 15;
+
+
+# Read the values that the attributes can assume
+open (VAL, "<$outdir/cAttValue.txt" ) or die "odtcompress: Missing file cAttValue.txt\n";
+@values = <VAL>;
+close( VAL );
+foreach $val (@values)
+{
+    chomp $val;
+    $val =~ s/\s*//g;
+}
+
+# Form hash to look up index to corresponding value
+@values{@values} = (0..$#values);
+
+
+# Read the decision tree phone classes
+open( CLS, "<$outdir/onewphone.list" ) or die "odtcompress: Missing file onewphone.list\n";
+@phones = <CLS>;
+close( CLS );
+foreach $phone (@phones)
+{
+    chomp $phone;
+    ($phone) = $phone =~ /^\s*([^\s]+)\s/;
+}
+
+#Make a hash to look up index to phone class
+@phones{@phones} = (0..$#phones);
+
+
+# Ensure log file exists
+foreach $logfile ( glob( "${treedir}/*.CF${conflevel}log" ) )
+{
+
+    die "odtcompress: Invalid file $logfile\n" unless -f $logfile;
+
+    # Form empty hash to track mapping of attribute
+    # values to each attribute index
+    $attmap = {};
+
+
+    #Parse the log file to produce a tree structure to be compressed
+    $rtree = parse_file( $logfile );
+
+    # Get the file name of the logfile, which will be used as the
+    # filename for the compessed tree file
+    $logfile =~ /^(.*\/)?([^.]+)\./;
+    $lettername = $2;
+
+    $treefile = "$outdir/${lettername}.olmdtpm";
+
+    # Compress the tree and output to directory
+    output_tree( $rtree, $treefile );
+
+    # Delete the parsed tree structure
+    undef $rtree;
+    undef $attmap;
+}
+
+
+
+#----------------------------------------------------------
+# parse_file
+#
+# Parse a c4.5 output log file and extract the simplified
+# decision tree
+#----------------------
+sub parse_file
+{
+    my( $fname ) = shift @_;
+
+    open( DT, $fname ) or die "odtcompress: Could not open $fname\n";
+
+    # Read until the decision tree is found. This may be
+    # the simplified decision tree, or if not, it may
+    # indicate a single phone output tree.
+    my $location = tell DT;
+    while( $lin = <DT> )
+    {
+       if( $lin =~ /^\s*(Simplified )?Decision Tree:\s*$/ )
+       {
+           $location = tell DT;
+       }
+    }
+
+    # Go to start of decision tree
+    seek DT, $location, 0;
+    
+    # Go past any blank lines
+    while( $lin = <DT> )
+    {
+       last if $lin !~ /^\s*$/;
+    }
+    
+
+
+    # Create the root node of the tree, with no parent
+    # and at level 0
+    my $rnode = init_node( undef, 0 );
+
+    # Parse the root node.  This will recursively parse the
+    # whole tree.
+    $lin = parse_node( \*DT, $lin, $rnode );
+
+
+    close( DT );
+
+    return $rnode;
+}
+
+
+#--------------------------------------------------------
+# init_node
+#
+# Initialize a node of the decision tree
+#-------------------
+sub init_node
+{
+    my $rparent = shift @_;
+    my $level = shift @_;
+
+    # Create a reference to a new anonymous hash for the node
+    my $refnode = {};
+
+
+    $$refnode{PARENT} = $rparent;
+    $$refnode{LEVEL} = $level;
+
+    return $refnode;
+}
+
+
+
+#---------------------------------------------------------
+# parse_node
+#
+# Parse the simplified c4.5 generated decision tree node.
+#-----------------
+sub parse_node
+{
+    local $FH = shift;
+    my $lin = shift;
+    my $curnode = shift;
+    my ($level, $curlevel, $type, $att, $val, $phone );
+
+
+    # Parse the first line of the node
+    ($level, $type, $att, $val, $phone ) = parse_lin( $lin );
+    $curlevel = $level;
+
+    # Save the index of the attribute of the node
+    my $attidx = $attributes{$att};
+    $$curnode{ATT} = $attidx;
+
+
+    # Loop over all lines for this node level
+    while( $lin !~ /^\s*$/ && $level == $curlevel )
+    {
+       # Enter value index mapped to the attribute into mapping hash
+       $$attmap{$attidx}{$values{$val}} = 1;
+
+       # Value is a branch value; decend into branch node and parse it
+       if( $type eq "BRANCH" )
+       {
+           # Create a new node for the branch at next level down
+           my $newnode = init_node( $curnode, $level+1);
+
+           # Save new node in branch value index hash of current node
+           $$curnode{BRANCH}{$values{$val}} = $newnode;
+
+           # Get the first line of the new node
+           $lin = <$FH>;
+           chomp $lin;
+
+           # Parse the new node, returning line after all lower level nodes
+           $lin = parse_node( $FH, $lin, $newnode );
+       }
+
+
+       # Value is a leaf value; save value index and its corresponding phone index
+       elsif( $type eq "LEAF" )
+       {
+           
+           # Save phone index to output corresponding to this value index
+           $$curnode{LEAF}{$values{$val}} = $phones{$phone};
+
+           # Get the next line
+           $lin = <$FH>;
+           chomp $lin;
+       }
+
+
+       # If not a blank line, parse it to determine if the line belongs
+       # to current or higher level node. This will indicate end if the
+       # line belongs to current node or ancestor node.
+       if( $lin !~ /^\s*$/ )
+       {           
+           ($level, $type, $att, $val, $phone ) = parse_lin( $lin );
+       }
+    }
+
+    return $lin;
+}
+   
+
+
+#----------------------------------------------------------
+# parse_lin
+#
+# Parse a line of the decision tree in the c4.5 log file
+#---------------------
+sub parse_lin
+{
+    my $lin = shift;
+    my @plin;
+
+    chomp $lin;
+
+    my ($level, $att, $val, $phone, $type);
+    my ( @parse );
+
+    # Return undef if blank line
+    return undef if $lin =~ /^\s*$/;
+
+
+    # Determine the level of the node
+    @parse = $lin =~ /^((\|\s+)*)(.*)$/;
+    $level = scalar( split( " ", $1 ) );
+    $lin = pop @parse;
+    
+    # Determine the attribute, value, and phone if leaf node
+    $lin =~ /\s*([^\s]+)(\s*=\s*([^\s]+)\s*:\s*([^\s]*))?/;
+
+    # Check if this is a single phone tree
+    if( $2 eq "" )
+    {
+       # Null attribute and value
+       $att = "NULL_ATTRIBUTE";
+       $val = "NO_ATTRIBUTE";
+
+       $phone = $1;
+       $type = "LEAF";
+    }
+    else
+    {
+
+       $att = $1;
+
+       $val = $3;
+
+       # Special cases of values modified for c4.5  program
+       if( $val eq "no" ) { $val = "NO_ATTRIBUTE" }
+       elsif( $val eq "up" ) { $val = "'" }
+       elsif( $val eq "dash" ) { $val = "-" }
+       elsif( $val eq "dot" ) { $val = "." }
+
+
+       $phone = $4;
+       $type = ( $phone eq "" ) ?  "BRANCH" : "LEAF";
+    }
+
+    return ($level, $type, $att, $val, $phone );
+}
+
+
+#-----------------------------------------------------------
+# encode_hash
+#
+# Encode a hash into a compressed list for linear processing efficiency.
+# Each integer key in the hash has an associated
+# integer value. There will often be many keys that have the
+# same value. The value that occurs most often is the default value
+# and the keys do not need to be encoded for the default value.
+# The remaining keys are encoded by the value they share in order of 
+# decreasing number of shared values. The integer values and keys
+# are output in an array in compressed format.
+#----------------------
+sub encode_hash
+{
+    my $rhash = shift @_;
+
+
+    # Build a list of keys corresponding to each value
+
+    my ($key, $val );
+    my %valkeys;
+    foreach $key ( sort {$a <=> $b} keys %$rhash )
+    {
+       $val = $$rhash{$key};
+
+       $valkeys{$val} = [] if ! defined $valkeys{$val};
+
+       # The valkeys hash contains a list of keys for each value.
+       push @{$valkeys{$val}}, $key;
+    }
+
+
+    # Determine the number of keys corresponding to each value
+    my %numkeys;
+    foreach $val ( keys %valkeys )
+    {
+       $numkeys{$val} = scalar( @{$valkeys{$val}} );
+    }
+
+    # Sort the values by the number of keys corresponding to the value.
+    # used.
+    my @sortvals = sort { $numkeys{$b} <=> $numkeys{$a} } keys %valkeys;
+
+
+    # Default value is the value that occurs most often
+    my $defaultval = shift @sortvals;
+
+
+    # Compress the remaining keys corresponding to values in order
+    # of most often occurring values
+    my @outlist = ();
+    foreach $val ( @sortvals )
+    {
+       # Output the value and number of keys having the value
+       push @outlist, $val;
+       push @outlist, $numkeys{$val};
+
+
+       # Output compressed list of keys corresponding to this 
+       # value. Note that @{$valkeys{$val}}
+       # is a sorted list of keys corresponding to the value.
+       my @encodekeys = encode_list( @{$valkeys{$val}} );
+       
+       push @outlist, @encodekeys;
+
+    }
+
+    # Output default value corresponding to all other keys
+    push @outlist, $defaultval;
+
+
+    # Output length of the list as first value
+    unshift @outlist, ( scalar(@outlist) + 1 );
+
+    return @outlist;
+}
+
+
+#----------------------------------------------------------
+# encode_list
+#
+# Encode a list of integers into a run-length compressed list
+# Input is a list. Encoding of the list encodes sequential 
+# integers as the first integer, followed by the negative of
+# the last sequential integer. For example, the list
+# ( 1, 3, 5, 6, 7, 8, 10) would be encoded as:
+# ( 1, 3, 5, -8, 10 )s
+#------------------
+sub encode_list
+{
+    my ( $item, $lastitem, $inrun );
+    my @encodelist;
+
+
+
+    # Run encode the sorted list
+    my $lastitem = undef;
+    my $inrun = 0;
+    foreach $item ( sort {$a <=> $b} @_ )
+    {
+       # next integer or start of new run of sequential integers
+       if( $lastitem == undef or $lastitem < $item-1 )
+           {
+               if( $inrun )
+               {
+                   push @encodelist, ( $lastitem | 0x80 );
+                   $inrun = 0;
+               }
+
+               push @encodelist, $item;
+               $lastitem = $item;
+
+           }
+
+           # continuation of run of key integers
+           elsif( $lastitem == $item-1 )
+           {
+               $lastitem = $item;
+               $inrun = 1;
+           }
+           
+           else
+           {
+               # Sanity check, should not happen
+               die "odtcompress: encode_list items out of order\n";
+           }
+       }
+    
+    # Ended in run of items, output end of run
+    if( $inrun )
+    {
+       push @encodelist, ( $lastitem | 0x80);
+    }
+
+    return @encodelist;
+}
+
+
+
+#-----------------------------------------------------------
+# output_tree
+#
+# Output the decision tree in compressed format for use by
+# the TIesrDT API.
+#------------------------
+sub output_tree
+{
+    my( $rtree, $fname ) = @_;
+
+
+    # Recursively encode the data of the nodes. This also allows
+    # calculation of the size of each node in bytes. The encoded
+    # data and the sizes are added to the tree hash
+    encode_node( $rtree );
+
+
+    # Open output file
+    open( TRE, ">$fname" ) or die "odtcompress: Could not open $fname\n";
+
+
+    # Output tree header information
+    # Endian packing template
+    my $temp =  $bigendian ?  "N" : "V";
+
+
+    # Tree header information
+
+    # Output size of top node plus node context info
+    my $size = $$rtree{SIZE} + 2;
+    print TRE pack( $temp, $size );
+
+
+    # Output number of attributes in byte
+    print TRE  pack( "C", scalar(@attributes) );
+
+    # Output number of values mapped to each attribute index
+    my $attidx;
+    foreach $attidx ( (0 .. $#attributes) )
+    {
+       my @attvalues = sort keys %{ $$attmap{$attidx} };
+       print TRE pack( "C", scalar(@attvalues) );
+    }
+
+
+    # Output the tree nodes depth first this function will
+    # recursively output all nodes of the tree
+    output_node( \*TRE, $rtree );
+
+    close(TRE);
+}
+
+#---------------------------------------------------------------
+# encode_node
+#
+# Encode the branch, leaf and header data for a node. This data is added
+# to the tree hash. The size of each node is also calculated and 
+# propagated up the tree so that node sizes (offsets) are included
+# in the header encoding.
+#--------------------------
+sub encode_node
+{
+    my $node = shift;
+    my $nodeflag;
+    my @header = ();
+    my @branchencode;
+    my @branchvalues;
+    my @leafencode;
+
+    # Initialize node size in bytes
+    $$node{SIZE} = 0;
+
+    # If node contains a reference to a leaf hash, then it has
+    # leaves, so they can be encoded.
+    if( defined $$node{LEAF} )
+    {
+       # Encode the node attribute values and corresponding
+       # output phones.
+       @leafencode = encode_hash( $$node{LEAF} );
+       
+       # Put the result in an anonymous list of the leaf
+       $$node{LEAFENCODE} = [@leafencode ];
+       $$node{SIZE} += scalar( @leafencode );
+
+       # Set node flag to indicate only leaf nodes
+       $nodeflag = 0x80;
+    }
+
+    # If the node contains a reference to a branch hash, then
+    # it has branch sub-nodes. Decend and encode the branch sub-nodes.
+    if( defined $$node{BRANCH} )
+    {
+       foreach $branchnode ( values %{$node->{BRANCH}} )
+       {
+           encode_node( $branchnode );
+
+           $$node{SIZE} += $$branchnode{SIZE};
+       }
+
+       # Encode compressed information regarding the 
+       # branch attribute values that lead to sub-nodes.
+       @branchvalues = sort {$a <=> $b} keys %{$node->{BRANCH}};
+       @branchencode = encode_list( @branchvalues );
+
+       # Override node flag to indicate node has branches
+       $nodeflag = 0xc0;
+    }
+
+
+    # Node header information
+    if( $nodeflag == 0x80 )
+    {
+       # If not a single phone tree, create leaf node only header byte
+       if ( $$node{ATT} != $attributes{NULL_ATTRIBUTE} )
+       {
+           # Node type info for a node that has only leaves.
+           # Inculdes flag and node attribute.
+           push @header,  $nodeflag | $$node{ATT};
+       }
+    }
+    else
+    {
+       # Node type info for a node that has branches. Includes
+       # flag and size of encoded attribute values.
+       my $nodetype;
+       $nodetype =  $nodeflag  | ( scalar(@branchencode) + 1 );
+
+       push @header, $nodetype;
+
+       # Encoded node attribute values that have branches
+       push @header, @branchencode;
+       push @header, scalar( keys %{$node->{BRANCH}} );
+
+       # Header sub-node information for each attribute value
+       # corresponding to a sub-node put in the header
+       # in the order encoded in @branchencode
+       my ( $val );
+       foreach $val ( @branchvalues )
+       {
+           my $childnode;
+           my $cnodeinfo;
+           $childnode = $$node{BRANCH}{$val};
+
+           $cnodeinfo = $$childnode{ATT};
+           $cnodeinfo = ($cnodeinfo << 12 ) | $$childnode{SIZE};
+           push @header, ($cnodeinfo >> 8 ) & 0xff;
+           push @header, ($cnodeinfo & 0xff );
+       }
+    }
+
+    # Node size includes header
+    $$node{SIZE} += scalar( @header );
+    $$node{HEADER} = [@header];
+}
+
+
+#-----------------------------------------------------------
+# output_node
+#
+# Output node for the tree, decending to other nodes as needed.
+#--------------------------
+sub output_node
+{
+    my( $FH, $node ) = @_;
+
+    # If this is top node, output root branch  attribute context
+    # and offset info. Even though the offset info will not be
+    # used, it gives the size of the top node.
+    if( $$node{LEVEL} == 0 )
+    {
+       my $cxt = $$node{ATT};
+       $cxt = $cxt << 12;
+
+       # Size not needed for top node
+       # $cxt = $cxt + $$node{SIZE};
+
+       print $FH pack "C",  ( ( $cxt >> 8 ) & 0xff );
+       print $FH pack "C",  ( $cxt & 0xff );
+    }    
+
+    # Output node header information
+    my $byte;
+    foreach $byte ( @{ $$node{HEADER} } )
+    {
+       print $FH pack "C", ($byte & 0xff);
+    }    
+
+
+    # Output encoded leaf info for the node, if any
+    if( defined $$node{LEAFENCODE} )
+    {
+       foreach $byte ( @{ $$node{LEAFENCODE} } )
+       {
+           print $FH pack "C", ($byte & 0xff);
+       }           
+    }
+
+    # Output info for all sub-nodes recursively
+    if( defined $$node{BRANCH} )
+    {
+       # Loop over all attribute values corresponding to sub-nodes
+       # in the order in which they were encoded
+       my $val;
+       foreach $val ( sort {$a <=> $b} keys %{ $node->{BRANCH} } )
+       {
+           my $subnode = $$node{BRANCH}{$val};
+           output_node( $FH, $subnode );
+       }
+    }
+}
diff --git a/TIesr_Tools/sample_to_htk.pl b/TIesr_Tools/sample_to_htk.pl
new file mode 100755 (executable)
index 0000000..ee464b4
--- /dev/null
@@ -0,0 +1,529 @@
+#!/usr/bin/perl
+#----------------------------------------------------------------
+#  sample_to_htk.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+sample_to_htk [-Help] [ -s samplerate -be -p preemp -c numcepstra 
+              -f numfilters -l floor -w winsize -t frameshift
+              -o outdir ] sample_data_file";
+
+
+$DOCUMENTATION = "
+
+This script converts a binary sampled audio data file into a set of cepstral
+vectors and puts the output in a parameter file that is compatible with HTK.
+HTK parameter files contain a header, and the cepstral data is in big-endian
+format. The binary sampled data file must be single channel with two-bytes per
+sample. The cepstral parameters are compatible with TIesr. The user may
+specify the parameters for the conversion. If they are not specified, defaults
+will apply. The options are as follows:
+
+-s samplerate  : Integer sample rate of the binary audio file. Default 8000/sec
+-be            : Set if binary sampled data is in big-endian format
+-p preemp      : Preemphasis floating point value. Default 0.96
+-c numcepstra  : Number of cepstra. Default 10
+-f numfilters  : Number of mel-spaced filters. Default 20
+-l floor       : Floor on power spectral density
+-w winsize     : Hamming sample window size. Must by power of 2. Default 256
+-t frameshift  : Sample shift between frames. Default 160 (20msec @ 8000 samp/sec)
+-o outdir      : Directory where output parameter files placed. Default current dir
+
+The resulting files will have the same file name as the original file, but
+will have an appended '.htk' file type.";
+
+#----------------------------------------------------------------
+use Getopt::Long;
+use File::Basename;
+
+# Use CPAN Math::FFT module
+use lib "lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi";
+use Math::FFT;
+
+
+GetOptions( "Help" => \$help,
+           "s=i" => \$samplerate,
+           "be" => \$bigendian,
+           "p=f" => \$preemp,
+           "c=i" => \$numcepstra,
+           "f=i" => \$numfilters,
+           "l=f" => \$psdfloor,
+            "w=i" => \$winsize,
+            "t=i" => \$frameshift,
+           "o=s" => \$outdir );
+
+if( $help )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n\n";
+    exit 1;
+}
+
+$samplerate = 8000 unless defined $samplerate;
+$preemp = 0.96 unless defined $preemp;
+$numcepstra = 10 unless defined $numcepstra;
+$numfilters = 20 unless defined $numfilters;
+$psdfloor = 0.0 unless defined $psdfloor;
+$winsize = 256 unless defined $winsize;
+$frameshift = 160 unless defined $frameshift;
+$outdir = "." unless defined $outdir;
+
+# Check for reasonable input
+if( $numcepstra > $numfilters )
+{
+    die "sample_to_htk: Invalid number of cepstra/filters\n";
+}
+
+if( $frameshift > $winsize )
+{
+    die "sample_to_htk: Invalid window/shift size\n";
+}
+
+if( 2**( int( log($winsize)/log(2) ) ) != $winsize )
+{
+    die "sample_to_htk: window size not power of 2\n";
+}
+
+
+
+if( ! -d $outdir )
+{
+    mkdir $outdir, 0770 or die "sample_to_htk: Could not make $outdir\n";
+}
+
+
+# Data preparation
+
+# Generate Hamming window
+@hwindow = hamming_window( $winsize );
+
+# Generate mel filters
+$rfilters = mel_filters( $samplerate, $numfilters, $winsize );
+
+# Setup for fft
+@frame = (0) x $winsize;
+$fft = Math::FFT->new(\@frame);
+
+# Setup for dct
+$rdct = dct_transform( $numcepstra, $numfilters );
+
+# Process each of the binary sampled data files
+foreach $rawfile ( @ARGV )
+{
+    # Find the name of the output file
+    ($basename, $path, $suffix) = fileparse( $rawfile, '\.[^.]*$' );
+    $outfile = $outdir. "/" . $basename . ".htk";
+
+
+    # Open the raw data file
+    open( RAW, "<$rawfile" ) or die "sample_to_htk: Could not open $rawfile\n";
+
+    # Initialize cepstral vector array
+    @cepstra = ();
+
+    # Set up to input the 2-byte samples as little or big endian
+    $template = $bigendian  ?  "n*"  :  "v*";
+
+    # Obtain the first window of samples from the file
+    $numbytes = read RAW, $instring, 2*$winsize;
+    die "sample_to_htk: $fil too small\n" if $numbytes != 2*$winsize;
+    $validframe = 1;
+
+    # Convert to signed integer
+    @inbuf = unpack $template, $instring;
+    @inbuf = unpack "s*", ( pack "S*", @inbuf );
+
+    # Preemphasis if requested
+    $lastsample = 0;
+    if( $preemp > 0 )
+    {
+       ( $lastsample, @inbuf ) = preemphasis( $preemp, $lastsample, @inbuf );
+    }
+
+
+    # Loop over all frames
+    while( $validframe )
+    {
+       
+       # Window the data
+       @frame = window( \@inbuf, \@hwindow );
+           
+       # Calculate FFT of the data
+       $fft = $fft->clone(\@frame);
+       $coeff = $fft->rdft();
+
+       # TIesr power spectrum
+       @dftpwr = pwrspec( $coeff, $psdfloor );
+
+
+       # Determine the mel-spaced filter powers
+       @melspec = melfilter( \@dftpwr, $numfilters,  $rfilters );
+
+       # Convert from mel spectrum to cepstrum vector by DFT
+       @cepstrum = transform( \@melspec, $rdct );
+
+       push @cepstra, @cepstrum;
+
+
+       # Get next frameshift samples of data and preemphasize
+       $numbytes = read RAW, $instring, 2*$frameshift;
+
+       if( $numbytes < 2*$frameshift )
+       {
+           $validframe = 0;
+       }
+       else
+       {
+           # Obtain samples in signed integer
+           @subbuf = unpack $template, $instring;
+           @subbuf = unpack "s*", ( pack "S*", @subbuf );
+           
+           if( $preemp > 0 )
+           {
+               ( $lastsample, @subbuf ) = preemphasis( $preemp, $lastsample, @subbuf );
+           }
+
+           # Updated frame with new samples
+           splice( @inbuf, 0, $frameshift );
+           push @inbuf, @subbuf;
+       }
+    }
+
+
+    # Done with the input raw data file
+    close( RAW );
+
+
+    # Open the HTK parameter file
+    open( CEP, ">$outfile" ) or die "sample_to_htk: Could not open $outfile\n";
+
+
+    # Write the HTK header in the file
+    # Number of cepstral vectors
+    print CEP  pack "N", int(  scalar(@cepstra)/$numcepstra );
+    
+    # cepstral vector sample rate
+    print CEP  pack "N", int( 10000000.0*$frameshift/$samplerate );
+    
+    # Number of bytes per vector
+    print CEP  pack "n", 4 * $numcepstra;
+
+    # Parameter kind is USER with no other qualifiers
+    print CEP  pack "n", 9;
+
+
+    # Determine native endian type
+    $is_le = ( (unpack "S", ( pack "v", 0x0001 ) ) == 0x0001 );
+
+    # Write the float cepstral data as big-endian. This may require byte swapping.
+    # This assumes that your machine uses IEEE floating point format.
+    foreach $cep ( @cepstra )
+    {
+       if( !is_le )
+       {
+           print CEP (pack "f", $cep);
+       }
+       else
+       {
+           # Must convert float 4 byte value to big endian
+           @bcep = unpack "C*", pack "f", $cep;
+           print CEP ( pack "C*", reverse(@bcep) );
+       }
+    }
+    
+    close( CEP );
+}
+
+
+#----------------------------------------------------------------------------
+# hamming_window
+
+# Define a Hamming window
+#------------
+sub hamming_window
+{
+    my $winsize = shift @_;
+
+    my $pi = atan2(1,1)*4;
+
+    my @hwin;
+    for( my $el = 0; $el < $winsize; $el++ )
+    {
+       $hwin[$el] = 0.54 - 0.46*cos( 2*$pi*$el/($winsize-1) );
+    }
+
+    return @hwin;
+}
+
+
+#-----------------------------------------------------------------------------
+# mel_filters
+
+# Define the mel filters for the given samplerate, number of filters and window
+# size. This function returns a reference to a structure containing the frequency
+# samples and weights for each of the mel filters.
+#-------------------
+sub mel_filters
+{
+    my ($samplerate, $numfilters, $winsize) = @_;
+
+    
+    # Frequency of each fft point
+    my $idx;
+    my @frq;
+    my $frqbin = $samplerate/$winsize;
+    for( $idx = 0; $idx <= ($winsize/2); $idx++ )
+    {
+       $frq[$idx] = $idx*$frqbin;
+    }
+
+
+    # Mel filterbank center frequencies and 0 Hz and half sample Hz
+    my @melfrq;
+    my $numlower = int(  $numfilters/2 + 2 );
+
+    # Lower half of mel center frequencies are linear to 1kHz
+    for( $idx = 0; $idx <= $numlower-1; $idx++ )
+    {
+       $melfrq[$idx] = 1000*$idx/($numlower-1);
+    }
+
+    # Higher half of mel center frequencies are logrithmic to half sample rate
+    my $numupper = $numfilters + 2 - $numlower;
+    my $logconst = 10**( ( log($samplerate/2/1000)/log(10) )/$numupper );
+    for( $idx = $numlower; $idx < $numfilters + 2; $idx++ )
+    {
+       $melfrq[$idx] = 1000 * $logconst**( $idx - $numlower + 1 );
+    }
+    
+
+    # Define filter bank for each mel frequencies. There are $numfilters 
+    # filters defined in the structure, indexed as 1..$numfilters
+
+    $filt = 1;
+    for( $idx = 0; $idx <= $#frq; $idx++ )
+    {
+       # Start defining next filter if frequency above prior mel filter midpoint
+       $filt++ if( $frq[$idx] >= $melfrq[$filt] );
+
+       # Filter gain at frequency given by $frq[$idx]
+       $gain = ( $frq[$idx] - $melfrq[$filt-1] ) / ( $melfrq[$filt] - $melfrq[$filt-1] );
+
+       
+       # Increasing gain component of present filter
+       if(  $filt <= $numfilters )
+       {
+           push @{$rmelfilt->[$filt]{FILTIDX}}, $idx;
+           push @{$rmelfilt->[$filt]{FILTGAIN}}, $gain*$gain;
+       }
+
+       # Decreasing gain part of prior filter
+       if( $filt > 1 && $filt <= $numfilters + 1 )
+       {
+           push @{$rmelfilt->[$filt-1]{FILTIDX}}, $idx;
+           push @{$rmelfilt->[$filt-1]{FILTGAIN}}, (1 - $gain)*(1 - $gain);
+       }
+    }
+
+    return $rmelfilt;
+}
+
+
+#----------------------------------------------------------------------------
+# preemphasis
+
+# Perform simple preemphasis of a block of data and also return the last
+# sample of the data for future preemphasis of following blocks.
+#----------------------
+sub preemphasis
+{
+
+    my $pconst = shift @_;
+    my $lastsample = shift @_;
+    my @block = @_;
+
+    # preemphasize first sample
+    my @pblock;
+    $pblock[0] = $block[0] - $pconst*$lastsample;
+
+    # Preemphasize all remaining samples of the block
+    for( my $idx=1; $idx <=$#block; $idx++ )
+    {
+       $pblock[$idx] = $block[$idx] - $pconst*$block[$idx-1];
+    }
+
+    return ( $block[$#block], @pblock );
+}
+
+
+#-----------------------------------------------------------------------
+# window
+
+# Apply window to a list of samples and return new list
+#----------------------
+sub window
+{
+    my $rdata = shift @_;
+    my $rwindow = shift @_;
+
+    my @windata;
+
+    my $idx;
+    for( $idx = 0; $idx <= $#{$rdata}; $idx++ )
+    {
+       $windata[$idx] = $$rwindow[$idx] * $$rdata[$idx];
+    }
+
+    return @windata;
+}
+
+
+#----------------------------------------------------------------------
+# pwrspec
+
+# Return power spectrum defined as square of magnitudes of fft coefficients
+# floored by a minimum value. TIesr defines 'power' as simple amplitude 
+# squared of fft coefficients.
+#------------------------
+sub pwrspec
+{
+    # Reference to FFT coefficient list
+    my $rcoeff = shift @_;
+
+    # Floor value
+    my $floor = shift @_;
+
+    # Number of coefficients in list, including real and imaginary parts
+    my $numcoeff = scalar @{$rcoeff};
+
+    my $idx;
+    my $dftpwr;
+   
+    # Loop over all positive frequency FFT coefficients
+    for($idx = 0; $idx < $numcoeff; $idx += 2 )
+    {
+       my $frqidx = int( $idx/2 );
+       if( $frqidx == 0 )
+       {
+           # Zero and half sample powers
+           $dftpwr[$frqidx] = $$rcoeff[$idx] * $$rcoeff[$idx];
+           $dftpwr[$frqidx] = $dftpwr[$frqidx] < $floor ?  $floor : $dftpwr[$frqidx];
+           
+           $frqidx = int( $numcoeff/2 );
+           $dftpwr[$frqidx] = $$rcoeff[$idx+1] * $$rcoeff[$idx+1];
+           $dftpwr[$frqidx] = $dftpwr[$frqidx] < $floor ?  $floor : $dftpwr[$frqidx];
+
+       }
+       else
+       {
+           # All other frequencies
+           $dftpwr[$frqidx] = $$rcoeff[$idx] * $$rcoeff[$idx] +
+               $$rcoeff[$idx+1] * $$rcoeff[$idx+1];
+
+           $dftpwr[$frqidx] = $dftpwr[$frqidx] < $floor ?  $floor : $dftpwr[$frqidx];
+       }
+    }
+    return @dftpwr;
+}
+
+
+#----------------------------------------------------------------------------------
+# melfilter
+
+# Calculate 'power' in each mel filter
+#-------------------------------
+sub melfilter
+{
+    my $rdftpwr = shift @_;
+    my $numfilters = shift @_;
+    my $rfilters = shift @_;
+
+    my @melspec;
+    # Loop over all filters, gathering the power in each 
+    my $filter;
+    my $idx;
+    for( $filter = 1; $filter <= $numfilters; $filter++ )
+    {
+       $melspec[$filter-1] = 0;
+
+       # Frequency indices and filter gains for this filter
+       my @indices = @{$rfilters->[$filter]{FILTIDX}};
+       my @gains = @{$rfilters->[$filter]{FILTGAIN}};
+
+       for( $idx = 0; $idx <= $#indices; $idx++ )
+       {
+           my $frqidx = $indices[$idx];
+           my $gain = $gains[$idx];
+
+           $melspec[$filter-1] +=  $gain * $rdftpwr->[$frqidx];
+       }
+
+       $melspec[$filter-1] = log( $melspec[$filter-1] ) / log(10);
+    }
+
+    return @melspec;
+}
+
+
+#-------------------------------------------------------------------------------------
+# dct_transform
+
+# Define the dct transform for the TIesr cepstral processing
+#-----------------------------
+sub dct_transform
+{
+    my $numcepstra = shift @_;
+    my $numfilters = shift @_;
+
+    my (  $cidx, $fidx );
+    my $rdct;
+    my $pi = atan2(1,1)*4;
+    for( $cidx = 0; $cidx < $numcepstra; $cidx++ )
+    {
+       for( $fidx = 0; $fidx < $numfilters; $fidx++  )
+       {
+           $rdct->[$cidx][$fidx] = cos( $pi*$cidx*($fidx+0.5)/$numfilters );
+       }
+    }
+
+    return $rdct;
+}
+
+
+#----------------------------------------------------------------------------
+# transform
+
+# transform the mel spectrum  vector by the dct matrix.
+#-------------------
+sub transform
+{
+    my $rdata = shift @_;
+    my $rdct = shift @_;
+
+    # Check that dimensions of matrix-vector multiply aggree
+    if( scalar @$rdata != scalar @{$rdct->[0]} ) 
+    {
+       die "sample_to_htk: Transform size mismatch\n";
+    }
+
+    my ( $cidx, $fidx );
+    my @cepstrum;
+
+
+    # Perform simple matrix-vector multiply. Should use fast DCT
+    # if one is available.
+    for( $cidx = 0; $cidx <= $#{$rdct}; $cidx++ )
+    {
+       my $cep = 0;
+       for( $fidx = 0; $fidx <= $#{$rdct->[0]}; $fidx++ )
+       {
+           $cep += $rdct->[$cidx][$fidx] * $$rdata[$fidx];
+       }
+       push @cepstrum, $cep;
+    }
+
+    return @cepstrum;
+}
diff --git a/TIesr_Tools/tiesr_jac_convert.pl b/TIesr_Tools/tiesr_jac_convert.pl
new file mode 100755 (executable)
index 0000000..81b1e3a
--- /dev/null
@@ -0,0 +1,487 @@
+#!/usr/local/bin/perl
+#---------------------------------------------------------------- 
+# tiesr_jac_convert.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+tiesr_jac_convert [-Help] [-SVA] [-WSVA] [-SBC] [-ORM] [-CNF] 
+   [-d] [-inshort shortbytes] [-inlong longbytes] 
+   [-outshort shortbytes] [-outlong longbytes] [-L] [-o outfile] jac_file";
+
+
+$DOCUMENTATION = " 
+
+This perl script is used to convert a given tiesr JAC file into little- or
+big-endian format.  The user may optionally output the information
+in text form on stdout using the -d option.  The -Help option outputs
+this help information. 
+
+This tool automatically determines whether the input jac_file is in
+little or big endian format.  However, some data in the TIesr JAC file
+is stored as short, and some stored as long.  The sizes of these may
+be different on different machines.  The sizes in the input JAC file
+can be specified using -inshort and -inlong options.  If not
+specified, they are assumed to be 2 and 4 respectively. The sizes in
+the output file can be specified by the -outshort and -outlong
+options.  Use care because if the correct sizes are not specified, then the
+output will not be correct.
+
+Options are required to specify the information in the jac file.
+These must be set if the input jac file contains the respective
+information.
+
+-SVA : jac file contains SVA information
+-WSVA: jac file contains Weighted SVA information (implies SVA)
+-SBC: jac file contains SBC information
+-ORM: jac file contains ORM data
+-CNF: jac file contains confidence information
+
+If the -o option is not specified, then no jac file will be output.
+This allows one to just view the contents of the jac file using the -d
+option.  To specify little-endian output use -L, otherwise, big-endian
+output is assumed.";
+
+#----------------------------------------------------------------
+
+use Getopt::Long;
+
+# Global variables used by the script
+
+# Scaling for mfcc mean and variance, up to 16 dimensions.  
+$CM_NBR_BETA = 3;
+
+# read mmf files and a file containing a list of hmms to load
+GetOptions('Help' => \$outdoc,
+          'SVA' => \$SVA,
+          'WSVA' => \$WSVA,
+          'SBC' => \$SBC,
+          'ORM' => \$ORM,
+          'CNF' => \$CNF,
+          'L'   => \$LITTLEENDIAN,
+          'd'   => \$DISPLAY,
+          'o=s'  => \$outfile,
+          'inshort=i' => \$inshort,
+          'inlong=i' => \$inlong,
+          'outshort=i' => \$outshort,
+          'outlong=i'=> \$outlong
+          );
+
+
+# Output only the documentation if requested
+
+if( $outdoc )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+if( ! defined $ARGV[0] )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+
+# Set short and long sizes
+$inshort = 2 if ! $inshort;
+$inlong = 4 if ! $inlong;
+
+$outshort = 2 if ! $outshort;
+$outlong = 4 if ! $outlong;
+
+
+# Open the jac input file for reading
+open( JAC, "<$ARGV[0]" ) or die "Can not open JAC file\n";
+
+if( defined $outfile )
+{
+    open(OUT, ">$outfile") or die "Can not open $outfile\n";
+}
+
+
+# Determine packing type based on n_filter parameter in JAC file
+# This assumes n_filters < 256 which should always be true.
+read( JAC, $buf, 1 );
+$jacle = ( unpack( "C", $buf ) != 0 )  ?  1 : 0;
+seek JAC, 0, 0;
+
+# Determine machine packing type
+$tmp = unpack( "s", pack( "v", 0x1234) );
+$machle = ($tmp == 0x1234);
+undef $tmp;
+
+
+# Get basic parameters
+&get_basic;
+
+&get_sva if( defined $SVA or defined $WSVA );
+
+&get_wsva if( defined $WSVA );
+
+&get_sbc if( defined $SBC );
+
+&get_orm if( defined $ORM );
+
+&get_conf if(defined $CNF );
+
+close( JAC );
+
+close( OUT) if( defined $outfile );
+
+exit;
+
+
+
+#----------------------------------------------------------------
+# get basic JAC parameters: n_filter, nbr_dim, log_H and accum
+#
+sub get_basic
+{
+    ($n_filter, $nbr_dim) = get_values( \*JAC, $inshort, 0, 2);
+
+    @log_H = get_values( \*JAC, $inshort, 1, $n_filter );
+
+    @accum = get_values( \*JAC, $inlong, 1, 2*$n_filter );
+
+    # Display values if requested
+    if( defined $DISPLAY )
+    {
+       print "BASIC JAC PARAMETERS:\n";
+        print "n_filter: ", $n_filter, "\n";
+       print " nbr_dim: ", $nbr_dim, "\n";
+
+       print "   log_H: ";
+       print_array(@log_H);
+
+       print "   accum: ";
+       print_array( @accum );
+    }
+
+    # Output values to file in proper order if requested
+    if( defined $outfile )
+    {
+       put_values( \*OUT, $outshort, 0, $n_filter, $nbr_dim  );
+       put_values( \*OUT, $outshort, 1, @log_H );
+       put_values( \*OUT, $outlong, 1, @accum );
+    }
+
+    return;
+}
+
+#----------------------------------------------------------------
+# Get SVA parameters: log_var_rho, var_fisher_IM
+#
+sub get_sva
+{
+    @log_var_rho = get_values( \*JAC, $inshort, 1, $nbr_dim );
+
+    @var_fisher_IM = get_values( \*JAC, $inlong, 1, $nbr_dim );
+
+    if( defined $DISPLAY)
+    {
+       print "\nSVA PARAMETERS:\n";
+       print "log_var_rho: ";
+       print_array(@log_var_rho);
+
+       print "var_fisher_IM: ";
+       print_array(@var_fisher_IM);
+    }
+
+    if( defined $outfile )
+    {
+       put_values( \*OUT, $outshort, 1, @log_var_rho );
+       put_values( \*OUT, $outlong, 1, @var_fisher_IM );
+    }
+
+    return;
+}
+
+
+#----------------------------------------------------------------
+# Get WSVA parameter noise_lvl
+#
+sub get_wsva
+{
+    ($noise_lvl) = get_values( \*JAC, $inshort, 1, 1 );
+
+    if( defined $DISPLAY)
+    {
+       print "\nWSVA PARAMETERS:\n";
+       print "noise_lvl: $noise_lvl\n";
+    }
+
+    if( defined $outfile )
+    {
+       put_values( \*OUT, $outshort, 1, $noise_lvl );
+    }      
+
+    return;
+}
+
+#----------------------------------------------------------------
+# Get SBC parameters
+#
+sub get_sbc
+{
+    ($n_utt, $n_nodes, $hlr_TRANSFORM_SIZE) = get_values( \*JAC, $inshort, 0, 3 );
+
+    for( $nd = 0; $nd < $n_nodes; $nd++ )
+    {
+       ($vector_count[$nd]) = get_values( \*JAC, $inshort, 0, 1 );
+       ($parent_node[$nd]) = get_values( \*JAC, $inshort, 1, 1 );
+       $dif1[$nd] = [ get_values( \*JAC, $inlong, 1, $hlr_TRANSFORM_SIZE ) ];
+       $dif2[$nd] = [ get_values( \*JAC, $inlong, 1, $hlr_TRANSFORM_SIZE ) ];
+       $p_trans[$nd] = [ get_values( \*JAC, $inshort, 1, $hlr_TRANSFORM_SIZE ) ];
+    }
+
+    ($n_monophones ) = get_values( \*JAC, $inshort, 0, 1 );
+    @hlr_Terminal = get_values( \*JAC, $inshort, 0, $n_monophones );
+    @hlrTransformIndex = get_values( \*JAC, $inshort, 0, $n_nodes );
+    @hlrTransforms = get_values( \*JAC, $inshort, 1, $n_nodes*$hlr_TRANSFORM_SIZE );
+
+    if( defined $DISPLAY )
+    {
+       print "\nSBC PARAMETERS\n";
+       print "n_utt: $n_utt\n";
+       print "n_nodes: $n_nodes\n";
+       print "hlr_TRANSFORM_SIZE: $hlr_TRANSFORM_SIZE\n";
+       
+       for( $nd = 0; $nd < $n_nodes; $nd++ )
+       {
+           print "vector_count[$nd]: $vector_count[$nd]\n";
+
+           $pn = ($parent_node[$nd]>>8 ) & 0xff;
+           print "parent_node[$nd]: $pn\n";
+
+           $ti = $parent_node[$nd] & 0xff;
+           print "transform_index[$nd]: $ti\n";
+
+           print "dif1[$nd]: ";
+           print_array( @{ $dif1[$nd] } );
+
+           print "dif2[$nd]: ";
+           print_array( @{ $dif2[$nd] } );
+
+           print "p_trans[$nd]: ";
+           print_array( @{ $p_trans[$nd] } );
+       }
+
+       print "n_monophones: $n_monophones\n";
+
+       print "hlr_Terminal: ";
+       print_array( @hlr_Terminal );
+       
+       print "hlrTransformIndex: ";
+       print_array( @hlrTransformIndex );
+
+       
+       for( $nd = 0; $nd < $n_nodes; $nd++ )
+       {
+           print "hlrTransforms[$nd]: ";
+           print_array( @hlrTransforms[ $nd*$hlr_TRANSFORM_SIZE .. ($nd+1)*$hlr_TRANSFORM_SIZE -1 ] );
+       }
+    }
+
+
+    if( defined $outfile )
+    {
+       put_values( \*OUT, $outshort, 0,  $n_utt, $n_nodes, $hlr_TRANSFORM_SIZE );
+
+       for( $nd = 0; $nd < $n_nodes; $nd++ )
+       {
+           put_values( \*OUT, $outshort, 0,  $vector_count[$nd] );
+
+           put_values( \*OUT, $outshort, 1,  $parent_node[$nd] );
+           
+           put_values( \*OUT, $outlong, 1, @{ $dif1[$nd] } );
+
+           put_values( \*OUT, $outlong, 1, @{ $dif2[$nd] } );
+
+           put_values( \*OUT, $outshort, 1, @{ $p_trans[$nd] } );
+       }           
+
+       put_values( \*OUT, $outshort, 0, $n_monophones );
+
+       put_values( \*OUT, $outshort, 0, @hlr_Terminal );
+
+       put_values( \*OUT, $outshort, 0, @hlrTransformIndex );
+
+       put_values( \*OUT, $outshort, 1, @hlrTransforms );
+    }      
+}
+
+
+#----------------------------------------------------------------
+# Get ORM parameters
+#
+sub get_orm
+{
+    ($inum_prior) = get_values( \*JAC, $inshort, 1, 1);
+
+    @iprior = get_values( \*JAC, $inshort, 1, $inum_prior ); 
+    @pprior = get_values( \*JAC, $inshort, 1, $inum_prior ); 
+
+    if( defined $DISPLAY )
+    {
+       print "\nORM PARAMETERS:\n";
+       print "inum_prior: $inum_prior\n";
+       
+       print "iprior: ";
+       print_array( @iprior );
+
+       print "pprior: ";
+       print_array( @pprior );
+    }  
+
+    if( defined $outfile )
+    {
+       put_values( \*OUT, $outshort, 1, $inum_prior );
+
+       put_values( \*OUT, $outshort, 1, @iprior );
+
+       put_values( \*OUT, $outshort, 1, @pprior );
+    }
+}
+
+
+#----------------------------------------------------------------
+# Get confidence parameters
+#
+sub get_conf
+{
+
+    ($h0mean, $h0inv, $h0gconst ) = get_values( \*JAC, $inshort, 1, 3 );
+    ($h1mean, $h1inv, $h1gconst ) = get_values( \*JAC, $inshort, 1, 3 );
+    ( $nsnr ) = get_values( \*JAC, $inshort, 1, 1 );
+
+    @lgBeta = get_values( \*JAC, $inshort, 1, $CM_NBR_BETA );
+    @acc_dif2_beta = get_values( \*JAC, $inlong, 1, $CM_NBR_BETA );
+
+    if( defined $DISPLAY )
+    {
+       print "\nCONFIDENCE PARAMETERS\n";
+       print "H0_mean: $h0mean\n";
+       print "H0inv: $h0inv\n";
+       print "H0gconst: $h0gconst\n";
+       print "H1_mean: $h1mean\n";
+       print "H1inv: $h1inv\n";
+       print "H1gconst: $h1gconst\n";
+
+       print "NSNR: $nsnr\n";
+
+       print "lgBeta:";
+       print_array( @lgBeta );
+
+       print "acc_dif2_beta:";
+       print_array( @acc_dif2_beta );
+    }
+
+
+    if( defined $outfile )
+    {
+       put_values( \*OUT, $outshort, 1, $h0mean, $h0inv, $h0gconst );
+
+       put_values( \*OUT, $outshort, 1, $h1mean, $h1inv, $h1gconst );
+
+       put_values( \*OUT, $outshort, 1, $nsnr );
+
+       put_values( \*OUT, $outshort, 1, @lgBeta );
+
+       put_values( \*OUT, $outlong, 1, @acc_dif2_beta );
+    }      
+}
+
+
+#----------------------------------------------------------------
+# Get little/big endian short/long signed/unsigned integer values
+# $le specifes little-endian order in file.  $intsize is the size of 
+# the integers in bytes. $sign is a flag indicating signed or unsigned. 
+#
+sub get_values
+{
+    my $file = shift(@_);
+    my $intsize = shift(@_);
+    my $signed = shift(@_);
+    my $num = shift(@_);
+    
+    my $buf;
+    my @intval;
+    
+    my $doreverse = ( $jacle != $machle );
+
+
+    read( $file, $buf, $num*$intsize );
+
+    $utype = "S" if $intsize == 2;
+    $utype = "L" if $intsize == 4;
+    $utype = "Q" if $intsize == 8;
+
+
+    @intval = unpack "${utype}*", $buf;
+  
+    foreach $val ( @intval )
+    {
+       if( $doreverse )
+       {
+           my $tmp, @tmp;
+           $tmp = pack( $utype, $val );
+           @tmp = unpack( "C$intsize", $tmp);
+           @tmp = reverse(@tmp);
+           $tmp = pack( "C$intsize", @tmp );
+           $val = unpack( $utype, $tmp );
+       }
+
+       $val = unpack(  lc($utype), pack( $utype, $val ) ) if $signed;
+    }
+
+
+    return @intval;
+}
+
+
+sub print_array
+{
+    foreach $val (@_)
+    {
+       print "$val ";
+    }
+    print "\n";
+}
+
+
+sub put_values
+{
+    my ($file, $size, $signed, @vals) = @_;
+
+    my ( $utype, $type );
+    $utype = "S" if $size == 2;
+    $utype = "L" if $size == 4;
+    $utype = "Q" if $size == 8;
+
+    my $type =  $signed ?  lc( $utype ) : $utype;
+
+
+    my $doswap = ( ( $LITTLEENDIAN && ! $machle ) or 
+               ( ! $LITTLEENDIAN && $machle ) );
+
+
+    for $val ( @vals )
+    {
+       if( $doswap )
+       {
+           my ( $tmp, @tmp );
+           $tmp = pack( $type, $val );
+           @tmp = unpack( "C$size", $tmp);
+           @tmp = reverse(@tmp);
+           $tmp = pack( "C$size", @tmp );
+           $val = unpack( $type, $tmp );
+       }
+           
+       print $file pack( $type, $val );
+    }
+}
diff --git a/TIesr_Tools/tiesr_model_convert.pl b/TIesr_Tools/tiesr_model_convert.pl
new file mode 100755 (executable)
index 0000000..fb7489b
--- /dev/null
@@ -0,0 +1,277 @@
+#!/usr/local/bin/perl
+#---------------------------------------------------------------- 
+# tiesr_model_convert.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+tiesr_model_convert [-Help] [-m modeldir] [-o outdir] [-l] [-bmean] [-bvar]
+      [-d] [-hmm] [-pdf] [-trans] [-mean] [-var] [-gconst] [-cluster] [-centroid]";
+
+
+$DOCUMENTATION = " 
+
+This perl script converts a tiesr fixed point model set to big or
+little endian.  It also provides for output of the information about the model
+set to stdout so that the model contents can be examined if the -d option is
+provided.  Models are assumed to hold static and delta cepstral features. When
+-d is specified, additional details of the model set can be requested using the
+following options:
+
+-hmm for hmm transition and state pdf index info
+-pdf for pdf gaussian weight, mean index and var index info
+-trans for transition matrix info
+-mean for mean vector output
+-var for var vector output
+-gconst for gconst data output
+-cluster for cluster indices of all Gaussian mean vectors
+-centroid for cluster centroid vectors
+
+For model output, the -l option requests little endian output. The -bmean option
+requests byte mean output, and the -bvar requests byte variance output.
+
+All numeric display data is in 16 bit short format.  If the model means and/or
+variances are stored in bytes, then unpacking has been done to display
+the values in the proper short format.
+";
+
+#----------------------------------------------------------------
+
+use Getopt::Long;
+
+use File::Basename;
+
+use TIesrModel();
+
+
+# read options
+GetOptions('Help' => \$outdoc,
+          'l' => \$LITTLEENDIAN,
+          'bmean' => \$bytemean,
+          'bvar' => \$bytevar,
+          'd' => \$showdata,
+          'hmm' => \$showhmm,
+          'pdf' => \$showpdf,
+          'trans' => \$showtrans,
+          'mean' => \$showmean,
+          'var' => \$showvar,
+          'gconst' => \$showgconst,
+          'centroid' => \$showcentroid,
+          'cluster' => \$showcluster,
+          'm=s' => \$modeldir,
+          'o=s' => \$outdir,
+          'h=s' => \$hmmlist );
+
+
+# Output only the documentation if requested
+
+if( $outdoc )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+( -d $modeldir ) or die "Invalid model directory $modeldir\n";
+
+
+
+# Create a new model set object
+$models = TIesrModel->new();
+
+# Parse the models
+$models->parse( $modeldir, $hmmlist );
+
+show_data() if $showdata;
+
+if( $outdir )
+{
+    $models->output( $outdir, $bytemean, $bytevar, $LITTLEENDIAN );
+}
+
+
+#----------------------------------------------------------------
+#  show_data
+
+#  show requested data from models
+#----------------------------------------------------------------
+sub show_data
+{
+    print "Model data for $modeldir\n\n";
+
+    printf "Number of words in grammar: %d\n", scalar( @{$models->{WORDS}} );
+    print "Number of HMMs: $models->{NUMHMMS}\n";
+    printf "Number of PDFs: %d\n", scalar( @{$models->{PDF}} );
+    printf "Number of Transition matrices: %d\n", scalar( @{$models->{TRANS}} );
+    print "Number of mean vectors: $models->{NUMMEANS}\n";
+
+    print "Number of clusters: $models->{NUMCLUSTERS}\n" 
+       if exists $models->{NUMCLUSTERS};
+
+    print "Number of variance vectors: $models->{NUMVARS}\n";
+    printf "Feature dimension (static+delta): %d\n", 2*$models->{DIM};
+
+
+    if( $showhmm )
+    {
+       print "\n\nHMM information:\n";
+       $index = 0;
+       printf "%5s   %15s   %5s  %5s\n", "Num", "Name", "Trans", "PDFs";
+       foreach $hmm ( @{$models->{HMM}} )
+       {
+           printf "%5d  (%15s)  %5d", $index, $hmm->{NAME}, $hmm->{TRANS};
+
+           foreach $pdfidx ( @{$hmm->{PDF}} )
+           {
+               printf "  %5d", $pdfidx;
+           }
+           print "\n";
+           $index++;
+       }
+    }
+
+
+    if( $showpdf )
+    {
+       print "\n\nPDF information:\n";
+       $index = 0;
+       printf "%5s  %9s  %6s  %5s  %5s  \n", "Num", "Gaussians", "Wgt", "Mean", "Var";
+       foreach $pdf ( @{$models->{PDF}} )
+       {
+           printf "%5d  %9d  ", $index, $pdf->{NUMGAUSS};
+           $ngauss = 0;
+           foreach $gauss ( @{$pdf->{GAUSS}} )
+           {
+               print "                  " if $ngauss != 0;
+               printf "%6d  %5d  %5d\n", $gauss->{WGT}, $gauss->{MEAN}, $gauss->{VAR};
+               $ngauss++;
+           }
+           $index++;
+       }
+    }
+
+
+    if( $showtrans )
+    {
+       print "\n\nTRANS information:\n";
+       $index = 0;
+
+       printf "%5s  %6s  %6s\n", "Num", "States", "Entry";
+       foreach $trans ( @{$models->{TRANS}} )
+       {
+           $nstates = $trans->{NUMSTATES};
+           printf "%5d  %6d", $index, $nstates;
+
+           # Entry probabilities
+           foreach $lprob ( @{$trans->{ENTRY}} )
+           {
+               printf "  %6d", $lprob;
+           }
+           print "\n";
+
+           #Transition probabilities from all emitting states
+           for $state (0 .. $nstates-2)
+           {
+               printf "  Trn from state %2d:", $state;
+               $lprobs = $trans->{TRANS}[$state];
+               foreach $lprob ( @{$lprobs} )
+               {
+                   printf "  %6d", $lprob;
+               }
+               print "\n";
+           }
+           print "\n";
+           $index++;
+       }
+    }
+
+    if( $showmean )
+    {
+       print "\n\nMean vectors:\n";
+       printf "%6s\n", "Num";
+       
+       $index = 0;
+       foreach $vec (@{$models->{MEANS}} )
+       {
+           printf "%5d:", $index;
+           foreach $val ( @{$vec} )
+           {
+               printf "  %6d", $val;
+           }
+           print "\n";
+           $index++;
+       }
+    }
+    
+
+    if( $showvar )
+    {
+       print "\n\nVariance vectors:\n";
+       printf "%6s\n", "Num";
+       
+       $index = 0;
+       foreach $vec (@{$models->{VARS}} )
+       {
+           printf "%5d:", $index;
+           foreach $val ( @{$vec} )
+           {
+               printf "  %6d", $val;
+           }
+           print "\n";
+           $index++;
+       }
+    }
+
+
+    if( $showgconst )
+    {
+       print "\n\nGconst values:\n";
+
+       $index = 0;
+       foreach $gconst (@{$models->{GCONST}} )
+       {
+           printf "  %5d", $gconst;
+           print "\n" if( $index%10 == 9 );
+           $index++;
+       }
+       print "\n";
+    }
+
+
+    if( $showcluster )
+    {
+       print "\n\nCluster indices:\n";
+       printf "%7s", "Num";
+
+       $index = 0;
+       foreach $class ( @{ $models->{CLUSTER} } )
+       {
+           printf "\n%6d:", $index if( $index%10 == 0 );
+           printf "%6d", $class;
+           $index++;
+       }
+       print "\n"
+    }
+
+
+    if( $showcentroid )
+    {
+       print "\n\nCluster centroid vectors:\n";
+       printf "%6s\n", "Num";
+       
+       $index = 0;
+       foreach $vec (@{ $models->{CENTROID} } )
+       {
+           printf "%5d:", $index;
+           foreach $val ( @{$vec} )
+           {
+               printf "  %6d", $val;
+           }
+           print "\n";
+           $index++;
+       }
+    }
+}
+
diff --git a/TIesr_Tools/tiesr_net_convert.pl b/TIesr_Tools/tiesr_net_convert.pl
new file mode 100755 (executable)
index 0000000..748c78c
--- /dev/null
@@ -0,0 +1,165 @@
+#!/usr/local/bin/perl
+#---------------------------------------------------------------- 
+# tiesr_net_convert.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+tiesr_net_convert [-Help] [-d] [-h hmmlist | -p phnlist] [-o outfile] [-l] net_bin_file
+
+";
+
+
+$DOCUMENTATION = " 
+
+This perl script converts a net.bin file to big endian or little endian.
+If the -d option is used, it  provides for output of the information in
+the TIesr net.bin file so that the grammar network contents can be examined.
+If no -o option is given, no file is output.
+
+If a text file containing the ordered hmm list of all hmms used in the
+grammar is available, which should be the case when models are created
+using model2bin, then the -h option can be used to output names with
+each hmm symbol when the -d option is specified.
+
+If only the dictionary phone list is available, such as when TIesrFlex is
+used to create the grammar network, then specify the phone list using
+the  -p option.  In this case the hmm2phone.bin file must be in the same
+directory as the net.bin file, and will be used to index from HMM to monophone.
+
+If the net file is in a directory that contains the word.lis file, then
+the word information will automatically be output with the -d option.
+
+";
+
+#----------------------------------------------------------------
+
+use Getopt::Long;
+
+use File::Basename;
+
+use TIesrNet;
+
+# read options
+GetOptions('Help' => \$outdoc,
+          'l' => \$littleendian,
+          'd' => \$showdata,
+          'h=s' => \$hmmfile,
+          'p=s' => \$phonefile,
+          'o=s' => \$outfile );
+
+
+# Output only the documentation if requested
+
+if( $outdoc )
+{
+    print "$USAGE\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+if( ! defined $ARGV[0] )
+{
+    print "$USAGE\n";
+    exit 1;
+}
+
+
+# Read the list of words from word.lis file
+if( defined $showdata )
+{
+    $wordfile = dirname( $ARGV[0] );
+    $wordfile .= "/word.lis";
+}
+
+
+if( defined $hmmfile or defined $phonefile )
+{
+    $hmm2phonefile = dirname( $ARGV[0] );
+    $hmm2phonefile .= "/hmm2phone.bin";
+}
+
+# Create a net structure
+$net = TIesrNet->new();
+
+# Parse the network supplied
+if( defined $hmmfile )
+{
+    $net->parsenet( $ARGV[0], $wordfile, $hmmfile, $hmm2phonefile, 0 );
+}
+elsif( defined $phonefile )
+{
+    $net->parsenet( $ARGV[0], $wordfile, $phonefile, $hmm2phonefile, 1 );
+}
+else
+{
+    $net->parsenet( $ARGV[0], $wordfile );
+}
+
+
+# Show all grammar network data if requested
+if( $showdata )
+{
+    # Show header info
+    print "Number of HMMs in network: ", $net->{NUMHMMS}, "\n";
+    print "Number of symbols in network: ", $net->{NUMSYMS}, "\n";
+    print "Number of words in network: ", $net->{NUMWORDS}, "\n";
+    print "Number of HMM sets: ", $net->{NUMSETS}, "\n";
+    print "Number of HMMs per set: ", $net->{NUMPERSET}, "\n";
+
+    # Show start symbols
+    $numsyms =  scalar( @{$net->{STARTSYMS}} );
+    print "\n\nStart Symbols: ", $numsyms, "\n";
+    for( $sym=0; $sym<$numsyms; $sym++ )
+    {
+       printf "%5d ", $net->{STARTSYMS}[$sym];
+
+       # format 10 symbols per line
+       print "\n" if( $sym > 0 and $sym < $numsyms-1 and ($sym+1) % 10 == 0 );
+    }
+    print "\n";
+
+    # Show end symbols
+    $numsyms =  scalar( @{$net->{ENDSYMS}} );
+    print "\n\nEnd Symbols: ", $numsyms, "\n";
+    for( $sym=0; $sym<$numsyms; $sym++ )
+    {
+       printf "%5d ", $net->{ENDSYMS}[$sym];
+
+       # format 10 symbols per line
+       print "\n" if( $sym > 0 and $sym < $numsyms-1 and ($sym+1) % 10 == 0 );
+    }
+    print "\n";
+
+
+    # Show all symbol info
+    print "\n\nSymbol Information\n";
+    $numsyms =  scalar( @{$net->{SYMBOLS}} );
+    for( $sym=0; $sym<$numsyms; $sym++ )
+    {
+       $r_sym = $net->{SYMBOLS}[$sym];
+       print "\nSymbol: $sym  HMM index: $r_sym->{HMMCODE}";
+       print "($r_sym->{HMMNAME})" if defined $r_sym->{HMMNAME};
+       print "  Number transitions: $r_sym->{NUMTRANS}";
+       print "  Word: $r_sym->{WORDINDEX}" if $r_sym->{WORDSYM};
+       print "($r_sym->{WORDNAME})" if defined $r_sym->{WORDNAME};
+       print "\n";
+       $numtrans = $r_sym->{NUMTRANS};
+       for( $trn=0; $trn < $numtrans; $trn++ )
+       {
+           printf "%5d ", $r_sym->{TRANS}[$trn];
+
+           # format 10 symbols per line
+           print "\n" if( $trn > 0 and $trn < ($numtrans-1)  and ($trn+1) % 10 == 0 );
+       }
+       print "\n";
+    }
+}
+
+
+if( $outfile )
+{
+  $net->output( $outfile, $littleendian );
+}
diff --git a/TIesr_Tools/train_trees.pl b/TIesr_Tools/train_trees.pl
new file mode 100755 (executable)
index 0000000..81234d6
--- /dev/null
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+#---------------------------------------------------------------
+#  train_trees.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+train_trees -Help -D datadir -CF  conflevel";
+
+
+$DOCUMENTATION = "
+This script builds decision trees for the letter data created using
+ttp_dict_to_trees.pl.  The -D option specifies the directory that holds the
+*.names and *.data files. The -CF option is the % confidence level parameter
+(1-99) used by c4.5 to reduce the size of a decision tree by eliminating
+branches of the tree. Smaller percentages remove more detailed branches, but
+this may result in inaccurate trees. Larger values eliminate fewer branches, but
+may result in many meaningless divisions of the tree due to overtraining.";
+
+#---------------------------------------------------------------
+
+use Getopt::Long;
+
+GetOptions( "Help" => \$help,
+           "D=s" => \$datadir,
+           "CF=i" => \$conflevel );
+
+
+if( $help )
+{
+    print "$USAGE\n\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+die "train_trees: Invalid directory $datadir\n" if ! -d $datadir;
+
+die "train_trees: Invalid confidence level $conflevel\n" 
+    unless ( $conflevel > 0 and $conflevel <= 100 );
+
+
+
+# Process each letter data file in working directory
+foreach $fstem ( glob( "$datadir/*.data" ) )
+{
+    $fstem =~ s/\.data\s*$//;
+
+    $letter = substr ($fstem, -1, 1);
+    
+    print "Training tree for letter: $letter\n";
+
+    $cmd = "c4.5  -f $fstem -c $conflevel > ${fstem}.CF${conflevel}log";
+
+    system( $cmd ) == 0 or die "train_trees: Could not run c4.5 on $fstem\n";
+}
diff --git a/TIesr_Tools/ttp_dict_tree_data.pl b/TIesr_Tools/ttp_dict_tree_data.pl
new file mode 100755 (executable)
index 0000000..ba6912f
--- /dev/null
@@ -0,0 +1,433 @@
+#!/usr/bin/perl
+#----------------------------------------------------------------
+#  ttp_dict_tree_data.pl
+
+#  Copyright (C) 2010 Texas Instruments Incorporated -  http://www.ti.com/ 
+#  ALL RIGHTS RESERVED
+
+
+$USAGE = "
+ttp_dict_tree_data [-Help] -d dictfile [ -L letterleft -R letterright ]
+                   [-p phonefile -pL phoneleft -pR phone right ]
+                   [-o outdir -w workdir ]";
+
+
+$DOCUMENTATION = "
+This script accepts as input the letter-to-phone mapping dictionary,
+and creates the .names and .data files for each letter found in the
+dictionary. The .names and .data files will be used by the C4.5
+decision tree training program to make decision trees for each
+letter. The -d option specifies the location of the letter-to-phone
+mapping dictionary file. The -L option specifies how many letter
+attributes to the left should be generated (default 4). The -R option
+specifies how many letter attributes to the right should be generated
+(default 4). The -p file specifies the name of the phone label
+file. The -pL specifies how many phone attributes to the left should
+be generated (default 0). The -pR specifies how many phone attributes
+to the right should be generated (default 0). The -o option specifies
+the output directory, and the -w option specifies a working
+directory. ";
+
+#----------------------------------------------------------------
+
+use Getopt::Long;
+
+use File::Copy;
+
+
+GetOptions( "Help" => \$help,
+           "d=s" => \$dictfile,
+           "L=i" => \$numleftcxt,
+           "R=i" => \$numrightcxt,
+           "p=s" => \$phnlblfile,
+           "pL=i" => \$numlblleftcxt,
+           "pR=i" => \$numlblrightcxt,
+           "o=s" => \$outdir,
+           "w=s" => \$workdir
+           );
+
+
+if( $help )
+{
+    print "$USAGE\n\n";
+    print "$DOCUMENTATION\n";
+    exit 1;
+}
+
+# Assign defaults
+$numleftcxt = 4 unless defined( $numleftcxt );
+$numrightcxt = 4 unless defined( $numrightcxt );
+
+$numlblleftcxt = 0 unless defined( $numlblleftcxt );
+$numlblrightcxt = 0 unless defined( $numlblrightcxt );
+
+$outdir = "." unless defined( $outdir );
+$workdir = "." unless defined( $workdir );
+
+
+# $dictfile must exist. $phnclsfile must exist if using phone attributes.
+if( ! -f $dictfile ||
+    ( ! -f $phnlblfile && 
+      ($numlblleftcxt > 0 || $numlblrightcxt > 0 ) )  )
+{
+    print "$USAGE\n\n";
+    print "$DOCUMENTATION\n";
+
+    die "ttp_dict_tree_data: Invalid input\n";
+}
+
+
+# Read in the phone label matrix
+if( $numlblleftcxt > 0 || $numlblrightcxt > 0 )
+{
+    open( LBL, "<$phnlblfile" ) or die "ttp_dict_tree_data: Could not open $phnlblfile\n";
+    
+    $numphnlbl = 0;
+    while( $lin = <LBL> )
+    {
+       chomp $lin;
+
+       @el = split( /\s+/, $lin );
+
+       # phone name
+       $phn = shift @el;
+
+       # phone values for the labels
+       $phnlbls{$phn} = [@el];
+
+       # number of phone labels
+       $numphnlbls = scalar(@el) unless $numphnlbls > scalar(@el);
+
+
+       # hash of phone label values for each phone label
+       # and for all labels
+       for( $lbl = 0; $lbl <= $#el; $lbl++ )
+       {
+           $lblvals[$lbl]{ $el[$lbl] } = 1;
+           $alllblvals{ $el[$lbl] } = 1;
+       }
+    }
+
+    close( LBL );
+    $dophnlbl = 1;
+
+
+    # Create TIESR phone label value file
+    $phnlblfile = "${outdir}/onewphone.list";
+    open( LBL, ">$phnlblfile" ) or die "ttp_dict_tree_data: Could not open $phnlblfile\n";
+    foreach $phn ( sort( keys( %phnlbls ) ) )
+    {
+       print LBL "$phn ", join( " ", @{$phnlbls{$phn}} ), "\n";
+    }
+    close( LBL );
+}
+
+
+# Create the TIesr decision tree attribute name listing file.
+$attnames = $outdir . "/cAttType.txt";
+open( TYP, ">$attnames" ) or die "ttp_dict_tree_data: Could not open $attnames\n";
+
+# Letter left context
+for( $cxt = $numleftcxt; $cxt > 0; $cxt-- )
+{
+    print TYP "L$cxt\n";
+}
+
+# Letter right context
+for( $cxt = 1; $cxt <= $numrightcxt; $cxt++ )
+{
+    print TYP "R$cxt\n";
+}
+
+if( $dophnlbl )
+{
+    # For each phone label
+    for( $plbl = 1; $plbl <= $numphnlbls; $plbl++ )
+    {
+       
+       # Left phone class label context
+       for( $cxt = $numlblleftcxt; $cxt > 0; $cxt-- )
+       {
+           print TYP "P${plbl}L$cxt\n";
+       }
+       
+       # Right phone class label context
+       for( $cxt = 1; $cxt <= $numlblrightcxt; $cxt++ )
+       {
+           print TYP "P${plbl}R$cxt\n";
+       }
+    }
+}
+
+close( TYP );
+
+
+# Parse the dictionary into tree data files and gather
+# letter to phone mappings.
+open( DICT, "<$dictfile" ) or die "ttp_dict_tree_data: Could not open $dictfile\n";
+
+%ltpmap = ();
+%lethash = ();
+
+while( $lin = <DICT> )
+{
+    chomp $lin;
+
+    parse_dict_line( $lin, $workdir );
+}
+close( DICT );
+
+
+# Output the C4.5 name files for each letter encountered in the 
+# dictionary
+output_names_files( $workdir );
+
+
+# Create the attribute values file. This includes both the letter
+# values and the phone label values that can be assigned.
+$attvalues = $outdir . "/cAttValue.txt";
+open( VAL, ">$attvalues" ) or die "ttp_dict_tree_data: Could not open $attvalues\n";
+
+foreach $let ( sort keys %lethash )
+{
+    print VAL "$let\n";
+}
+foreach $val ( sort keys %alllblvals )
+{
+    print VAL "$val\n";
+}
+
+# The default no-attribute label
+print VAL "NO_ATTRIBUTE\n" if ! exists( $alllblvals{ "NO_ATTRIBUTE" } );
+
+close( VAL );
+
+
+#-------------------------------------------------------------
+sub parse_dict_line
+{
+
+    my( $lin, $workdir) = @_;
+
+
+    # Extract word, pseudo-phones making up the word, and
+    # letters in the word
+    my( @wdphones ) = split( " ", $lin );
+    my( $word ) = shift @wdphones;
+    $word =~ s/^\"?(.*?)\"?$/$1/;
+    my( @letters ) = split('', $word );
+
+    # Sanity check of dictionary
+    die "ttp_dict_tree_data: Invalid dictionary entry: $lin\n" unless $#letters == $#wdphones;
+
+    # Process each letter in the word, building list of pseudo-phones mapping
+    # to the letter.  Build the work files sequentially.
+    my $letidx;
+    for( $letidx = 0; $letidx <= $#letters; $letidx++ )
+    {
+       # Current letter of word
+       my ($letter) = $letters[$letidx];
+
+
+       # Open the letter decision tree data file for this letter
+       # Open in append if the letter already encountered.
+       my $fn;
+       $fn = sub_letter( $letter );
+       $fn = ">$workdir/${fn}.data";
+       $fn = ">$fn" if exists $lethash{$letter};
+       open( DATA, $fn ) or die "ttp_dict_tree_data: Could not open $fn\n";
+
+
+       # Update hash of letters and letter-to-phone map
+       $lethash{$letter} = 1;
+       $ltpmap{$letter}{$wdphones[$letidx]} = 1;
+
+
+       # Output data for this letter in its contexts
+       # Letter left context
+       my $firstval = 1;
+       my $cxt;
+       for( $cxt = $letidx-$numleftcxt; $cxt < $letidx; $cxt++ )
+       {
+           print DATA "," if !$firstval;
+
+           if( $cxt < 0 )
+           {
+               print DATA "no";
+           }
+           else
+           {
+               $cletter = sub_letter( $letters[$cxt] );
+               print DATA $cletter;
+           }
+           $firstval = 0;
+       }
+
+
+        # Letter right context
+       for( $cxt = $letidx + 1; $cxt <= $numrightcxt + $letidx; $cxt++ )
+       {
+           print DATA "," if !$firstval;
+
+           if( $cxt > $#letters )
+           {
+               print DATA "no";
+           }
+           else
+           {
+               $cletter = sub_letter( $letters[$cxt] );
+               print DATA $cletter;
+           }
+           $firstval = 0;
+       }
+
+
+       # Phone label contexts
+       if( $dophnlbl )
+       {
+           # For each phone label
+           my $plbl;
+           for( $plbl = 0; $plbl < $numphnlbls; $plbl++ )
+           {
+               
+               # Left phone label context
+               for( $cxt = $letidx - $numlblleftcxt; $cxt < $letidx; $cxt++ )
+               {
+
+                   print DATA "," if !$firstval;
+
+                   if( $cxt < 0 )
+                   {
+                       print DATA "no";
+                   }
+                   else
+                   {
+                       my( $phn ) = $wdphones[$cxt];
+                       my( $phnlbl ) = $phnlbls{$phn}[$plbl];
+                       print DATA $phnlbl;
+                   }
+                   $firstval = 0;
+               }
+
+               # Right phone label context
+               for( $cxt = $letidx + 1; $cxt <= $letidx + $numlblrightcxt; $cxt++ )
+               {
+
+                   print DATA "," if !$firstval;
+
+                   if( $cxt > $#letters )
+                   {
+                       print DATA "no";
+                   }
+                   else
+                   {
+                       my( $phn ) = $wdphones[$cxt];
+                       my( $phnlbl ) = $phnlbls{$phn}[$plbl];
+                       print DATA $phnlbl;
+                   }
+                   $firstval = 0;
+               }
+           }
+       }
+       
+       # Output the phone corresponding to context attributes
+       print DATA ",${wdphones[$letidx]}.\n";
+       close( DATA );
+    }
+}
+
+
+#---------------------------------------------------------------
+sub output_names_files
+{
+    my( $workdir ) = shift @_;
+
+    foreach $letter ( sort keys( %lethash ) )
+    {
+       my $fn;
+
+       
+       # Open the .names file for the letter
+       $fn = sub_letter( $letter );
+       $fn = "${workdir}/${fn}.names";
+       open( LET, ">$fn" ) or die "ttp_dict_tree_data: Could not open $fn\n";
+
+
+       # Print all pseudo-phones mapped to the letter
+       my(@letphones) = sort keys( %{$ltpmap{$letter}} );
+       print LET join(",", @letphones), ".\n";
+
+
+       # Print possible discrete values for each attribute
+
+       my( @letvalues ) = sort keys( %lethash );
+
+       foreach $letv (@letvalues)
+       {
+           $letv = sub_letter( $letv );
+       }
+       unshift( @letvalues, "no" );
+
+
+        # Letter left context
+       for( $cxt = $numleftcxt; $cxt > 0; $cxt-- )
+       {
+           print LET "L${cxt}: " , join(",", @letvalues) , ".\n";
+       }
+
+        # Letter right context
+       for( $cxt = 1; $cxt <= $numrightcxt; $cxt++ )
+       {
+           print LET "R${cxt}: " , join(",", @letvalues) , ".\n";
+       }
+
+       if( $dophnlbl )
+       {
+           # For each phone label
+           for( $plbl = 1; $plbl <= $numphnlbls; $plbl++ )
+           {
+               
+               # All values that can be assigned to this label
+               @labelvals = sort keys( %{$lblvals[$plbl - 1]} );
+               unshift( @labelvals, "no" );
+
+
+               # Left phone class label context
+               for( $cxt = $numlblleftcxt; $cxt > 0; $cxt-- )
+               {
+                   print LET "P${plbl}L$cxt: ", join(",", @labelvals) , ".\n";
+               }
+       
+               # Right phone class label context
+               for( $cxt = 1; $cxt <= $numlblrightcxt; $cxt++ )
+               {
+                   print LET "P${plbl}R$cxt: " , join(",", @labelvals) , "\n";
+               }
+           }
+       }
+
+       close( LET );
+    }
+}
+
+
+
+
+
+#---------------------------------------------------------------
+# sub letter
+#
+# substitute for punctuation letters for TIesr.
+#
+sub sub_letter
+{
+    my( $letter ) = shift @_;
+
+    $sletter = $letter;
+    $sletter = "dot" if $letter eq ".";
+    $sletter = "dash" if $letter eq "-";
+    $sletter = "up" if $letter eq "'";
+    $sletter = "down" if $letter eq "_";
+
+    return $sletter;
+}