Overlap-Save and Overlap-Add

advertisement
Overlap-Save and Overlap-Add
Circular and Linear Convolution
The Discrete Fourier Transform Pair
Overlap-Save and Overlap-Add
I
DFT and inverse-DFT (IDFT):
X (k) =
Dr. Deepa Kundur
University of Toronto
x(n) =
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
1 / 58
Circular and Linear Convolution
Time Domain
x(n)
x(n) = x(n + N)
a1 x1 (n) + a2 x2 (n)
x(N − n)
x((n − l))N
x(n)e j2πln/N
x ∗ (n)
x1 (n) ⊗ x2 (n)
x1 (n)x2 (n)
P
N−1
∗
n=0 x(n)y (n)
Dr. Deepa Kundur (University of Toronto)
n
x(n)e −j2πk N ,
n=0
N−1
X
1
N
k = 0, 1, . . . , N − 1
n
X (k)e j2πk N ,
n = 0, 1, . . . , N − 1
k=0
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Important DFT Properties
Property
Notation:
Periodicity:
Linearity:
Time reversal
Circular time shift:
Circular frequency shift:
Complex conjugate:
Circular convolution:
Multiplication:
Parseval’s theorem:
Dr. Deepa Kundur (University of Toronto)
N−1
X
2 / 58
Circular and Linear Convolution
Circular Convolution
Frequency Domain
X (k)
X (k) = X (k + N)
a1 X1 (k) + a2 X2 (k)
X (N − k)
X (k)e −j2πkl/N
X ((k − l))N
X ∗ (N − k)
X1 (k)X2 (k)
1
X1 (k) ⊗ X2 (k)
N P
N−1
1
∗
k=0 X (k)Y (k)
N
Overlap-Save and Overlap-Add
x1 (n) ⊗ x2 (n)
F
←→
X1 (k)X2 (k)
Q: What is circular convolution?
3 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
4 / 58
Overlap-Save and Overlap-Add
Circular and Linear Convolution
Overlap-Save and Overlap-Add
Circular and Linear Convolution
Circular Convolution
Circular Convolution
Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N − 1.
Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N − 1.
Examples: N = 10 and support: n = 0, 1, . . . , 9
1
1
4
-3
-2
-1
0
x1 (n) ⊗ x2 (n) =
1
2
n
5
3
6
7
8
9
10
11
12
-3
-2
-1
0
=
1
2
3
4
5
6
7
8
9
10
11
12
n
N−1
X
k=0
N−1
X
x1 (k)x2 ((n − k))N
x2 (k)x1 ((n − k))N
k=0
where (n)N = n mod N = remainder of n/N.
1
-3
-2
-1
Dr. Deepa Kundur (University of Toronto)
0
1
2
3
4
5
6
7
8
9
10
11
12
n
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
5 / 58
Circular and Linear Convolution
Example: N = 4
n
-4 -3 -2
(n)4 0 1 2
(n)N = n
Example: N = 4
-4 -3 -2
n
(n)4 0 1 2
-1 0 1 2 3 4 5 6 7 8
3 0 1 2 3 0 1 2 3 0
nonneg integer < N
n
= integer +
N
N
Dr. Deepa Kundur (University of Toronto)
Circular and Linear Convolution
mod N = remainder of n/N
-1 0 1 2 3 4 5 6 7 8
3 0 1 2 3 0 1 2 3 0
x((n))4 will be periodic with period 4. The repeated pattern will be
consist of: {x(0), x(1), x(2), x(3)}.
−2
2
= −1 +
4
4
Overlap-Save and Overlap-Add
6 / 58
Modulo Indices and Periodic Repetition
mod N = remainder of n/N
5
1
=1+
4
4
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Modulo Indices and Periodic Repetition
(n)N = n
Dr. Deepa Kundur (University of Toronto)
Thus, x((n))N is a periodic signal comprised of the following
repeating pattern: {x(0), x(1), · · · x(N − 2), x(N − 1)}.
7 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
8 / 58
Overlap-Save and Overlap-Add
Circular and Linear Convolution
Overlap-Save and Overlap-Add
Circular and Linear Convolution
Overlap During Periodic Repetition
Overlap During Periodic Repetition
A periodic repetition makes an aperiodic signal x(n), periodic to
produce x̃(n).
A periodic repetition makes an aperiodic signal x(n), periodic to
produce x̃(n).
x̃(n) =
∞
X
There are two important parameters:
1. smallest support length of the signal x(n)
2. period N used for repetition that determines the period of x̃(n)
x(n − lN)
l=−∞
I
smallest support length > period of repetition
I
I
smallest support length ≤ period of repetition
I
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
9 / 58
l=-2
2
-7
-6
-5
-4
-3
-2
-1
0
2
3
4
5
6
n
7
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
-7
-6
-5
-4
-3
-2
l=1
+
+
-1
0
1
2
3
4
5
6
l=-2
x (n)
x (n-2N)
...
7
-7
-6
-5
-4
-3
-2
-1
0
-5
x (n)
2
3
4
5
6
n
7
-7
l=2
+
x (n-2N)
+
+
1
x (n)
+
-6
-5
-4
-3
-2
-1
2
3
4
5
6
7
0
1
2
3
4
5
6
7
n
-4
-3
-2
-1
0
x~ (n)
support length = 6 > N
2
2
1
1
1
2
3
4
5
6
7
n
-7
Overlap-Save and Overlap-Add
-6
-5
-4
-3
-2
-1
0
1
n
=x(n)
= x (n)
Dr. Deepa Kundur (University of Toronto)
l=1
x (n-N)
overlap
~
support length = 4 = N
-6
l=0
x (n+N)
+
...
1
n
l=-1
x (n+2N)
2
no overlap
-7
10 / 58
Circular and Linear Convolution
l=2
x (n-N)
x (n)
+
Overlap-Save and Overlap-Add
Period Repetition: Example N = 4
l=0
x (n+N)
+
...
1
l=-1
x (n+2N)
1
there will be no overlap
⇒ x(n) can be recovered from x̃(n)
Circular and Linear Convolution
Periodic Repetition: Example N = 4
x (n)
there will be overlap
11 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
12 / 58
Overlap-Save and Overlap-Add
Circular and Linear Convolution
Overlap-Save and Overlap-Add
Modulo Indices and the Periodic Repetition
Circular and Linear Convolution
Modulo Indices and the Periodic Repetition
x(n)
2
Assume: x(n) has support n = 0, 1, . . . , N − 1.
1
x((n))N = x(n mod N) = x̃(n) =
∞
X
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n
x(n − lN)
l=−∞
Note: Because the support size and period size are the same, there is
no overlap when taking the periodic repetition x((n))N .
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
13 / 58
Circular and Linear Convolution
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
Dr. Deepa Kundur (University of Toronto)
2
1
0
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
15 / 58
x((n))N
1
1
n
Overlap-Save and Overlap-Add
Circular and Linear Convolution
2
2
1
0
1
Dr. Deepa Kundur (University of Toronto)
x(n)
1
14 / 58
Modulo Indices and the Periodic Repetition
2
2
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Modulo Indices and the Periodic Repetition
x(n)
Dr. Deepa Kundur (University of Toronto)
n
Overlap-Save and Overlap-Add
1
1
0
16 / 58
Circular and Linear Convolution
Overlap-Save and Overlap-Add
Modulo Indices and the Periodic Repetition
2
1
12
8
4
0
-4
1
0
15
11
7
3
-1
1
1
2
12
8
4
0
-4
1
0
1
1
0
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
1
n
1
13
9
5
1
-3
1
n
x((n))N
2
2
13
9
5
1
-3
14
10
6
2
-2
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
x(n)
2
x((n))N
2
Modulo Indices and the Periodic Repetition
15
11
7
3
-1
x(n)
Circular and Linear Convolution
0
14
10
6
2
-2
Overlap-Save and Overlap-Add
~
x (n)
2
1
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 ...
n
Therefore x((n))N = x̃(n).
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
17 / 58
Dr. Deepa Kundur (University of Toronto)
Circular and Linear Convolution
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Circular Convolution: One Interpretation
18 / 58
Circular and Linear Convolution
Circular Convolution: One Interpretation
Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N − 1.
To compute
PN−1
k=0
x1 (k)x2 ((n − k))N (or
PN−1
k=0
x2 (k)x1 ((n − k))N ):
1. Take the periodic repetition of x2 (n) with period N:
x̃2 (n) =
∞
X
N−1
X
x2 (n − lN)
k=0
l=−∞
2. Conduct a standard linear convolution of x1 (n) and x̃2 (n) for
n = 0, 1, . . . , N − 1:
x1 (n) ⊗ x2 (n) = x1 (n) ∗ x̃2 (n) =
∞
X
x1 (k)x̃2 (n − k) =
k=−∞
x1 (k) x2 ((n − k))N =
N−1
X
N−1
X
x1 (k) x̃2 (n − k)
k=0
. . . which makes sense, since x((n))N = x̃(n).
x1 (k)x̃2 (n − k)
k=0
Note: x1 (n) ⊗ x2 (n) = 0 for n < 0 and n ≥ N.
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
19 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
20 / 58
Overlap-Save and Overlap-Add
Circular and Linear Convolution
Overlap-Save and Overlap-Add
Circular Convolution: Another Interpretation
Using DFT for Linear Convolution
Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N − 1.
To compute
PN−1
k=0
x1 (k)x2 ((n − k))N (or
PN−1
k=0
Circular and Linear Convolution
Therefore, circular convolution and linear convolution are related as
follows:
x2 (k)x1 ((n − k))N ):
1. Conduct a linear convolution of x1 (n) and x2 (n) for all n:
xL (n) = x1 (n) ∗ x2 (n) =
∞
X
x1 (k)x2 (n − k) =
k=−∞
N−1
X
xC (n) = x1 (n) ⊗ x2 (n) =
x1 (k)x2 (n − k)
∞
X
xL (n − lN),
for n = 0, 1, . . . , N − 1
Q: When can one recover xL (n) from xC (n)?
When can one use the DFT (or FFT) to compute linear convolution?
A: When there is no overlap in the periodic repetition of xL (n).
When support length of xL (n) ≤ N.
n = 0, 1, . . . , N − 1
l=−∞
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
xL (n − lN)
l=−∞
k=0
2. Compute the periodic repetition of xL (n) and window the result for
n = 0, 1, . . . , N − 1:
x1 (n) ⊗ x2 (n) =
∞
X
21 / 58
Dr. Deepa Kundur (University of Toronto)
Circular and Linear Convolution
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Using DFT for Linear Convolution
22 / 58
Filtering of Long Data Sequences
Filtering of Long Data Sequences
Let x(n) have support n = 0, 1, . . . , L − 1.
Let h(n) have support n = 0, 1, . . . , M − 1.
We can set N ≥ L + M − 1 and zero pad x(n) and h(n) to have
support n = 0, 1, . . . , N − 1.
1. Take N-DFT of x(n) to give X (k), k = 0, 1, . . . , N − 1.
I
The input signal x(n) is often very long especially in real-time
signal monitoring applications.
I
For linear filtering via the DFT, for example, the signal must be
limited size due to memory requirements.
2. Take N-DFT of h(n) to give H(k), k = 0, 1, . . . , N − 1.
3. Multiply: Y (k) = X (k) · H(k), k = 0, 1, . . . , N − 1.
4. Take N-IDFT of Y (k) to give y (n), n = 0, 1, . . . , N − 1.
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
23 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
24 / 58
Overlap-Save and Overlap-Add
Filtering of Long Data Sequences
Overlap-Save and Overlap-Add
Filtering of Long Data Sequences
Filtering of Long Data Sequences
Recall, for N = 8 the 8-FFT is given by
Stage 1
x(0)
x(4)
0
W8
Stage 2
Stage 3
W8
0
I
Complexity of N-FFT is N log(N).
I
If N is too large as for long data sequences, then there is a
significant delay in processing that precludes real-time
processing.
X(2)
-1
2
W8
W8
All N-input samples are required simultaneously by the FFT
operator.
X(0)
0
x(6)
I
X(1)
-1
x(2)
-1
X(3)
-1
0
W8
x(1)
Filtering of Long Data Sequences
-1
X(4)
1
x(5)
W8
0
W8
-1
-1
0
W8
x(3)
2
W8
-1
2
x(7)
-1
Dr. Deepa Kundur (University of Toronto)
W8
-1
-1
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
signal
input
X(6)
25 / 58
signal
output
26 / 58
Filtering of Long Data Sequences
Filtering of Long Data Sequences
Main advantage: samples of the output y (n) = h(n) ∗ x(n) will
be available real-time on a block-by-block basis.
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Strategy:
Dr. Deepa Kundur (University of Toronto)
Dr. Deepa Kundur (University of Toronto)
Filtering of Long Data Sequences
1. Segment the input signal into fixed-size blocks prior to
processing.
2. Compute DFT-based linear filtering of each block separately via
the FFT.
3. Fit the output blocks together in such a way that the overall
output is equivalent to the linear filtering of x(n) directly.
I
Data Processing
Delay
X(7)
Filtering of Long Data Sequences
I
Data Acquisition
Delay
3
W8
0
W8
-1
X(5)
27 / 58
I
Goal: FIR filtering: y (n) = x(n) ∗ h(n)
I
Two approaches to real-time linear filtering of long inputs:
I
I
I
Overlap-Add Method
Overlap-Save Method
Assumptions:
I
I
FIR filter h(n) length = M
Block length = L M
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
28 / 58
Overlap-Save and Overlap-Add
Overlap-Add Method
Overlap-Save and Overlap-Add
Overlap-Add Method
Overlap-Add Method
Overlap-Add Method
Deals with the following signal processing principles:
I
The linear convolution of a discrete-time signal of length L and a
discrete-time signal of length M produces a discrete-time
convolved result of length L + M − 1.
I
Addititvity:
Overlap-Add Method
(x1 (n)+x2 (n)) ∗ h(n) = x1 (n) ∗ h(n)+x2 (n) ∗ h(n)
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
29 / 58
Overlap-Add Method
-2
-1
0
1
2
6
L=4
7
8
L=4
9
L=4
Input
into
blocks
length
L=4
x1(n)
=
* h(n)
1
-2
-1
0
1
2
3
4
5
6
7
8
9
L=4
x2(n)
+
* h(n)
1
4
-3
-2
-1
0
1
2
3
6
7
8
9
L=4
x3(n)
+
* h(n)
1
10
-3
-2
-1
0
n
10
5
1
2
3
6
7
8
9
x(n) is divided
non-overlapping
xm (n) each of
L.
n
10
-3
Overlap-Add Method
n
10
5
3
30 / 58
Overlap-Add Filtering Stage
* h(n)
4
-3
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
x(n)
1
Dr. Deepa Kundur (University of Toronto)
Each
input
block
xm (n) is individually
filtered as it is received
to produce the output
block ym (n).
I
makes use of the N-DFT and N-IDFT where: N = L + M − 1
I
Thus, zero-padding of x(n) and h(n) that are of length
L, M < N is required.
I
The actual implementation of the DFT/IDFT will use the
FFT/IFFT for computational simplicity.
+ ...
n
L=4
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
31 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
32 / 58
Overlap-Save and Overlap-Add
Overlap-Add Method
Overlap-Save and Overlap-Add
Using DFT for Linear Convolution
Overlap-Add Method
Linear Convolution via the DFT
Length of linear convolution result = Length of DFT
Let xm (n) have support n = 0, 1, . . . , L − 1.
Let h(n) have support n = 0, 1, . . . , M − 1.
l=-2
x (n)
x (n+2N)
2
We set N ≥ L + M − 1 (the length of the linear convolution result)
and zero pad xm (n) and h(n) to have support n = 0, 1, . . . , N − 1.
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
1. Take N-DFT of xm (n) to give Xm (k), k = 0, 1, . . . , N − 1.
6
n
7
-7
l=1
l=0
+
+
-6
-5
-4
-3
-2
-1
2
3
4
5
6
7
0
1
2
l=2
x (n-N)
x (n)
+
+
...
1
-7
l=-1
x (n+N)
3
4
5
6
x (n-2N)
...
7
n
no overlap
2. Take N-DFT of h(n) to give H(k), k = 0, 1, . . . , N − 1.
x~ (n)
support length = 4 = N
3. Multiply: Ym (k) = Xm (k) · H(k), k = 0, 1, . . . , N − 1.
2
4. Take N-IDFT of Ym (k) to give ym (n), n = 0, 1, . . . , N − 1.
1
-7
-6
-5
-4
-3
-2
-1
0
1
n
= x (n)
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
33 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Add Method
Overlap-Save and Overlap-Add
x(n)
* h(n)
4
-2
-1
0
1
2
6
7
8
L=4
9
L=4
* h(n)
1
-1
0
1
2
3
4
5
6
7
8
9
L=4
x2(n)
+
* h(n)
1
4
-3
-2
-1
0
1
2
3
6
7
8
9
L=4
x3(n)
+
* h(n)
1
10
-3
-2
-1
0
n
10
5
1
2
3
6
7
8
9
x(n) is divided
non-overlapping
xm (n) each of
L.
n
10
-2
4
-3
Input
into
blocks
length
L=4
x1(n)
-3
Overlap-Add Method
* h(n)
1
n
10
5
3
L=4
=
34 / 58
x(n)
1
-3
Overlap-Save and Overlap-Add
-2
-1
0
1
2
6
L=4
7
8
L=4
L=4
1
Each
input
block
xm (n) is individually
filtered as it is received
to produce the output
block ym (n).
+ ...
-2
-1
0
1
2
3
L=4
y2(n)
+
1
4
-2
-1
0
1
5
6
7
8
y (n) = x(n) ∗ h(n)
ADD
to
next
block
2
3
5
6
8
6
n
10
7
M-1=2
L=4
y3(n)
9
ADD
to
next
block
1
+ ...
-2
-1
0
1
2
3
6
7
8
9
L=4
35 / 58
Dr. Deepa Kundur (University of Toronto)
The support overlap
amongst the ym (n)
blocks must be accounted for.
n
10
-3
Output blocks ym (n)
must be fitted together
appropriately to generate:
n
9
M-1=2
4
-3
+
n
Overlap-Save and Overlap-Add
L=4
10
-3
L=4
Dr. Deepa Kundur (University of Toronto)
9
These extra M-1 samples (i.e., “tail”)
due to convolution expanding
the support must be added to the
begininning of the next output
block
y1(n)
=
n
10
5
3
M-1=2
Overlap-Save and Overlap-Add
36 / 58
Overlap-Save and Overlap-Add
Overlap-Add Method
Overlap-Save and Overlap-Add
Overlap-Add Addition Stage
* h(n)
1
4
-3
-2
-1
0
1
2
x(n) = x1 (n) + x2 (n) + x3 (n) + · · · =
∞
X
6
=
7
8
L=4
9
L=4
L=4
These extra M-1 samples (i.e., “tail”)
due to convolution expanding
the support must be added to the
begininning of the next output
block
y1(n)
xm (n)
n
10
5
3
L=4
From the Addititvity property, since:
1
-3
x(n) ∗ h(n) = (x1 (n) + x2 (n) + x3 (n) + · · · ) ∗ h(n)
= x1 (n) ∗ h(n) + x2 (n) ∗ h(n) + x3 (n) ∗ h(n) + · · ·
∞
∞
X
X
=
xm (n) ∗ h(n) =
ym (n)
-2
-1
0
1
2
3
L=4
y2(n)
+
4
-1
0
1
2
5
3
+
6
6
8
9
8
9
y (n) = x(n) ∗ h(n)
n
10
7
M-1=2
L=4
y3(n)
m=1
7
ADD
to
next
block
1
-2
6
M-1=2
4
-3
5
ADD
to
next
block
1
+ ...
-2
-1
0
1
2
3
6
7
8
9
M-1=2
L=4
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
37 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Add Method
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Input signal:
The support overlap
amongst the ym (n)
blocks must be accounted for.
n
10
-3
Output blocks ym (n)
must be fitted together
appropriately to generate:
n
10
m=1
m=1
Overlap-Add Method
x(n)
38 / 58
Overlap-Add Method
Overlap-Add Method
1
=
1. Break the input signal x(n) into non-overlapping blocks xm (n) of length L.
-3
-2
-1
0
1
2
3
4
5
6
7
8
9
10
n
2. Zero pad h(n) to be of length N = L + M − 1.
zeros
3. Take N-DFT of h(n) to give H(k), k = 0, 1, . . . , N − 1.
4. For each block m:
zeros
Output signal:
4.1
4.2
4.3
4.4
zeros
Add
points
5. Form y (n) by overlapping the last M − 1 samples of ym (n) with the first
M − 1 samples of ym+1 (n) and adding the result.
Add
points
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Zero pad xm (n) to be of length N = L + M − 1.
Take N-DFT of xm (n) to give Xm (k), k = 0, 1, . . . , N − 1.
Multiply: Ym (k) = Xm (k) · H(k), k = 0, 1, . . . , N − 1.
Take N-IDFT of Ym (k) to give ym (n), n = 0, 1, . . . , N − 1.
39 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
40 / 58
Overlap-Save and Overlap-Add
Overlap-Add Method
Overlap-Save and Overlap-Add
Overlap-Add Method: Cautionary Note
Overlap-Add Method
Overlap-Add Method: Cautionary Note
Output signal:
Add
If you DO NOT overlap and add, but only append the output blocks
ym (n) for m = 1, 2, . . ., then you will not get the true y (n) sequence.
points
Add
points
Q: What sequence will you obtain instead?
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
41 / 58
Overlap-Add Method
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Overlap-Add Method: Cautionary Note
42 / 58
Overlap-Save Method
Overlap-Save Method
zeros
Overlap-Save Method
Overlap-[Discard] Method
zeros
zeros
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
43 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
44 / 58
Overlap-Save and Overlap-Add
Overlap-Save Method
Overlap-Save and Overlap-Add
Overlap-Save Method
Overlap-Save Method
yL(n) linear
convolution
2
result
Deals with the following signal processing principles:
I
The N = (L + M − 1)-circular convolution of a discrete-time
signal of length N and a discrete-time signal of length M using
an N-DFT and N-IDFT.
xC (n) =
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
6
7
-7
xL (n − lN) ,
| {z }
+
-6
-5
-4
-3
...
+
-2
-1
0
1
2
3
4
5
6
7
n
Add and keep points only
at n=0, 1, ..., N-1
yC (n)
circular
convolution
result
n = 0, 1, . . . , N − 1
yL(n-2N)
+
+
n
overlap since
N < L+M-1
Time-Domain Aliasing:
∞
X
-7
yL(n-N)
yL(n)
+
...
1
I
yL(n+N)
yL(n+2N)
l=−∞ support=M + N − 1
-7
-6
-5
-4
-3
corruption from
previous repetitions
2
1
-2
-1
0
1
2
3
4
5
6
7
n
= yL(n) at n=M-1, M, ..., N-1
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
45 / 58
Overlap-Save Method
yC ,m (n)
=
aliasing corruption
yL,m (n)
n = 0, 1, . . . , M − 2
n = M − 1, M, . . . , N − 1
I
The first M − 1 points of a the current filtered output block
ym (n) must be discarded.
The previous filtered block ym−1 (n) must compensate by
providing these output samples.
Dr. Deepa Kundur (University of Toronto)
Overlap-Save Method
Overlap-Save and Overlap-Add
1. All input blocks xm (n) are of length N = (L + M − 1) and
contain sequential samples from x(n).
2. Input block xm (n) for m > 1 overlaps containing the first M − 1
points of the previous block xm−1 (n) to deal with aliasing
corruption.
where yL,m (n) = xm (n) ∗ h(n) is the desired output.
I
46 / 58
Overlap-Save Input Segmentation Stage
Convolution of xm (n) with support n = 0, 1, . . . , N − 1 and h(n)
with support n = 0, 1, . . . , M − 1 via the N-DFT will produce a
result yC ,m (n) such that:
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Overlap-Save Method
I
Dr. Deepa Kundur (University of Toronto)
3. For m = 1, there is no previous block, so the first M − 1 points
are zeros.
47 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
48 / 58
Overlap-Save and Overlap-Add
Overlap-Save Method
Overlap-Save and Overlap-Add
Overlap-Save Input Segmentation Stage
Overlap-Save Method
Overlap-Save Input Segmentation Stage
Input signal blocks:
x1 (n) = {0,
|
0, . . .
{z
M − 1 zeros
0, x(0), x(1), . . . , x(L − 1)}
}
x2 (n) = {x(L − M + 1), . . . x(L − 1), x(L), . . . , x(2L − 1)}
|
{z
}
zeros
last M − 1 points from x1 (n)
x3 (n) = {x(2L − M + 1), . . . x(2L − 1), x(2L), . . . , x(3L − 1)}
|
{z
}
point
overlap
last M − 1 points from x2 (n)
..
.
point
overlap
The last M − 1 points from the previous input block must be saved
for use in the current input block.
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
49 / 58
Overlap-Save Method
I
50 / 58
Overlap-Save Method
Using DFT for Circular Convolution
makes use of the N-DFT and N-IDFT where: N = L + M − 1
I
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Overlap-Save Filtering Stage
I
Dr. Deepa Kundur (University of Toronto)
Only a one-time zero-padding of h(n) of length M L < N is
required to give it support n = 0, 1, . . . , N − 1.
The input blocks xm (n) are of length N to start, so no
zero-padding is necessary.
N = L + M − 1.
Let xm (n) have support n = 0, 1, . . . , N − 1.
Let h(n) have support n = 0, 1, . . . , M − 1.
We zero pad h(n) to have support n = 0, 1, . . . , N − 1.
1. Take N-DFT of xm (n) to give Xm (k), k = 0, 1, . . . , N − 1.
2. Take N-DFT of h(n) to give H(k), k = 0, 1, . . . , N − 1.
I
The actual implementation of the DFT/IDFT will use the
FFT/IFFT for computational simplicity.
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
3. Multiply: Ym (k) = Xm (k) · H(k), k = 0, 1, . . . , N − 1.
4. Take N-IDFT of Ym (k) to give yC ,m (n), n = 0, 1, . . . , N − 1.
51 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
52 / 58
Overlap-Save and Overlap-Add
Overlap-Save Method
Overlap-Save and Overlap-Add
Circular Convolution via the DFT
Overlap-Save Method
Overlap-Save Output Blocks
Length of linear convolution result > Length of DFT
yL(n) linear
convolution
2
result
-6
-5
-4
-3
-2
-1
0
yL(n-N)
yL(n)
+
...
1
-7
yL(n+N)
yL(n+2N)
+
2
3
4
5
6
n
7
-7
-6
-5
-4
-3
...
+
+
1
yL(n-2N)
+
-2
-1
0
1
2
3
4
5
6
7
n
yC ,m (n) =
Add and keep points only
at n=0, 1, ..., N-1
overlap since
N < L+M-1
yC (n)
circular
convolution
result
-7
-6
-5
-4
-3
where yL,m (n) = xm (n) ∗ h(n) is the desired output.
corruption from
previous repetitions
2
aliasing n = 0, 1, . . . , M − 2
yL,m (n) n = M − 1, M, . . . , N − 1
1
-2
-1
0
1
2
3
4
5
6
7
n
= yL(n) at n=M-1, M, ..., N-1
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
53 / 58
Overlap-Save Method
= {y1 (0),
|
y1 (1), . . .
{z
y1 (M − 2), y (0), . . . , y (L − 1)}
}
= {y2 (0),
|
y2 (1), . . .
{z
y2 (M − 2), y (L), . . . , y (2L − 1)}
}
= {y3 (0),
|
y3 (1), . . .
{z
y3 (M − 2), y (2L), . . . , y (3L − 1)}
}
Overlap-Save and Overlap-Add
Overlap-Save and Overlap-Add
Overlap-Save [Discard] Output Blocks
y1 (n)
Dr. Deepa Kundur (University of Toronto)
54 / 58
Overlap-Save Method
Overlap-Save Output Stage
Output signal blocks:
M − 1 points corrupted from aliasing
y2 (n)
Discard
M − 1 points corrupted from aliasing
y3 (n)
points
Discard
points
M − 1 points corrupted from aliasing
Discard
points
where y (n) = x(n) ∗ h(n) is the desired output.
The first M − 1 points of each output block are discarded.
The remaining L points of each output block are appended to form
y (n).
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
55 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
56 / 58
Overlap-Save and Overlap-Add
Overlap-Save Method
Overlap-Save and Overlap-Add
Overlap-Save Method
Overlap-Save Method
Overlap-Save Method
1. Insert M − 1 zeros at the beginning of the input sequence x(n).
Input signal blocks:
2. Break the padded input signal into overlapping blocks xm (n) of length
N = L + M − 1 where the overlap length is M − 1.
zeros
3. Zero pad h(n) to be of length N = L + M − 1.
4. Take N-DFT of h(n) to give H(k), k = 0, 1, . . . , N − 1.
5. For each block m:
point
overlap
5.1 Take N-DFT of xm (n) to give Xm (k), k = 0, 1, . . . , N − 1.
5.2 Multiply: Ym (k) = Xm (k) · H(k), k = 0, 1, . . . , N − 1.
5.3 Take N-IDFT of Ym (k) to give ym (n), n = 0, 1, . . . , N − 1.
Output signal blocks:
point
overlap
Discard
5.4 Discard the first M − 1 points of each output block ym (n).
6. Form y (n) by appending the remaining (i.e., last) L samples of each block
ym (n).
points
Discard
points
Discard
points
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
57 / 58
Dr. Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add
58 / 58
Download