ccan_c.mht

来自「常用的DSP算法集锦」· MHT 代码 · 共 61 行

MHT
61
字号
From: <由 Microsoft Internet Explorer 5 保存>
Subject: 
Date: Wed, 27 Sep 2006 22:37:18 +0800
MIME-Version: 1.0
Content-Type: text/html;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.oxbad.com/DSP/maindoc/arithmetic_source/c/CCAN.C
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2900.2963" name=3DGENERATOR></HEAD>
<BODY><PRE>/* ccan.c - circular buffer implementation of canonical =
realization */

void wrap();                              /* defined in =
\ref{hardware.sec} */

double ccan(M, a, b, w, p, x)             /* usage: y=3Dccan(M, a, b, w, =
&amp;p, x); */
double *a, *b, *w, **p, x;                /* \(p\) =3D circular pointer =
to buffer \(w\) */
int M;                                    /* \(a,b\) have common order =
\(M\) */
{
       int i;
       double y =3D 0, s0;

       **p =3D x;                                 /* read input sample =
\(x\) */

       s0  =3D *(*p)++;                           /* \(s\sb{0}=3Dx\) */
       wrap(M, w, p);                           /* \(p\) now points to =
\(s\sb{1}\) */

       for (a++, i=3D1; i&lt;=3DM; i++) {              /* start with =
\(a\) incremented to \(a\sb{1}\) */
              s0 -=3D (*a++) * (*(*p)++);
              wrap(M, w, p);
              }

       **p =3D s0;                                /* \(p\) has wrapped =
around once */

       for (i=3D0; i&lt;=3DM; i++) {                   /* numerator part =
*/
              y +=3D (*b++) * (*(*p)++);
              wrap(M, w, p);                    /* upon exit, \(p\) has =
wrapped */
              }                                 /* around once again */

       (*p)--;                                  /* update circular delay =
line */
       wrap(M, w, p);

       return y;                                /* output sample */
}
</PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?