In signal processing, the overlap–add method (OA, OLA) is an efficient way to evaluate the discrete convolution of a very long signal ${\displaystyle x[n]}$ with a finite impulse response (FIR) filter ${\displaystyle h[n]}$:

{\displaystyle {\begin{aligned}y[n]=x[n]*h[n]\ {\stackrel {\mathrm {def} }{=}}\ \sum _{m=-\infty }^{\infty }h[m]\cdot x[n-m]=\sum _{m=1}^{M}h[m]\cdot x[n-m],\end{aligned}}}

where h[m] = 0 for m outside the region [1, M].

The concept is to divide the problem into multiple convolutions of h[n] with short segments of ${\displaystyle x[n]}$:

${\displaystyle x_{k}[n]\ {\stackrel {\mathrm {def} }{=}}{\begin{cases}x[n+kL]&n=1,2,\ldots ,L\\0&{\textrm {otherwise}},\end{cases}}}$

where L is an arbitrary segment length. Then:

${\displaystyle x[n]=\sum _{k}x_{k}[n-kL],\,}$

and y[n] can be written as a sum of short convolutions:

{\displaystyle {\begin{aligned}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{aligned}}}

where  ${\displaystyle y_{k}[n]\ {\stackrel {\mathrm {def} }{=}}\ x_{k}[n]*h[n]\,}$  is zero outside the region [1, L + M − 1].  And for any parameter  ${\displaystyle N\geq L+M-1,\,}$  it is equivalent to the ${\displaystyle N\,}$-point circular convolution of ${\displaystyle x_{k}[n]\,}$ with ${\displaystyle h[n]\,}$  in the region [1, N].

The advantage is that the circular convolution can be computed very efficiently as follows, according to the circular convolution theorem:

${\displaystyle y_{k}[n]={\textrm {IFFT}}\left({\textrm {FFT}}\left(x_{k}[n]\right)\cdot {\textrm {FFT}}\left(h[n]\right)\right)}$

(Eq.1)

where FFT and IFFT refer to the fast Fourier transform and inverse fast Fourier transform, respectively, evaluated over ${\displaystyle N}$ discrete points.

## The algorithm

Fig. 1 sketches the idea of the overlap–add method. The signal ${\displaystyle x[n]}$ is first partitioned into non-overlapping sequences, then the discrete Fourier transforms of the sequences ${\displaystyle y_{k}[n]}$ are evaluated by multiplying the FFT of ${\displaystyle x_{k}[n]}$ with the FFT of ${\displaystyle h[n]}$. After recovering of ${\displaystyle y_{k}[n]}$ by inverse FFT, the resulting output signal is reconstructed by overlapping and adding the ${\displaystyle y_{k}[n]}$ as shown in the figure. The overlap arises from the fact that a linear convolution is always longer than the original sequences. In the early days of development of the fast Fourier transform, ${\displaystyle L}$ was often chosen to be a power of 2 for efficiency, but further development has revealed efficient transforms for larger prime factorizations of L, reducing computational sensitivity to this parameter. A pseudocode of the algorithm is the following:

   Algorithm 1 (OA for linear convolution)
Evaluate the best value of N and L (L>0, N = M+L-1 nearest to power of 2).
Nx = length(x);
i = 1
y = zeros(1, M+Nx-1)
while i <= Nx  (Nx: the last index of x[n])
il = min(i+L-1,Nx)
yt = IFFT( FFT(x(i:il),N) * H, N)
k  = min(i+N-1,M+Nx-1)
y(i:k) = y(i:k) + yt(1:k-i+1)    (add the overlapped output blocks)
i = i+L
end


This algorithm is based on the linearity of the DFT

## Circular convolution with the overlap–add method

When sequence x[n] is periodic, and Nx is the period, then y[n] is also periodic, with the same period.  To compute one period of y[n], Algorithm 1 can first be used to convolve h[n] with just one period of x[n].  In the region MnNx,  the resultant y[n] sequence is correct.  And if the next M − 1 values are added to the first M − 1 values, then the region 1 ≤ nNx will represent the desired convolution. The modified pseudocode is:

   Algorithm 2 (OA for circular convolution)
Evaluate Algorithm 1
y(1:M-1) = y(1:M-1) + y(Nx+1:Nx+M-1)
y = y(1:Nx)
end


## Cost of the overlap-add method

The cost of the convolution can be associated to the number of complex multiplications involved in the operation. The major computational effort is due to the FFT operation, which for a radix-2 algorithm applied to a signal of length ${\displaystyle N}$ roughly calls for ${\displaystyle C={\frac {N}{2}}\log _{2}N}$ complex multiplications. It turns out that the number of complex multiplications of the overlap-add method are:

${\displaystyle C_{OA}=\left\lceil {\frac {N_{x}}{N-M+1}}\right\rceil N\left(\log _{2}N+1\right)\,}$

${\displaystyle C_{OA}}$ accounts for the FFT+filter multiplication+IFFT operation.

The additional cost of the ${\displaystyle M_{L}}$ sections involved in the circular version of the overlap–add method is usually very small and can be neglected for the sake of simplicity. The best value of ${\displaystyle N}$ can be found by numerical search of the minimum of ${\displaystyle C_{OA}\left(N\right)=C_{OA}\left(2^{m}\right)}$ by spanning the integer ${\displaystyle m}$ in the range ${\displaystyle \log _{2}\left(M\right)\leq m\leq \log _{2}\left(N_{x}\right)}$. Being ${\displaystyle N}$ a power of two, the FFTs of the overlap–add method are computed efficiently. Once evaluated the value of ${\displaystyle N}$ it turns out that the optimal partitioning of ${\displaystyle x[n]}$ has ${\displaystyle L=N-M+1}$. For comparison, the cost of the standard circular convolution of ${\displaystyle x[n]}$ and ${\displaystyle h[n]}$ is:

${\displaystyle C_{S}=N_{x}\left(\log _{2}N_{x}+1\right)\,}$

Hence the cost of the overlap–add method scales almost as ${\displaystyle O\left(N_{x}\log _{2}N\right)}$ while the cost of the standard circular convolution method is almost ${\displaystyle O\left(N_{x}\log _{2}N_{x}\right)}$. However such functions accounts only for the cost of the complex multiplications, regardless of the other operations involved in the algorithm. A direct measure of the computational time required by the algorithms is of much interest. Fig. 2 shows the ratio of the measured time to evaluate a standard circular convolution using  Eq.1 with the time elapsed by the same convolution using the overlap–add method in the form of Alg 2, vs. the sequence and the filter length. Both algorithms have been implemented under Matlab. The bold line represent the boundary of the region where the overlap–add method is faster (ratio>1) than the standard circular convolution. Note that the overlap–add method in the tested cases can be three times faster than the standard method.

Figure 2: Ratio between the time required by  Eq.1 and the time required by the overlap–add Alg. 2 to evaluate a complex circular convolution, vs the sequence length ${\displaystyle N_{x}}$ and the filter length ${\displaystyle M}$.