📄 qccfilter.3
字号:
.TH QCCFILTER 3 "QCCPACK" "".SH NAMEQccFilter \- generic data structure for FIR filtering of signals.SH SYNOPSIS.B #include "libQccPack.h".sp.BI "int QccFilterInitialize(QccFilter *" filter );.br.BI "int QccFilterAlloc(QccFilter *" filter );.br.BI "void QccFilterFree(QccFilter *" filter );.br.BI "int QccFilterCopy(QccFilter *" filter1 ", const QccFilter *" filter2 );.br.BI "int QccFilterReversal(const QccFilter *" filter1 ", QccFilter *" filter2 );.br.BI "int QccFilterAlternateSignFlip(QccFilter *" filter );.br.BI int QccFilterRead(FILE *" infile ", QccFilter *" filter );.br.BI "int QccFilterWrite(FILE *" outfile ", const QccFilter *" filter );.br.BI "int QccFilterPrint(const QccFilter *" filter );.SH DESCRIPTIONQccPack provides the.B QccFilterdata structure to specify FIR filters for one-dimensional signals.The.B QccFilterstructure contains filter coefficients, as well as information onthe filters causality. These coefficients then are used in routines like.BR QccFilterVector (3)and.BR QccFilterMultiRateFilterVector (3)to filter signals using time-domain convolution..SH "DATA STRUCTURE"The.B QccFilterdata structure is defined as:.RS.nftypedef struct{ int causality; int length; QccVector coefficients;} QccFilter;.fi.RE.LPThe fields of.B QccFilterare as follows:.TP.I causalityThe causality of the filter, that is, how the filter coefficients arearranged with respect to the time-domain origin. Possible values are.BR QCCFILTER_CAUSAL ,.BR QCCFILTER_ANTICAUSAL ,.BR QCCFILTER_SYMMETRICWHOLE ,and.BR QCCFILTER_SYMMETRICHALF ..BR.TP.I lengthThe number of coefficients in the filter..TP.I coefficientsA vector of the filter coefficients..LPSuppose that.I length is.IR N .If.I causalityis.BR QCCFILTER_CAUSAL ,then the coefficients,.IR h[n] ,of the.RI length- Ncausal FIR filter in.I coefficientsare in the order:.RS.IR "h[0] h[1] h[2]" " ... " h[N-1].REIf.I causalityis.BR QCCFILTER_ANTICAUSAL ,then the coefficients,.IR h[n] ,of the.RI length- Nanti-causal FIR filter in.I coefficientsare in the order:.RS.IR "h[N-1] h[N-2]" " ... " "h[1] h[0]".REIf.I causalityis.BR QCCFILTER_SYMMETRICWHOLE ,then the coefficients,.IR h[n] ,of the.RI length- (2N - 1)whole-sample symmetric FIR filter in.I coefficientsare in the order:.RS.IR "h[0] h[1] h[2]" " ... " h[N-1].REThat is, only the right half of the filter coefficients are storedfor a whole-sample symmetric filter.If.I causalityis.BR QCCFILTER_SYMMETRICHALF ,then the coefficients,.IR h[n] ,of the.RI length- 2Nhalf-sample symmetric FIR filter in.I coefficientsare in the order:.RS.IR "h[0] h[1] h[2]" " ... " h[N-1].REThat is, only the right half of the filter coefficients are storedfor a half-sample symmetric filter..SH "FILE FORMAT"For reading and reading.BR QccFilterstructures, QccPack uses the following file format.The file is in ASCII with no magic number. The file consists ofthe following information:.RS.sp.I c.br.I d.br.I f0.br.I f1.br\|..br\|..br\|..br.sp.REwhere.I cis.IR filter->causality ,.I dis.IR filter->length ,and the.IR fiare the filter coefficients,.IR filter->coefficients ..SH "ROUTINES".B QccFilterInitialize()should be called before any use of a.B QccFilterstructure..B QccFilterInitialize()initializes the fields of.I filterto the following values:.RS.IR casuality :.B QCCFILTER_CAUSAL.br.IR length :0.br.IR coefficients :.B NULL.RE.LP.B QccFilterAlloc()Alloctates storage space for the filters coefficients..IR filter -> lengthmust give a nonzero filter length.The appropriate amount of storage space is allocated by calling.BR QccVectorAlloc (3),with a pointer to the vector returned as.IR filter -> coefficients ..LP.B QccFilterFree()frees space previously allocated by.BR QccFilterAlloc() ..LP.B QccFilterCopy()copies.I filter2to.IR filter1 .If.I filter1has not been allocated prior to calling.B QccFilterCopy() (as is evidenced by a.B NULL.IR filter1 -> coefficientspointer), then.B QccFilterAlloc()is called to allocate space for.I filter1with the same size as.IR filter2 .Otherwise.RB (non- NULL.IR filter1 -> coefficientspointer), it is assumed that sufficient space as already beenallocated to.IR filter1 ..LP.B QccFilterReversal()creates the time reversal of.IR filter2 ,storing the resulting time-reversed filter in.IR filter1 .Sufficient storage space for the coefficients of.I filter1must be allocated prior to calling.BR QccFilterReversal() .For example, if.I filter2 is a.RI length- Ncausal filter,.B QccFilterReversal()produces a.RI length- Nanti-causal filter, which is returned as.IR filter1 ..LP.B QccFilterAlternateSignFlip()changes the sign of every other coefficient in.IR filter .For example, if .I filteris a.RI length- N.RI ( Neven) casual filter.RS.IR "h[0] h[1] h[2]" " ... " "h[N-3] h[N-2] h[n-1]" ,.REthen, after .B QccFilterAlternateSignFlip()returns,.I filteris.RS.IR "-h[0] h[1] -h[2]" " ... " "h[N-3] -h[N-2] h[N-1]" ..RE.LP.BR QccFilterRead()reads the.I filterstructure from the file pointed to by.IR infile which must be already opened for reading via a call to.IR QccFileOpen (3)..LP.BR QccFilterWrite()writes the.I filterstructure to the file pointed to by.IR outfile which must be already opened for writing via a call to.IR QccFileOpen (3)..LP.B QccFilterPrint()prints a formated list of the filter coefficients of.I filterto stdout..SH "RETURN VALUE"Each of these routines (except.BR QccFilterFree() )return 0 upon successful completion, 1 on error..SH "SEE ALSO".BR QccFilterVector (3),.BR QccFilterMultiRateFilterVector (3),.BR QccFilterMatrixSeparable (3),.BR QccPack (3).SH AUTHORCopyright (C) 1997-2009 James E. Fowler.\" The programs herein are free software; you can redistribute them an.or.\" modify them under the terms of the GNU General Public License.\" as published by the Free Software Foundation; either version 2.\" of the License, or (at your option) any later version..\" .\" These programs are distributed in the hope that they will be useful,.\" but WITHOUT ANY WARRANTY; without even the implied warranty of.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the.\" GNU General Public License for more details..\" .\" You should have received a copy of the GNU General Public License.\" along with these programs; if not, write to the Free Software.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -