[zaptel-commits] trunk r1025 - /trunk/mg2ec.h
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Mon May 8 04:17:43 MST 2006
Author: mattf
Date: Mon May 8 06:17:43 2006
New Revision: 1025
URL: http://svn.digium.com/view/zaptel?rev=1025&view=rev
Log:
Improve CPU performance of MG2 by using a counter instead of a history
Modified:
trunk/mg2ec.h
Modified: trunk/mg2ec.h
URL: http://svn.digium.com/view/zaptel/trunk/mg2ec.h?rev=1025&r1=1024&r2=1025&view=diff
==============================================================================
--- trunk/mg2ec.h (original)
+++ trunk/mg2ec.h Mon May 8 06:17:43 2006
@@ -158,8 +158,8 @@
int avg_Lu_i_toolow;
int avg_Lu_i_ok;
#endif
- short lastsig[256];
- int lastpos;
+ short lastsig;
+ int lastcount;
int backup;
#ifdef DC_NORMALIZE
int dc_estimate;
@@ -327,18 +327,18 @@
ec->N_d);
rs >>= 15;
- ec->lastsig[ec->lastpos++] = isig;
- if (ec->lastpos >= 256)
- ec->lastpos = 0;
-
- for (k=0; k < 256; k++) {
- if (isig != ec->lastsig[k])
- break;
+ if (ec->lastsig == isig) {
+ ec->lastcount++;
+ } else {
+ ec->lastcount = 0;
+ ec->lastsig = isig;
}
if (isig == 0) {
u = 0;
- } else if (k == 256) {
+ } else if (ec->lastcount > 255) {
+ /* We have seen the same input-signal more than 255 times,
+ * we should pass it through uncancelled, as we are likely on hold */
u = isig;
} else {
if (rs < -32768) {
More information about the zaptel-commits
mailing list