Started by July 16, 2003
```Anyone know where to find assembly routines for SHARC to perform lattice-ladder filters?
E.g. analysis (decimate) section:

input ------------ 2:1 ------ + --------------- + ------- .... ---> output1
|                   X                 X
T               *a0  *-a0         *a1  *-a1
|               /       \         /       \
-- *-1 -- 2:1 ---------- + -- T ---------- + --- .... ---> output2

|    stage 1     |
----------------

pstate=&state;
pcoeff=&coeff;

*Output1 = -(*Input)*(*pcoeff);
*Output2 = -(*Input++);
(*Output1) += *Input;
(*Output2) -= (*Input++)*(*pcoeff++);

LOOP(NumberOfCoefficients-1)
temp = *Output2;
*Output2 = (*pstate) - ((*Output1)*(*pcoeff));
*Output1 += ((*pstate)*(*pcoeff++));
*pstate++ = temp;
ENDLOOP

Output1++;
Output2++;

synthesis section:

input1 -------- + - T -- .... -------- + ------ 1:2 ----------
X                      X                       |
*-aj *aj              *-a0 *a0                 T
/       \              /       \                   |
input2 ------------ + -- .... ------------ + -- 1:2 -- *-1 -- + ---> output

|    stage j    |
---------------

pstate=&state;
pcoeff=&coeff[NumberOfCoefficients-1];

sum1 = (*Input1) - ((*Input2)*(*pcoeff));
sum2 = (*Input2++) + ((*Input1++)*(*pcoeff--));

LOOP(NumberOfCoefficients-1)
temp = sum1;
sum1 = (*pstate) - (sum2*(*pcoeff));
sum2 += ((*pstate)*(*pcoeff--));
*pstate++ = temp;
ENDLOOP

(*Output++) = -sum2;
(*Output++) = sum1;

Thx.

x--   100 Proof News - http://www.100ProofNews.com
x--   3,500+ Binary NewsGroups, and over 90,000 other groups

```
```keith <keith> wrote:

> Anyone know where to find assembly routines for SHARC to perform
> lattice-ladder filters? E.g. analysis (decimate) section:
>

Hello Keith,

I tried a modified SOS structure, at first in C (hand optimized),
then in assembler (as good as I could), then after a discussion with
compiler people from VDSP, I rewrote the C code so that it didn't
contain any of my usual optimizations any more, and I compared the
results:
worst performance had the C code which I optimized before
compilation.
The non-optimized code passed the internal optimization stage of the
compiler, and then performed pretty much the same as the assembly
code. The overall behaviour of the C coded solution was even better
in some situation.

It should be easy to write C code out of what you posted here.
Programme  it straightforward, compile it with compiler optimization
activated and check if it meets your requirements.
If not, it should be very hard to solve this by translating it into
the assembly language.

just my 2c.

Bernhard
--
before sending to the above email-address: