|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javaseis.compress.TraceCompressor
public class TraceCompressor
The jsTraceCompressor class provides compression support for (trace) data. For 16 or -8bit compression, the trace is divided into sample windows. The maximum value in each window is used to scale trace samples to 16 or 8-bits. The floating point scalars are stored in the buffer first, followed by the 16 or 8-bit trace samples. Methods are provided to position the buffer for compression or decompression in trace units.
Field Summary | |
---|---|
protected byte[] |
_buffer08
|
protected int |
_buffer08LengthInFloats
|
protected char[] |
_buffer16
|
protected int |
_buffer16LengthInFloats
|
protected java.nio.ByteBuffer |
_bufferViewByte
|
protected java.nio.FloatBuffer |
_bufferViewFloat
|
protected java.nio.ShortBuffer |
_bufferViewShort
|
protected int |
_bytesPerSample
|
protected int |
_numSamples
|
protected int |
_numSamplesX
|
protected int |
_numWindows
|
protected int |
_recordLengthInBytes
|
protected int |
_recordLengthInFloats
|
protected int |
_recordLengthInShorts
|
protected float[] |
_scalars
|
protected int |
_scalarsLengthInBytes
|
protected int |
_scalarsLengthInShorts
|
protected byte[] |
_traceDataByte
|
protected short[] |
_traceDataShort
|
protected DataFormat |
_traceFormat
|
protected int |
_tracePosition
|
protected static int |
CLIPPING_MAX_INT08
|
protected static int |
CLIPPING_MAX_INT16
|
protected static int |
CLIPPING_MIN_INT08
|
protected static int |
CLIPPING_MIN_INT16
|
protected static int |
WNDWLEN08
|
protected static int |
WNDWLEN16
|
Constructor Summary | |
---|---|
TraceCompressor(DataFormat traceFormat,
int numSamples,
java.nio.ByteBuffer bufferByte)
Constructs an instace of jsTraceCompressor. |
Method Summary | |
---|---|
protected void |
arrayCopyByteToFloat(int numSamples,
byte[] traceIn,
float[] traceOut)
Copies trace data from byte array to float array. |
protected void |
arrayCopyFloatToByte(int numSamples,
float[] traceIn,
byte[] traceOut)
Copies trace data from float array to byte array (clipping if necessary). |
protected void |
arrayCopyFloatToShort(int numSamples,
float[] traceIn,
short[] traceOut)
Copies trac edata from byte array to float array. |
protected void |
arrayCopyShortToFloat(int numSamples,
short[] traceIn,
float[] traceOut)
Copies trace data from short array to float array. |
int |
getPosition()
Gets the buffer position in trace units. |
static int |
getRecordLength(DataFormat traceFormat,
int numSamples)
Gets the record length in bytes. |
static void |
main(java.lang.String[] args)
The "main" method used for testing. |
void |
packFrame(int numTraces,
float[][] traceData)
Packs frame data into compression buffer. |
void |
packTrace(float[] traceData)
Packs trace data into DataFormat.FLOAT,INT16,INT08 buffer. |
void |
packTrace08(float[] traceData)
Packs trace data into DataFormat.COMPRESSED_INT08 buffer. |
void |
packTrace16(float[] traceData)
Packs trace data into DataFormat.COMPRESSED_INT16 buffer. |
int |
setPosition(int tracePosition)
Sets the buffer position in trace units. |
void |
unpackFrame(int numTraces,
float[][] traceData)
Unpacks frame data from compression buffer. |
void |
unpackTrace(float[] traceData)
Unpacks trace data from DataFormat.FLOAT,INT16,INT08 buffer. |
void |
unpackTrace08(float[] traceData)
Unpacks trace data from DataFormat.COMPRESSED_INT08 buffer. |
void |
unpackTrace16(float[] traceData)
Unpacks trace data from DataFormat.COMPRESSED_INT16 buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected byte[] _buffer08
protected int _buffer08LengthInFloats
protected char[] _buffer16
protected int _buffer16LengthInFloats
protected java.nio.ByteBuffer _bufferViewByte
protected java.nio.FloatBuffer _bufferViewFloat
protected java.nio.ShortBuffer _bufferViewShort
protected int _bytesPerSample
protected int _numSamples
protected int _numSamplesX
protected int _numWindows
protected int _recordLengthInBytes
protected int _recordLengthInFloats
protected int _recordLengthInShorts
protected float[] _scalars
protected int _scalarsLengthInBytes
protected int _scalarsLengthInShorts
protected byte[] _traceDataByte
protected short[] _traceDataShort
protected DataFormat _traceFormat
protected int _tracePosition
protected static final int CLIPPING_MAX_INT08
protected static final int CLIPPING_MAX_INT16
protected static final int CLIPPING_MIN_INT08
protected static final int CLIPPING_MIN_INT16
protected static int WNDWLEN08
protected static int WNDWLEN16
Constructor Detail |
---|
public TraceCompressor(DataFormat traceFormat, int numSamples, java.nio.ByteBuffer bufferByte)
traceFormat
- The format type (i.e. DataFormat.INT16, etc).numSamples
- The number of samples per trace.bufferByte
- The buffer used to store compressed trace data.Method Detail |
---|
protected void arrayCopyByteToFloat(int numSamples, byte[] traceIn, float[] traceOut)
numSamples
- The number of samples in the arrays.traceIn
- The input byte array.traceOut
- The output float array.protected void arrayCopyFloatToByte(int numSamples, float[] traceIn, byte[] traceOut)
numSamples
- The number of samples in the arrays.traceIn
- The input float array.traceOut
- The output byte array.protected void arrayCopyFloatToShort(int numSamples, float[] traceIn, short[] traceOut)
numSamples
- The number of samples in the arrays.traceIn
- The input byte array.traceOut
- The output float array.protected void arrayCopyShortToFloat(int numSamples, short[] traceIn, float[] traceOut)
numSamples
- The number of samples in the arrays.traceIn
- The input short array.traceOut
- The output float array.public int getPosition()
public static int getRecordLength(DataFormat traceFormat, int numSamples) throws SeisException
traceFormat
- The trace format.numSamples
- The number of samples per trace.
SeisException
public static void main(java.lang.String[] args) throws SeisException
args
- The arguments for testing.
SeisException
- Thrown on testing errors.public void packFrame(int numTraces, float[][] traceData)
traceData
- The array of frame data to compress.public void packTrace(float[] traceData)
traceData
- The array of trace data to compress.public void packTrace08(float[] traceData)
traceData
- The array of trace data to compress.public void packTrace16(float[] traceData)
traceData
- The array of trace data to compress.public int setPosition(int tracePosition)
tracePosition
- The desired buffer position in trace units.
public void unpackFrame(int numTraces, float[][] traceData)
traceData
- The array to contain decompressed frame data.public void unpackTrace(float[] traceData)
traceData
- The array to contain decompressed trace data.public void unpackTrace08(float[] traceData)
traceData
- The array to contain decompressed trace data.public void unpackTrace16(float[] traceData)
traceData
- The array to contain decompressed trace data.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |