|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.oregondsp.signalProcessing.filter.fir.OverlapAdd
public class OverlapAdd
Implements a finite impulse response (FIR) filter using the overlap-add algorithm.
The overlap add algorithm (see Oppenheim and Schafer, Digital Signal Processing, 1975) enables FIR filters to operate on sequences of arbitrary length when the sequences are available in a series of uniform consecutive, contiguous blocks. The output is produced incrementally with the filter() method, filtering one block at a time. The algorithm is capable of filtering data from continuous, real-time streams or streams from very large archive files. However, it is suitable for filtering data segments of any length (including short, extracted event segments).
The size of the sequential data blocks must be uniform (i.e. the same from one invocation of filter() to the next). The block size is specified in the first constructor, which uses it and the filter kernel size to calculate the size of the forward and inverse FFT algorithms required to implement the convolution operation.
The DFT object may be large if the chosen processing block size is large. If more than one OverlapAdd instance is to be used in an application, it may be worthwhile to share fft resources among instances, which is possible provided the kernel sizes of the FIR filters are identical. For this case, a second constructor is provided that constructs a "slave" instance containing a reference to the DFT used in another "master" OverlapAdd instance. Slave instances use the DFT resources of their associated master instances. Care should be taken to keep master and slave instances in the same thread.
The OverlapAdd class keeps state information from one invocation of filter() to the next on consecutive blocks of the data stream. This state information allows the algorithm to perform continuous convolutions on streams of arbitrary length, including real-time streams. If and when the end of the stream is reached, the remaining state information may be dumped using the flush() method.
An example of the application of the OverlapAdd class is available in the Interpolator class.
Constructor Summary | |
---|---|
OverlapAdd(float[] H,
int blockSize)
Constructor for master OverlapAdd instance - this one has the fft instances. |
|
OverlapAdd(float[] H,
OverlapAdd master)
Constructor for slave OverlapAdd instance - this one uses the fft instance contained in the master |
Method Summary | |
---|---|
void |
filter(float[] src,
int sptr,
float[] dst,
int dptr)
Filtering operation to produce an incremental convolution result from one block of data |
void |
flush(float[] dst,
int dptr)
Flushes state information buffer - i.e. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OverlapAdd(float[] H, int blockSize)
H
- float[] containing convolutional kernelblockSize
- int specifying size of data blocks to be filteredpublic OverlapAdd(float[] H, OverlapAdd master)
H
- Float array containing kernelmaster
- Master OverlapAdd instance - slave obtains fft instances from the masterMethod Detail |
---|
public void filter(float[] src, int sptr, float[] dst, int dptr)
src
- float[] array containing data blocksptr
- int specifying point within data array to begin block (usually 0).
Array length must be at least blocksize + sptr.dst
- float[] containing increment of convolution result - array length must be at
least dptr + blockSizedptr
- Point within destination array where convolution result startspublic void flush(float[] dst, int dptr)
dst
- float[] where convolution results are returned. Length of dst must be >= dptr + blockSize.dptr
- int specifying point in dst where convolution results begin.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |