📄 dvfir2.c
字号:
/*
* *************************************************************************
* * *
* * This confidential and proprietary software may be used only *
* * as authorized by a licensing agreement from the Alta Group of *
* * Cadence Design Systems, Inc. In the event of publication, the *
* * following notice is applicable: *
* * *
* * (c) COPYRIGHT 1995 ALTA GROUP OF CADENCE DESIGN SYSTEMS, INC. *
* * ALL RIGHTS RESERVED *
* * *
* * The entire notice above must be reproduced on all authorized *
* * copies. *
* * *
* *************************************************************************
*
*/
/*
* FILE: dvfir2.c
* DATE: Nov 1, 1989
* RELATED FILES:
* AUTHOR: Mark Schrank
* DESCRIPTION: "c" Dvfir2 function
* NOTES/WARNINGS:
* REVISION HISTORY:
* Release Who Date Comments
* 2.6 John Lundell 02/23/90 Changed Macro calls to register pointers.
* 3.0 John Lundell 03/19/93 Collapsed two loops to one for efficiency.
*/
#include "cgs.h"
/*
*---------------------------------------------------------------
* FUNCTION: Dvfir2(d_input,sp_state,sp_coef)
* DESCRIPTION:
* Performs a single FIR filter output using passed filter
* input, state, and coefficients
*
* RETURN VALUE: The filter output
* NOTES/WARNINGS:
* This function uses the state vector as a tapped-delay line.
* The entire vector is shifted with each new point. Though
* this may seem slow, it is faster than Dvfir for short
* filter lengths.
*
* REVISION HISTORY:
* Release Who Date Comments
* 2.6 John Lundell 02/23/90 Changed Macro calls to register pointers.
* 3.0 John Lundell 03/19/93 Collapsed two loops to one for efficiency.
*/
double Dvfir2(d_input, sp_state, sp_coef)
double d_input;
Ovector sp_state, sp_coef;
{
register long n = sp_coef->length;
register char *sp = sp_state->virtstart;
register char *cp = sp_coef->virtstart;
register long stps = sp_state->stepsize;
register long stpc = sp_coef->stepsize;
register double result = 0.0;
register double t2, t1 = d_input;
/*
* Calculate the output
*/
while (n-- > 0) {
result += *(double *) cp * t1;
t2 = *(double *) sp;
*(double *) sp = t1;
t1 = t2;
cp += stpc;
sp += stps;
}
return result;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -