?? fgwsinc.c
字號:
/*
* *************************************************************************
* * *
* * This confidential and proprietary software may be used only *
* * as authorized by a licensing agreement from the Summit Group of *
* * Cadence Design Systems, Inc. In the event of publication, the *
* * following notice is applicable: *
* * *
* * (c) COPYRIGHT 1994 SUMMIT GROUP OF CADENCE DESIGN SYSTEMS, INC. *
* * ALL RIGHTS RESERVED *
* * *
* * The entire notice above must be reproduced on all authorized *
* * copies. *
* * *
* *************************************************************************
*
*/
/*
* FILE: parts/spb/cgs/generic/cgsfilt/fgwsinc.c
* DATE: Tue Oct 19, 1993
* RELATED FILES:
* AUTHOR: John Lundell
* DESCRIPTION:
* Windowed sinc filter generation
*
* NOTES/WARNINGS:
* REVISION HISTORY:
* Release Who Date Comments
*/
#include "cgs.h"
#include "cgsfilt.h"
/*---------------------------------------------------------------
* FUNCTION: filtGenWSincLpf
* DESCRIPTION:
* RETURN VALUE:
* NOTES/WARNINGS:
* REVISION HISTORY:
* Release Who Date Comments
*/
void filtGenWSincLpf(sp_wghts, d_freq, d_gain)
Ovector sp_wghts;
double d_freq;
double d_gain;
{
int len, half, i;
double *ws, *we, w;
double arg, wscl;
/*
* Setup lengths and pointers
*/
len = OvGetLength(sp_wghts);
ws = (double *) OvGetVirtStart(sp_wghts);
ws[len-1] = 0.0;
half = (len - 1) >> 1;
len = half << 1;
we = ws + len;
/*
* Calculate the filter tap weights
*/
wscl = PI / half;
for (i = 0; i < half; i++) {
w = 0.54 - 0.46 * cos(wscl * i);
arg = d_freq * (i - half);
w *= sin(arg) / arg;
*ws++ = w;
*we-- = w;
}
*ws = 1.0;
/*
* Set the DC gain to 1.0
*/
Dvcsum(sp_wghts, &wscl);
wscl = d_gain / wscl;
Dvscale(wscl, sp_wghts, sp_wghts);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -