Tampere University of Technology
1
POLYNOMIAL-BASED INTERPOLATION FILTERS FOR DSP APPLICATIONS DESIGN, IMPLEMENTATION, AND APPLICATIONS Djordje Babic, Jussi Vesma, Tapio Saramäki, Vesa Lehtinen, Markku Renfors Tampere University of Technology, Finland
• This pile of lecture notes is based on the research work done by Dr. Tech. Jussi Vesma, Prof. Tapio Saramäki, Dr. Tech. Djordje Babic, and Prof. Markku Renfors. • The lecture notes have been prepared by Prof. Saramäki and Dr. Vesma, and updated by Dr. Babic and M.Sc. Vesa Lehtinen.
Tampere University of Technology
POLYNOMIAL-BASED INTERPOLATION FILTERS FOR DSP APPLICATIONS DESIGN, IMPLEMENTATION, AND APPLICATIONS Speaker: Vesa Lehtinen Tampere University of Technology, Finland e-mail:
[email protected]
Contents 1. Interpolation Filters 2. Fractional-Delay Filters 3. Lagrange Interpolation 4. Analog Model for Interpolation Filter 5. Polynomial-Based Interpolation Filters 6. Design 7. Applications
2
Tampere University of Technology
3
INTERPOLATION FILTERS • In many DSP applications there is a need to know the value of a signal also between the existing discretetime samples x(n). • Special interpolation filters can be used to compute new sample values y(l)=ya(tl) at arbitrary points t l =(nl +µl)Tin. • Here ya(t) approximates the original continuous-time signal xa(t). • The output sample time is thus determined by the fractional interval (or delay) µl∈[0,1) and the integer index nl. • Terms "interpolator" and "fractional delay (FD) filter" are also used in the literature. ya(t)
= x(n) = y(l)
µl-1Tin nl-1Tin
tl-1
µlTin nlTin
µl+1Tin tl
nl+1Tin
Fig. 1. Interpolation in the time domain.
tl+1
Time
Tampere University of Technology
4
Terminology pitfalls: Mathematical interpolation vs. interpolation in DSP vs. decimation • In mathematics, interpolation stands for constructing a smooth curve that travels through all given points. o Constructing a curve that is as close as possible but does not include all the given points is referred to as approximation. Cf., e.g., leastsquares approximation. • In DSP, upsampling + antiimage filtering commonly referred to as “interpolation” (vs. decimation). o Not all DSP “interpolators” interpolate in the mathematical sense. o Filters that interpolate in the math sense are also known as Nyquist filters (recall the zero intersymbol interference property). o It is the antiimage filter that performs the interpolation, not the upsampler. • In decimation by fractional (nonintegral) ratios, output samples are generated between the input samples. => Fractional decimation incorporates interpolation / approximation for the purpose of antialiasing.
Tampere University of Technology
5
Applications for Interpolation Filters • Timing adjustment in all-digital receivers (symbol synchronization) • Time delay estimation • Conversion between arbitrary sample rates • Conversion between uniform and nonuniform sample grids • Echo cancellation • Phased array antenna systems • Speech coding and synthesis • Computer simulation of continuous-time systems • Image processing (image resizing and rotation)
Tampere University of Technology
6
Statement of the general interpolation problem for uniformly sampled input x(n)
Interpolation filter
y(l)
h(k,µl) nl
µl
Fig. 2. Simplified block diagram for interpolation filter.
• The input parameters nl and µl are used to determine the time instant tl for the l th output sample y(l)=ya(tl) as t l =(nl +µl)Tin. • Given tl, these parameters are determined by nl = tl / Tin and µl = tl / Tin − tl / Tin
(1)
• After knowing nl and µl, the interpolation filter calculates y(l) according to the convolution
y (l ) =
N / 2 −1
∑
k =− N / 2
x(nl − k )h(k , µl ).
(2)
where N is the length and h(k, µl) is the (discrete-time) impulse response of the interpolation filter.
Tampere University of Technology
7
Interpretation of the convolution sum
• First, the location of the existing sample preceding (or occurring at) the new sampling instant tl is determined and denoted by nl. • Based on the location of this sample, the existing samples located at n=nl −N/2+1, nl −N/2+2,···, nl +N/2 are used. This means that there are N/2 existing discrete-time samples before and after the desired new time instant tl. • Second, the distance between tl and nlTin is measured as a fraction of Tin, giving the fractional interval µl. • In the above convolution, µl determines the coefficient values h(k, µl). The purpose is to determine them in such a way that y(l) is found according to some criterion to be discussed next.
Tampere University of Technology
8
Requirements for the impulse-response coefficients h((k,, µl)
1. h(k, µl) should be optimized such that y(l)≈xa((nl +µl)Tin) for all values of µl ∈[0,1) and l. 2. The fundamental idea in the optimization is that ya(t) approximates the original continuous-time signal xa(t) according to some time-domain or frequency-domain criterion. 3. Frequency-domain criteria are preferred for DSP applications. 4. The interpolation filter should have an efficient digital implementation structure.
Tampere University of Technology
9
Filter Synthesis and Analysis Problem • The problem is now to design a filter which calculates the interpolated samples y(l) for a given value of µl based on the above discussion. • And to analyze the performance of the filter (what is the error between ya(t) and xa(t)). • Note that the direct analysis of the above interpolation filter is difficult, because the system is time-varying. Three approaches to find a solution
1. The frequency response of the ideal fractional delay is e−jωµ, find a FIR filter to approximate this response (FD filter approach) for each value of µ. 2. Use some classical interpolation method to calculate y(l), e.g., Lagrange or B-spline interpolation (timedomain approach). 3. Utilize the continuous-time (analog) model for the interpolation filter (frequency-domain approach).
Tampere University of Technology
10
FD FILTERS • There are several synthesis methods [1] to design FIR filters having a phase delay of Dint+µ, where Dint =N/2−1 is the integer delay determined by the length of the filter N and µ∈[0,1) is the fractional delay. • The amplitude response of this FIR filter should approximate unity on the given frequency band. • Good solution when µ is fixed. Otherwise, several FD FIR filters are designed and coefficients are stored in a lookup table. ⇒ Need for a large memory. • See Matlab demo #1.
Tampere University of Technology
11
Example: FD Filter • The length of the filter N=8, Ωp =[0, 0.75π], six different filters having µ=0, 0.1, 0.2, 0.3, 0.4, and 0.5 1 0.9
Amplitude Response
0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
Angular Frequency ω / π
0.8
0.9
1
Fig. 3. Amplitude response for the example FD filter. 3.5
Phase Delay Response
3.4
3.3
3.2
3.1
3 0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
Angular Frequency ω / π
0.8
Fig. 4. Phase delay response.
0.9
1
Tampere University of Technology
12
LAGRANGE INTERPOLATION • In Lagrange interpolation, the interpolated signal ya(t) is a piecewise polynomial of an odd degree M. ya((n+µ)Tin)=ŷn((n+µ)Tin) I.e., the polynomial ŷn(t) is used for t∈[nTin, (n+1)Tin). • The polynomial pieces ŷn(t) are defined such that ŷn(kTin)=x(kTin) for N=M+1 consecutive sample points k=n−N/2+1,…,n+N/2. Notice that these points extend beyond the range in which ŷn(t) is applied. • Disadvantage: Does not utilize the frequency-domain information of the input signal x(n). • Lagrange interpolation is discussed in more detail later on. • See Matlab demo #2.
Tampere University of Technology
13
Example: Lagrange Interpolation
• How to obtain y(l)? ZERO-ORDER HOLD
ya(t)
= x(n) = y(l)
µlTin
nl (nl+µl)Tin nl+1
LINEAR INTERPOLATION ya(t)
= x(n) = y(l)
µlTin
nl (nl+µl)Tin nl+1
CUBIC LAGRANGE INTERPOLATION = x(n) = y(l)
ya(t)
µlTin
nl (nl+µl)Tin nl+1
Fig. 5. Lagrange interpolation.
Tampere University of Technology
14
ANALOG MODEL FOR INTERPOLATION FILTER x(n)
xs(t)
DAC
y(l)
ya(t)
ha(t)
Sample at tl = ( n l + µ l ) Tin Fig. 6. Analog model for interpolation filter.
• Interpolation is a reconstruction problem where the approximating signal ya(t) is reconstructed based on the existing discrete-time samples x(n). • Therefore, one useful way to model discrete-time interpolation filters is to use the analog system shown in Fig. 6. • In this system, x(n) is first converted to the sequence of weighted and shifted Dirac impulses xs(t). • xs(t) is then filtered using an analog, linear timeinvariant (LTI) reconstruction filter ha(t) resulting in the following convolution: ∞
ya (t ) =
∞
∫ x (τ )h (t − τ )dτ = ∑ x(k )h (t − kT s
−∞
a
a
k = −∞
in ).
(3)
Tampere University of Technology
15
Why to Use the Analog Model? • Interpolation is generally considered as a time-domain polynomial fitting problem which is not a very practical approach for DSP applications. This is because the time-domain characteristics of the signal are not known usually. What is known is the frequency band of the signal. • The use of the analog model turns interpolation from a time-domain problem to a frequency-domain filtering problem. • Various interpolation methods can, indeed, be expressed as convolution when the input samples are uniformly spaced.
Tampere University of Technology
16
Role of ha(t) in the Frequency Domain • How to design ha(t) in the frequency domain? • Such that it preserves the signal components in the range [0,Fin /2] and attenuates them elsewhere.
X a( f )
f Fin/2 Fig. 7. The spectrum of the original continuous-time signal.
X(e j2π f /Fin) Ha( j2π f )
f Fin/2
Fin
2Fin
Fig. 8. The spectrum of the input signal x(n) and the frequency response of the reconstruction filter ha(t).
Tampere University of Technology
17
Farrow structure – traditional approach • The main idea of this part is the understanding of the special implementation form of polynomial-based interpolation filters. • y(l) is then obtained by sampling ya(t) at tl giving y ( l ) = y a ( tl ) =
N / 2 −1
∑ x(n
l
− k )ha (( k + µl )Tin ) .
k =−N / 2
(4)
• It is assumed that ha(t) is zero outside the interval −NTin /2≤t≤NTin /2. • By comparing (2) and (4), it can be seen that the impulse responses of the analog and discrete-time filters are related as follows: h( k , µl ) = ha((k + µl )Tin )
(5)
for k=−N/2, −N/2+1,···, N/2−1. • In the causal case, ha(t) is delayed by NTin/2 and the output is given by y (l ) =
N −1
∑ x(n
l
k =0
− k + N / 2)ha ((k + µl − N / 2)Tin ).
(6)
Tampere University of Technology
18
• For a polynomial-based interpolation filter, the impulse response ha(t) is expressed in each interval of length Tin by means of a polynomial as follows: ha (( k + µl ) Tin ) =
M
∑
cˆm ( k )µ l
m
(7)
m =0
for k=−N/2,···, N/2−1. Here the cˆm (k ) ’s are the coefficients and M is the degree of the polynomials. • By using the analog model, the digital implementation structure for polynomial-based interpolation filters can be derived by substituting (7) into (6) giving y (l ) =
N −1
∑
x ( nl − k + N / 2 )
k =0
M
∑
m
cˆm ( k − N / 2)µ l =
m =0
M
∑
v m ( nl ) µ l
m =0
m
(8)
where vm ( nl ) =
N −1
∑ x(n − k + N / 2)cˆ l
m (k
− N / 2)
k =0
(9)
are the output samples of the M+1 FIR filters having the transfer functions Cˆ m ( z ) =
N −1
∑ k =0
cˆm ( k − N / 2) z − k .
(10)
Tampere University of Technology
19
Interpretation of the Above Equation • According to Equation (9), the lth output sample y(l) at the time instant t = (nl +µl)Tin can be generated based on the N existing samples x(n) being located at n=nl −N/2+1, nl −N/2+2,···, nl +N/2 in the following three steps: • First, these samples are filtered using M+1 FIR filters having the transfer functions of the form given in (10) • Second, the outputs of these filters, denoted by vm(nl), m are multiplied with constants µ l . • Third, the multiplication results are added, leading to the so-called original Farrow structure shown in Fig. 10. • In this figure, the input to both structures is denoted by x(nl + N/2) to emphasize the fact that this is the last existing sample value when evaluating y(l). • If desired, the transfer functions Cˆ m ( z ) can share the delay elements.
Tampere University of Technology
20
x(nl) ^
CM(z) vM(nl)
^
^
C2(z)
^
C1(z)
C0(z)
v1(nl)
v2(nl)
v0(nl)
Hold & sample y(l)
µl Fig. 9. The Farrow structure for interpolation. x(nl + N/2) cM(0)
Fin −1
Z
c1(0)
c0(0)
−1
Z
cM(1)
−1
−1
Z
c1(1)
−1
Z
−1
Z
cM(N − 1)
v M (nl)
c0(1)
Z
c1(N − 1)
v1(nl)
µl
c0(N − 1)
v0(nl)
Fout y(l)
Fig. 10. The Farrow structure.
Tampere University of Technology
21
Characteristics of the Farrow Structure • The number of FIR subfilters is M+1. • The length of these subfilters is N. • Filter coefficients are directly determined by the polynomial coefficients of the impulse response ha(t). • The main advantage of the Farrow structure is that all the filter coefficients are fixed. • The only changeable parameters are the fractional interval µl as well as nl that depend on the l th output sampling instant. • During computation, the control of µl is easier than in the implementation based on fixed FD filters. • The resolution of µl is limited only by the precision of the arithmetic, not by the size of the coefficient memory. • These characteristics of the Farrow structure make it a very attractive structure to be implemented using a VLSI circuit or a signal processor. • In fact, the Farrow structure is a general-purpose adjustable FIR filter whose taps are polynomials in a control variable. Any filter property may be varied.
Tampere University of Technology
22
POLYNOMIAL-BASED INTERPOLATION FILTERS General approach: How to construct the impulse response ha(t)
• ha(t) nonzero for 0 ≤t 1 is rational, µl becomes periodic, with the periodicity of K. The set of µ values contains K members and can be written as {µ(0)+ k/K | k=0…K-1, 0≤ µ(0) Simpler formulas, simpler programs. BUT: A filter designed using the discrete-time model may not be good for other conversion factors! x(n) Fin
↑K
KFin
FIR filter z(j) Hd(z) KFin
↓L
y(l) Fout=KFin/L
Fig. 25. Model for rational sample rate conversion.
Tampere University of Technology
55
Emulating Continuous-Time Signal Processing
• The Farrow structure can be easily generalized to process digitally the reconstructed signal ya(t). • These applications include, among others, interpolating the derivative or integral of ya(t). • Derivative is widely utilized, for example, in finding the location of a local maximum or minimum of a signal. • Integral can be used to calculate the energy of a signal over a given time interval. • We concentrate on determining the derivative of ya(t). Farrow Structure for Determining the Derivative of ya(t)
• In the intervals nTi n ≤t>2. • However, if there are signal components close to Fin/2, i.e., the oversampling factor is small ( high orders feasible
Disadvantages: • Poor response (Lagrange) – Requires an oversampled signal • High order (due to poor response) => Longer delay in causal realisations
References [1] L. Elden, L. Wittmeyer-Koch, and H.B. Nielsen, Introduction to Numerical Computation. Studentlitteratur, Lund, 2004, pp. 107–113. [2] http://mathworld.wolfram.com/UmbralCalculus.html [3] S. Tassart and Ph. Depalle, “Fractional delays using Lagrange interpolators,“ in Proc. Nordic Acoustic Meeting, Helsinki, Finland, 12–14 June, 1996. [4] C. Candan, “An efficient filt ing structure for Lagrange interpolation,” in IEEE Signal Processing Letters, Vol. 14, No. 1, Jan 2007, pp. 17–19. [5] T.J. Goodman, M.F. Aburdene, “Interpolation Using the Discrete Pascal Transform,” Proc. 40th Annual Conf. Information Sciences and Systems, 22–24 March 2006, pp. 1079–1083. [6] Vesa Lehtinen, Markku Renfors, "Structures for Interpolation, Decimation, and Nonuniform Sampling Based on Newton's Interpolation Formula," in Proc. Sampling Theory and Applications (SAMPTA), Marseille, France, 18-22 May 2009. http://hal.archives-ouvertes.fr/hal-00451769/
Vesa Lehtinen
3/3
29.10.2008