[asterisk-dev] [Code Review] dsp.c optimize goerztzel sample loops, in dtmf_detect, mf_detect and tone_detect

rmudgett reviewboard at asterisk.org
Tue Sep 4 14:46:05 CDT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2093/#review7009
-----------------------------------------------------------

Ship it!


These changes are straight forward.


trunk/main/dsp.c
<https://reviewboard.asterisk.org/r/2093/#comment13621>

    Might as well fix the typo: suqare


- rmudgett


On Sept. 1, 2012, 6:31 a.m., Alec Davis wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2093/
> -----------------------------------------------------------
> 
> (Updated Sept. 1, 2012, 6:31 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> 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
> 
> 
> Diffs
> -----
> 
>   trunk/main/dsp.c 371689 
> 
> Diff: https://reviewboard.asterisk.org/r/2093/diff
> 
> 
> Testing
> -------
> 
> Yes, DTMF anyway, still able for recognise digits dialled. 
> 
> Verified with spandsp 0.0.6 if SPANDSP_USE_FIXED_POINT is chosen
> 
> 
> Thanks,
> 
> Alec
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120904/7533bf59/attachment-0001.htm>


More information about the asterisk-dev mailing list