В visualDSP++ 3.5 для ADSP-2191 есть такая функция
Код
void iir_fr16(x,y,n,s)
const fract16 x[]; /* Input sample vector x */
fract16 y[]; /* Output sample vector y */
int n; /* Number of input samples */
iir_state_fr16 *s /* Pointer to filter state structure */
const fract16 x[]; /* Input sample vector x */
fract16 y[]; /* Output sample vector y */
int n; /* Number of input samples */
iir_state_fr16 *s /* Pointer to filter state structure */
fraсt16 - это формат с фиксированной точкой вида 1.15 (знак + 15 разрядов после запятой)
переменные фильтра содержатся в структуре вида :
Код
typedef struct
{
fract16 *c; /* coefficients */
fract16 *d; /* start of delay line */
int k; /* number of bi-quad stages */
} iir_state_fr16;
{
fract16 *c; /* coefficients */
fract16 *d; /* start of delay line */
int k; /* number of bi-quad stages */
} iir_state_fr16;
Переменная s инициализируется макросом :
Код
#define iir_init(state, coeffs, delay, stages) \
(state).c = (coeffs); \
(state).d = (delay); \
(state).k = (stages)
(state).c = (coeffs); \
(state).d = (delay); \
(state).k = (stages)
Далее сказано :
Цитата
The characteristics of the filter are dependent upon filter coefficients and the number of stages. Each stage has five coefficients which must be stored in the order B2, B1, B0, A2, A1. The value of A0 is implied to be 1.0 and A1 and A2 should be scaled accordingly. This requires that the value of the A0 coefficient is greater than both A1 and A2 for all the stages.
Значит ли, что коэффициент a0 должен быть всегда равен 1.0 ?
мои расчеты выдают следующие коэффициенты
a0=1.0
a1=1.3160875
a2=-0.99004206
b0=0.655965
b1=0.0
b2=-0.655965
могу ли я каким-то образом воспользоваться для реализации этого фильтра типом переменных fract16 и встроенной функцией? или надо писать собственную функцию для работы с форматом 2.14 (у меня коэффициент a1 больше единицы) ?