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
Dr. Deepa Kundur
Texas A&M

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

Fall 2010

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

1 / 59

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

2 / 59

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

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

The Discrete Fourier Transform Pair

Important DFT Properties

DFT and inverse-DFT (IDFT):


N1

X (k) = 1 N

x(n)e j2k N ,
n=0 N1

k = 0, 1, . . . , N 1
n

x(n) =

X (k)e j2k N ,
k=0

n = 0, 1, . . . , N 1

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 j2ln/N x (n) x1 (n) x2 (n) x1 (n)x2 (n) N1 n=0 x(n)y (n)

Frequency Domain X (k) X (k) = X (k + N) a1 X1 (k) + a2 X2 (k) X (N k) X (k)e j2kl/N X ((k l))N X (N k) X1 (k)X2 (k) 1 X (k) X2 (k) N 1 N1 1 k=0 X (k)Y (k) N

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

3 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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

Circular Convolution

Circular Convolution
Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N 1. Examples: N = 10 and support: n = 0, 1, . . . , 9
F

x1 (n) x2 (n) Q: What is circular convolution?

X1 (k)X2 (k)
-3 -2 -1 0

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

-3

-2

-1

10

11

12

-3

-2

-1

10

11

12

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

5 / 59

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

6 / 59

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

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

Circular Convolution
Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N 1.
N1

Modulo Indices and Periodic Repetition


(n)N = n x1 (k)x2 ((n k))N
k=0 N1

mod N = remainder of n/N

x1 (n) x2 (n) = =
k=0

x2 (k)x1 ((n k))N

Example: N = 4 n -4 -3 -2 (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

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

nonneg integer < N n = integer + N N 5 1 =1+ 4 4 2 2 = 1 + 4 4

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

7 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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


(n)N = n Example: N = 4 -4 -3 -2 n (n)4 0 1 2 mod N = remainder of n/N

Overlap During Periodic Repetition


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

-1 0 1 2 3 4 5 6 7 8 3 0 1 2 3 0 1 2 3 0

x (n) =
l=

x(n lN)

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

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

9 / 59

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

10 / 59

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

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

Overlap During Periodic Repetition


A periodic repetition makes an aperiodic signal x(n), periodic to produce x (n). 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) smallest support length > period of repetition
there will be overlap

Periodic Repetition: Example N = 4


l=-2 l=-1 l=0 l=1 l=2

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

no overlap support length = 4 = N ~ x (n)


2 1

smallest support length period of repetition


there will be no overlap x(n) can be recovered from x (n)
-7 -6 -5 -4 -3 -2 -1 0

