Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Overlap-Save and Overlap-Add for Real-time Processing

Overlap-Save and Overlap-Add for Real-time


Processing
Overlap-Save and Overlap-Add for Real-time
Filtering Reference:

Professor Deepa Kundur Section 7.3 of

University of Toronto John G. Proakis and Dimitris G. Manolakis, Digital Signal Processing:
Principles, Algorithms, and Applications, 4th edition, 2007.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 1 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 2 / 59

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

The Discrete Fourier Transform Pair Important DFT Properties

Property Time Domain Frequency Domain


I DFT and inverse-DFT (IDFT): Notation: x(n) X (k)
Periodicity: x(n) = x(n + N) X (k) = X (k + N)
N−1 Linearity: a1 x1 (n) + a2 x2 (n) a1 X1 (k) + a2 X2 (k)
n
X Time reversal x(N − n) X (N − k)
X (k) = x(n)e −j2πk N , k = 0, 1, . . . , N − 1 Circular time shift: x((n − l))N X (k)e −j2πkl/N
n=0 Circular frequency shift: x(n)e j2πln/N X ((k − l))N
N−1 Complex conjugate: x ∗ (n) X ∗ (N − k)
1 X n Circular convolution: x1 (n) ⊗ x2 (n) X1 (k)X2 (k)
x(n) = X (k)e j2πk N , n = 0, 1, . . . , N − 1 Multiplication: x1 (n)x2 (n) 1
X1 (k) ⊗ X2 (k)
N Parseval’s theorem:
P N−1 ∗
N P
1 N−1 ∗
k=0 n=0 x(n)y (n) N k=0 X (k)Y (k)

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 3 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 4 / 59
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

DTFT Theorems and Properties Circular and Linear Convolution

Property Time Domain Frequency Domain


Notation: x(n) X (ω)
x1 (n) X1 (ω)
x2 (n) X1 (ω) F
Linearity: a1 x1 (n) + a2 x2 (n) a1 X1 (ω) + a2 X2 (ω)
x1 (n) ⊗ x2 (n) ←→ X1 (k)X2 (k)
Time shifting: x(n − k) e −jωk X (ω) F
Time reversal x(−n) X (−ω) x1 (n) ∗ x2 (n) ←→ X1 (ω)X2 (ω)
Convolution: x1 (n) ∗ x2 (n) X1 (ω)X2 (ω)
Correlation: rx1 x2 (l) = x1 (l) ∗ x2 (−l) Sx1 x2 (ω) = X1 (ω)X2 (−ω)
= X1 (ω)X2∗ (ω) [if x2 (n) real]
Wiener-Khintchine: rxx (l) = x(l) ∗ x(−l) Sxx (ω) = |X (ω)|2 Q: What is circular convolution?

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 5 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 6 / 59

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

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.
N−1
Examples: N = 10 and support: n = 0, 1, . . . , 9 X
x1 (n) ⊗ x2 (n) = x1 (k)x2 ((n − k))N
k=0
N−1
1 1
X
= x2 (k)x1 ((n − k))N
-3 -2 -1 0 1 2 3
4 5
6 7 8 9 10 11 12
n -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12
n k=0

where (n)N = n mod N = remainder of n/N.


1

-3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12
n

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 7 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 8 / 59
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 Periodic Repetition Modulo Indices and Periodic Repetition

(n)N = n mod N = remainder of n/N (n)N = n mod N = remainder of n/N

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)}.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 9 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 10 / 59

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 During Periodic Repetition Overlap During Periodic Repetition


A periodic repetition makes an aperiodic signal x(n), periodic to A periodic repetition makes an aperiodic signal x(n), periodic to
produce xp (n). produce xp (n).


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)

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 11 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 12 / 59
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

Periodic Repetition: Example N = 4 Period Repetition: Example N = 4


l=-2 l=-1 l=0 l=1 l=2 l=-2 l=-1 l=0 l=1 l=2
x (n+N) x (n-N) x (n+N) x (n-N)
x (n) x (n+2N) x (n) x (n-2N) x (n) x (n+2N) x (n) x (n-2N)
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 -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

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)

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 13 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 14 / 59

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

x((n))N = x(n mod N) = xp (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 .

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 15 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 16 / 59
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) 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

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 17 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 18 / 59

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 ...

Therefore x((n))N = xp (n).

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 19 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 20 / 59
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

