GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSEC / dev > lsec / rhel5-64
#include <compress.h>
#include <LSEC_p.h>
#include <LSEC/LSEC_msgs.h>
#include <LDT/APM.h>
#include <LDT/HDE.h>
#include <PBS/MBA.h>
#include <MSG/MSG_pubdefs.h>
#include <string.h>
Functions | |
unsigned | LSEC_checkCompression (LSEC_compression *cpr) |
Check if there were errors during the histogram or encode operations. | |
void | LSEC_clearCompression (LSEC_compression *cpr) |
Clear the compression structrure of any data from a previous cycle. | |
void | LSEC_deleteCompression (LSEC_compression *cpr) |
Free the memory associated with the compression structure. | |
unsigned int | LSEC_getBin (LSEC_compression *cpr, unsigned int bin) |
Return the contents of one bin of the histogram. | |
unsigned int | LSEC_getCount (LSEC_compression *cpr) |
Return the number of non-zero bins in the histogram. | |
LSEC_compression * | LSEC_newCompression (unsigned int nbits, const char *name) |
Allocate and initialise a new compression structure for APE encoding. | |
LSEC_compression * | LSEC_newCompressionH (unsigned int nbits, const char *name) |
Allocate and initialise a new compression structure for Huffman encoding. | |
unsigned * | LSEC_pack (LSEC_compression *cpr, unsigned *buffer) |
Pack the tables of a compression structure into a buffer. | |
unsigned int | LSEC_packedSize32 (LSEC_compression *cpr) |
Calculate the size of a packed compression structure. | |
unsigned | LSEC_process (LSEC_compression *cpr) |
Build the lookup, frequency and probability tables required by the APE. | |
void | LSEC_reportCompression (LSEC_compression *cpr, FILE *fp) |
Describe the contents of a compression structure. | |
void | LSEC_zeroBin (LSEC_compression *cpr, unsigned int bin) |
Set the selected bin of the histogram to zero. |
$Id: compress.c,v 1.13 2011/03/27 17:44:40 saxton Exp $
unsigned LSEC_checkCompression | ( | LSEC_compression * | cpr | ) |
Check if there were errors during the histogram or encode operations.
cpr | Pointer to a compression structure |
LSEC_SYMOOR | If any of the symbols histogrammed or encoded by this compression structure were out of range | |
LSEC_AWEFAIL | If there were any error during the encoding | |
LSEC_SUCCESS | If there were no errors |
References _LSEC_compression::encerr, _LSEC_compression::name, and _LSEC_compression::ovrflw.
Referenced by LSEC_checkCalCompaction().
void LSEC_clearCompression | ( | LSEC_compression * | cpr | ) |
Clear the compression structrure of any data from a previous cycle.
cpr | Pointer to an allocated, initialised, compression structure |
References LSEC_compressionDesc::count, _LSEC_compression::desc, _LSEC_compression::encerr, LSEC_compressionDesc::first_bin, _LSEC_compression::hist, _LSEC_compression::last_bin, _LSEC_compression::nbits, and _LSEC_compression::ovrflw.
Referenced by LSEC_clearCalCompaction().
void LSEC_deleteCompression | ( | LSEC_compression * | cpr | ) |
Free the memory associated with the compression structure.
cpr | Pointer to an allocated compression structure |
Referenced by LSEC_deleteCompaction().
unsigned int LSEC_getBin | ( | LSEC_compression * | cpr, | |
unsigned int | bin | |||
) |
Return the contents of one bin of the histogram.
cpr | Pointer to an allocated, initialised, populated, compression structure | |
bin | ID of one of the bins of the histogram |
References _LSEC_compression::hist, and _LSEC_compression::nbits.
unsigned int LSEC_getCount | ( | LSEC_compression * | cpr | ) |
Return the number of non-zero bins in the histogram.
cpr | Pointer to a compression structure |
References LSEC_compressionDesc::count, and _LSEC_compression::desc.
LSEC_compression* LSEC_newCompression | ( | unsigned int | nbits, | |
const char * | name | |||
) |
Allocate and initialise a new compression structure for APE encoding.
nbits | Number of symbols in the complete range of possible symbols (including excluded internal sub-ranges), hence the number of bins in the histogram and frequency tables | |
name | String used in the reporting of error to identify a compression structure |
References _LSEC_compression::delta, _LSEC_compression::freq, _LSEC_compression::fwlu, _LSEC_compression::hist, _LSEC_compression::mask, _LSEC_compression::name, _LSEC_compression::nbits, and _LSEC_compression::table.
Referenced by LSEC_newCompaction().
LSEC_compression* LSEC_newCompressionH | ( | unsigned int | nbits, | |
const char * | name | |||
) |
Allocate and initialise a new compression structure for Huffman encoding.
nbits | Number of symbols in the complete range of possible symbols (including excluded internal sub-ranges), hence the number of bins in the histogram and frequency tables | |
name | String used in the reporting of error to identify a compression structure |
References _LSEC_compression::hde, _LSEC_compression::hist, _LSEC_compression::hist0, _LSEC_compression::mask, _LSEC_compression::name, and _LSEC_compression::nbits.
Referenced by LSEC_newCompaction().
unsigned* LSEC_pack | ( | LSEC_compression * | cpr, | |
unsigned * | buffer | |||
) |
Pack the tables of a compression structure into a buffer.
This routine selects sufficient data from the tables of the compression structure to be able to recreate the tables required to decompress the data, and pack it into the consignment
buffer | Pointer to the start of the buffer to place the packed structure | |
cpr | Pointer to an initialised, populated and processed compression structure |
References LSEC_compressionDesc::count, _LSEC_compression::delta, _LSEC_compression::desc, _LSEC_compression::freq, _LSEC_compression::hde, LSEC_compressionDesc::n_delta_bits, and LSEC_compressionDesc::n_entry_bits.
unsigned int LSEC_packedSize32 | ( | LSEC_compression * | cpr | ) |
Calculate the size of a packed compression structure.
This routine calculates the number of 32-bit words required to hold the packed compression structure
cpr | Pointer to a compression structure |
References LSEC_compressionDesc::count, _LSEC_compression::desc, _LSEC_compression::hde, LSEC_compressionDesc::n_delta_bits, and LSEC_compressionDesc::n_entry_bits.
unsigned LSEC_process | ( | LSEC_compression * | cpr | ) |
Build the lookup, frequency and probability tables required by the APE.
cpr | Pointer to an allocated, initialised, populated, compression structure |
LSEC_SUCCESS | If the processing goes well |
References LSEC_compressionDesc::count, _LSEC_compression::delta, _LSEC_compression::desc, LSEC_compressionDesc::first_bin, _LSEC_compression::freq, _LSEC_compression::fwlu, _LSEC_compression::hde, _LSEC_compression::hist, _LSEC_compression::hist0, _LSEC_compression::last_bin, LSEC_compressionDesc::n_delta_bits, LSEC_compressionDesc::n_entry_bits, _LSEC_compression::nbits, and _LSEC_compression::table.
Referenced by LSEC_processCal().
void LSEC_reportCompression | ( | LSEC_compression * | cpr, | |
FILE * | fp | |||
) |
Describe the contents of a compression structure.
This routine formats the compression structure as ASCII text and writes it to the specified file
cpr | Pointer to the compression structure | |
fp | Pointer to the file used as the destination |
References LSEC_compressionDesc::count, _LSEC_compression::desc, _LSEC_compression::encerr, _LSEC_compression::freq, _LSEC_compression::hist, _LSEC_compression::name, _LSEC_compression::nbits, and _LSEC_compression::ovrflw.
Referenced by LSEC_reportCalCompaction().
void LSEC_zeroBin | ( | LSEC_compression * | cpr, | |
unsigned int | bin | |||
) |
Set the selected bin of the histogram to zero.
This indicates that this symbol will be selectively removed from the uncompressed data stream before encoding
cpr | Pointer to an allocated, initialised, populated, compression structure | |
bin | ID of one of the bins of the histogram |
References _LSEC_compression::hist, and _LSEC_compression::nbits.