= x (n)
Dr. Deepa Kundur (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 11 / 59 Dr. Deepa Kundur (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 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

Period Repetition: Example N = 4


l=-2 l=-1 l=0 l=1 l=2

Modulo Indices and the Periodic Repetition


x (n-N) x (n-2N)
+ +

x (n)
2 1

x (n+2N)

x (n+N)

x (n)
+

...
1 2 3 4 5 6 7

+ +

Assume: x(n) has support n = 0, 1, . . . , N 1.


n

-7

-6

-5

-4

-3

-2

-1

-7

-6

-5

-4

-3

-2

-1

x((n))N = x(n mod N) = x (n) =


overlap support length = 6 > N

x(n lN)
l=

x (n)
2 1

Note: Because the support size and period size are the same, there is no overlap when taking the periodic repetition x((n))N .
2 3 4 5 6 7

-7

-6

-5

-4

-3

-2

-1

=x(n)

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

13 / 59

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

14 / 59

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

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

Modulo Indices and the Periodic Repetition


x(n)
2 1

Modulo Indices and the Periodic Repetition


x(n)
2 1 2 1 0 1

-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

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

15 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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


x(n)
2 1 2 1 0 1

Modulo Indices and the Periodic Repetition


x(n)
2 1 2 1 0 1

x((n))N

x((n))N

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

17 / 59

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

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

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

Modulo Indices and the Periodic Repetition


x(n)
2 1 2 1 0 1

Circular Convolution: One Interpretation


Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N 1. To compute
N1 k=0 x1 (k)x2 ((n

x((n))N

15 11 7 3 -1

12 8 4 0 -4
1

k))N (or

N1 k=0 x2 (k)x1 ((n

k))N ):

1. Take the periodic repetition of x2 (n) with period N:

x (n)
2 1

-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 ...

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


Dr. Deepa Kundur (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 19 / 59

14 10 6 2 -2

-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

x2 (n) =
l=

x2 (n lN)

2. Conduct a standard linear convolution of x1 (n) and x2 (n) for n = 0, 1, . . . , N 1:


N1

x1 (n) x2 (n) = x1 (n) x2 (n) =


k=

x1 (k)2 (n k) = x
k=0

x1 (k)2 (n k) x

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

Dr. Deepa Kundur (Texas A&M)

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

14 10 6 2 -2

-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

1 0

15 11 7 3 -1
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

Fall 2010

18 / 59

13 9 5 1 -3

Fall 2010

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: Another Interpretation


Assume: x1 (n) and x2 (n) have support n = 0, 1, . . . , N 1. To compute
N1 k=0 x1 (k)x2 ((n

k))N (or

N1 k=0 x2 (k)x1 ((n

k))N ):

1. Conduct a linear convolution of x1 (n) and x2 (n) for all n:


N1 N1
N1

x1 (k) x2 ((n k))N =


k=0 k=0

x1 (k) x2 (n k)

xL (n) = x1 (n) x2 (n) =


k=

x1 (k)x2 (n k) =
k=0

x1 (k)x2 (n k)

. . . which makes sense, since x((n))N = x (n).

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

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

21 / 59

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Circular and Linear Convolution

Fall 2010

22 / 59

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

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

Using DFT for Linear Convolution


Therefore, circular convolution and linear convolution are related as follows:

Using DFT for Linear Convolution


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.

xC (n) = x1 (n) x2 (n) =


l=

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.
Dr. Deepa Kundur (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 23 / 59

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 (Texas A&M)

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

Fall 2010

24 / 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


Recall, for N = 8 the 8-FFT is given by
x(0) x(4) x(2) x(6)

Stage 1

Stage 2

Stage 3

X(0) X(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.

W8

-1 W8 -1 W8
2 0

X(2) X(3)
W8 -1 W8
1 0

0 W8

-1

-1

x(1) x(5) x(3) x(7)

X(4) X(5) X(6) X(7)

0 W8

-1 W8 -1 W8
2 0

-1 W8 -1 W8 -1 -1
3 2

W8

-1

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Filtering of Long Data Sequences

Fall 2010

25 / 59

Dr. Deepa Kundur (Texas A&M)

Overlap-Save and Overlap-Add for Real-time Filtering Filtering of Long Data Sequences

Fall 2010

26 / 59

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

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

Filtering of Long Data Sequences


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

Filtering of Long Data Sequences


Strategy:
1. Segment the input signal into xed-size blocks prior to processing. 2. Compute DFT-based linear ltering 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 ltering of x(n) directly.

Main advantage: samples of the output y (n) = h(n) x(n) will be available real-time on a block-by-block basis.

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

27 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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


Goal: FIR ltering: y (n) = x(n) h(n) Two approaches to real-time linear ltering of long inputs:
Overlap-Add Method Overlap-Save Method

Overlap-Add Method

Overlap-Add Method

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

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

29 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

30 / 59

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

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

Overlap-Add Method
-3 -2

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

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)
+
-3 -2 -1 0

x1(n)

=
-3 -2 -1 0

1
10 1 2 3 4 5 6 7 8 9

* h(n)
n
L=4

Input into blocks length

x(n) is divided non-overlapping xm (n) each of L.

x2(n)

+
-3 -2 -1 0

1
4 1 2 3 5 6 7 8 9 10

* h(n)
n
L=4

x3(n)
1

Each input block xm (n) is individually ltered as it is received to produce the output block ym (n).

* h(n)
10 1 2 3 6 7 8 9

+ ...
n

L=4

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

31 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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.

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


Thus, zero-padding of x(n) and h(n) that are of length L, M < N is required. The actual implementation of the DFT/IDFT will use the FFT/IFFT for computational simplicity.

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

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

33 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

34 / 59

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

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

Linear Convolution via the DFT


Length of linear convolution result = Length of DFT
l=-2 l=-1 l=0 l=1 l=2
-3 -2

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

x (n)
2 1

x (n+2N)

x (n+N)
+

x (n)
+

x (n-N)
+

x (n-2N)

x1(n)

...
1 2 3 4 5 6 7

...
7

=
n
-3 -2 -1 0

1
10

* h(n)
1 2 3 4 5 6 7 8 9

Input into blocks length


n

x(n) is divided non-overlapping xm (n) each of L.

-7

-6

-5

-4

-3

-2

-1

-7

-6

-5

-4

-3

-2

-1

x2(n)

L=4

no overlap support length = 4 = N

+
x (n)
-3 -2 -1 0

1
4 1 2 3 5 6 7 8 9 10

* h(n)
n
L=4

2 1

x3(n)

Each input block xm (n) is individually ltered as it is received to produce the output block ym (n).

-7

-6

-5

-4

-3

-2

-1

+
-3 -2 -1 0

1
10 1 2 3 6 7 8 9

* h(n)
L=4

+ ...
n

= x (n)
Dr. Deepa Kundur (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 35 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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

Overlap-Add Addition Stage


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. From the Addititvity property, since:

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

x(n) = x1 (n) + x2 (n) + x3 (n) + =


m=1

xm (n)

y2(n)

L=4 ADD to next block

M-1=2

+
-3 -2 -1 0

x(n) h(n) = (x1 (n) + x2 (n) + x3 (n) + ) h(n) = x1 (n) h(n) + x2 (n) h(n) + x3 (n) h(n) +

4 1 2 3

6 6 7

10

=
m=1

y3(n)

L=4 ADD to next block

M-1=2

xm (n) h(n) =
m=1

ym (n)

+
-3 -2 -1 0

+ ...
10 8 9

n
M-1=2

L=4

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

37 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

38 / 59

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

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

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

Input signal:
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.

=
-3

y1(n)
-2 -1 0

These extra M-1 samples (i.e., tail) due to convolution expanding the support must be added to the 4 begininning of the next output 5 6 7 8 9 10 block
10

n n

zeros zeros

-3

-2

-1

y2(n)

L=4 ADD to next block

M-1=2

+
-3 -2 -1 0

Output signal:
Add points Add points

zeros

4 1 2 3

6 6 7

10

y3(n)

L=4 ADD to next block

M-1=2

+
-3 -2 -1 0

+ ...
10 8 9

n
M-1=2

L=4

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

39 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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
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. 4. For each block m: 4.1 4.2 4.3 4.4 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.

Overlap-Add Method: Cautionary Note

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?

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.

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

41 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

42 / 59

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

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

Overlap-Add Method: Cautionary Note


Output signal:
Add points Add points

Overlap-Add Method: Cautionary Note

zeros zeros zeros

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

43 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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

Overlap-Save Method Overlap-[Discard] Method

xC (n) =

xL (n lN) ,
l= support=M + N 1

n = 0, 1, . . . , N 1

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

45 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

46 / 59

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

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

Overlap-Save Method
yL(n) linear convolution 2 result
1

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

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

-7

-6

-5

-4

-3

-2

-1

-7

-6

-5

-4

-3

-2

Add and keep points only at n=0, 1, ..., N-1


overlap since N < L+M-1

yC (n)
2 1

circular convolution result


-7 -6 -5 -4 -3 -2 -1 0

corruption from previous repetitions

where yL,m (n) = xm (n) h(n) is the desired output.

= yL(n) at 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.
Fall 2010 47 / 59 Dr. Deepa Kundur (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 48 / 59

Dr. Deepa Kundur (Texas A&M)

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

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


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 rst M 1 points of the previous block xm1 (n) to deal with aliasing corruption. 3. For m = 1, there is no previous block, so the rst M 1 points are zeros.

Overlap-Save Input Segmentation Stage


Input signal blocks:

zeros

point overlap point overlap

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

49 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

50 / 59

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

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

Overlap-Save Input Segmentation Stage

Overlap-Save Filtering Stage


makes use of the N-DFT and N-IDFT where: N = L + M 1
Only a one-time zero-padding of h(n) of length M required to give it support n = 0, 1, . . . , N 1. L < N is

x1 (n) = {0,

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


last M 1 points from x1 (n)

x3 (n) = {x(2L M + 1), . . . x(2L 1), x(2L), . . . , x(3L 1)}


last M 1 points from x2 (n)

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.

. . . The last M 1 points from the previous input block must be saved for use in the current input block.
Dr. Deepa Kundur (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 51 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

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


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

Circular Convolution via the DFT


Length of linear convolution result > Length of DFT
yL(n) linear convolution 2 result
1

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

Add and keep points only at n=0, 1, ..., N-1


overlap since N < L+M-1

yC (n)
2 1

circular convolution result


-7 -6 -5 -4 -3 -2 -1 0

corruption from previous repetitions

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

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

53 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

54 / 59

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

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

Overlap-Save Output Blocks

Overlap-Save [Discard] Output Blocks


y1 (n) y2 (n) = {y1 (0), = {y2 (0), = {y3 (0), y1 (1), . . . y2 (1), . . . y3 (1), . . . y1 (M 2), y (0), . . . , y (L 1)} y2 (M 2), y (L), . . . , y (2L 1)} y3 (M 2), y (2L), . . . , y (3L 1)}

M 1 points corrupted from aliasing

yC ,m (n) =

aliasing n = 0, 1, . . . , M 2 yL,m (n) n = M 1, M, . . . , N 1

M 1 points corrupted from aliasing

y3 (n)

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 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 (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 55 / 59 Dr. Deepa Kundur (Texas A&M) Overlap-Save and Overlap-Add for Real-time Filtering Fall 2010 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


Output signal blocks:
Discard points Discard points Discard points

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.

5.4 Discard the rst 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).

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

57 / 59

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

58 / 59

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

Overlap-Save Method
Input signal blocks:

zeros

point overlap

Output signal blocks:


Discard points Discard points

point overlap

Discard points

Dr. Deepa Kundur (Texas A&M)

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

Fall 2010

59 / 59

You might also like