Circular Convolution: One Interpretation Circular Convolution: One Interpretation


Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N − 1.
PN−1 PN−1
To compute k=0 x1 (k)x2 ((n − k))N (or k=0 x2 (k)x1 ((n − k))N ):
1. Take the periodic repetition of x2 (n) with period N:
N−1 N−1
∞ X X
x1 (k) x2 ((n − k))N = x1 (k) x2p (n − k)
X
x2p (n) = x2 (n − lN)
l=−∞ k=0 k=0

2. Conduct a standard linear convolution of x1 (n) and x2p (n) for


n = 0, 1, . . . , N − 1: . . . which makes sense, since x((n))N = xp (n).

X N−1
X
x1 (n) ⊗ x2 (n) = x1 (n) ∗ x2p (n) = x1 (k)x2p (n − k) = x1 (k)x2p (n − k)
k=−∞ k=0

Note: x1 (n) ⊗ x2 (n) = 0 for n < 0 and n ≥ N.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 21 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 22 / 59

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

Circular Convolution: Another Interpretation Using DFT for Linear Convolution


Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N − 1.
PN−1 PN−1
Therefore, circular convolution and linear convolution are related as
To compute k=0 x1 (k)x2 ((n − k))N (or k=0 x2 (k)x1 ((n − k))N ): follows:
1. Conduct a linear convolution of x1 (n) and x2 (n) for all n: ∞
X
∞ N−1 xC (n) = x1 (n) ⊗ x2 (n) = xL (n − lN)
X X
xL (n) = x1 (n) ∗ x2 (n) = x1 (k)x2 (n − k) = x1 (k)x2 (n − k) l=−∞
k=−∞ k=0
for n = 0, 1, . . . , N − 1
2. Compute the periodic repetition of xL (n) and window the result for
n = 0, 1, . . . , N − 1: Q: When can one recover xL (n) from xC (n)?
When can one use the DFT to compute linear convolution?

A: When there is no overlap in the periodic repetition of xL (n).
X
x1 (n) ⊗ x2 (n) = xL (n − lN), n = 0, 1, . . . , N − 1
l=−∞ When support length of xL (n) ≤ N.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 23 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 24 / 59
Overlap-Save and Overlap-Add for Real-time Processing Circular and Linear Convolution Overlap-Save and Overlap-Add for Real-time Processing Filtering of Long Data Sequences

Using DFT for Linear Convolution 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 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.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 25 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 26 / 59

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

Filtering of Long Data Sequences Filtering of Long Data Sequences

I All N-input samples are required simultaneously by the DFT


operator. I Strategy:
1. Segment the input signal into fixed-size blocks prior to
I If N is too large as for long data sequences, then there is a processing.
significant delay in processing that precludes real-time 2. Compute DFT-based linear filtering of each block separately.
processing. 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 Main advantage: samples of the output y (n) = h(n) ∗ x(n) will
signal Data Acquisition Data Processing signal
input Delay Delay output
be available real-time on a block-by-block basis.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 27 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 28 / 59
Overlap-Save and Overlap-Add for Real-time Processing Filtering of Long Data Sequences Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method

Filtering of Long Data Sequences Overlap-Add Method

I Goal: FIR filtering: y (n) = x(n) ∗ h(n)

I Two approaches to real-time linear filtering of long inputs:


I Overlap-Add Method
I Overlap-Save Method
Overlap-Add Method

I Assumptions:
I FIR filter h(n) length = M
I Block length = L  M

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 29 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 30 / 59

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

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 31 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 32 / 59
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method

Overlap-Add Filtering Stage Using DFT for Linear Convolution

Let xm (n) have support n = 0, 1, . . . , L − 1.


Let h(n) have support n = 0, 1, . . . , M − 1.
I makes use of the N-DFT and N-IDFT where: N = L + M − 1
We set N ≥ L + M − 1 (the length of the linear convolution result)
I Thus, zero-padding of x(n) and h(n) that are of length and zero pad xm (n) and h(n) to have support n = 0, 1, . . . , N − 1.
L, M < N is required.
1. Take N-DFT of xm (n) to give Xm (k), k = 0, 1, . . . , N − 1.
I The actual implementation of the DFT/IDFT will use the fast
Fourier Transform (FFT) for computational simplicity. 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.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 33 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 34 / 59

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

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 35 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 36 / 59
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 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

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 37 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 38 / 59

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

