Wikipedia / Overlap–add method
Wikipedia / Overlap–add method
In signal processing, the overlap–add method is an efficient way to evaluate the discrete convolution with a finite impulse response:
(see Convolution#Notation).
Algorithm
:
is an arbitrary segment length. Then:
can be written as a sum of short convolutions:
-point circular convolution The advantage is that the circular convolution can be computed more efficiently than linear convolution, according to the circular convolution theorem:
where:
DFTN and IDFTN refer to the Discrete Fourier transform discrete points, and
is an integer power-of-2, and the transforms are implemented with the FFT algorithm, for efficiency.
Pseudocode
The following is a pseudocode representation of the algorithm:
(Overlap-add algorithm for linear convolution)
h = FIR_filter
M = length(h)
Nx = length(x)
N = 8 × 2^ceiling( log2(M) ) (8 times the smallest power of two bigger than filter length M. See next section for a slightly better choice.)
step_size = N - (M-1) (L in the text above)
H = DFT(h, N)
position = 0
y(1 : Nx + M-1) = 0
while position + step_size ≤ Nx do
y(position+(1:N)) = y(position+(1:N)) + IDFT(DFT(x(position+(1:step_size)), N) × H)
position = position + step_size
endEfficiency considerations
When the DFT and IDFT are implemented by the FFT algorithm, the pseudocode above requires about complex multiplications for the FFT, product of arrays, and IFFT. Each iteration produces output samples, so the number of complex multiplications per output sample is about:
whereas direct evaluation of that minimize ).
Instead of , we can also consider applying samples. The total number of complex multiplications would be:
Comparatively, the number of complex multiplications required by the pseudocode algorithm is:
Hence the cost. The two methods are also compared in Figure 3, created by MATLAB simulation. The contours are lines of constant ratio of the times it takes to perform both methods. When the overlap-add method is faster, the ratio exceeds 1, and ratios as high as 3 are seen.
See also
Notes
References
Further reading