Index: mg2ec.h =================================================================== --- mg2ec.h (revision 1006) +++ mg2ec.h (working copy) @@ -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) {