返回信息流10. Convert the following codes from floating-point to fixed-point, Note that the input parameter ‘filtcfs’ will refer to ‘chpfcfs_48’.
/****
This is a standard second-order filter segment. The input arguments are as follows: input buffer pointer, input buffer offset, output buffer pointer, output buffer offset, pointer to filter coefficient structure, pointer to filter state structure, number of samples to filter.
Note the data in input and output buffer are limited to range [-1, 1)。
****/
float chpfcfs_48 = { /* Control path highpass filter */
-1.770839276, /* a1 */
0.773085703, /* a2 */
0.923165903, /* b0 */
-1.771962489, /* b1 */
0.848796586 }; /* b2 */
void biquad(float *inptr, short inoff, float *outptr, short outoff,
float *filtcfs, float *filtvars, short sampcount)
{
float accum;
int samp;
for (samp = 0; samp < sampcount; samp++)
{
accum = -filtvars->y1 * filtcfs->a1;
accum -= filtvars->y2 * filtcfs->a2;
accum += *inptr * filtcfs->b0;
accum += filtvars->x1 * filtcfs->b1;
accum += filtvars->x2 * filtcfs->b2;
filtvars->x2 = filtvars->x1;
filtvars->x1 = *inptr;
*outptr = accum;
filtvars->y2 = filtvars->y1;
filtvars->y1 = *outptr;
inptr += inoff;
outptr += outoff;
}
}
这是一条镜像帖。来源:北邮人论坛 / embedded-system / #4534同步于 2009/4/16
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Embedded_System机器人发帖
弄DSP的进来看看这个题目
lpok
2009/4/16镜像同步3 回复
订阅后,新回复会通过你的通知中心匿名送达。