WPC1 - routines for compress a single seismic trace using wavelet packets wpc1Compress compress a single trace wpc1Uncompress uncompress and generate a single trace wpc1Numsmp obtain the # of samples wpc1Size length of the compressed bit stream wpc1Free free up the space for the compressed data wpc1Write write the compressed data to a file wpc1Read read compressed data from a file Function Prototypes: void *wpc1Compress(float *f, int n1, float error, int *nbytes); int wpc1Uncompress(void *w1, float *f); int wpc1Numsmp(void *wpc1); int wpc1Size(void *wpc1); void wpc1Free(void *wpc1); void wpc1Write (void *wpc1, FILE *fp); void *wpc1Read (FILE *fp); wpc1Compress: Input: f pointer to the trace n1 # of samples in the trace error relative RMS error tolerable during compression Output: nbytes # of bytes after compression Return: pointer to the compressed data wpc1Uncompress: Input: w1 pointer to the compressed trace Output: f pointer to the uncompressed trace Return: consistency flag, 1 if wpc1Compressed data, 0 otherwise wpc1Numsmp: Input: wpc1 pointer to the compressed data Return: # of samples per trace wpc1Size: Input: wpc1 pointer to the compressed data Return: # of bytes after compression wpc1Free: Input: wpc pointer to the compressed data wpc1Write: Input: wpc1 pointer to the compressed data fp file pointer to which to write wpc1Read: Input: fp file pointer to which to write Return: pointer to the compressed data wpc1Compress: Notes: The compression here is done block by block, so the data is tiled first. For a single trace, to reduce the overhead, the shape gains of each block are also quantized, but using 16bit, to maintain the accuracy. Also, to reduce overhead, the last block (non-regular block) is NOT transformed at all if it is shorter than half of the tile size. If it is longer than half of the tile size, zero padding is performed. An upgrade to the mixed-radix version is expected soon. The size of the tiling is set in the routine wpcInitConfig. Those numbers are obtained empirically. Since we cannot determine the size of the output before compression, memory is allocated within this routine, and adjusted after the compression. Author: Tong Chen, 08/04/94