org.jcodec.algo
Class StreamInterpolator
java.lang.Object
org.jcodec.algo.StreamInterpolator
- Direct Known Subclasses:
- BiliearStreamInterpolator, CubicSplineStreamInterpolator
public abstract class StreamInterpolator
- extends Object
This class is part of JCodec ( www.jcodec.org ) This software is distributed
under FreeBSD License
Interpolates a sequence of signal samples into another sequence of samples
taken at a different frequency
Interpolation algorithm depends on a specific implementation
The input stream is supplied in chunks represented as integer arrays. The
output is produced in chunks as well.
The first sample of each chunk is the next sample to the last sample of a
previous chunk in the sequence.
The interpolator is stateful and each stream requires a separate instance.
Example ( interpolates 48000 signal to 44100 ):
WavInput inp = null;
WavOutput out = null;
try {
inp = new WavInput(new File(args[0]));
out = new WavOutput(new File(args[1]), new WavHeader(inp.getHeader(), 44100));
StreamInterpolator in = new CubicSplineStreamInterpolator(new Rational(44100, 48000));
int[] samples;
while ((samples = inp.read(1024)) != null) {
int[] outSamples = in.interpolate(samples);
out.write(outSamples);
}
} finally {
inp.close();
out.close();
}
- Author:
- The JCodec project
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ratio
protected Rational ratio
StreamInterpolator
public StreamInterpolator(Rational ratio)
interpolate
public abstract int[] interpolate(int[] in)
Copyright © 2013. All Rights Reserved.