Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 0b420d0fce195cf4115dc6a3be5c2da2 > files > 277

sphinxbase-devel-0.7-1.fc14.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>SphinxBase: include/sphinxbase/logmath.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">SphinxBase&#160;<span id="projectnumber">0.6</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('logmath_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>include/sphinxbase/logmath.h</h1>  </div>
</div>
<div class="contents">
<a href="logmath_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/* ====================================================================</span>
<a name="l00003"></a>00003 <span class="comment"> * Copyright (c) 2007 Carnegie Mellon University.  All rights</span>
<a name="l00004"></a>00004 <span class="comment"> * reserved.</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00007"></a>00007 <span class="comment"> * modification, are permitted provided that the following conditions</span>
<a name="l00008"></a>00008 <span class="comment"> * are met:</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="l00011"></a>00011 <span class="comment"> *    notice, this list of conditions and the following disclaimer. </span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> *    notice, this list of conditions and the following disclaimer in</span>
<a name="l00015"></a>00015 <span class="comment"> *    the documentation and/or other materials provided with the</span>
<a name="l00016"></a>00016 <span class="comment"> *    distribution.</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * This work was supported in part by funding from the Defense Advanced </span>
<a name="l00019"></a>00019 <span class="comment"> * Research Projects Agency and the National Science Foundation of the </span>
<a name="l00020"></a>00020 <span class="comment"> * United States of America, and the CMU Sphinx Speech Consortium.</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS&#39;&#39; AND </span>
<a name="l00023"></a>00023 <span class="comment"> * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, </span>
<a name="l00024"></a>00024 <span class="comment"> * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</span>
<a name="l00025"></a>00025 <span class="comment"> * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY</span>
<a name="l00026"></a>00026 <span class="comment"> * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00027"></a>00027 <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT </span>
<a name="l00028"></a>00028 <span class="comment"> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, </span>
<a name="l00029"></a>00029 <span class="comment"> * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY </span>
<a name="l00030"></a>00030 <span class="comment"> * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT </span>
<a name="l00031"></a>00031 <span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE </span>
<a name="l00032"></a>00032 <span class="comment"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00033"></a>00033 <span class="comment"> *</span>
<a name="l00034"></a>00034 <span class="comment"> * ====================================================================</span>
<a name="l00035"></a>00035 <span class="comment"> *</span>
<a name="l00036"></a>00036 <span class="comment"> */</span>
<a name="l00072"></a>00072 <span class="preprocessor">#ifndef __LOGMATH_H__</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#define __LOGMATH_H__</span>
<a name="l00074"></a>00074 <span class="preprocessor"></span>
<a name="l00075"></a>00075 <span class="preprocessor">#include &lt;sphinxbase/sphinxbase_export.h&gt;</span>
<a name="l00076"></a>00076 <span class="preprocessor">#include &lt;sphinxbase/prim_type.h&gt;</span>
<a name="l00077"></a>00077 <span class="preprocessor">#include &lt;sphinxbase/cmd_ln.h&gt;</span>
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 
<a name="l00080"></a>00080 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00082"></a>00082 <span class="preprocessor">#endif</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#if 0</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span><span class="comment">/* Fool Emacs. */</span>
<a name="l00085"></a>00085 }
<a name="l00086"></a>00086 <span class="preprocessor">#endif</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span>
<a name="l00093"></a><a class="code" href="logmath_8h.html#a8c04c94e2c6364f6cf3b649eb4ce5bfd">00093</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structlogadd__s.html">logadd_s</a> <a class="code" href="structlogadd__s.html">logadd_t</a>;
<a name="l00094"></a><a class="code" href="structlogadd__s.html">00094</a> <span class="keyword">struct </span><a class="code" href="structlogadd__s.html">logadd_s</a> {
<a name="l00096"></a><a class="code" href="structlogadd__s.html#a27793577d513d85cd73c2daffc140695">00096</a>     <span class="keywordtype">void</span> *<a class="code" href="structlogadd__s.html#a27793577d513d85cd73c2daffc140695" title="Table, in unsigned integers of (width) bytes.">table</a>;
<a name="l00098"></a><a class="code" href="structlogadd__s.html#a484c53a05b46d863d0456af679cee5d8">00098</a>     uint32 <a class="code" href="structlogadd__s.html#a484c53a05b46d863d0456af679cee5d8" title="Number of elements in (table).">table_size</a>;
<a name="l00100"></a><a class="code" href="structlogadd__s.html#a8e35a353d751d957270baf5192007c3e">00100</a>     uint8 <a class="code" href="structlogadd__s.html#a8e35a353d751d957270baf5192007c3e" title="Width of elements of (table).">width</a>;
<a name="l00102"></a><a class="code" href="structlogadd__s.html#a4000a49e71ed2c09da4f34cb5ccaed4b">00102</a>     int8 <a class="code" href="structlogadd__s.html#a4000a49e71ed2c09da4f34cb5ccaed4b" title="Right shift applied to elements in (table).">shift</a>;
<a name="l00103"></a>00103 };
<a name="l00104"></a>00104 
<a name="l00108"></a><a class="code" href="logmath_8h.html#ae613aa7db1dd40ff56a80a7dadb22cc8">00108</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structlogmath__s.html">logmath_s</a> <a class="code" href="structlogmath__s.html">logmath_t</a>;
<a name="l00109"></a>00109 
<a name="l00113"></a><a class="code" href="logmath_8h.html#ae5c5ce106e9f8f1e763d419de53317a8">00113</a> <span class="preprocessor">#define LOGMATH_TABLE(lm) ((logadd_t *)lm)</span>
<a name="l00114"></a>00114 <span class="preprocessor"></span>
<a name="l00122"></a>00122 SPHINXBASE_EXPORT
<a name="l00123"></a>00123 <a class="code" href="structlogmath__s.html">logmath_t</a> *<a class="code" href="logmath_8h.html#a5835860c5f6a703c80c0214f816f0b11" title="Initialize a log math computation table.">logmath_init</a>(float64 base, <span class="keywordtype">int</span> shift, <span class="keywordtype">int</span> use_table);
<a name="l00124"></a>00124 
<a name="l00128"></a>00128 SPHINXBASE_EXPORT
<a name="l00129"></a>00129 <a class="code" href="structlogmath__s.html">logmath_t</a> *<a class="code" href="logmath_8h.html#afbed298ba0bc4736415d78880fe5c7c2" title="Memory-map (or read) a log table from a file.">logmath_read</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename);
<a name="l00130"></a>00130 
<a name="l00134"></a>00134 SPHINXBASE_EXPORT
<a name="l00135"></a>00135 int32 <a class="code" href="logmath_8h.html#a787070f5e689878348ef219245fc7c44" title="Write a log table to a file.">logmath_write</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, <span class="keyword">const</span> <span class="keywordtype">char</span> *filename);
<a name="l00136"></a>00136 
<a name="l00140"></a>00140 SPHINXBASE_EXPORT
<a name="l00141"></a>00141 int32 <a class="code" href="logmath_8h.html#a3280500e77bf27aa7cda23268b8eb8b3" title="Get the log table size and dimensions.">logmath_get_table_shape</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, uint32 *out_size,
<a name="l00142"></a>00142                               uint32 *out_width, uint32 *out_shift);
<a name="l00143"></a>00143 
<a name="l00147"></a>00147 SPHINXBASE_EXPORT
<a name="l00148"></a>00148 float64 <a class="code" href="logmath_8h.html#a6114206ec0321d7015c42fc7b81cb83e" title="Get the log base.">logmath_get_base</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00149"></a>00149 
<a name="l00153"></a>00153 SPHINXBASE_EXPORT
<a name="l00154"></a>00154 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#a1c160c28a9e7d25923f391773b1028c0" title="Get the smallest possible value represented in this base.">logmath_get_zero</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00155"></a>00155 
<a name="l00159"></a>00159 SPHINXBASE_EXPORT
<a name="l00160"></a>00160 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#a0cd690d2a414aebb5e126b8cabbfabde" title="Get the width of the values in a log table.">logmath_get_width</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00161"></a>00161 
<a name="l00165"></a>00165 SPHINXBASE_EXPORT
<a name="l00166"></a>00166 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#aed009aca9736612bebdda57444ec63a6" title="Get the shift of the values in a log table.">logmath_get_shift</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00167"></a>00167 
<a name="l00173"></a>00173 SPHINXBASE_EXPORT
<a name="l00174"></a>00174 <a class="code" href="structlogmath__s.html">logmath_t</a> *<a class="code" href="logmath_8h.html#a1c1b2ba3b137a39e9e835a8f3e27d381" title="Retain ownership of a log table.">logmath_retain</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00175"></a>00175 
<a name="l00181"></a>00181 SPHINXBASE_EXPORT
<a name="l00182"></a>00182 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#a97865ef8bc1e8e2525a2329e0627ecfb" title="Free a log table.">logmath_free</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00183"></a>00183 
<a name="l00187"></a>00187 SPHINXBASE_EXPORT
<a name="l00188"></a>00188 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#a61bf79c70a38f00ca060b69b0efd7489" title="Add two values in log space exactly and slowly (without using add table).">logmath_add_exact</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, <span class="keywordtype">int</span> logb_p, <span class="keywordtype">int</span> logb_q);
<a name="l00189"></a>00189 
<a name="l00193"></a>00193 SPHINXBASE_EXPORT
<a name="l00194"></a>00194 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#a5eb70928578b0115c9c7ac2765396a06" title="Add two values in log space (i.e.">logmath_add</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, <span class="keywordtype">int</span> logb_p, <span class="keywordtype">int</span> logb_q);
<a name="l00195"></a>00195 
<a name="l00199"></a>00199 SPHINXBASE_EXPORT
<a name="l00200"></a>00200 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#aebb4711268322fa7aec31e5798fe7e90" title="Convert linear floating point number to integer log in base B.">logmath_log</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, float64 p);
<a name="l00201"></a>00201 
<a name="l00205"></a>00205 SPHINXBASE_EXPORT
<a name="l00206"></a>00206 float64 <a class="code" href="logmath_8h.html#ae8b0a168e29e448c0d6de66dc46e099e" title="Convert integer log in base B to linear floating point.">logmath_exp</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, <span class="keywordtype">int</span> logb_p);
<a name="l00207"></a>00207 
<a name="l00211"></a>00211 SPHINXBASE_EXPORT
<a name="l00212"></a>00212 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#a52eff2c778ad758888b03ac5efcdccea" title="Convert natural log (in floating point) to integer log in base B.">logmath_ln_to_log</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, float64 log_p);
<a name="l00213"></a>00213 
<a name="l00217"></a>00217 SPHINXBASE_EXPORT
<a name="l00218"></a>00218 float64 <a class="code" href="logmath_8h.html#a8035e176636eae8b4e02fe488f25457a" title="Convert integer log in base B to natural log (in floating point).">logmath_log_to_ln</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, <span class="keywordtype">int</span> logb_p);
<a name="l00219"></a>00219 
<a name="l00223"></a>00223 SPHINXBASE_EXPORT
<a name="l00224"></a>00224 <span class="keywordtype">int</span> <a class="code" href="logmath_8h.html#aacb4dddeed63a61fb927915f7e3a642e" title="Convert base 10 log (in floating point) to integer log in base B.">logmath_log10_to_log</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, float64 log_p);
<a name="l00225"></a>00225 
<a name="l00229"></a>00229 SPHINXBASE_EXPORT
<a name="l00230"></a>00230 float64 <a class="code" href="logmath_8h.html#a7c17cb624003975e84fbd141ca6e2e06" title="Convert integer log in base B to base 10 log (in floating point).">logmath_log_to_log10</a>(<a class="code" href="structlogmath__s.html">logmath_t</a> *lmath, <span class="keywordtype">int</span> logb_p);
<a name="l00231"></a>00231 
<a name="l00232"></a>00232 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00233"></a>00233 <span class="preprocessor"></span>}
<a name="l00234"></a>00234 <span class="preprocessor">#endif</span>
<a name="l00235"></a>00235 <span class="preprocessor"></span>
<a name="l00236"></a>00236 
<a name="l00237"></a>00237 <span class="preprocessor">#endif </span><span class="comment">/*  __LOGMATH_H__ */</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="logmath_8h.html">logmath.h</a>      </li>
      <li class="footer">Generated on Tue Apr 19 2011 for SphinxBase by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
    </ul>
  </div>

</body>
</html>