L=4 L=4 Output blocks ym (n)


These 7 M-1
6extra samples (i.e., “tail”) n must be fitted together
-3 -2
y1(n)
-1 0 1 2 3 4 5 8 9 10
due to convolution expanding
the support must be added to the appropriately to gener-
= 1 begininning of the next output zeros
block ate:
10
n
-3 -2 -1 0 1 2 3 4 5 6 7 8 9
zeros
L=4 M-1=2 y (n) = x(n) ∗ h(n)
y2(n) ADD
to Output signal: zeros
+ 1 next
block
The support overlap
4 5 6 8 9 10
n amongst the ym (n)
-3 -2 -1 0 1 2 3 6 7
blocks must be ac- Add
L=4 M-1=2
y3(n) ADD
to
counted for. points Add
+ 1 next + ...
block
points
-3 -2 -1 0 1 2 3 6 7 8 9
10
n
L=4 M-1=2

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 39 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 40 / 59
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method

Overlap-Add Method Overlap-Add Method: Cautionary Note

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.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 41 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 42 / 59

Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Add Method

Overlap-Add Method: Cautionary Note Overlap-Add Method: Cautionary Note


Output signal:

Add

points Add
zeros
points

zeros

zeros

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 43 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 44 / 59
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 Overlap-Save Method

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
Overlap-Save Method an N-DFT and N-IDFT.
Overlap-[Discard] Method
I Time-Domain Aliasing:

X
xC (n) = xL (n − lN) , n = 0, 1, . . . , N − 1
| {z }
l=−∞ support=M + N − 1

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 45 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 46 / 59

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.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 47 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 48 / 59
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 Input Segmentation Stage Overlap-Save Input Segmentation Stage

1. All input blocks xm (n) are of length N = (L + M − 1) and Input signal blocks:

contain sequential samples from x(n).

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

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 49 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 50 / 59

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 Input Segmentation Stage Overlap-Save Filtering Stage

I makes use of the N-DFT and N-IDFT where: N = L + M − 1


x1 (n) = {0, 0, . . . 0, x(0), x(1), . . . , x(L − 1)}
| {z }
M − 1 zeros
I Only a one-time zero-padding of h(n) of length M  L < N is
x2 (n) = {x(L − M + 1), . . . x(L − 1), x(L), . . . , x(2L − 1)}
| {z } required to give it support n = 0, 1, . . . , N − 1.
last M − 1 points from x1 (n)

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.

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 51 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 52 / 59
Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method

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

= yL(n) at n=M-1, M, ..., N-1

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 53 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 54 / 59

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 Output Blocks Overlap-Save [Discard] Output Blocks

y1 (n) = {y1 (0), y1 (1), . . . y1 (M − 2), y (0), . . . , y (L − 1)}


| {z }
M − 1 points corrupted from aliasing
y2 (n) = {y2 (0), y2 (1), . . . y2 (M − 2), y (L), . . . , y (2L − 1)}
 | {z }
aliasing n = 0, 1, . . . , M − 2 M − 1 points corrupted from aliasing
yC ,m (n) = y3 (n) = {y3 (0), y3 (1), . . . y3 (M − 2), y (2L), . . . , y (3L − 1)}
yL,m (n) n = M − 1, M, . . . , N − 1 | {z }
M − 1 points corrupted from aliasing

where yL,m (n) = xm (n) ∗ h(n) is the desired output. 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).

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 55 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 56 / 59
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 Output Stage Overlap-Save Method


1. Insert M − 1 zeros at the beginning of the input sequence x(n).
Output 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.
Discard 3. Zero pad h(n) to be of length N = L + M − 1.
points Discard 4. Take N-DFT of h(n) to give H(k), k = 0, 1, . . . , N − 1.
points Discard 5. For each block m:
points 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.
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).

Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 57 / 59 Professor Deepa Kundur (University of Toronto)
Overlap-Save and Overlap-Add for Real-time Filtering 58 / 59

Overlap-Save and Overlap-Add for Real-time Processing Overlap-Save Method

Overlap-Save Method

Input signal blocks:

zeros

point
overlap
point
Output signal blocks: overlap

Discard

points Discard

points Discard

points


Professor Deepa Kundur (University of Toronto)


Overlap-Save and Overlap-Add for Real-time Filtering 59 / 59

You might also like