biquad filters from dsplib.h

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
Post Reply
Ord
User
Posts: 9
Joined: Sun 2011-09-25 23:27

biquad filters from dsplib.h

Post by Ord »

Hi,

I have been having a hard time to use the DspIir2Lq function from dsplib.

I notice that the header definition shows it returns s_int32, but when I look at the dis-assembly of my program it seems to return only a 16 bit value in A0, so I cast it to a s_int16.

I am calling it like this:

Code: Select all

// declare variables
s_int16 mem[5];
__y struct DSP_IIR2COEFF16 cf;

// setup coefficients for unity gain, no filter
		cf.b0 = 8191;
		cf.b1 = 0;
		cf.b2 = 0;
		cf.a1 = 0;
		cf.a2 = 0;

// then in the loop for processing samples:
lr[0] = (s_int16)DspIir2Lq(lr[0],&cf,mem);
Do I miss something?

Thanks!
User avatar
pasi
VLSI Staff
Posts: 2122
Joined: Thu 2010-07-15 16:04

Re: biquad filters from dsplib.h

Post by pasi »

A very late reply: yes, the return type should be s_int16. Usually the return value is assigned to a s_int16 variable, so it doesn't matter.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply