Professional Documents
Culture Documents
Over
Over
University of Toronto John G. Proakis and Dimitris G. Manolakis, Digital Signal Processing:
Principles, Algorithms, and Applications, 4th edition, 2007.
Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution
Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution
-3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12
n
Modulo Indices and Periodic Repetition Modulo Indices and Periodic Repetition
Example: N = 4 Example: N = 4
n -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 n -4 -3 -2 -1 0 1 2 3 4 5 6 7 8
(n)4 0 1 2 3 0 1 2 3 0 1 2 3 0 (n)4 0 1 2 3 0 1 2 3 0 1 2 3 0
n nonneg integer < N x((n))4 will be periodic with period 4. The repeated pattern will be
= integer +
N N consist of: {x(0), x(1), x(2), x(3)}.
5 1 −2 2
=1+ = −1 + Thus, x((n))N is a periodic signal comprised of the following
4 4 4 4
repeating pattern: {x(0), x(1), · · · x(N − 2), x(N − 1)}.
Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution
∞
There are two important parameters:
X
xp (n) = x(n − lN) 1. smallest support length of the signal x(n)
l=−∞ 2. period N used for repetition that determines the period of xp (n)
I smallest support length > period of repetition
I there will be overlap
I smallest support length ≤ period of repetition
I there will be no overlap
⇒ x(n) can be recovered from xp (n)
no overlap overlap
support length = 4 = N xp(n) support length = 6 > N xp(n)
2 2
1 1
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n
= x (n) =x(n)
Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution
Modulo Indices and the Periodic Repetition Modulo Indices and the Periodic Repetition
x(n)
2
Assume: x(n) has support n = 0, 1, . . . , N − 1.
1
∞
n
X -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
Note: Because the support size and period size are the same, there is
no overlap when taking the periodic repetition x((n))N .
Modulo Indices and the Periodic Repetition Modulo Indices and the Periodic Repetition
x(n) 2 x(n) 2 x((n))N
2
2 2
1 1 1 1
1 0 1 0
1 1
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 0
Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution
Modulo Indices and the Periodic Repetition Modulo Indices and the Periodic Repetition
x(n) 2 x((n))N
2 x(n) 2 x((n))N
2
12 12
2 8 2 8
1 1 4 1 1 4
0 0
1 0 1 0
-4 -4
15
11
15
11
-1
-1
7
3
7
3
1 1 1 1
n n
13
13
-3
-3
1
5
9
1
5
9
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 0
-2 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 0
-2
2
~ 2
6 x (n) 6
10 10
14 2 14
n
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 ...
Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution
We can set N ≥ L + M − 1 and zero pad x(n) and h(n) to have I The input signal x(n) is often very long especially in real-time
support n = 0, 1, . . . , N − 1. signal monitoring applications.
I For linear filtering via the DFT, for example, the signal must be
1. Take N-DFT of x(n) to give X (k), k = 0, 1, . . . , N − 1.
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.
Overlap-Save and Overlap-Add for Real-time Processing Filtering of Long Data Sequences Overlap-Save and Overlap-Add for Real-time Processing Filtering of Long Data Sequences
I Assumptions:
I FIR filter h(n) length = M
I Block length = L M
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method
x(n)
Overlap-Add Method 1
* h(n)
-3 -2 -1 0 1 2 3
4 5
6 7 8 9
10
n
L=4 L=4 L=4 L=4 Input x(n) is divided
Deals with the following signal processing principles:
x1(n) into non-overlapping
blocks xm (n) each of
I The linear convolution of a discrete-time signal of length L and a = 1
* h(n) length L.
discrete-time signal of length M produces a discrete-time -3 -2 -1 0 1 2 3 4 5 6 7 8 9
10
n
convolved result of length L + M − 1. x2(n)
L=4
Each input block
xm (n) is individually
+ 1
* h(n)
I Addititvity: filtered as it is received
-3 -2 -1 0 1 2 3
4 5
6 7 8 9
10
n to produce the output
L=4
(x1 (n)+x2 (n)) ∗ h(n) = x1 (n) ∗ h(n)+x2 (n) ∗ h(n) x3(n) block ym (n).
+ 1
* h(n) + ...
-3 -2 -1 0 1 2 3 6 7 8 9
10
n
L=4
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method
x(n)
Linear Convolution via the DFT 1
* h(n)
Length of linear convolution result = Length of DFT
-3 -2 -1 0 1 2 3
4 5
6 7 8 9
10
n
l=-2 l=-1 l=0 l=1 l=2 L=4 L=4 L=4 L=4 Input x(n) is divided
x (n+N) x (n-N)
x (n) x (n+2N) x (n) x (n-2N) x1(n) into non-overlapping
2 + + blocks xm (n) each of
... + +
... = 1
* h(n) length L.
1
-3 -2 -1 0 1 2 3 4 5 6 7 8 9
10
n
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n L=4
x2(n) Each input block
xm (n) is individually
no overlap + 1
* h(n)
xp(n)
filtered as it is received
support length = 4 = N 4 5 10
n
-3 -2 -1 0 1 2 3 6 7 8 9 to produce the output
2 L=4
x3(n) block ym (n).
1
+ 1
* h(n) + ...
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n
-3 -2 -1 0 1 2 3 6 7 8 9
10
n
= x (n) L=4
x(n)
Overlap-Add Addition Stage
1
* h(n)
-3 -2 -1 0 1 2 3
4 5
6 7 8 9
10
n
L=4 L=4 L=4 L=4 Output blocks ym (n)
These extra M-1 samples (i.e., “tail”) must be fitted together From the Addititvity property, since:
y1(n) due to convolution expanding
the support must be added to the appropriately to gener- ∞
begininning of the next output
= 1
X
block ate: x(n) = x1 (n) + x2 (n) + x3 (n) + · · · = xm (n)
-3 -2 -1 0 1 2 3 4 5 6 7 8 9
10
n m=1
L=4 M-1=2 y (n) = x(n) ∗ h(n) x(n) ∗ h(n) = (x1 (n) + x2 (n) + x3 (n) + · · · ) ∗ h(n)
y2(n) ADD
to
next
The support overlap = x1 (n) ∗ h(n) + x2 (n) ∗ h(n) + x3 (n) ∗ h(n) + · · ·
+ 1
block
∞ ∞
4 5 6 8 9 10
n amongst the ym (n) X X
-3 -2 -1 0 1 2 3 6 7 = xm (n) ∗ h(n) = ym (n)
L=4 M-1=2 blocks must be ac-
y3(n) m=1 m=1
ADD
to
counted for.
+ 1 next
block
+ ...
-3 -2 -1 0 1 2 3 6 7 8 9
10
n
L=4 M-1=2
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method
x(n)
Input signal:
1
* h(n)
1
4 5 10
n
=-3 -2 -1 0 1
L=4
2 3 6
L=4
7 8 9
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. If you DO NOT overlap and add, but only append the output blocks
4. For each block m: ym (n) for m = 1, 2, . . ., then you will not get the true y (n) sequence.
4.1 Zero pad xm (n) to be of length N = L + M − 1.
4.2 Take N-DFT of xm (n) to give Xm (k), k = 0, 1, . . . , N − 1. Q: What sequence will you obtain instead?
4.3 Multiply: Ym (k) = Xm (k) · H(k), k = 0, 1, . . . , N − 1.
4.4 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 first
M − 1 samples of ym+1 (n) and adding the result.
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method
Add
points Add
zeros
points
zeros
zeros
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method
Overlap-Save Method
yL(n+N) yL(n-N)
yL(n) linear yL(n+2N) yL(n) yL(n-2N)
convolution I Convolution of xm (n) with support n = 0, 1, . . . , N − 1 and h(n)
2
result + + + ... with support n = 0, 1, . . . , M − 1 via the N-DFT will produce a
...
1
+ +
result yC ,m (n) such that:
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n
Add and keep points only aliasing corruption n = 0, 1, . . . , M − 2
yC ,m (n) =
at n=0, 1, ..., N-1 yL,m (n) n = M − 1, M, . . . , N − 1
overlap since
N < L+M-1 yC (n) where yL,m (n) = xm (n) ∗ h(n) is the desired output.
corruption from
circular 2 previous repetitions
convolution I The first M − 1 points of a the current filtered output block
1
result ym (n) must be discarded.
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n
I The previous filtered block ym−1 (n) must compensate by
= yL(n) at n=M-1, M, ..., N-1
providing these output samples.
1. All input blocks xm (n) are of length N = (L + M − 1) and Input signal blocks:
zeros
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.
point
overlap
3. For m = 1, there is no previous block, so the first M − 1 points point
are zeros. overlap
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method
x3 (n) = {x(2L − M + 1), . . . x(2L − 1), x(2L), . . . , x(3L − 1)} I The input blocks xm (n) are of length N to start, so no
zero-padding is necessary.
| {z }
last M − 1 points from x2 (n)
..
. I The actual implementation of the DFT/IDFT will use the fast
Fourier Transform (FFT) for computational simplicity.
The last M − 1 points from the previous input block must be saved
for use in the current input block.
Using DFT for Circular Convolution Circular Convolution via the DFT
Length of linear convolution result > Length of DFT
N = L + M − 1. yL(n+N) yL(n-N)
yL(n) linear yL(n+2N) yL(n) yL(n-2N)
Let xm (n) have support n = 0, 1, . . . , N − 1. convolution
Let h(n) have support n = 0, 1, . . . , M − 1. 2
result + + + ...
...
1
+ +
We zero pad h(n) to have support n = 0, 1, . . . , N − 1. -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
n -7 -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
1. Take N-DFT of xm (n) to give Xm (k), k = 0, 1, . . . , N − 1. overlap since
N < L+M-1 yC (n)
2. Take N-DFT of h(n) to give H(k), k = 0, 1, . . . , N − 1. corruption from
circular 2 previous repetitions
3. Multiply: Ym (k) = Xm (k) · H(k), k = 0, 1, . . . , N − 1. convolution 1
result
4. Take N-IDFT of Ym (k) to give yC ,m (n), n = 0, 1, . . . , N − 1. n
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method
where yL,m (n) = xm (n) ∗ h(n) is the desired output. where y (n) = x(n) ∗ h(n) is the desired output.
Overlap-Save Method
zeros
point
overlap
point
Output signal blocks: overlap
Discard
points Discard
points Discard
points