[Speex-dev] fir_mem_up filter question

Jean-Marc Valin Jean-Marc.Valin at USherbrooke.ca
Thu May 26 14:33:26 PDT 2005

Le jeudi 26 mai 2005 à 13:44 -0400, Fritz Koenig a écrit :
> In the fir_mem_up filter, the inner loop does a mac on the y0, y1, y2, 
> y3 variables.  What is the range of values of those variables?  I would 
> like to move the SHR 1 outside the loop after the mac has been done.  
> Will this result in a 32 bit overflow of the y0, y2, y2 and y3 variables?

With the current range, the SHR 1 is needed in order to be 100% sure
that no overflow is possible. However, even without the shift, it takes
pathological cases for an overflow to occur (e.g. a 4kHz sine wave of
maximal amplitude) and I would not expect it on real-life signals. If
you have a CPU/DSP that supports MAC with saturation (or can live with
the fact that an overflow may appear for pathological cases), you can
definitely mode the SHR out of the loop. Of course, you can always SHR
one of the inputs at the price of a slight loss in precision.


> On2 Technologies, Inc.
> http://www.on2.com
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev

Jean-Marc Valin <Jean-Marc.Valin at USherbrooke.ca>
Universite de Sherbrooke

More information about the Speex-dev mailing list