📄 interpfilt.3
字号:
.\" Copyright (c) 1987-1990 Entropic Speech, Inc..\" Copyright (c) 1997 Entropic Research Laboratory, Inc. All rights reserved..\" @(#)interpfilt.3 1.7 18 Apr 1997 ESI/ERL.ds ]W (c) 1997 Entropic Research Laboratory, Inc..TH INTERP_FILT 3\-ESPSsp 18 Apr 1997.SH NAMEinterp_filt \- perform interpolation filtering on a data array..SH SYNOPSIS.ft B.brint interp_filt (nx, x, y, pzfunc, state, up, down, poutflag, pout);.brint nx, up, down, *poutflag, *pout;.brdouble *x, *y, *state;.brstruct zfunc *pzfunc;.ft.SH DESCRIPTION.I interp_filttakes an array of .I nxinputs in .I x,performs interpolation filtering, and returns the result in.I y.This changes the sampling rateby a factor of .I up/down.To accomplish this it raises the sampling rate by a factor of .I upby inserting zeros into the input data sequence,filters it with the transfer function pointed to by.I pzfunc,and downsamples the resulting sequence by a factor of.I downto result in .I *poutoutputs.Depending on the values of.I nxand.I *poutflagon any particular call to the function, .I *poutwill either be.I nx*up/downor.I nx*up/down + 1..PPIn the case of IIR filtering, a weighted sum must be computed for eachsample at the higher sampling rate .I (up*src_sf).For FIR filtering, however, the function is implemented so as to computeonly the samples which will be returned in the.I yarray.The user may change.I nx, and.I *pzfunc,between calls of the function, but the values passed on the first callof the function for .I nx, pzfunc->nsiz,or.I pzfunc->dsizmust never be exceeded..PP.I poutflag is a pointer to a variable which indicates to the subroutine which samplein the function's internal state array corresponds to the next output. Normally, the calling programshould initialize this parameter to zero at the beginning of thefiltering operation, and not change it after that..PPThe array pointed to by.I statecontains the present state vector of the filter, when implemented in"Direct" form.The calling program should allocate space for the.I statearray sufficient to store max.I (up*pzfunc->nsiz, up*pzfunc->dsiz)elements.For FIR filters, the state vector will contain the previousinput samples at the .I up*src_sfsampling rate.For IIR filters, the contents of the state vector are more complicated.Since the function retains information about its past inputs and outputsthrough the.I statearray, the contents of this array should normally not be alteredby the calling program between calls to the function..PPData can be stored in the .I statearray prior to the first call to.I interp_filtfor the purposes of initialization.For either FIR or IIR filters, the .I statearray should be initialized to contain all zeroes if the filtering operationis to assume zero inputs before the starting point of the filtering.For FIR filters, the .I statearray may be filled with the previous.I up*(pzfunc->nsiz)which would occur at the sampling rate.I up*src_sf,in order to have the first computed output correspond to "steady state"conditions..SH EXAMPLE.nf/* The following is valid for FIR filtering. */skip_rec (fpin, start - pzfunc->nsiz, size_rec (ih));get_sd_recf (temp, pzfunc->nsiz, ih, fpin);/* Intersperse zeros in the state array to set the initial conditions. */for (i=0; i<pzfunc->nsiz; i++) { state [i*up] = temp[i]; for (j=1; j<up; j++) state [i*up+j] = 0; }/* We're going to filter nan input samples. */nleft = nan;/* The first output will correspond to the first input. */outflag = 0;/* Main filtering loop. */while (nleft > nsamp)) { get_sd_recf (x, nsamp, ih, fpin); nleft -= nsamp; interp_filt (nsamp, x, y, pzfunc, state, up, down, &outflag, &nout); put_sd_recf (y, nout, oh, fpout); }/* Finish up the odd samples. */get_sd_recf (x, nleft, ih, fpin);interp_filt (nleft, x, y, pzfunc, state, up, down, &outflag, &nout);put_sd_recf (y, nout, oh, fpout);.fi.SH DIAGNOSTICSThe function returns 1 if the filtering was performed successfully.The function prints an error message to .I stderrand exits if .I pzfunc->dsizis greater than 0 and .I pzfunc->poles[0]is equal to 0..SH BUGSNone known..SH SEE ALSO.nf\fIfilter\fP(1\-ESPS), ESPS(5\-ESPS).fi.SH REFERENCESL.R. Rabiner and R.W.Schafer, .I Digital Processing of Speech Signals,page 22, Prentice-Hall, 1978..SH AUTHORBrian Sublett
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -