<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2093/">https://reviewboard.asterisk.org/r/2093/</a>
</td>
</tr>
</table>
<br />
<p>Ship it!</p>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">These changes are straight forward.</pre>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/2093/diff/1/?file=31135#file31135line553" style="color: black; font-weight: bold; text-decoration: underline;">trunk/main/dsp.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static int tone_detect(struct ast_dsp *dsp, tone_detect_state_t *s, int16_t *amp, int samples)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">551</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="cm">/* signed 32 bit int should be enough to suqare any possible signed 16 bit value */</span></pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">553</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="cm">/* signed 32 bit int should be enough to suqare any possible signed 16 bit value */</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Might as well fix the typo: suqare</pre>
</div>
<br />
<p>- rmudgett</p>
<br />
<p>On September 1st, 2012, 6:31 a.m., Alec Davis wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Alec Davis.</div>
<p style="color: grey;"><i>Updated Sept. 1, 2012, 6:31 a.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">the dmtf_detector had to recalc the address from the amp[] for each of 8 calls to goerztzel_sample()
Now use similar optimization as was already done in tone_detect().
If we're counting just lines of code executed, originally for each of the 160 samples was 80, now 53.
created code looked like this;
this code is repeated 8 times in dtmf_detect, at 8000 times a second.
677:dsp.c **** goertzel_sample(s->td.dtmf.row_out, amp[j]);
14299 .loc 1 677 0
14300 0d21 8B45E0 movl -32(%ebp),%eax
14301 0d24 01C0 addl %eax,%eax
14302 0d26 034510 addl 16(%ebp),%eax
14303 0d29 0FB700 movzwl (%eax),%eax
14304 0d2c 98 cwtl
14305 0d2d 8B550C movl 12(%ebp),%edx
14306 0d30 81C29402 addl $660,%edx
14306 0000
14307 0d36 89442404 movl %eax,4(%esp)
14308 0d3a 891424 movl %edx,(%esp)
14309 0d3d E8EEF2FF call goertzel_sample
=============================================================
Now this code is add once
675:dsp.c **** samp = amp[j];
14281 .loc 1 675 0
14282 0cf1 8B45DC movl -36(%ebp),%eax
14283 0cf4 01C0 addl %eax,%eax
14284 0cf6 034510 addl 16(%ebp),%eax
14285 0cf9 0FB700 movzwl (%eax),%eax
14286 0cfc 668945E6 movw %ax,-26(%ebp)
Now this code is repeated 8 times.
679:dsp.c **** goertzel_sample(s->td.dtmf.row_out, samp);
14298 .loc 1 679 0
14299 0d25 0FBF45E6 movswl -26(%ebp),%eax
14300 0d29 8B550C movl 12(%ebp),%edx
14301 0d2c 81C29402 addl $660,%edx
14301 0000
14302 0d32 89442404 movl %eax,4(%esp)
14303 0d36 891424 movl %edx,(%esp)
14304 0d39 E8F2F2FF call goertzel_sample
</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yes, DTMF anyway, still able for recognise digits dialled.
Verified with spandsp 0.0.6 if SPANDSP_USE_FIXED_POINT is chosen</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>trunk/main/dsp.c <span style="color: grey">(371689)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2093/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>