overlap–add method
{{Short description|Method in signal processing}}
{{about|the convolution method|the "Weight, OverLap, Add" channelization method|Discrete-time Fourier transform#Sampling the DTFT{{!}}Sampling the DTFT}}
In signal processing, the overlap–add method is an efficient way to evaluate the discrete convolution of a very long signal with a finite impulse response (FIR) filter :
{{Equation box 1
|indent= |cellpadding= 0 |border= 0 |background colour=white
|equation={{NumBlk|:|
\ \triangleq\ \sum_{m=-\infty}^{\infty} h[m] \cdot x[n - m]
= \sum_{m=1}^{M} h[m] \cdot x[n - m],
|{{EquationRef|Eq.1}}}}}}
where for outside the region This article uses common abstract notations, such as or in which it is understood that the functions should be thought of in their totality, rather than at specific instants (see Convolution#Notation).
Image:Overlap-add algorithm.svg
The concept is to divide the problem into multiple convolutions of with short segments of :
:
x[n + kL], & n = 1, 2, \ldots, L\\
0, & \text{otherwise},
\end{cases}
where is an arbitrary segment length. Then:
:
and can be written as a sum of short convolutions:
:
y[n] = \left(\sum_{k} x_k[n - kL]\right) * h[n]
&= \sum_{k} \left(x_k[n - kL] * h[n]\right)\\
&= \sum_{k} y_k[n - kL],
\end{align}
where the linear convolution is zero outside the region And for any parameter {{efn-ua
|This condition implies that the segment has at least appended zeros, which prevents circular overlap of the output rise and fall transients.
}} it is equivalent to the -point circular convolution of with in the region The advantage is that the circular convolution can be computed more efficiently than linear convolution, according to the circular convolution theorem:
{{Equation box 1
|indent= |cellpadding= 0 |border= 0 |background colour=white
|equation={{NumBlk|:|
|{{EquationRef|Eq.2}}}}}}
where:
- DFTN and IDFTN refer to the Discrete Fourier transform and its inverse, evaluated over discrete points, and
- is customarily chosen such that is an integer power-of-2, and the transforms are implemented with the FFT algorithm, for efficiency.
Pseudocode
The following is a pseudocode 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
end
Efficiency considerations
Image:FFT_size_vs_filter_length_for_Overlap-add_convolution.svg
When the DFT and IDFT are implemented by the FFT algorithm, the pseudocode above requires about {{nowrap|N (log2(N) + 1)}} complex multiplications for the FFT, product of arrays, and IFFT.{{efn-ua
|1=Cooley–Tukey FFT algorithm for N=2k needs (N/2) log2(N) – see FFT – Definition and speed
}} Each iteration produces {{nowrap|N-M+1}} output samples, so the number of complex multiplications per output sample is about:
{{Equation box 1
|indent= |cellpadding= 0 |border= 0 |background colour=white
|equation={{NumBlk|:|
|{{EquationRef|Eq.3}}}}}}
For example, when and {{EquationNote|Eq.3}} equals whereas direct evaluation of {{EquationNote|Eq.1}} would require up to complex multiplications per output sample, the worst case being when both and are complex-valued. Also note that for any given {{EquationNote|Eq.3}} has a minimum with respect to Figure 2 is a graph of the values of that minimize {{EquationNote|Eq.3}} for a range of filter lengths ().
Instead of {{EquationNote|Eq.1}}, we can also consider applying {{EquationNote|Eq.2}} to a long sequence of length samples. The total number of complex multiplications would be:
:
Comparatively, the number of complex multiplications required by the pseudocode algorithm is:
:
Hence the cost of the overlap–add method scales almost as while the cost of a single, large circular convolution is almost . 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
{{notelist-ua}}
References
{{reflist|refs=
{{Cite book
| author1=Rabiner, Lawrence R.
| author2=Gold, Bernard
| title=Theory and application of digital signal processing
| year=1975
| publisher=Prentice-Hall
| location=Englewood Cliffs, N.J.
| isbn=0-13-914101-4
| chapter=2.25
| pages=[https://archive.org/details/theoryapplicatio00rabi/page/63 63–65]
| chapter-url-access=registration
| chapter-url=https://archive.org/details/theoryapplicatio00rabi/page/63
}}
}}
Further reading
- {{Cite book
|author1=Oppenheim, Alan V. |author2=Schafer, Ronald W. | title=Digital signal processing
| year=1975
| publisher=Prentice-Hall
| location=Englewood Cliffs, N.J.
| isbn=0-13-214635-5
| pages=
}}
- {{Cite book
| author=Hayes, M. Horace
| title = Digital Signal Processing
| series = Schaum's Outline Series
| year=1999
| publisher=McGraw Hill
| location=New York
| isbn=0-07-027389-8
| pages=
}}
- {{cite journal | last1=Senobari | first1=Nader Shakibay | last2=Funning | first2=Gareth J. | last3=Keogh | first3=Eamonn | last4=Zhu | first4=Yan | last5=Yeh | first5=Chin-Chia Michael | last6=Zimmerman | first6=Zachary | last7=Mueen | first7=Abdullah | title=Super-Efficient Cross-Correlation (SEC-C): A Fast Matched Filtering Code Suitable for Desktop Computers | journal=Seismological Research Letters | volume=90 | issue=1 | date=2019 | issn=0895-0695 | doi=10.1785/0220180122 | pages=322–334 | url=https://www.cs.ucr.edu/~eamonn/SuperEfficientCrossCorrelation.pdf }}
{{DEFAULTSORT:Overlap-Add Method}}