<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][16071] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=16071">16071</a></dd>
<dt>Author</dt> <dd>mikej</dd>
<dt>Date</dt> <dd>2009-12-28 19:58:30 -0600 (Mon, 28 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>update spandsp to snapshot <a href="http://jira.freeswitch.org/browse/spandsp-20091228">spandsp-20091228</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunklibsspandspupdate">freeswitch/trunk/libs/spandsp/.update</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcbitstreamc">freeswitch/trunk/libs/spandsp/src/bitstream.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcg726c">freeswitch/trunk/libs/spandsp/src/g726.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcgsm0610_rpec">freeswitch/trunk/libs/spandsp/src/gsm0610_rpe.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrclpc10_decodec">freeswitch/trunk/libs/spandsp/src/lpc10_decode.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcmake_modem_filterc">freeswitch/trunk/libs/spandsp/src/make_modem_filter.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspbitstreamh">freeswitch/trunk/libs/spandsp/src/spandsp/bitstream.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivatebitstreamh">freeswitch/trunk/libs/spandsp/src/spandsp/private/bitstream.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivatev17rxh">freeswitch/trunk/libs/spandsp/src/spandsp/private/v17rx.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivatev17txh">freeswitch/trunk/libs/spandsp/src/spandsp/private/v17tx.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivatev8h">freeswitch/trunk/libs/spandsp/src/spandsp/private/v8.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspv17txh">freeswitch/trunk/libs/spandsp/src/spandsp/v17tx.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspv8h">freeswitch/trunk/libs/spandsp/src/spandsp/v8.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspversionh">freeswitch/trunk/libs/spandsp/src/spandsp/version.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcv17_v32bis_rx_constellation_mapsh">freeswitch/trunk/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcv17_v32bis_tx_constellation_mapsh">freeswitch/trunk/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcv17rxc">freeswitch/trunk/libs/spandsp/src/v17rx.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcv17txc">freeswitch/trunk/libs/spandsp/src/v17tx.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcv29rxc">freeswitch/trunk/libs/spandsp/src/v29rx.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcv8c">freeswitch/trunk/libs/spandsp/src/v8.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcvector_intc">freeswitch/trunk/libs/spandsp/src/vector_int.c</a></li>
<li><a href="#freeswitchtrunklibsspandsptestsv8_testsc">freeswitch/trunk/libs/spandsp/tests/v8_tests.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunklibsspandspupdate"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/.update (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/.update        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/.update        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -1 +1 @@
</span><del>-Wed Dec 23 11:53:35 EST 2009
</del><ins>+Mon Dec 28 20:58:04 EST 2009
</ins></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcbitstreamc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/bitstream.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/bitstream.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/bitstream.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: bitstream.c,v 1.18 2009/02/10 13:06:46 steveu Exp $
</del><ins>+ * $Id: bitstream.c,v 1.18.4.1 2009/12/28 12:20:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -44,33 +44,48 @@
</span><span class="cx"> SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
</span><span class="cx"> {
</span><span class="cx">     value &amp;= ((1 &lt;&lt; bits) - 1);
</span><del>-    if (s-&gt;residue + bits &lt;= 32)
</del><ins>+    if (s-&gt;lsb_first)
</ins><span class="cx">     {
</span><del>-        s-&gt;bitstream |= (value &lt;&lt; s-&gt;residue);
-        s-&gt;residue += bits;
</del><ins>+        if (s-&gt;residue + bits &lt;= 32)
+        {
+            s-&gt;bitstream |= (value &lt;&lt; s-&gt;residue);
+            s-&gt;residue += bits;
+        }
+        while (s-&gt;residue &gt;= 8)
+        {
+            s-&gt;residue -= 8;
+            *(*c)++ = (uint8_t) (s-&gt;bitstream &amp; 0xFF);
+            s-&gt;bitstream &gt;&gt;= 8;
+        }
</ins><span class="cx">     }
</span><del>-    while (s-&gt;residue &gt;= 8)
</del><ins>+    else
</ins><span class="cx">     {
</span><del>-        s-&gt;residue -= 8;
-        *(*c)++ = (uint8_t) (s-&gt;bitstream &amp; 0xFF);
-        s-&gt;bitstream &gt;&gt;= 8;
</del><ins>+        if (s-&gt;residue + bits &lt;= 32)
+        {
+            s-&gt;bitstream = (s-&gt;bitstream &lt;&lt; bits) | value;
+            s-&gt;residue += bits;
+        }
+        while (s-&gt;residue &gt;= 8)
+        {
+            s-&gt;residue -= 8;
+            *(*c)++ = (uint8_t) ((s-&gt;bitstream &gt;&gt; s-&gt;residue) &amp; 0xFF);
+        }
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-SPAN_DECLARE(void) bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
</del><ins>+SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c)
</ins><span class="cx"> {
</span><del>-    value &amp;= ((1 &lt;&lt; bits) - 1);
-    if (s-&gt;residue + bits &lt;= 32)
</del><ins>+    if (s-&gt;residue &gt; 0)
</ins><span class="cx">     {
</span><del>-        s-&gt;bitstream = (s-&gt;bitstream &lt;&lt; bits) | value;
-        s-&gt;residue += bits;
</del><ins>+        s-&gt;bitstream &amp;= ((1 &lt;&lt; s-&gt;residue) - 1);
+        if (s-&gt;lsb_first)
+            *(*c)++ = (uint8_t) s-&gt;bitstream;
+        else
+            *(*c)++ = (uint8_t) (s-&gt;bitstream &lt;&lt; (8 - s-&gt;residue));
+        s-&gt;residue = 0;
</ins><span class="cx">     }
</span><del>-    while (s-&gt;residue &gt;= 8)
-    {
-        s-&gt;residue -= 8;
-        *(*c)++ = (uint8_t) ((s-&gt;bitstream &gt;&gt; s-&gt;residue) &amp; 0xFF);
-    }
</del><ins>+    s-&gt;bitstream = 0;
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="lines">@@ -78,55 +93,33 @@
</span><span class="cx"> {
</span><span class="cx">     uint32_t x;
</span><span class="cx"> 
</span><del>-    while (s-&gt;residue &lt; bits)
</del><ins>+    if (s-&gt;lsb_first)
</ins><span class="cx">     {
</span><del>-        s-&gt;bitstream |= (((uint32_t) *(*c)++) &lt;&lt; s-&gt;residue);
-        s-&gt;residue += 8;
</del><ins>+        while (s-&gt;residue &lt; bits)
+        {
+            s-&gt;bitstream |= (((uint32_t) *(*c)++) &lt;&lt; s-&gt;residue);
+            s-&gt;residue += 8;
+        }
+        s-&gt;residue -= bits;
+        x = s-&gt;bitstream &amp; ((1 &lt;&lt; bits) - 1);
+        s-&gt;bitstream &gt;&gt;= bits;
</ins><span class="cx">     }
</span><del>-    s-&gt;residue -= bits;
-    x = s-&gt;bitstream &amp; ((1 &lt;&lt; bits) - 1);
-    s-&gt;bitstream &gt;&gt;= bits;
-    return x;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(uint32_t) bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits)
-{
-    uint32_t x;
-
-    while (s-&gt;residue &lt; bits)
</del><ins>+    else
</ins><span class="cx">     {
</span><del>-        s-&gt;bitstream = (s-&gt;bitstream &lt;&lt; 8) | ((uint32_t) *(*c)++);
-        s-&gt;residue += 8;
</del><ins>+        while (s-&gt;residue &lt; bits)
+        {
+            s-&gt;bitstream = (s-&gt;bitstream &lt;&lt; 8) | ((uint32_t) *(*c)++);
+            s-&gt;residue += 8;
+        }
+        s-&gt;residue -= bits;
+        x = (s-&gt;bitstream &gt;&gt; s-&gt;residue) &amp; ((1 &lt;&lt; bits) - 1);
</ins><span class="cx">     }
</span><del>-    s-&gt;residue -= bits;
-    x = (s-&gt;bitstream &gt;&gt; s-&gt;residue) &amp; ((1 &lt;&lt; bits) - 1);
</del><span class="cx">     return x;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c)
</del><ins>+SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int lsb_first)
</ins><span class="cx"> {
</span><del>-    if (s-&gt;residue &gt; 0)
-    {
-        *(*c)++ = (uint8_t) ((s-&gt;bitstream &lt;&lt; (8 - s-&gt;residue)) &amp; 0xFF);
-        s-&gt;residue = 0;
-    }
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(void) bitstream_flush2(bitstream_state_t *s, uint8_t **c)
-{
-    if (s-&gt;residue &gt; 0)
-    {
-        *(*c)++ = (uint8_t) ((s-&gt;bitstream &lt;&lt; (8 - s-&gt;residue)) &amp; 0xFF);
-        s-&gt;residue = 0;
-    }
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s)
-{
</del><span class="cx">     if (s == NULL)
</span><span class="cx">     {
</span><span class="cx">         if ((s = (bitstream_state_t *) malloc(sizeof(*s))) == NULL)
</span><span class="lines">@@ -134,6 +127,7 @@
</span><span class="cx">     }
</span><span class="cx">     s-&gt;bitstream = 0;
</span><span class="cx">     s-&gt;residue = 0;
</span><ins>+    s-&gt;lsb_first = lsb_first;
</ins><span class="cx">     return s;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcg726c"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/g726.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/g726.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/g726.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">  * 2550 Garcia Avenue
</span><span class="cx">  * Mountain View, California  94043
</span><span class="cx">  *
</span><del>- * $Id: g726.c,v 1.28 2009/02/10 13:06:46 steveu Exp $
</del><ins>+ * $Id: g726.c,v 1.28.4.1 2009/12/28 12:20:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -1052,7 +1052,7 @@
</span><span class="cx">         s-&gt;bits_per_sample = 5;
</span><span class="cx">         break;
</span><span class="cx">     }
</span><del>-    bitstream_init(&amp;s-&gt;bs);
</del><ins>+    bitstream_init(&amp;s-&gt;bs, (s-&gt;packing != G726_PACKING_LEFT));
</ins><span class="cx">     return s;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcgsm0610_rpec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/gsm0610_rpe.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/gsm0610_rpe.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/gsm0610_rpe.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">  * This code is based on the widely used GSM 06.10 code available from
</span><span class="cx">  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
</span><span class="cx">  *
</span><del>- * $Id: gsm0610_rpe.c,v 1.25.4.1 2009/12/19 09:47:56 steveu Exp $
</del><ins>+ * $Id: gsm0610_rpe.c,v 1.25.4.2 2009/12/28 11:54:58 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -45,6 +45,8 @@
</span><span class="cx"> #include &quot;floating_fudge.h&quot;
</span><span class="cx"> #include &lt;stdlib.h&gt;
</span><span class="cx"> 
</span><ins>+#include &quot;mmx_sse_decs.h&quot;
+
</ins><span class="cx"> #include &quot;spandsp/telephony.h&quot;
</span><span class="cx"> #include &quot;spandsp/fast_convert.h&quot;
</span><span class="cx"> #include &quot;spandsp/bitstream.h&quot;
</span><span class="lines">@@ -55,26 +57,17 @@
</span><span class="cx"> 
</span><span class="cx"> /* 4.2.13 .. 4.2.17  RPE ENCODING SECTION */
</span><span class="cx"> 
</span><del>-#if defined(__GNUC__)  &amp;&amp;  defined(__i386__)
-#define SPANDSP_USE_I386_ASM
-#if (defined(__APPLE__) || defined(macintosh)) &amp;&amp; defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
-#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1060
-#undef SPANDSP_USE_I386_ASM
-#endif
-#endif
-#endif
-
</del><span class="cx"> /* 4.2.13 */
</span><del>-static void weighting_filter(const int16_t *e,     // signal [-5..0.39.44] IN
-                             int16_t x[40])
</del><ins>+static void weighting_filter(int16_t x[40],
+                             const int16_t *e)      // signal [-5..0.39.44] IN)
</ins><span class="cx"> {
</span><del>-#if defined(SPANDSP_USE_I386_ASM)
</del><ins>+#if defined(__GNUC__)  &amp;&amp;  defined(SPANDSP_USE_MMX)  &amp;&amp;  defined(__x86_64__)
</ins><span class="cx">     /* Table 4.4   Coefficients of the weighting filter */
</span><span class="cx">     /* This must be padded to a multiple of 4 for MMX to work */
</span><span class="cx">     static const union
</span><span class="cx">     {
</span><span class="cx">         int16_t gsm_H[12];
</span><del>-        uint64_t x[3];
</del><ins>+        __m64 x[3];
</ins><span class="cx">     } gsm_H =
</span><span class="cx">     {
</span><span class="cx">         {
</span><span class="lines">@@ -85,12 +78,68 @@
</span><span class="cx"> 
</span><span class="cx">     __asm__ __volatile__(
</span><span class="cx">         &quot; emms;\n&quot;
</span><ins>+        &quot; addq $-10,%%rcx;\n&quot;
+        &quot; leaq %[gsm_H],%%rax;\n&quot;
+        &quot; movq (%%rax),%%mm1;\n&quot;
+        &quot; movq 8(%%rax),%%mm2;\n&quot;
+        &quot; movq 16(%%rax),%%mm3;\n&quot;
+        &quot; movq $0x1000,%%rax;\n&quot;
+        &quot; movq %%rax,%%mm5;\n&quot;              /* For rounding */
+        &quot; xorq %%rsi,%%rsi;\n&quot;
+        &quot; .p2align 2;\n&quot;
+        &quot;1:\n&quot;
+        &quot; movq (%%rcx,%%rsi,2),%%mm0;\n&quot;
+        &quot; pmaddwd %%mm1,%%mm0;\n&quot;

+        &quot; movq 8(%%rcx,%%rsi,2),%%mm4;\n&quot;
+        &quot; pmaddwd %%mm2,%%mm4;\n&quot;
+        &quot; paddd %%mm4,%%mm0;\n&quot;
+
+        &quot; movq 16(%%rcx,%%rsi,2),%%mm4;\n&quot;
+        &quot; pmaddwd %%mm3,%%mm4;\n&quot;
+        &quot; paddd %%mm4,%%mm0;\n&quot;
+
+        &quot; movq %%mm0,%%mm4;\n&quot;
+        &quot; punpckhdq %%mm0,%%mm4;\n&quot;         /* mm4 has high int32 of mm0 dup'd */
+        &quot; paddd %%mm4,%%mm0;\n&quot;
+
+        &quot; paddd %%mm5,%%mm0;\n&quot;             /* Add for roundoff */
+        &quot; psrad $13,%%mm0;\n&quot;
+        &quot; packssdw %%mm0,%%mm0;\n&quot;        
+        &quot; movd %%mm0,%%eax;\n&quot;              /* eax has result */
+        &quot; movw %%ax,(%%rdi,%%rsi,2);\n&quot;
+        &quot; incq %%rsi;\n&quot;
+        &quot; cmpq $39,%%rsi;\n&quot;
+        &quot; jle 1b;\n&quot;
+        &quot; emms;\n&quot;
+        :
+        : &quot;c&quot; (e), &quot;D&quot; (x), [gsm_H] &quot;X&quot; (gsm_H)
+        : &quot;rax&quot;, &quot;rdx&quot;, &quot;rsi&quot;, &quot;memory&quot;
+    );
+#elif defined(__GNUC__)  &amp;&amp;  defined(SPANDSP_USE_MMX)  &amp;&amp;  defined(__i386__)
+    /* Table 4.4   Coefficients of the weighting filter */
+    /* This must be padded to a multiple of 4 for MMX to work */
+    static const union
+    {
+        int16_t gsm_H[12];
+        __m64_t x[3];
+    } gsm_H =
+    {
+        {
+            -134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134, 0
+        }
+
+    };
+
+    __asm__ __volatile__(
+        &quot; emms;\n&quot;
</ins><span class="cx">         &quot; addl $-10,%%ecx;\n&quot;
</span><ins>+        &quot; leal %[gsm_H],%%eax;\n&quot;
+        &quot; movq (%%eax),%%mm1;\n&quot;
+        &quot; movq 8(%%eax),%%mm2;\n&quot;
+        &quot; movq 16(%%eax),%%mm3;\n&quot;
</ins><span class="cx">         &quot; movl $0x1000,%%eax;\n&quot;
</span><span class="cx">         &quot; movd %%eax,%%mm5;\n&quot;              /* For rounding */
</span><del>-        &quot; movq %[gsm_H],%%mm1;\n&quot;
-        &quot; movq %[gsm_H8],%%mm2;\n&quot;
-        &quot; movq %[gsm_H16],%%mm3;\n&quot;
</del><span class="cx">         &quot; xorl %%esi,%%esi;\n&quot;
</span><span class="cx">         &quot; .p2align 2;\n&quot;
</span><span class="cx">         &quot;1:\n&quot;
</span><span class="lines">@@ -119,8 +168,8 @@
</span><span class="cx">         &quot; jle 1b;\n&quot;
</span><span class="cx">         &quot; emms;\n&quot;
</span><span class="cx">         :
</span><del>-        : &quot;c&quot; (e), &quot;D&quot; (x), [gsm_H] &quot;X&quot; (gsm_H.x[0]), [gsm_H8] &quot;X&quot; (gsm_H.x[1]), [gsm_H16] &quot;X&quot; (gsm_H.x[2])
-        : &quot;eax&quot;, &quot;edx&quot;, &quot;esi&quot;
</del><ins>+        : &quot;c&quot; (e), &quot;D&quot; (x), [gsm_H] &quot;X&quot; (gsm_H)
+        : &quot;eax&quot;, &quot;edx&quot;, &quot;esi&quot;, &quot;memory&quot;
</ins><span class="cx">     );
</span><span class="cx"> #else
</span><span class="cx">     int32_t L_result;
</span><span class="lines">@@ -163,13 +212,13 @@
</span><span class="cx">         */
</span><span class="cx">         L_result += STEP( 0,  -134);
</span><span class="cx">         L_result += STEP( 1,  -374);
</span><del>-              // += STEP( 2,  0   );
</del><ins>+              /* += STEP( 2,  0   ); */
</ins><span class="cx">         L_result += STEP( 3,  2054);
</span><span class="cx">         L_result += STEP( 4,  5741);
</span><span class="cx">         L_result += STEP( 5,  8192);
</span><span class="cx">         L_result += STEP( 6,  5741);
</span><span class="cx">         L_result += STEP( 7,  2054);
</span><del>-              // += STEP( 8,  0   );
</del><ins>+              /* += STEP( 8,  0   ); */
</ins><span class="cx">         L_result += STEP( 9,  -374);
</span><span class="cx">         L_result += STEP(10,  -134);
</span><span class="cx"> 
</span><span class="lines">@@ -523,7 +572,7 @@
</span><span class="cx">     int16_t mant;
</span><span class="cx">     int16_t exp;
</span><span class="cx"> 
</span><del>-    weighting_filter(e, x);
</del><ins>+    weighting_filter(x, e);
</ins><span class="cx">     rpe_grid_selection(x, xM, Mc);
</span><span class="cx"> 
</span><span class="cx">     apcm_quantization(xM, xMc, &amp;mant, &amp;exp, xmaxc);
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrclpc10_decodec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/lpc10_decode.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/lpc10_decode.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/lpc10_decode.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx">  * implementation of the LPC-10 2400 bps Voice Coder. They do not
</span><span class="cx">  * exert copyright claims on their code, and it may be freely used.
</span><span class="cx">  *
</span><del>- * $Id: lpc10_decode.c,v 1.27 2009/02/10 13:06:46 steveu Exp $
</del><ins>+ * $Id: lpc10_decode.c,v 1.27.4.1 2009/12/24 17:00:19 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if defined(HAVE_CONFIG_H)
</span><span class="lines">@@ -446,8 +446,7 @@
</span><span class="cx">                         xxy = expf(xxy);
</span><span class="cx">                         rci[j + *nout*rci_dim1 + 1] = (xxy - 1.0f)/(xxy + 1.0f);
</span><span class="cx">                     }
</span><del>-                    rmsi[*nout - 1] = logf(s-&gt;rmso) + prop*(logf(*rms) - logf(s-&gt;rmso));
-                    rmsi[*nout - 1] = expf(rmsi[*nout - 1]);
</del><ins>+                    rmsi[*nout - 1] = expf(logf(s-&gt;rmso) + prop*(logf(*rms) - logf(s-&gt;rmso)));
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">             if (vflag != 1)
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcmake_modem_filterc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/make_modem_filter.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/make_modem_filter.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/make_modem_filter.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: make_modem_filter.c,v 1.17 2009/10/03 04:37:25 steveu Exp $
</del><ins>+ * $Id: make_modem_filter.c,v 1.17.4.1 2009/12/28 12:20:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if defined(HAVE_CONFIG_H)
</span><span class="lines">@@ -356,7 +356,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    if (strcmp(modem, &quot;V.17&quot;) == 0)
</del><ins>+    if (strcmp(modem, &quot;V.17&quot;) == 0  ||  strcmp(modem, &quot;V.32bis&quot;) == 0)
</ins><span class="cx">     {
</span><span class="cx">         /* This applies to V.32bis as well as V.17 */
</span><span class="cx">         rx_coeff_sets = 192;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspbitstreamh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/bitstream.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/bitstream.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/bitstream.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: bitstream.h,v 1.14 2009/02/10 13:06:47 steveu Exp $
</del><ins>+ * $Id: bitstream.h,v 1.14.4.1 2009/12/28 12:20:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -39,7 +39,6 @@
</span><span class="cx"> /*! Bitstream handler state */
</span><span class="cx"> typedef struct bitstream_state_s bitstream_state_t;
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> #if defined(__cplusplus)
</span><span class="cx"> extern &quot;C&quot;
</span><span class="cx"> {
</span><span class="lines">@@ -52,8 +51,6 @@
</span><span class="cx">     \param bits The number of bits of value to be pushed. 1 to 25 bits is valid. */
</span><span class="cx"> SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits);
</span><span class="cx"> 
</span><del>-SPAN_DECLARE(void) bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits);
-
</del><span class="cx"> /*! \brief Get a chunk of bits from the input buffer.
</span><span class="cx">     \param s A pointer to the bitstream context.
</span><span class="cx">     \param c A pointer to the bitstream input buffer.
</span><span class="lines">@@ -61,19 +58,16 @@
</span><span class="cx">     \return The value retrieved from the input buffer. */
</span><span class="cx"> SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits);
</span><span class="cx"> 
</span><del>-SPAN_DECLARE(uint32_t) bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits);
-
</del><span class="cx"> /*! \brief Flush any residual bit to the output buffer.
</span><span class="cx">     \param s A pointer to the bitstream context.
</span><span class="cx">     \param c A pointer to the bitstream output buffer. */
</span><span class="cx"> SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c);
</span><span class="cx"> 
</span><del>-SPAN_DECLARE(void) bitstream_flush2(bitstream_state_t *s, uint8_t **c);
-
</del><span class="cx"> /*! \brief Initialise a bitstream context.
</span><span class="cx">     \param s A pointer to the bitstream context.
</span><ins>+    \param lsb_first TRUE if the bit stream is LSB first, else its MSB first.
</ins><span class="cx">     \return A pointer to the bitstream context. */
</span><del>-SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s);
</del><ins>+SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction);
</ins><span class="cx"> 
</span><span class="cx"> SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s);
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivatebitstreamh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/bitstream.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/bitstream.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/bitstream.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: bitstream.h,v 1.1 2008/11/30 12:45:09 steveu Exp $
</del><ins>+ * $Id: bitstream.h,v 1.1.4.1 2009/12/28 12:20:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if !defined(_SPANDSP_PRIVATE_BITSTREAM_H_)
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx">     uint32_t bitstream;
</span><span class="cx">     /*! The residual bits in bitstream. */
</span><span class="cx">     int residue;
</span><ins>+    /*! TRUE if the stream is LSB first, else MSB first */
+    int lsb_first;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivatev17rxh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/v17rx.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/v17rx.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/v17rx.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v17rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
</del><ins>+ * $Id: v17rx.h,v 1.2.4.1 2009/12/24 16:52:30 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if !defined(_SPANDSP_PRIVATE_V17RX_H_)
</span><span class="lines">@@ -84,7 +84,10 @@
</span><span class="cx">     /*! \brief The state of the differential decoder */
</span><span class="cx">     int diff;
</span><span class="cx">     /*! \brief The register for the data scrambler. */
</span><del>-    unsigned int scramble_reg;
</del><ins>+    uint32_t scramble_reg;
+    /*! \brief Scrambler tap */
+    //int scrambler_tap;
+
</ins><span class="cx">     /*! \brief TRUE if the short training sequence is to be used. */
</span><span class="cx">     int short_train;
</span><span class="cx">     /*! \brief The section of the training data we are currently in. */
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivatev17txh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/v17tx.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/v17tx.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/v17tx.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v17tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
</del><ins>+ * $Id: v17tx.h,v 1.2.4.1 2009/12/24 16:52:30 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -71,9 +71,13 @@
</span><span class="cx">     int diff;
</span><span class="cx">     /*! \brief The current state of the convolutional encoder. */
</span><span class="cx">     int convolution;
</span><ins>+    /*! \brief The code number for the current position in the constellation. */
+    int constellation_state;
</ins><span class="cx"> 
</span><span class="cx">     /*! \brief The register for the data scrambler. */
</span><del>-    unsigned int scramble_reg;
</del><ins>+    uint32_t scramble_reg;
+    /*! \brief Scrambler tap */
+    //int scrambler_tap;
</ins><span class="cx">     /*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */
</span><span class="cx">     int in_training;
</span><span class="cx">     /*! \brief TRUE if the short training sequence is to be used. */
</span><span class="lines">@@ -87,8 +91,6 @@
</span><span class="cx">     int32_t carrier_phase_rate;
</span><span class="cx">     /*! \brief The current fractional phase of the baud timing. */
</span><span class="cx">     int baud_phase;
</span><del>-    /*! \brief The code number for the current position in the constellation. */
-    int constellation_state;
</del><span class="cx">     
</span><span class="cx">     /*! \brief A pointer to the constellation currently in use. */
</span><span class="cx"> #if defined(SPANDSP_USE_FIXED_POINT)
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivatev8h"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/v8.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/v8.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/v8.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v8.h,v 1.3 2009/11/04 15:52:06 steveu Exp $
</del><ins>+ * $Id: v8.h,v 1.3.4.1 2009/12/28 12:20:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx">  
</span><span class="cx"> #if !defined(_SPANDSP_PRIVATE_V8_H_)
</span><span class="lines">@@ -50,10 +50,10 @@
</span><span class="cx">     modem_connect_tones_rx_state_t ansam_rx;
</span><span class="cx"> 
</span><span class="cx">     /*! \brief Modulation schemes available at this end. */
</span><del>-    int local_end_modulations;
-    int common_modulations;
</del><ins>+    unsigned int far_end_modulations;
</ins><span class="cx"> 
</span><del>-    v8_result_t result;
</del><ins>+    v8_parms_t parms;
+    v8_parms_t result;
</ins><span class="cx"> 
</span><span class="cx">     /* V.8 data parsing */
</span><span class="cx">     uint32_t bit_stream;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspv17txh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/v17tx.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/v17tx.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/v17tx.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v17tx.h,v 1.43 2009/07/09 13:52:09 steveu Exp $
</del><ins>+ * $Id: v17tx.h,v 1.43.4.1 2009/12/24 16:52:30 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -102,12 +102,12 @@
</span><span class="cx">     use of the context, to initialise its contents.
</span><span class="cx">     \brief Initialise a V.17 modem transmit context.
</span><span class="cx">     \param s The modem context.
</span><del>-    \param rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400.
</del><ins>+    \param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400.
</ins><span class="cx">     \param tep TRUE is the optional TEP tone is to be transmitted.
</span><span class="cx">     \param get_bit The callback routine used to get the data to be transmitted.
</span><span class="cx">     \param user_data An opaque pointer.
</span><span class="cx">     \return A pointer to the modem context, or NULL if there was a problem. */
</span><del>-SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int rate, int tep, get_bit_func_t get_bit, void *user_data);
</del><ins>+SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
</ins><span class="cx"> 
</span><span class="cx"> /*! Reinitialise an existing V.17 modem transmit context, so it may be reused.
</span><span class="cx">     \brief Reinitialise an existing V.17 modem transmit context.
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspv8h"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/v8.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/v8.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/v8.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v8.h,v 1.31 2009/11/04 16:10:14 steveu Exp $
</del><ins>+ * $Id: v8.h,v 1.31.4.1 2009/12/28 12:20:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx">  
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -43,9 +43,9 @@
</span><span class="cx"> #if !defined(_SPANDSP_V8_H_)
</span><span class="cx"> #define _SPANDSP_V8_H_
</span><span class="cx"> 
</span><del>-typedef struct v8_result_s v8_result_t;
</del><ins>+typedef struct v8_parms_s v8_parms_t;
</ins><span class="cx"> 
</span><del>-typedef void (v8_result_handler_t)(void *user_data, v8_result_t *result);
</del><ins>+typedef void (v8_result_handler_t)(void *user_data, v8_parms_t *result);
</ins><span class="cx"> 
</span><span class="cx"> enum v8_call_function_e
</span><span class="cx"> {
</span><span class="lines">@@ -102,18 +102,15 @@
</span><span class="cx"> 
</span><span class="cx"> typedef struct v8_state_s v8_state_t;
</span><span class="cx"> 
</span><del>-struct v8_result_s
</del><ins>+struct v8_parms_s
</ins><span class="cx"> {
</span><del>-    int modem_connect_tone_detected;
</del><ins>+    int modem_connect_tone;
</ins><span class="cx">     int call_function;
</span><del>-    int far_end_modulations;
-    int negotiated_modulation;
</del><ins>+    unsigned int modulations;
</ins><span class="cx">     int protocol;
</span><span class="cx">     int pstn_access;
</span><del>-    int nsf_seen;
-    int nsf;
</del><span class="cx">     int pcm_modem_availability;
</span><del>-    int t66_seen;
</del><ins>+    int nsf;
</ins><span class="cx">     int t66;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -122,20 +119,21 @@
</span><span class="cx"> {
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+SPAN_DECLARE(int) v8_restart(v8_state_t *s,
+                             int calling_party,
+                             v8_parms_t *parms);
+
</ins><span class="cx"> /*! Initialise a V.8 context.
</span><span class="cx">     \brief Initialise a V.8 context.
</span><span class="cx">     \param s The V.8 context.
</span><span class="cx">     \param calling_party TRUE if caller mode, else answerer mode.
</span><del>-    \param use_ansam_pr TRUE if ANSam/ is to be used, else ANSam will be used.
-    \param available_modulations A bitwise list of the modulation schemes to be
-           advertised as available here.
</del><ins>+    \param parms The allowed parameters for the call.
</ins><span class="cx">     \param result_handler The callback routine used to handle the results of negotiation.
</span><span class="cx">     \param user_data An opaque pointer passed to the result_handler routine.
</span><span class="cx">     \return A pointer to the V.8 context, or NULL if there was a problem. */
</span><span class="cx"> SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s,
</span><span class="cx">                                    int calling_party,
</span><del>-                                   int use_ansam_pr,
-                                   int available_modulations,
</del><ins>+                                   v8_parms_t *parms,
</ins><span class="cx">                                    v8_result_handler_t *result_handler,
</span><span class="cx">                                    void *user_data);
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspversionh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/version.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/version.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/version.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -30,9 +30,9 @@
</span><span class="cx"> 
</span><span class="cx"> /* The date and time of the version are in UTC form. */
</span><span class="cx"> 
</span><del>-#define SPANDSP_RELEASE_DATE            20091223
-#define SPANDSP_RELEASE_TIME            143600
-#define SPANDSP_RELEASE_DATETIME_STRING &quot;20091223 143600&quot;
</del><ins>+#define SPANDSP_RELEASE_DATE            20091228
+#define SPANDSP_RELEASE_TIME            123351
+#define SPANDSP_RELEASE_DATETIME_STRING &quot;20091228 123351&quot;
</ins><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> /*- End of file ------------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcv17_v32bis_rx_constellation_mapsh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v17_v32bis_rx_constellation_maps.h,v 1.1 2009/06/02 11:51:57 steveu Exp $
</del><ins>+ * $Id: v17_v32bis_rx_constellation_maps.h,v 1.1.4.1 2009/12/24 16:52:30 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /* The following table maps the 8 soft-decisions associated with every possible point in the
</span><span class="lines">@@ -5514,4 +5514,1376 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+static const uint8_t constel_map_4800[36][36] =
+{   /* 4,800bps map - No trellis. V.32/V.32bis only */
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    }
+};
+
</ins><span class="cx"> /*- End of file ------------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcv17_v32bis_tx_constellation_mapsh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v17_v32bis_tx_constellation_maps.h,v 1.1 2009/06/02 11:51:57 steveu Exp $
</del><ins>+ * $Id: v17_v32bis_tx_constellation_maps.h,v 1.1.4.1 2009/12/24 16:52:30 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if defined(SPANDSP_USE_FIXED_POINTx)
</span><span class="lines">@@ -299,16 +299,30 @@
</span><span class="cx">     {-2, -2}        /* 0x0F */
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+/* This one does not exist in V.17 as a data constellation. It is only
+   the equaliser training constellation. In V.32/V.32bis it is a data mode. */
</ins><span class="cx"> #if defined(SPANDSP_USE_FIXED_POINTx)
</span><span class="cx"> static const complexi16_t v17_v32bis_4800_constellation[4] =
</span><span class="cx"> #else
</span><span class="cx"> static const complexf_t v17_v32bis_4800_constellation[4] =
</span><span class="cx"> #endif
</span><span class="cx"> {
</span><del>-    {-6, -2},
-    { 2, -6},
-    { 6,  2},
-    {-2,  6}
</del><ins>+    {-6, -2},       /* 0x00 */
+    {-2,  6},       /* 0x01 */
+    { 2, -6},       /* 0x02 */
+    { 6,  2}        /* 0x03 */
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+#if defined(SPANDSP_USE_FIXED_POINTx)
+static const complexi16_t v17_v32bis_abcd_constellation[4] =
+#else
+static const complexf_t v17_v32bis_abcd_constellation[4] =
+#endif
+{
+    {-6, -2},       /* A */
+    { 2, -6},       /* B */
+    { 6,  2},       /* C */
+    {-2,  6}        /* D */
+};
+
</ins><span class="cx"> /*- End of file ------------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcv17rxc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/v17rx.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/v17rx.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/v17rx.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v17rx.c,v 1.153.4.4 2009/12/19 14:18:13 steveu Exp $
</del><ins>+ * $Id: v17rx.c,v 1.153.4.6 2009/12/28 12:20:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -297,7 +297,8 @@
</span><span class="cx"> {
</span><span class="cx">     int out_bit;
</span><span class="cx"> 
</span><del>-    out_bit = (in_bit ^ (s-&gt;scramble_reg &gt;&gt; 17) ^ (s-&gt;scramble_reg &gt;&gt; 22)) &amp; 1;
</del><ins>+    //out_bit = (in_bit ^ (s-&gt;scramble_reg &gt;&gt; s-&gt;scrambler_tap) ^ (s-&gt;scramble_reg &gt;&gt; (23 - 1))) &amp; 1;
+    out_bit = (in_bit ^ (s-&gt;scramble_reg &gt;&gt; (18 - 1)) ^ (s-&gt;scramble_reg &gt;&gt; (23 - 1))) &amp; 1;
</ins><span class="cx">     s-&gt;scramble_reg &lt;&lt;= 1;
</span><span class="cx">     if (s-&gt;training_stage &gt; TRAINING_STAGE_NORMAL_OPERATION  &amp;&amp;  s-&gt;training_stage &lt; TRAINING_STAGE_TCM_WINDUP)
</span><span class="cx">         s-&gt;scramble_reg |= out_bit;
</span><span class="lines">@@ -361,12 +362,22 @@
</span><span class="cx"> 
</span><span class="cx"> static int decode_baud(v17_rx_state_t *s, complexf_t *z)
</span><span class="cx"> {
</span><del>-    static const int diff_code[16] =
</del><ins>+    static const uint8_t v32bis_4800_differential_decoder[4][4] =
</ins><span class="cx">     {
</span><del>-        0, 3, 2, 1, 1, 0, 3, 2, 2, 1, 0, 3, 3, 2, 1, 0                         
</del><ins>+        {2, 3, 0, 1},
+        {0, 2, 1, 3},
+        {3, 1, 2, 0},
+        {1, 0, 3, 2}
</ins><span class="cx">     };
</span><del>-    static const int tcm_paths[8][4] =
</del><ins>+    static const uint8_t v17_differential_decoder[4][4] =
</ins><span class="cx">     {
</span><ins>+        {0, 1, 2, 3},
+        {3, 0, 1, 2},
+        {2, 3, 0, 1},
+        {1, 2, 3, 0}
+    };
+    static const uint8_t tcm_paths[8][4] =
+    {
</ins><span class="cx">         {0, 6, 2, 4},
</span><span class="cx">         {6, 0, 4, 2},
</span><span class="cx">         {2, 4, 0, 6},
</span><span class="lines">@@ -408,6 +419,17 @@
</span><span class="cx">     else if (im &lt; 0)
</span><span class="cx">         im = 0;
</span><span class="cx"> 
</span><ins>+    if (s-&gt;bits_per_symbol == 2)
+    {
+        /* 4800bps V.32bis mode, without trellis coding */
+        nearest = constel_map_4800[re][im];
+        raw = v32bis_4800_differential_decoder[s-&gt;diff][nearest];
+        s-&gt;diff = nearest;
+        put_bit(s, raw);
+        put_bit(s, raw &gt;&gt; 1);
+        return nearest;
+    }
+
</ins><span class="cx">     /* Find a set of 8 candidate constellation positions, that are the closest
</span><span class="cx">        to the target, with different patterns in the last 3 bits. */
</span><span class="cx"> #if defined(SPANDSP_USE_FIXED_POINTx)
</span><span class="lines">@@ -515,7 +537,7 @@
</span><span class="cx">     nearest = s-&gt;full_path_to_past_state_locations[j][k] &gt;&gt; 1;
</span><span class="cx"> 
</span><span class="cx">     /* Differentially decode */
</span><del>-    raw = (nearest &amp; 0x3C) | diff_code[((nearest &amp; 0x03) &lt;&lt; 2) | s-&gt;diff];
</del><ins>+    raw = (nearest &amp; 0x3C) | v17_differential_decoder[s-&gt;diff][nearest &amp; 0x03];
</ins><span class="cx">     s-&gt;diff = nearest &amp; 0x03;
</span><span class="cx">     for (i = 0;  i &lt; s-&gt;bits_per_symbol;  i++)
</span><span class="cx">     {
</span><span class="lines">@@ -555,7 +577,7 @@
</span><span class="cx">     p = v - s-&gt;symbol_sync_dc_filter[1];
</span><span class="cx">     s-&gt;symbol_sync_dc_filter[1] = s-&gt;symbol_sync_dc_filter[0];
</span><span class="cx">     s-&gt;symbol_sync_dc_filter[0] = v;
</span><del>-    /* A little integration will now filter away much of the noise */
</del><ins>+    /* A little integration will now filter away much of the HF noise */
</ins><span class="cx">     s-&gt;baud_phase -= p;
</span><span class="cx">     if (abs(s-&gt;baud_phase) &gt; 100*FP_FACTOR)
</span><span class="cx">     {
</span><span class="lines">@@ -563,7 +585,6 @@
</span><span class="cx">             i = (s-&gt;baud_phase &gt; 1000*FP_FACTOR)  ?  15  :  1;
</span><span class="cx">         else
</span><span class="cx">             i = (s-&gt;baud_phase &lt; -1000*FP_FACTOR)  ?  -15  :  -1;
</span><del>-
</del><span class="cx">         //printf(&quot;v = %10.5f %5d - %f %f %d %d\n&quot;, v, i, p, s-&gt;baud_phase, s-&gt;total_baud_timing_correction);
</span><span class="cx">         s-&gt;eq_put_step += i;
</span><span class="cx">         s-&gt;total_baud_timing_correction += i;
</span><span class="lines">@@ -573,14 +594,12 @@
</span><span class="cx">     v = s-&gt;symbol_sync_low[1]*s-&gt;symbol_sync_high[0]*SYNC_LOW_BAND_EDGE_COEFF_2
</span><span class="cx">       - s-&gt;symbol_sync_low[0]*s-&gt;symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_2
</span><span class="cx">       + s-&gt;symbol_sync_low[1]*s-&gt;symbol_sync_high[1]*SYNC_MIXED_EDGES_COEFF_3;
</span><del>-
</del><span class="cx">     /* Filter away any DC component  */
</span><span class="cx">     p = v - s-&gt;symbol_sync_dc_filter[1];
</span><span class="cx">     s-&gt;symbol_sync_dc_filter[1] = s-&gt;symbol_sync_dc_filter[0];
</span><span class="cx">     s-&gt;symbol_sync_dc_filter[0] = v;
</span><span class="cx">     /* A little integration will now filter away much of the HF noise */
</span><span class="cx">     s-&gt;baud_phase -= p;
</span><del>-
</del><span class="cx">     if (fabsf(s-&gt;baud_phase) &gt; 100.0f)
</span><span class="cx">     {
</span><span class="cx">         if (s-&gt;baud_phase &gt; 0.0f)
</span><span class="lines">@@ -588,7 +607,6 @@
</span><span class="cx">         else
</span><span class="cx">             i = (s-&gt;baud_phase &lt; -1000.0f)  ?  -15  :  -1;
</span><span class="cx">         //printf(&quot;v = %10.5f %5d - %f %f %d\n&quot;, v, i, p, s-&gt;baud_phase, s-&gt;total_baud_timing_correction);
</span><del>-
</del><span class="cx">         s-&gt;eq_put_step += i;
</span><span class="cx">         s-&gt;total_baud_timing_correction += i;
</span><span class="cx">     }
</span><span class="lines">@@ -624,8 +642,7 @@
</span><span class="cx"> 
</span><span class="cx">     /* This routine processes every half a baud, as we put things into the equalizer at the T/2 rate. */
</span><span class="cx"> 
</span><del>-    /* Add a sample to the equalizer's circular buffer, but don't calculate anything
-       at this time. */
</del><ins>+    /* Add a sample to the equalizer's circular buffer, but don't calculate anything at this time. */
</ins><span class="cx">     s-&gt;eq_buf[s-&gt;eq_step] = *sample;
</span><span class="cx">     if (++s-&gt;eq_step &gt;= V17_EQUALIZER_LEN)
</span><span class="cx">         s-&gt;eq_step = 0;
</span><span class="lines">@@ -880,7 +897,18 @@
</span><span class="cx">         {
</span><span class="cx">             s-&gt;training_count = 0;
</span><span class="cx">             s-&gt;training_error = 0.0f;
</span><del>-            s-&gt;training_stage = TRAINING_STAGE_TCM_WINDUP;
</del><ins>+            if (s-&gt;bits_per_symbol == 2)
+            {
+                /* Restart the differential decoder */
+                /* There is no trellis, so go straight to processing decoded data */
+                s-&gt;diff = (s-&gt;short_train)  ?  0  :  1;
+                s-&gt;training_stage = TRAINING_STAGE_TEST_ONES;
+            }
+            else
+            {
+                /* Wait for the trellis to wind up */
+                s-&gt;training_stage = TRAINING_STAGE_TCM_WINDUP;
+            }
</ins><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">     case TRAINING_STAGE_SHORT_WAIT_FOR_CDBA:
</span><span class="lines">@@ -937,7 +965,19 @@
</span><span class="cx">             if (s-&gt;training_error &lt; (V17_TRAINING_SHORT_SEG_2_LEN - 8)*4.0f*constellation_spacing[s-&gt;space_map])
</span><span class="cx">             {
</span><span class="cx">                 s-&gt;training_count = 0;
</span><del>-                s-&gt;training_stage = TRAINING_STAGE_TCM_WINDUP;
</del><ins>+                if (s-&gt;bits_per_symbol == 2)
+                {
+                    /* There is no trellis, so go straight to processing decoded data */
+                    /* Restart the differential decoder */
+                    s-&gt;diff = (s-&gt;short_train)  ?  0  :  1;
+                    s-&gt;training_error = 0.0f;
+                    s-&gt;training_stage = TRAINING_STAGE_TEST_ONES;
+                }
+                else
+                {
+                    /* Wait for the trellis to wind up */
+                    s-&gt;training_stage = TRAINING_STAGE_TCM_WINDUP;
+                }
</ins><span class="cx">                 report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS);
</span><span class="cx">             }
</span><span class="cx">             else
</span><span class="lines">@@ -1254,6 +1294,13 @@
</span><span class="cx">         s-&gt;space_map = 3;
</span><span class="cx">         s-&gt;bits_per_symbol = 3;
</span><span class="cx">         break;
</span><ins>+    case 4800:
+        /* This does not exist in the V.17 spec as a valid mode of operation.
+           However, it does exist in V.32bis, so it is here for completeness. */
+        s-&gt;constellation = v17_v32bis_4800_constellation;
+        s-&gt;space_map = 0;
+        s-&gt;bits_per_symbol = 2;
+        break;
</ins><span class="cx">     default:
</span><span class="cx">         return -1;
</span><span class="cx">     }
</span><span class="lines">@@ -1306,28 +1353,50 @@
</span><span class="cx">         s-&gt;agc_scaling = s-&gt;agc_scaling_save;
</span><span class="cx">         equalizer_restore(s);
</span><span class="cx">         /* Don't allow any frequency correction at all, until we start to pull the phase in. */
</span><ins>+#if defined(SPANDSP_USE_FIXED_POINTx)
+        s-&gt;carrier_track_i = 0;
+        s-&gt;carrier_track_p = 40000;
+#else
</ins><span class="cx">         s-&gt;carrier_track_i = 0.0f;
</span><span class="cx">         s-&gt;carrier_track_p = 40000.0f;
</span><ins>+#endif
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="cx">         s-&gt;carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
</span><ins>+        equalizer_reset(s);
+#if defined(SPANDSP_USE_FIXED_POINTx)
+        s-&gt;agc_scaling_save = 0;
+        s-&gt;agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN;
+        s-&gt;carrier_track_i = 5000;
+        s-&gt;carrier_track_p = 40000;
+#else
</ins><span class="cx">         s-&gt;agc_scaling_save = 0.0f;
</span><span class="cx">         s-&gt;agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN;
</span><del>-        equalizer_reset(s);
</del><span class="cx">         s-&gt;carrier_track_i = 5000.0f;
</span><span class="cx">         s-&gt;carrier_track_p = 40000.0f;
</span><ins>+#endif
</ins><span class="cx">     }
</span><span class="cx">     s-&gt;last_sample = 0;
</span><span class="cx"> 
</span><span class="cx">     /* Initialise the working data for symbol timing synchronisation */
</span><del>-    s-&gt;symbol_sync_low[0] = 0.0f;
-    s-&gt;symbol_sync_low[1] = 0.0f;
-    s-&gt;symbol_sync_high[0] = 0.0f;
-    s-&gt;symbol_sync_high[1] = 0.0f;
-    s-&gt;symbol_sync_dc_filter[0] = 0.0f;
-    s-&gt;symbol_sync_dc_filter[1] = 0.0f;
</del><ins>+#if defined(SPANDSP_USE_FIXED_POINTx)
+    for (i = 0;  i &lt; 2;  i++)
+    {
+        s-&gt;symbol_sync_low[i] = 0;
+        s-&gt;symbol_sync_high[i] = 0;
+        s-&gt;symbol_sync_dc_filter[i] = 0;
+    }
+    s-&gt;baud_phase = 0;
+#else
+    for (i = 0;  i &lt; 2;  i++)
+    {
+        s-&gt;symbol_sync_low[i] = 0.0f;
+        s-&gt;symbol_sync_high[i] = 0.0f;
+        s-&gt;symbol_sync_dc_filter[i] = 0.0f;
+    }
</ins><span class="cx">     s-&gt;baud_phase = 0.0f;
</span><ins>+#endif
</ins><span class="cx">     s-&gt;baud_half = 0;
</span><span class="cx">     
</span><span class="cx">     s-&gt;total_baud_timing_correction = 0;
</span><span class="lines">@@ -1344,6 +1413,8 @@
</span><span class="cx">     case 12000:
</span><span class="cx">     case 9600:
</span><span class="cx">     case 7200:
</span><ins>+    case 4800:
+        /* 4800 is an extension of V.17, to provide full converage of the V.32bis modes */
</ins><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         return NULL;
</span><span class="lines">@@ -1359,11 +1430,11 @@
</span><span class="cx">     s-&gt;put_bit = put_bit;
</span><span class="cx">     s-&gt;put_bit_user_data = user_data;
</span><span class="cx">     s-&gt;short_train = FALSE;
</span><ins>+    //s-&gt;scrambler_tap = 18 - 1;
</ins><span class="cx">     v17_rx_signal_cutoff(s, -45.5f);
</span><span class="cx">     s-&gt;agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN;
</span><span class="cx">     s-&gt;agc_scaling_save = 0.0f;
</span><span class="cx">     s-&gt;carrier_phase_rate_save = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
</span><del>-
</del><span class="cx">     v17_rx_restart(s, bit_rate, s-&gt;short_train);
</span><span class="cx">     return s;
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcv17txc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/v17tx.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/v17tx.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/v17tx.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v17tx.c,v 1.75 2009/06/02 16:03:56 steveu Exp $
</del><ins>+ * $Id: v17tx.c,v 1.75.4.1 2009/12/24 16:52:30 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -100,7 +100,8 @@
</span><span class="cx"> {
</span><span class="cx">     int out_bit;
</span><span class="cx"> 
</span><del>-    out_bit = (in_bit ^ (s-&gt;scramble_reg &gt;&gt; 17) ^ (s-&gt;scramble_reg &gt;&gt; 22)) &amp; 1;
</del><ins>+    //out_bit = (in_bit ^ (s-&gt;scramble_reg &gt;&gt; s-&gt;scrambler_tap) ^ (s-&gt;scramble_reg &gt;&gt; (23 - 1))) &amp; 1;
+    out_bit = (in_bit ^ (s-&gt;scramble_reg &gt;&gt; (18 - 1)) ^ (s-&gt;scramble_reg &gt;&gt; (23 - 1))) &amp; 1;
</ins><span class="cx">     s-&gt;scramble_reg = (s-&gt;scramble_reg &lt;&lt; 1) | out_bit;
</span><span class="cx">     return out_bit;
</span><span class="cx"> }
</span><span class="lines">@@ -135,7 +136,7 @@
</span><span class="cx">             if (s-&gt;training_step &lt;= V17_TRAINING_SEG_TEP_B)
</span><span class="cx">             {
</span><span class="cx">                 /* Optional segment: Unmodulated carrier (talker echo protection) */
</span><del>-                return v17_v32bis_4800_constellation[0];
</del><ins>+                return v17_v32bis_abcd_constellation[0];
</ins><span class="cx">             }
</span><span class="cx">             if (s-&gt;training_step &lt;= V17_TRAINING_SEG_1)
</span><span class="cx">             {
</span><span class="lines">@@ -143,7 +144,7 @@
</span><span class="cx">                 return zero;
</span><span class="cx">             }
</span><span class="cx">             /* Segment 1: ABAB... */
</span><del>-            return v17_v32bis_4800_constellation[(s-&gt;training_step &amp; 1) ^ 1];
</del><ins>+            return v17_v32bis_abcd_constellation[(s-&gt;training_step &amp; 1) ^ 1];
</ins><span class="cx">         }
</span><span class="cx">         /* Segment 2: CDBA... */
</span><span class="cx">         /* Apply the scrambler */
</span><span class="lines">@@ -155,7 +156,7 @@
</span><span class="cx">             /* Go straight to the ones test. */
</span><span class="cx">             s-&gt;training_step = V17_TRAINING_SEG_4;
</span><span class="cx">         }
</span><del>-        return v17_v32bis_4800_constellation[s-&gt;constellation_state];
</del><ins>+        return v17_v32bis_abcd_constellation[s-&gt;constellation_state];
</ins><span class="cx">     }
</span><span class="cx">     /* Segment 3: Bridge... */
</span><span class="cx">     shift = ((s-&gt;training_step - V17_TRAINING_SEG_3 - 1) &amp; 0x7) &lt;&lt; 1;
</span><span class="lines">@@ -163,30 +164,53 @@
</span><span class="cx">     bits = scramble(s, V17_BRIDGE_WORD &gt;&gt; shift);
</span><span class="cx">     bits = (bits &lt;&lt; 1) | scramble(s, V17_BRIDGE_WORD &gt;&gt; (shift + 1));
</span><span class="cx">     s-&gt;constellation_state = (s-&gt;constellation_state + dibit_to_step[bits]) &amp; 3;
</span><del>-    return v17_v32bis_4800_constellation[s-&gt;constellation_state];
</del><ins>+    return v17_v32bis_abcd_constellation[s-&gt;constellation_state];
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="cx"> static __inline__ int diff_and_convolutional_encode(v17_tx_state_t *s, int q)
</span><span class="cx"> {
</span><del>-    static const int diff_code[16] =
</del><ins>+    static const uint8_t v32bis_4800_differential_encoder[4][4] =
</ins><span class="cx">     {
</span><del>-        0, 1, 2, 3, 1, 2, 3, 0, 2, 3, 0, 1, 3, 0, 1, 2
</del><ins>+        {2, 3, 0, 1},
+        {0, 2, 1, 3},
+        {3, 1, 2, 0},
+        {1, 0, 3, 2}
</ins><span class="cx">     };
</span><del>-    int y1;
-    int y2;
-    int this1;
-    int this2;
</del><ins>+    static const uint8_t v17_differential_encoder[4][4] =
+    {
+        {0, 1, 2, 3},
+        {1, 2, 3, 0},
+        {2, 3, 0, 1},
+        {3, 0, 1, 2}
+    };
+    static const uint8_t v17_convolutional_coder[8][4] =
+    {
+        {0, 2, 3, 1},
+        {4, 7, 5, 6},
+        {1, 3, 2, 0},
+        {7, 4, 6, 5},
+        {2, 0, 1, 3},
+        {6, 5, 7, 4},
+        {3, 1, 0, 2},
+        {5, 6, 4, 7}
+    };
</ins><span class="cx"> 
</span><ins>+    if (s-&gt;bits_per_symbol == 2)
+    {
+        /* 4800bps mode for V.32bis */
+        /* There is no trellis. We just differentially encode. */
+        s-&gt;diff = v32bis_4800_differential_encoder[s-&gt;diff][q &amp; 0x03];
+        return s-&gt;diff;
+    }
</ins><span class="cx">     /* Differentially encode */
</span><del>-    s-&gt;diff = diff_code[((q &amp; 0x03) &lt;&lt; 2) | s-&gt;diff];
</del><ins>+    s-&gt;diff = v17_differential_encoder[s-&gt;diff][q &amp; 0x03];
</ins><span class="cx"> 
</span><span class="cx">     /* Convolutionally encode the redundant bit */
</span><del>-    y2 = s-&gt;diff &gt;&gt; 1;
-    y1 = s-&gt;diff;
-    this2 = y2 ^ y1 ^ (s-&gt;convolution &gt;&gt; 2) ^ ((y2 ^ (s-&gt;convolution &gt;&gt; 1)) &amp; s-&gt;convolution);
-    this1 = y2 ^ (s-&gt;convolution &gt;&gt; 1) ^ (y1 &amp; s-&gt;convolution);
-    s-&gt;convolution = ((s-&gt;convolution &amp; 1) &lt;&lt; 2) | ((this2 &amp; 1) &lt;&lt; 1) | (this1 &amp; 1);
</del><ins>+    s-&gt;convolution = v17_convolutional_coder[s-&gt;convolution][s-&gt;diff];
+
+    /* The final result is the combination of some uncoded bits, 2 differentially
+       encoded bits, and the convolutionally encoded redundant bit. */
</ins><span class="cx">     return ((q &lt;&lt; 1) &amp; 0x78) | (s-&gt;diff &lt;&lt; 1) | ((s-&gt;convolution &gt;&gt; 2) &amp; 1);
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -373,12 +397,18 @@
</span><span class="cx">         s-&gt;bits_per_symbol = 3;
</span><span class="cx">         s-&gt;constellation = v17_v32bis_7200_constellation;
</span><span class="cx">         break;
</span><ins>+    case 4800:
+        /* This does not exist in the V.17 spec as a valid mode of operation.
+           However, it does exist in V.32bis, so it is here for completeness. */
+        s-&gt;bits_per_symbol = 2;
+        s-&gt;constellation = v17_v32bis_4800_constellation;
+        break;
</ins><span class="cx">     default:
</span><span class="cx">         return -1;
</span><span class="cx">     }
</span><ins>+    s-&gt;bit_rate = bit_rate;
</ins><span class="cx">     /* NB: some modems seem to use 3 instead of 1 for long training */
</span><span class="cx">     s-&gt;diff = (short_train)  ?  0  :  1;
</span><del>-    s-&gt;bit_rate = bit_rate;
</del><span class="cx"> #if defined(SPANDSP_USE_FIXED_POINT)
</span><span class="cx">     memset(s-&gt;rrc_filter, 0, sizeof(s-&gt;rrc_filter));
</span><span class="cx"> #else
</span><span class="lines">@@ -406,6 +436,8 @@
</span><span class="cx">     case 12000:
</span><span class="cx">     case 9600:
</span><span class="cx">     case 7200:
</span><ins>+    case 4800:
+        /* 4800 is an extension of V.17, to provide full converage of the V.32bis modes */
</ins><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         return NULL;
</span><span class="lines">@@ -420,6 +452,7 @@
</span><span class="cx">     span_log_set_protocol(&amp;s-&gt;logging, &quot;V.17 TX&quot;);
</span><span class="cx">     s-&gt;get_bit = get_bit;
</span><span class="cx">     s-&gt;get_bit_user_data = user_data;
</span><ins>+    //s-&gt;scrambler_tap = 18 - 1;
</ins><span class="cx">     s-&gt;carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
</span><span class="cx">     v17_tx_power(s, -14.0f);
</span><span class="cx">     v17_tx_restart(s, bit_rate, tep, FALSE);
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcv29rxc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/v29rx.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/v29rx.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/v29rx.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v29rx.c,v 1.167.4.4 2009/12/19 14:18:13 steveu Exp $
</del><ins>+ * $Id: v29rx.c,v 1.167.4.5 2009/12/28 12:20:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -511,7 +511,7 @@
</span><span class="cx">     p = v - s-&gt;symbol_sync_dc_filter[1];
</span><span class="cx">     s-&gt;symbol_sync_dc_filter[1] = s-&gt;symbol_sync_dc_filter[0];
</span><span class="cx">     s-&gt;symbol_sync_dc_filter[0] = v;
</span><del>-    /* A little integration will now filter away much of the noise */
</del><ins>+    /* A little integration will now filter away much of the HF noise */
</ins><span class="cx">     s-&gt;baud_phase -= p;
</span><span class="cx">     if (abs(s-&gt;baud_phase) &gt; 30*FP_FACTOR)
</span><span class="cx">     {
</span><span class="lines">@@ -519,7 +519,6 @@
</span><span class="cx">             i = (s-&gt;baud_phase &gt; 1000*FP_FACTOR)  ?  5  :  1;
</span><span class="cx">         else
</span><span class="cx">             i = (s-&gt;baud_phase &lt; -1000*FP_FACTOR)  ?  -5  :  -1;
</span><del>-
</del><span class="cx">         //printf(&quot;v = %10.5f %5d - %f %f %d %d\n&quot;, v, i, p, s-&gt;baud_phase, s-&gt;total_baud_timing_correction);
</span><span class="cx">         s-&gt;eq_put_step += i;
</span><span class="cx">         s-&gt;total_baud_timing_correction += i;
</span><span class="lines">@@ -533,19 +532,14 @@
</span><span class="cx">     p = v - s-&gt;symbol_sync_dc_filter[1];
</span><span class="cx">     s-&gt;symbol_sync_dc_filter[1] = s-&gt;symbol_sync_dc_filter[0];
</span><span class="cx">     s-&gt;symbol_sync_dc_filter[0] = v;
</span><del>-    /* A little integration will now filter away much of the noise */
</del><ins>+    /* A little integration will now filter away much of the HF noise */
</ins><span class="cx">     s-&gt;baud_phase -= p;
</span><del>-#if 0
-    if (fabsf(s-&gt;baud_phase) &gt; 100.0f)
-#else
</del><span class="cx">     if (fabsf(s-&gt;baud_phase) &gt; 30.0f)
</span><del>-#endif
</del><span class="cx">     {
</span><span class="cx">         if (s-&gt;baud_phase &gt; 0.0f)
</span><span class="cx">             i = (s-&gt;baud_phase &gt; 1000.0f)  ?  5  :  1;
</span><span class="cx">         else
</span><span class="cx">             i = (s-&gt;baud_phase &lt; -1000.0f)  ?  -5  :  -1;
</span><del>-
</del><span class="cx">         //printf(&quot;v = %10.5f %5d - %f %f %d %d\n&quot;, v, i, p, s-&gt;baud_phase, s-&gt;total_baud_timing_correction);
</span><span class="cx">         s-&gt;eq_put_step += i;
</span><span class="cx">         s-&gt;total_baud_timing_correction += i;
</span><span class="lines">@@ -586,8 +580,7 @@
</span><span class="cx"> 
</span><span class="cx">     /* This routine processes every half a baud, as we put things into the equalizer at the T/2 rate. */
</span><span class="cx"> 
</span><del>-    /* Add a sample to the equalizer's circular buffer, but don't calculate anything
-       at this time. */
</del><ins>+    /* Add a sample to the equalizer's circular buffer, but don't calculate anything at this time. */
</ins><span class="cx">     s-&gt;eq_buf[s-&gt;eq_step] = *sample;
</span><span class="cx">     if (++s-&gt;eq_step &gt;= V29_EQUALIZER_LEN)
</span><span class="cx">         s-&gt;eq_step = 0;
</span><span class="lines">@@ -1082,6 +1075,8 @@
</span><span class="cx"> 
</span><span class="cx"> SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train)
</span><span class="cx"> {
</span><ins>+    int i;
+
</ins><span class="cx">     switch (bit_rate)
</span><span class="cx">     {
</span><span class="cx">     case 9600:
</span><span class="lines">@@ -1153,20 +1148,20 @@
</span><span class="cx"> 
</span><span class="cx">     /* Initialise the working data for symbol timing synchronisation */
</span><span class="cx"> #if defined(SPANDSP_USE_FIXED_POINT)
</span><del>-    s-&gt;symbol_sync_low[0] = 0;
-    s-&gt;symbol_sync_low[1] = 0;
-    s-&gt;symbol_sync_high[0] = 0;
-    s-&gt;symbol_sync_high[1] = 0;
-    s-&gt;symbol_sync_dc_filter[0] = 0;
-    s-&gt;symbol_sync_dc_filter[1] = 0;
</del><ins>+    for (i = 0;  i &lt; 2;  i++)
+    {
+        s-&gt;symbol_sync_low[i] = 0;
+        s-&gt;symbol_sync_high[i] = 0;
+        s-&gt;symbol_sync_dc_filter[i] = 0;
+    }
</ins><span class="cx">     s-&gt;baud_phase = 0;
</span><span class="cx"> #else
</span><del>-    s-&gt;symbol_sync_low[0] = 0.0f;
-    s-&gt;symbol_sync_low[1] = 0.0f;
-    s-&gt;symbol_sync_high[0] = 0.0f;
-    s-&gt;symbol_sync_high[1] = 0.0f;
-    s-&gt;symbol_sync_dc_filter[0] = 0.0f;
-    s-&gt;symbol_sync_dc_filter[1] = 0.0f;
</del><ins>+    for (i = 0;  i &lt; 2;  i++)
+    {
+        s-&gt;symbol_sync_low[i] = 0.0f;
+        s-&gt;symbol_sync_high[i] = 0.0f;
+        s-&gt;symbol_sync_dc_filter[i] = 0.0f;
+    }
</ins><span class="cx">     s-&gt;baud_phase = 0.0f;
</span><span class="cx"> #endif
</span><span class="cx">     s-&gt;baud_half = 0;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcv8c"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/v8.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/v8.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/v8.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v8.c,v 1.42.4.1 2009/12/23 14:23:49 steveu Exp $
</del><ins>+ * $Id: v8.c,v 1.42.4.3 2009/12/28 12:20:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx">  
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -298,7 +298,7 @@
</span><span class="cx"> 
</span><span class="cx"> static const uint8_t *process_modulation_mode(v8_state_t *s, const uint8_t *p)
</span><span class="cx"> {
</span><del>-    int far_end_modulations;
</del><ins>+    unsigned int far_end_modulations;
</ins><span class="cx"> 
</span><span class="cx">     /* Modulation mode octet */
</span><span class="cx">     far_end_modulations = 0;
</span><span class="lines">@@ -338,8 +338,9 @@
</span><span class="cx">                 far_end_modulations |= V8_MOD_V26TER;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    s-&gt;result.far_end_modulations = far_end_modulations;
-    v8_log_supported_modulations(s, s-&gt;result.far_end_modulations);
</del><ins>+    s-&gt;far_end_modulations =
+    s-&gt;result.modulations = far_end_modulations;
+    v8_log_supported_modulations(s, far_end_modulations);
</ins><span class="cx">     return ++p;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -363,7 +364,6 @@
</span><span class="cx"> static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8_t *p)
</span><span class="cx"> {
</span><span class="cx">     s-&gt;result.nsf = (*p &gt;&gt; 5) &amp; 0x07;
</span><del>-    s-&gt;result.nsf_seen = TRUE;
</del><span class="cx">     span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, &quot;%s\n&quot;, v8_nsf_to_str(s-&gt;result.nsf));
</span><span class="cx">     return p;
</span><span class="cx"> }
</span><span class="lines">@@ -380,7 +380,6 @@
</span><span class="cx"> static const uint8_t *process_t66(v8_state_t *s, const uint8_t *p)
</span><span class="cx"> {
</span><span class="cx">     s-&gt;result.t66 = (*p &gt;&gt; 5) &amp; 0x07;
</span><del>-    s-&gt;result.t66_seen = TRUE;
</del><span class="cx">     span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, &quot;%s\n&quot;, v8_t66_to_str(s-&gt;result.t66));
</span><span class="cx">     return ++p;
</span><span class="cx"> }
</span><span class="lines">@@ -420,7 +419,7 @@
</span><span class="cx">     /* Zero indicates the end */
</span><span class="cx">     s-&gt;cm_jm_data[s-&gt;cm_jm_len] = 0;
</span><span class="cx"> 
</span><del>-    s-&gt;result.far_end_modulations = 0;
</del><ins>+    s-&gt;result.modulations = 0;
</ins><span class="cx">     p = s-&gt;cm_jm_data;
</span><span class="cx"> 
</span><span class="cx">     while (*p)
</span><span class="lines">@@ -585,6 +584,7 @@
</span><span class="cx">                 FSK_FRAME_MODE_ASYNC,
</span><span class="cx">                 put_bit,
</span><span class="cx">                 s);
</span><ins>+    fsk_rx_signal_cutoff(&amp;s-&gt;v21rx, -45.5f);
</ins><span class="cx">     s-&gt;preamble_type = V8_SYNC_UNKNOWN;
</span><span class="cx">     s-&gt;bit_stream = 0;
</span><span class="cx">     s-&gt;cm_jm_len = 0;
</span><span class="lines">@@ -635,75 +635,67 @@
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-static void send_cm_jm(v8_state_t *s, int mod_mask)
</del><ins>+static void send_cm_jm(v8_state_t *s)
</ins><span class="cx"> {
</span><span class="cx">     int val;
</span><ins>+    unsigned int offered_modulations;
+    
+    offered_modulations = s-&gt;parms.modulations &amp; s-&gt;far_end_modulations;
</ins><span class="cx"> 
</span><span class="cx">     /* Send a CM, or a JM as appropriate */
</span><span class="cx">     v8_put_preamble(s);
</span><span class="cx">     v8_put_byte(s, V8_CM_JM_SYNC_OCTET);
</span><span class="cx">     /* Data call */
</span><del>-    v8_put_byte(s, (V8_CALL_V_SERIES &lt;&lt; 5) | V8_CALL_FUNCTION_TAG);
</del><ins>+    v8_put_byte(s, (s-&gt;result.call_function &lt;&lt; 5) | V8_CALL_FUNCTION_TAG);
</ins><span class="cx">     
</span><span class="cx">     /* Supported modulations */
</span><span class="cx">     val = 0x05;
</span><del>-    if (mod_mask &amp; V8_MOD_V90)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V90)
</ins><span class="cx">         val |= 0x20;
</span><del>-    if (mod_mask &amp; V8_MOD_V34)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V34)
</ins><span class="cx">         val |= 0x40;
</span><span class="cx">     v8_put_byte(s, val);
</span><span class="cx"> 
</span><span class="cx">     val = 0x10;
</span><del>-    if (mod_mask &amp; V8_MOD_V32)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V32)
</ins><span class="cx">         val |= 0x01;
</span><del>-    if (mod_mask &amp; V8_MOD_V22)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V22)
</ins><span class="cx">         val |= 0x02;
</span><del>-    if (mod_mask &amp; V8_MOD_V17)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V17)
</ins><span class="cx">         val |= 0x04;
</span><del>-    if (mod_mask &amp; V8_MOD_V29)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V29)
</ins><span class="cx">         val |= 0x40;
</span><del>-    if (mod_mask &amp; V8_MOD_V27TER)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V27TER)
</ins><span class="cx">         val |= 0x80;
</span><span class="cx">     v8_put_byte(s, val);
</span><span class="cx"> 
</span><span class="cx">     val = 0x10;
</span><del>-    if (mod_mask &amp; V8_MOD_V26TER)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V26TER)
</ins><span class="cx">         val |= 0x01;
</span><del>-    if (mod_mask &amp; V8_MOD_V26BIS)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V26BIS)
</ins><span class="cx">         val |= 0x02;
</span><del>-    if (mod_mask &amp; V8_MOD_V23)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V23)
</ins><span class="cx">         val |= 0x04;
</span><del>-    if (mod_mask &amp; V8_MOD_V23HALF)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V23HALF)
</ins><span class="cx">         val |= 0x40;
</span><del>-    if (mod_mask &amp; V8_MOD_V21)
</del><ins>+    if (offered_modulations &amp; V8_MOD_V21)
</ins><span class="cx">         val |= 0x80;
</span><span class="cx">     v8_put_byte(s, val);
</span><span class="cx"> 
</span><del>-    v8_put_byte(s, (0 &lt;&lt; 5) | V8_PCM_MODEM_AVAILABILITY_TAG);
</del><ins>+    if (s-&gt;parms.protocol)
+        v8_put_byte(s, (s-&gt;parms.protocol &lt;&lt; 5) | V8_PROTOCOLS_TAG);
+    if (s-&gt;parms.pcm_modem_availability)
+        v8_put_byte(s, (s-&gt;parms.pcm_modem_availability &lt;&lt; 5) | V8_PCM_MODEM_AVAILABILITY_TAG);
+    if (s-&gt;parms.pstn_access)
+        v8_put_byte(s, (s-&gt;parms.pstn_access &lt;&lt; 5) | V8_PSTN_ACCESS_TAG);
+    if (s-&gt;parms.t66 &gt;= 0)
+        v8_put_byte(s, (s-&gt;parms.t66 &lt;&lt; 5) | V8_T66_TAG);
</ins><span class="cx"> 
</span><del>-    v8_put_byte(s, (V8_PROTOCOL_LAPM_V42 &lt;&lt; 5) | V8_PROTOCOLS_TAG);
-
-    /* No cellular right now */    
-    v8_put_byte(s, (0 &lt;&lt; 5) | V8_PSTN_ACCESS_TAG);
</del><ins>+    /* No NSF */
+    //v8_put_byte(s, (0 &lt;&lt; 5) | V8_NSF_TAG);
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-static int select_modulation(int mask)
-{
-    if (mask &amp; V8_MOD_V90)
-        return V8_MOD_V90;
-    if (mask &amp; V8_MOD_V34)
-        return V8_MOD_V34;
-    if (mask &amp; V8_MOD_V32)
-        return V8_MOD_V32;
-    if (mask &amp; V8_MOD_V23)
-        return V8_MOD_V23;
-    if (mask &amp; V8_MOD_V21)
-        return V8_MOD_V21;
-    return V8_MOD_FAILED;
-}
-/*- End of function --------------------------------------------------------*/
-
</del><span class="cx"> SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
</span><span class="cx"> {
</span><span class="cx">     int len;
</span><span class="lines">@@ -724,6 +716,7 @@
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><ins>+            /* Send the 75ms of silence after the ANSam tone */
</ins><span class="cx">             if (max_len &gt; s-&gt;modem_connect_tone_tx_on)
</span><span class="cx">                 len = s-&gt;modem_connect_tone_tx_on;
</span><span class="cx">             else
</span><span class="lines">@@ -755,14 +748,14 @@
</span><span class="cx">     {
</span><span class="cx">         v8_put_preamble(s);
</span><span class="cx">         v8_put_byte(s, V8_CI_SYNC_OCTET);
</span><del>-        v8_put_byte(s, (V8_CALL_V_SERIES &lt;&lt; 5) | V8_CALL_FUNCTION_TAG);
</del><ins>+        v8_put_byte(s, (s-&gt;result.call_function &lt;&lt; 5) | V8_CALL_FUNCTION_TAG);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="cx"> static void handle_modem_connect_tone(v8_state_t *s, int tone)
</span><span class="cx"> {
</span><del>-    s-&gt;result.modem_connect_tone_detected = tone;
</del><ins>+    s-&gt;result.modem_connect_tone = tone;
</ins><span class="cx">     span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;'%s' recognised\n&quot;, modem_connect_tone_to_str(tone));
</span><span class="cx">     if (tone == MODEM_CONNECT_TONES_ANSAM
</span><span class="cx">         ||
</span><span class="lines">@@ -856,7 +849,7 @@
</span><span class="cx">             v8_decode_init(s);
</span><span class="cx">             s-&gt;negotiation_timer = ms_to_samples(5000);
</span><span class="cx">             fsk_tx_restart(&amp;s-&gt;v21tx, &amp;preset_fsk_specs[FSK_V21CH1]);
</span><del>-            send_cm_jm(s, s-&gt;local_end_modulations);
</del><ins>+            send_cm_jm(s);
</ins><span class="cx">             s-&gt;state = V8_CM_ON;
</span><span class="cx">             s-&gt;fsk_tx_on = TRUE;
</span><span class="cx">         }
</span><span class="lines">@@ -868,8 +861,6 @@
</span><span class="cx">             span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;JM recognised\n&quot;);
</span><span class="cx">             /* Now JM has been detected, we send CJ and wait for 75 ms
</span><span class="cx">                before finishing the V.8 analysis. */
</span><del>-            s-&gt;result.negotiated_modulation = select_modulation(s-&gt;result.far_end_modulations);
-
</del><span class="cx">             fsk_tx_restart(&amp;s-&gt;v21tx, &amp;preset_fsk_specs[FSK_V21CH1]);
</span><span class="cx">             for (i = 0;  i &lt; 3;  i++)
</span><span class="cx">                 v8_put_byte(s, 0);
</span><span class="lines">@@ -888,7 +879,7 @@
</span><span class="cx">         if (queue_contents(s-&gt;tx_queue) &lt; 10)
</span><span class="cx">         {
</span><span class="cx">             /* Send CM again */
</span><del>-            send_cm_jm(s, s-&gt;local_end_modulations);
</del><ins>+            send_cm_jm(s);
</ins><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">     case V8_CJ_ON:
</span><span class="lines">@@ -914,14 +905,15 @@
</span><span class="cx">         if (s-&gt;got_cm_jm)
</span><span class="cx">         {
</span><span class="cx">             span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;CM recognised\n&quot;);
</span><ins>+            
+            /* TODO: negotiate if the call function is acceptable */
+            
</ins><span class="cx">             /* Stop sending ANSam or ANSam/ and send JM instead */
</span><span class="cx">             fsk_tx_init(&amp;s-&gt;v21tx, &amp;preset_fsk_specs[FSK_V21CH2], get_bit, s);
</span><span class="cx">             /* Set the timeout for JM */
</span><span class="cx">             s-&gt;negotiation_timer = ms_to_samples(5000); 
</span><span class="cx">             s-&gt;state = V8_JM_ON;
</span><del>-            s-&gt;common_modulations = s-&gt;local_end_modulations &amp; s-&gt;result.far_end_modulations;
-            s-&gt;result.negotiated_modulation = select_modulation(s-&gt;common_modulations);
-            send_cm_jm(s, s-&gt;common_modulations);
</del><ins>+            send_cm_jm(s);
</ins><span class="cx">             s-&gt;modem_connect_tone_tx_on = ms_to_samples(75);
</span><span class="cx">             s-&gt;fsk_tx_on = TRUE;
</span><span class="cx">             break;
</span><span class="lines">@@ -958,7 +950,7 @@
</span><span class="cx">         if (queue_contents(s-&gt;tx_queue) &lt; 10)
</span><span class="cx">         {
</span><span class="cx">             /* Send JM */
</span><del>-            send_cm_jm(s, s-&gt;common_modulations);
</del><ins>+            send_cm_jm(s);
</ins><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">     case V8_SIGA:
</span><span class="lines">@@ -985,10 +977,49 @@
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+SPAN_DECLARE(int) v8_restart(v8_state_t *s,
+                             int calling_party,
+                             v8_parms_t *parms)
+{
+    memcpy(&amp;s-&gt;parms, parms, sizeof(s-&gt;parms));
+    memset(&amp;s-&gt;result, 0, sizeof(s-&gt;result));
+
+    s-&gt;result.call_function = s-&gt;parms.call_function;
+    s-&gt;result.nsf = -1;
+    s-&gt;result.t66 = -1;
+
+    s-&gt;ci_timer = 0;
+    if (calling_party)
+    {
+        s-&gt;calling_party = TRUE;
+        s-&gt;state = V8_WAIT_1S;
+        s-&gt;negotiation_timer = ms_to_samples(1000);
+        s-&gt;ci_count = 0;
+        modem_connect_tones_rx_init(&amp;s-&gt;ansam_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
+        fsk_tx_init(&amp;s-&gt;v21tx, &amp;preset_fsk_specs[FSK_V21CH1], get_bit, s);
+    }
+    else
+    {
+        /* Send the ANSam or ANSam/ tone */
+        s-&gt;calling_party = FALSE;
+        modem_connect_tones_tx_init(&amp;s-&gt;ansam_tx, s-&gt;parms.modem_connect_tone);
+                
+        v8_decode_init(s);
+        s-&gt;state = V8_CM_WAIT;
+        s-&gt;negotiation_timer = ms_to_samples(200 + 5000);
+        s-&gt;modem_connect_tone_tx_on = ms_to_samples(75) + 1;
+    }
+    s-&gt;result.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+
+    if ((s-&gt;tx_queue = queue_init(NULL, 1024, 0)) == NULL)
+        return -1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
</ins><span class="cx"> SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s,
</span><span class="cx">                                    int calling_party,
</span><del>-                                   int use_ansam_pr,
-                                   int available_modulations,
</del><ins>+                                   v8_parms_t *parms,
</ins><span class="cx">                                    v8_result_handler_t *result_handler,
</span><span class="cx">                                    void *user_data)
</span><span class="cx"> {
</span><span class="lines">@@ -1000,10 +1031,17 @@
</span><span class="cx">     memset(s, 0, sizeof(*s));
</span><span class="cx">     span_log_init(&amp;s-&gt;logging, SPAN_LOG_NONE, NULL);
</span><span class="cx">     span_log_set_protocol(&amp;s-&gt;logging, &quot;V.8&quot;);
</span><del>-    s-&gt;local_end_modulations = available_modulations;
</del><span class="cx">     s-&gt;result_handler = result_handler;
</span><span class="cx">     s-&gt;result_handler_user_data = user_data;
</span><span class="cx"> 
</span><ins>+    v8_restart(s, calling_party, parms);
+
+    memcpy(&amp;s-&gt;parms, parms, sizeof(s-&gt;parms));
+
+    s-&gt;result.call_function = s-&gt;parms.call_function;
+    s-&gt;result.nsf = -1;
+    s-&gt;result.t66 = -1;
+
</ins><span class="cx">     s-&gt;ci_timer = 0;
</span><span class="cx">     if (calling_party)
</span><span class="cx">     {
</span><span class="lines">@@ -1018,15 +1056,14 @@
</span><span class="cx">     {
</span><span class="cx">         /* Send the ANSam or ANSam/ tone */
</span><span class="cx">         s-&gt;calling_party = FALSE;
</span><del>-        modem_connect_tones_tx_init(&amp;s-&gt;ansam_tx,
-                                    (use_ansam_pr)  ?  MODEM_CONNECT_TONES_ANSAM_PR  :  MODEM_CONNECT_TONES_ANSAM);
</del><ins>+        modem_connect_tones_tx_init(&amp;s-&gt;ansam_tx, s-&gt;parms.modem_connect_tone);
</ins><span class="cx">                 
</span><span class="cx">         v8_decode_init(s);
</span><span class="cx">         s-&gt;state = V8_CM_WAIT;
</span><span class="cx">         s-&gt;negotiation_timer = ms_to_samples(200 + 5000);
</span><span class="cx">         s-&gt;modem_connect_tone_tx_on = ms_to_samples(75) + 1;
</span><span class="cx">     }
</span><del>-    s-&gt;result.modem_connect_tone_detected = MODEM_CONNECT_TONES_NONE;
</del><ins>+    s-&gt;result.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
</ins><span class="cx"> 
</span><span class="cx">     if ((s-&gt;tx_queue = queue_init(NULL, 1024, 0)) == NULL)
</span><span class="cx">         return NULL;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcvector_intc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/vector_int.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/vector_int.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/src/vector_int.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: vector_int.c,v 1.26 2009/07/12 09:23:09 steveu Exp $
</del><ins>+ * $Id: vector_int.c,v 1.26.4.1 2009/12/28 11:54:59 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -53,8 +53,7 @@
</span><span class="cx"> {
</span><span class="cx">     int32_t z;
</span><span class="cx"> 
</span><del>-#if defined(__GNUC__)  &amp;&amp;  defined(SPANDSP_USE_MMX)
-#if defined(__x86_64__)
</del><ins>+#if defined(__GNUC__)  &amp;&amp;  defined(SPANDSP_USE_MMX)  &amp;&amp;  defined(__x86_64__)
</ins><span class="cx">     __asm__ __volatile__(
</span><span class="cx">         &quot; emms;\n&quot;
</span><span class="cx">         &quot; pxor %%mm0,%%mm0;\n&quot;
</span><span class="lines">@@ -152,7 +151,7 @@
</span><span class="cx">         : &quot;S&quot; (x), &quot;D&quot; (y), &quot;a&quot; (n)
</span><span class="cx">         : &quot;cc&quot;
</span><span class="cx">     );
</span><del>-#else
</del><ins>+#elif defined(__GNUC__)  &amp;&amp;  defined(SPANDSP_USE_MMX)  &amp;&amp;  defined(__i386__)
</ins><span class="cx">     __asm__ __volatile__(
</span><span class="cx">         &quot; emms;\n&quot;
</span><span class="cx">         &quot; pxor %%mm0,%%mm0;\n&quot;
</span><span class="lines">@@ -250,7 +249,6 @@
</span><span class="cx">         : &quot;S&quot; (x), &quot;D&quot; (y), &quot;a&quot; (n)
</span><span class="cx">         : &quot;cc&quot;
</span><span class="cx">     );
</span><del>-#endif
</del><span class="cx"> #else
</span><span class="cx">     int i;
</span><span class="cx"> 
</span><span class="lines">@@ -290,12 +288,11 @@
</span><span class="cx"> 
</span><span class="cx"> SPAN_DECLARE(int32_t) vec_min_maxi16(const int16_t x[], int n, int16_t out[])
</span><span class="cx"> {
</span><del>-#if defined(__GNUC__)  &amp;&amp;  defined(SPANDSP_USE_MMX)
</del><ins>+#if defined(__GNUC__)  &amp;&amp;  defined(SPANDSP_USE_MMX)  &amp;&amp;  defined(__x86_64__)
</ins><span class="cx">     static const int32_t lower_bound = 0x80008000;
</span><span class="cx">     static const int32_t upper_bound = 0x7FFF7FFF;
</span><span class="cx">     int32_t max;
</span><span class="cx"> 
</span><del>-#if defined(__x86_64__)
</del><span class="cx">     __asm__ __volatile__(
</span><span class="cx">         &quot; emms;\n&quot;
</span><span class="cx">         &quot; pushq %%rdx;\n&quot;
</span><span class="lines">@@ -443,7 +440,11 @@
</span><span class="cx">         : &quot;S&quot; (x), &quot;a&quot; (n), &quot;d&quot; (out), [lower] &quot;m&quot; (lower_bound), [upper] &quot;m&quot; (upper_bound)
</span><span class="cx">         : &quot;ecx&quot;
</span><span class="cx">     );
</span><del>-#else
</del><ins>+#elif defined(__GNUC__)  &amp;&amp;  defined(SPANDSP_USE_MMX)  &amp;&amp;  defined(__i386__)
+    static const int32_t lower_bound = 0x80008000;
+    static const int32_t upper_bound = 0x7FFF7FFF;
+    int32_t max;
+
</ins><span class="cx">     __asm__ __volatile__(
</span><span class="cx">         &quot; emms;\n&quot;
</span><span class="cx">         &quot; pushl %%edx;\n&quot;
</span><span class="lines">@@ -592,8 +593,6 @@
</span><span class="cx">         : &quot;S&quot; (x), &quot;a&quot; (n), &quot;d&quot; (out), [lower] &quot;m&quot; (lower_bound), [upper] &quot;m&quot; (upper_bound)
</span><span class="cx">         : &quot;ecx&quot;
</span><span class="cx">     );
</span><del>-#endif
-    return max;
</del><span class="cx"> #else
</span><span class="cx">     int i;
</span><span class="cx">     int16_t min;
</span><span class="lines">@@ -622,8 +621,8 @@
</span><span class="cx">     z = abs(min);
</span><span class="cx">     if (z &gt; max)
</span><span class="cx">         return z;
</span><del>-    return max;
</del><span class="cx"> #endif
</span><ins>+    return max;
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> /*- End of file ------------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandsptestsv8_testsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/tests/v8_tests.c (16070 => 16071)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/tests/v8_tests.c        2009-12-29 01:52:12 UTC (rev 16070)
+++ freeswitch/trunk/libs/spandsp/tests/v8_tests.c        2009-12-29 01:58:30 UTC (rev 16071)
</span><span class="lines">@@ -22,16 +22,13 @@
</span><span class="cx">  * along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: v8_tests.c,v 1.36 2009/11/04 16:10:14 steveu Exp $
</del><ins>+ * $Id: v8_tests.c,v 1.36.4.1 2009/12/28 12:32:53 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \page v8_tests_page V.8 tests
</span><span class="cx"> \section v8_tests_page_sec_1 What does it do?
</span><span class="cx"> */
</span><span class="cx"> 
</span><del>-/* Enable the following definition to enable direct probing into the internal structures */
-//#define WITH_SPANDSP_INTERNALS
-
</del><span class="cx"> #if defined(HAVE_CONFIG_H)
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -59,8 +56,25 @@
</span><span class="cx"> 
</span><span class="cx"> int negotiations_ok = 0;
</span><span class="cx"> 
</span><del>-static void handler(void *user_data, v8_result_t *result)
</del><ins>+static int select_modulation(int mask)
</ins><span class="cx"> {
</span><ins>+    /* Select the fastest data modem available */
+    if (mask &amp; V8_MOD_V90)
+        return V8_MOD_V90;
+    if (mask &amp; V8_MOD_V34)
+        return V8_MOD_V34;
+    if (mask &amp; V8_MOD_V32)
+        return V8_MOD_V32;
+    if (mask &amp; V8_MOD_V23)
+        return V8_MOD_V23;
+    if (mask &amp; V8_MOD_V21)
+        return V8_MOD_V21;
+    return V8_MOD_FAILED;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void handler(void *user_data, v8_parms_t *result)
+{
</ins><span class="cx">     const char *s;
</span><span class="cx">     
</span><span class="cx">     s = (const char *) user_data;
</span><span class="lines">@@ -70,25 +84,25 @@
</span><span class="cx">         printf(&quot;%s V.8 negotiation failed\n&quot;, s);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (result-&gt;modem_connect_tone_detected == MODEM_CONNECT_TONES_ANSAM
</del><ins>+    if (result-&gt;modem_connect_tone == MODEM_CONNECT_TONES_ANSAM
</ins><span class="cx">         ||
</span><del>-        result-&gt;modem_connect_tone_detected == MODEM_CONNECT_TONES_ANSAM_PR
</del><ins>+        result-&gt;modem_connect_tone == MODEM_CONNECT_TONES_ANSAM_PR
</ins><span class="cx">         ||
</span><del>-        result-&gt;modem_connect_tone_detected == MODEM_CONNECT_TONES_NONE)
</del><ins>+        result-&gt;modem_connect_tone == MODEM_CONNECT_TONES_NONE)
</ins><span class="cx">     {
</span><span class="cx">         printf(&quot;%s V.8 negotiation result:\n&quot;, s);
</span><del>-        printf(&quot;  Modem connect tone '%s'\n&quot;, modem_connect_tone_to_str(result-&gt;modem_connect_tone_detected));
-        printf(&quot;  Call function '%s'\n&quot;, v8_call_function_to_str(result-&gt;call_function));
-        printf(&quot;  Negotiated modulation '%s'\n&quot;, v8_modulation_to_str(result-&gt;negotiated_modulation));
-        printf(&quot;  Protocol '%s'\n&quot;, v8_protocol_to_str(result-&gt;protocol));
-        printf(&quot;  PSTN access '%s'\n&quot;, v8_pstn_access_to_str(result-&gt;pstn_access));
-        printf(&quot;  NSF %d %d\n&quot;, result-&gt;nsf_seen, result-&gt;nsf);
-        printf(&quot;  PCM modem availability '%s'\n&quot;, v8_pcm_modem_availability_to_str(result-&gt;pcm_modem_availability));
-        printf(&quot;  T.66 %d %d\n&quot;, result-&gt;t66_seen, result-&gt;t66);
</del><ins>+        printf(&quot;  Modem connect tone '%s' (%d)\n&quot;, modem_connect_tone_to_str(result-&gt;modem_connect_tone), result-&gt;modem_connect_tone);
+        printf(&quot;  Call function '%s' (%d)\n&quot;, v8_call_function_to_str(result-&gt;call_function), result-&gt;call_function);
+        printf(&quot;  Far end modulations 0x%X\n&quot;, result-&gt;modulations);
+        printf(&quot;  Protocol '%s' (%d)\n&quot;, v8_protocol_to_str(result-&gt;protocol), result-&gt;protocol);
+        printf(&quot;  PSTN access '%s' (%d)\n&quot;, v8_pstn_access_to_str(result-&gt;pstn_access), result-&gt;pstn_access);
+        printf(&quot;  PCM modem availability '%s' (%d)\n&quot;, v8_pcm_modem_availability_to_str(result-&gt;pcm_modem_availability), result-&gt;pcm_modem_availability);
+        if (result-&gt;t66 &gt;= 0)
+            printf(&quot;  T.66 '%s' (%d)\n&quot;, v8_t66_to_str(result-&gt;t66), result-&gt;t66);
+        if (result-&gt;nsf &gt;= 0)
+            printf(&quot;  NSF %d\n&quot;, result-&gt;nsf);
</ins><span class="cx">         if (result-&gt;call_function == V8_CALL_V_SERIES
</span><span class="cx">             &amp;&amp;
</span><del>-            result-&gt;negotiated_modulation == V8_MOD_V90
-            &amp;&amp;
</del><span class="cx">             result-&gt;protocol == V8_PROTOCOL_LAPM_V42)
</span><span class="cx">         {
</span><span class="cx">             negotiations_ok++;
</span><span class="lines">@@ -97,7 +111,7 @@
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="cx">         printf(&quot;%s V.8 negotiation result:\n&quot;, s);
</span><del>-        printf(&quot;  Modem connect tone '%s'\n&quot;, modem_connect_tone_to_str(result-&gt;modem_connect_tone_detected));
</del><ins>+        printf(&quot;  Modem connect tone '%s' (%d)\n&quot;, modem_connect_tone_to_str(result-&gt;modem_connect_tone), result-&gt;modem_connect_tone);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -116,6 +130,8 @@
</span><span class="cx">     int outframes;
</span><span class="cx">     int16_t amp[SAMPLES_PER_CHUNK];
</span><span class="cx">     int16_t out_amp[2*SAMPLES_PER_CHUNK];
</span><ins>+    v8_parms_t v8_call_parms;
+    v8_parms_t v8_answer_parms;
</ins><span class="cx"> 
</span><span class="cx">     caller_available_modulations = V8_MOD_V17
</span><span class="cx">                                  | V8_MOD_V21
</span><span class="lines">@@ -147,8 +163,32 @@
</span><span class="cx">                                    | V8_MOD_V92;
</span><span class="cx">     negotiations_ok = 0;
</span><span class="cx"> 
</span><del>-    v8_caller = v8_init(NULL, TRUE, TRUE, caller_available_modulations, handler, (void *) &quot;caller&quot;);
-    v8_answerer = v8_init(NULL, FALSE, TRUE, answerer_available_modulations, handler, (void *) &quot;answerer&quot;);
</del><ins>+    v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+    v8_call_parms.call_function = V8_CALL_V_SERIES;
+    v8_call_parms.modulations = caller_available_modulations;
+    v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
+    v8_call_parms.pcm_modem_availability = 0;
+    v8_call_parms.pstn_access = 0;
+    v8_call_parms.nsf = -1;
+    v8_call_parms.t66 = -1;
+    v8_caller = v8_init(NULL,
+                        TRUE,
+                        &amp;v8_call_parms,
+                        handler,
+                        (void *) &quot;caller&quot;);
+    v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
+    v8_answer_parms.call_function = V8_CALL_V_SERIES;
+    v8_answer_parms.modulations = answerer_available_modulations;
+    v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
+    v8_answer_parms.pcm_modem_availability = 0;
+    v8_answer_parms.pstn_access = 0;
+    v8_answer_parms.nsf = -1;
+    v8_answer_parms.t66 = -1;
+    v8_answerer = v8_init(NULL,
+                          FALSE,
+                          &amp;v8_answer_parms,
+                          handler,
+                          (void *) &quot;answerer&quot;);
</ins><span class="cx">     caller_logging = v8_get_logging_state(v8_caller);
</span><span class="cx">     span_log_set_level(caller_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
</span><span class="cx">     span_log_set_tag(caller_logging, &quot;caller&quot;);
</span><span class="lines">@@ -213,6 +253,7 @@
</span><span class="cx">     int tone;
</span><span class="cx">     int16_t amp[SAMPLES_PER_CHUNK];
</span><span class="cx">     int16_t out_amp[2*SAMPLES_PER_CHUNK];
</span><ins>+    v8_parms_t v8_answer_parms;
</ins><span class="cx"> 
</span><span class="cx">     answerer_available_modulations = V8_MOD_V17
</span><span class="cx">                                    | V8_MOD_V21
</span><span class="lines">@@ -232,7 +273,20 @@
</span><span class="cx"> 
</span><span class="cx">     non_v8_caller_tx = silence_gen_init(NULL, 10*SAMPLE_RATE);
</span><span class="cx">     non_v8_caller_rx = modem_connect_tones_rx_init(NULL, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
</span><del>-    v8_answerer = v8_init(NULL, FALSE, TRUE, answerer_available_modulations, handler, (void *) &quot;answerer&quot;);
</del><ins>+
+    v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
+    v8_answer_parms.call_function = V8_CALL_V_SERIES;
+    v8_answer_parms.modulations = answerer_available_modulations;
+    v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
+    v8_answer_parms.pcm_modem_availability = 0;
+    v8_answer_parms.pstn_access = 0;
+    v8_answer_parms.nsf = -1;
+    v8_answer_parms.t66 = -1;
+    v8_answerer = v8_init(NULL,
+                          FALSE,
+                          &amp;v8_answer_parms,
+                          handler,
+                          (void *) &quot;answerer&quot;);
</ins><span class="cx">     answerer_logging = v8_get_logging_state(v8_answerer);
</span><span class="cx">     span_log_set_level(answerer_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
</span><span class="cx">     span_log_set_tag(answerer_logging, &quot;answerer&quot;);
</span><span class="lines">@@ -298,6 +352,7 @@
</span><span class="cx">     int outframes;
</span><span class="cx">     int16_t amp[SAMPLES_PER_CHUNK];
</span><span class="cx">     int16_t out_amp[2*SAMPLES_PER_CHUNK];
</span><ins>+    v8_parms_t v8_call_parms;
</ins><span class="cx"> 
</span><span class="cx">     caller_available_modulations = V8_MOD_V17
</span><span class="cx">                                  | V8_MOD_V21
</span><span class="lines">@@ -315,7 +370,19 @@
</span><span class="cx">                                  | V8_MOD_V92;
</span><span class="cx">     negotiations_ok = 0;
</span><span class="cx"> 
</span><del>-    v8_caller = v8_init(NULL, TRUE, TRUE, caller_available_modulations, handler, (void *) &quot;caller&quot;);
</del><ins>+    v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+    v8_call_parms.call_function = V8_CALL_V_SERIES;
+    v8_call_parms.modulations = caller_available_modulations;
+    v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
+    v8_call_parms.pcm_modem_availability = 0;
+    v8_call_parms.pstn_access = 0;
+    v8_call_parms.nsf = -1;
+    v8_call_parms.t66 = -1;
+    v8_caller = v8_init(NULL,
+                        TRUE,
+                        &amp;v8_call_parms,
+                        handler,
+                        (void *) &quot;caller&quot;);
</ins><span class="cx">     non_v8_answerer_tx = modem_connect_tones_tx_init(NULL, MODEM_CONNECT_TONES_ANS_PR);
</span><span class="cx">     caller_logging = v8_get_logging_state(v8_caller);
</span><span class="cx">     span_log_set_level(caller_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
</span><span class="lines">@@ -375,7 +442,10 @@
</span><span class="cx">     SNDFILE *outhandle;
</span><span class="cx">     int opt;
</span><span class="cx">     char *decode_test_file;
</span><ins>+    v8_state_t *v8_caller;
</ins><span class="cx">     v8_state_t *v8_answerer;
</span><ins>+    v8_parms_t v8_call_parms;
+    v8_parms_t v8_answer_parms;
</ins><span class="cx">     logging_state_t *logging;
</span><span class="cx"> 
</span><span class="cx">     decode_test_file = NULL;
</span><span class="lines">@@ -450,10 +520,40 @@
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="cx">         printf(&quot;Decode file '%s'\n&quot;, decode_test_file);
</span><del>-        v8_answerer = v8_init(NULL, FALSE, TRUE, answerer_available_modulations, handler, (void *) &quot;answerer&quot;);
</del><ins>+        v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+        v8_call_parms.call_function = V8_CALL_V_SERIES;
+        v8_call_parms.modulations = caller_available_modulations;
+        v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
+        v8_call_parms.pcm_modem_availability = 0;
+        v8_call_parms.pstn_access = 0;
+        v8_call_parms.nsf = -1;
+        v8_call_parms.t66 = -1;
+        v8_caller = v8_init(NULL,
+                            TRUE,
+                            &amp;v8_call_parms,
+                            handler,
+                            (void *) &quot;caller&quot;);
+        logging = v8_get_logging_state(v8_caller);
+        span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
+        span_log_set_tag(logging, &quot;caller&quot;);
+
+        v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
+        v8_answer_parms.call_function = V8_CALL_V_SERIES;
+        v8_answer_parms.modulations = answerer_available_modulations;
+        v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
+        v8_answer_parms.pcm_modem_availability = 0;
+        v8_answer_parms.pstn_access = 0;
+        v8_answer_parms.nsf = -1;
+        v8_answer_parms.t66 = -1;
+        v8_answerer = v8_init(NULL,
+                              FALSE,
+                              &amp;v8_answer_parms,
+                              handler,
+                              (void *) &quot;answerer&quot;);
</ins><span class="cx">         logging = v8_get_logging_state(v8_answerer);
</span><span class="cx">         span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
</span><del>-        span_log_set_tag(logging, &quot;decoder&quot;);
</del><ins>+        span_log_set_tag(logging, &quot;answerer&quot;);
+
</ins><span class="cx">         if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
</span><span class="cx">         {
</span><span class="cx">             fprintf(stderr, &quot;    Cannot open speech file '%s'\n&quot;, decode_test_file);
</span><span class="lines">@@ -463,10 +563,14 @@
</span><span class="cx"> 
</span><span class="cx">         while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK)))
</span><span class="cx">         {
</span><ins>+            remnant = v8_rx(v8_caller, amp, samples);
</ins><span class="cx">             remnant = v8_rx(v8_answerer, amp, samples);
</span><ins>+            remnant = v8_tx(v8_caller, amp, samples);
+            remnant = v8_tx(v8_answerer, amp, samples);
</ins><span class="cx">         }
</span><span class="cx">         /*endwhile*/
</span><span class="cx"> 
</span><ins>+        v8_free(v8_caller);
</ins><span class="cx">         v8_free(v8_answerer);
</span><span class="cx">         if (sf_close(inhandle) != 0)
</span><span class="cx">         {
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>