8 Kundur Overlap Save Add
8 Kundur Overlap Save Add
X (k ) = 1 N
x (n)e j 2k N ,
n=0 N 1
k = 0, 1, . . . , N 1
n
x (n ) =
X (k )e j 2k N ,
k =0
n = 0, 1, . . . , N 1
1 / 58
2 / 58
Circular Convolution
Property Notation: Periodicity: Linearity: Time reversal Circular time shift: Circular frequency shift: Complex conjugate: Circular convolution: Multiplication: Parsevals theorem:
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 j 2ln/N x (n) x1 (n) x2 (n) x1 (n)x2 (n) N 1 n=0 x (n)y (n)
X1 (k )X2 (k )
3 / 58
4 / 58
Circular Convolution
Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N 1. Examples: N = 10 and support: n = 0, 1, . . . , 9
Circular Convolution
Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N 1.
N 1
x1 (n) x2 (n) =
k =0 N 1
1
4 -3 -2 -1 0 1 2 3 5 6 7 8 9 10 11 12
=
1 2 3 4 5 6 7 8 9 10 11 12
-3
-2
-1
-3
-2
-1
10
11
12
5 / 58
6 / 58
-1 0 1 2 3 4 5 6 7 8 3 0 1 2 3 0 1 2 3 0
-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)}. 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
8 / 58
x (n) =
l =
x (n lN )
9 / 58
10 / 58
x (n)
2 1
x (n+2N)
x (n+N)
+
x (n)
+
x (n-N)
+
x (n-2N)
x (n)
2
x (n+2N)
x (n+N)
x (n)
+
x (n-N)
x (n-2N)
+
...
1 2 3 4 5 6 7
...
7
...
1 2 3 4 5 6 7
+ +
+
-1 0 1 2 3 4 5 6 7
-7
-6
-5
-4
-3
-2
-1
-7
-6
-5
-4
-3
-2
-1
-7
-6
-5
-4
-3
-2
-1
-7
-6
-5
-4
-3
-2
overlap
x (n)
2 1
~ x (n)
2 1
-7
-6
-5
-4
-3
-2
-1
-7
-6
-5
-4
-3
-2
-1
= x (n)
Dr. Deepa Kundur (University of Toronto) Overlap-Save and Overlap-Add 11 / 58 Dr. Deepa Kundur (University of Toronto)
=x(n)
12 / 58
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
x (n lN )
Note: Because the support size and period size are the same, there is no overlap when taking the periodic repetition x ((n))N .
13 / 58
14 / 58
x((n))N
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
1 0
15 / 58
16 / 58
x((n))N
15 11 7 3 -1
x (n)
2 1
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 ...
k ))N (or
N 1 k =0 x2 (k )x1 ((n
k ))N ):
N 1 N 1
x 2 (n) =
l =
x2 (n lN )
k =0
x1 (k ) x2 ((n k ))N =
k =0
x1 (k ) x 2 (n k )
x1 (k ) x2 (n k ) =
k =0
x1 (k ) x2 (n k )
19 / 58
14 10 6 2 -2
14 10 6 2 -2
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
15 11 7 3 -1
1
12 8 4 0 -4 13 9 5 1 -3
0
x((n))N
2 1
12 8 4 0 -4
1
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
13 9 5 1 -3
0
20 / 58
k ))N (or
N 1 k =0 x2 (k )x1 ((n
k ))N ):
xL (n lN )
x1 (k )x2 (n k ) =
k =0
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 .
21 / 58 Dr. Deepa Kundur (University of Toronto) Overlap-Save and Overlap-Add 22 / 58
2. Compute the periodic repetition of xL (n) and window the result for n = 0, 1, . . . , N 1:
x1 (n) x2 (n) =
l =
xL (n lN ),
n = 0, 1, . . . , N 1
The input signal x (n) is often very long especially in real-time signal monitoring applications. For linear ltering via the DFT, for example, the signal must be limited size due to memory requirements.
23 / 58
24 / 58
Stage 1
Stage 2
All N -input samples are required simultaneously by the FFT operator. Complexity of N -FFT is N log(N ). If N is too large as for long data sequences, then there is a signicant delay in processing that precludes real-time processing.
signal input Data Acquisition Delay Data Processing Delay signal output
W8
-1 W8 -1
2 W8 0
X(2) X(3)
W8 -1 W8
1 0
W8
-1
-1
W8
-1
0 W8 2 W8
-1
-1 W8
0 W8 2
-1 W8
3
-1
-1
-1
25 / 58
26 / 58
Assumptions:
FIR lter h(n) length = M Block length = L M
Main advantage: samples of the output y (n) = h(n) x (n) will be available real-time on a block-by-block basis.
27 / 58
28 / 58
Overlap-Add Method
Overlap-Add Method
Overlap-Add Method
Overlap-Add Method
Deals with the following signal processing principles: 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. Addititvity: (x1 (n)+x2 (n)) h(n) = x1 (n) h(n)+x2 (n) h(n)
Overlap-Add Method
29 / 58
30 / 58
Overlap-Add Method
Overlap-Add Method
x(n)
1
4 -3 -2 -1 0 1 2 3 5 6 7 8 9 10
* h(n)
n
L=4 L=4 L=4 L=4
x1(n)
=
-3 -2 -1 0
1
10 1 2 3 4 5 6 7 8 9
* h(n)
L=4
x2(n)
+
-3 -2 -1 0
1
4 1 2 3 5 6 7 8 9 10
* h(n)
n
L=4
x3(n)
Each input block xm (n) is individually ltered as it is received to produce the output block ym (n).
+
-3 -2 -1 0
1
10 1 2 3 6 7 8 9
* h(n)
L=4
+ ...
n
31 / 58
32 / 58
Overlap-Add Method
Overlap-Add Method
x (n)
2 1
x (n+2N)
x (n+N)
+
x (n)
+
x (n-N)
+
x (n-2N)
...
1 2 3 4 5 6 7
...
7
-7
-6
-5
-4
-3
-2
-1
-7
-6
-5
-4
-3
-2
-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. 3. Multiply: Ym (k ) = Xm (k ) H (k ), k = 0, 1, . . . , N 1. 4. Take N -IDFT of Ym (k ) to give ym (n), n = 0, 1, . . . , N 1.
-7
-6
-5
-4
-3
-2
-1
= x (n)
Dr. Deepa Kundur (University of Toronto) Overlap-Save and Overlap-Add 33 / 58 Dr. Deepa Kundur (University of Toronto) Overlap-Save and Overlap-Add 34 / 58
Overlap-Add Method
Overlap-Add Method
x(n)
1
4 -3 -2 -1 0 1 2 3 5 6 7 8 9 10
x(n)
* h(n)
n
L=4
-3 -2 -1 0
1
4 1 2 3 5 6 7 8 9 10
* h(n)
n
L=4 L=4 L=4 L=4
L=4
L=4
L=4
x1(n)
=
-3 -2 -1 0
1
10 1 2 3 4 5 6 7 8 9
* h(n)
n
L=4
y1(n)
=
-3 -2 -1 0
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
10
Output blocks ym (n) must be tted together appropriately to generate: y (n) = x (n) h(n) The support overlap amongst the ym (n) blocks must be accounted for.
x2(n)
+
-3 -2 -1 0
1
4 1 2 3 5 6 7 8 9 10
* h(n)
n
L=4
x3(n)
Each input block xm (n) is individually ltered as it is received to produce the output block ym (n).
y2(n)
M-1=2
+
-3 -2 -1 0
4 1 2 3
6 6 7
10
y3(n)
M-1=2
+
-3 -2 -1 0
1
10 1 2 3 6 7 8 9
* h(n)
L=4
+ ...
n
+
-3 -2 -1 0
+ ...
10 8 9
n
M-1=2
L=4
35 / 58
36 / 58
Overlap-Add Method
Overlap-Add Method
x(n)
1
4 -1 0 1 2 3 5 6 7 8 9 10
* h(n)
n
L=4 L=4 L=4 L=4
y1(n)
xm (n)
=
-3 -2 -1 0
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
10
Output blocks ym (n) must be tted together appropriately to generate: y (n) = x (n) h(n) The support overlap amongst the ym (n) blocks must be accounted for.
x (n) h(n) = (x1 (n) + x2 (n) + x3 (n) + ) h(n) = x1 (n) h(n) + x2 (n) h(n) + x3 (n) h(n) +
y2(n)
M-1=2
+
-3 -2 -1 0
=
m=1
xm (n) h(n) =
m=1
ym (n)
4 1 2 3
6 6 7
10
y3(n)
M-1=2
+
-3 -2 -1 0
+ ...
10 8 9
n
M-1=2
L=4
37 / 58
38 / 58
Overlap-Add Method
Overlap-Add Method
Input signal:
Overlap-Add Method
=
-3 -2 -1 0
1. Break the input signal x (n) into non-overlapping blocks xm (n) of length L. 2. Zero pad h(n) to be of length N = L + M 1. 3. Take N -DFT of h(n) to give H (k ), k = 0, 1, . . . , N 1.
zeros
1 2 3 4 5 6 7 8 9 10
zeros
Output signal:
Add points Add points
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.
5. Form y (n) by overlapping the last M 1 samples of ym (n) with the rst M 1 samples of ym+1 (n) and adding the result.
39 / 58
40 / 58
Overlap-Add Method
Overlap-Add Method
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. Q: What sequence will you obtain instead?
points
Add points
41 / 58
42 / 58
Overlap-Add Method
Overlap-Save Method
Overlap-Save Method
43 / 58
44 / 58
Overlap-Save Method
Overlap-Save Method
Overlap-Save Method
Deals with the following signal processing principles: 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. Time-Domain Aliasing:
yL(n+2N)
yL(n+N)
yL(n)
+
yL(n-N)
yL(n-2N)
+
...
n
+ +
...
n
+
-1 0 1 2 3 4 5 6 7
-7
-6
-5
-4
-3
-2
-1
-7
-6
-5
-4
-3
-2
yC (n)
2 1
xC ( n ) =
xL (n lN ) ,
l = support=M + N 1
n = 0, 1, . . . , N 1
45 / 58
46 / 58
Overlap-Save Method
Overlap-Save Method
Overlap-Save Method
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:
yC ,m (n) = aliasing corruption yL,m (n) n = 0, 1, . . . , M 2 n = M 1, M , . . . , N 1
The rst M 1 points of a the current ltered output block ym (n) must be discarded. The previous ltered block ym1 (n) must compensate by providing these output samples.
Dr. Deepa Kundur (University of Toronto) Overlap-Save and Overlap-Add 47 / 58
48 / 58
Overlap-Save Method
Overlap-Save Method
x1 (n) = {0,
0, . . .
M 1 zeros
zeros
. . . The last M 1 points from the previous input block must be saved for use in the current input block.
49 / 58
50 / 58
Overlap-Save Method
Overlap-Save Method
The input blocks xm (n) are of length N to start, so no zero-padding is necessary. The actual implementation of the DFT/IDFT will use the FFT/IFFT for computational simplicity.
51 / 58
52 / 58
Overlap-Save Method
Overlap-Save Method
yL(n+2N)
yL(n+N)
yL(n-N)
yL(n-2N)
+
...
n
+ +
...
n
+
-1 0 1 2 3 4 5 6 7
-7
-6
-5
-4
-3
-2
-1
-7
-6
-5
-4
-3
-2
yC , m ( n ) =
yC (n)
2 1
53 / 58
54 / 58
Overlap-Save Method
Overlap-Save Method
The rst 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 Method
Overlap-Save Method
Overlap-Save Method
1. Insert M 1 zeros at the beginning of the input sequence x (n). 2. Break the padded input signal into overlapping blocks xm (n) of length N = L + M 1 where the overlap length is M 1. 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: 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.
Overlap-Save Method
Input signal blocks:
zeros
point overlap
point overlap
Discard points
57 / 58
58 / 58