GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > QSEC / V2-0-0

Constituent: qsec     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

decompress.c File Reference

Routines used to manipulate the tables used to decode the compressed events. More...

#include "decompress_p.h"
#include "LDT/APM.h"
#include <string.h>
#include <math.h>

Include dependency graph for decompress.c:


Functions

static const unsigned * getwrd (const unsigned *buffer, unsigned *bcnt, unsigned *word, unsigned nbits)
 Get bits from a buffer.
double calc_nbits (const int *f, int cnt, int tot)
 Calculate the number of bits need to encode a sample with the specified frequency distribution.
size_t QSEC_sizeofDecompression (unsigned int nbits)
 Calculate the total size required to accomodate a decompression structure.
QSEC_decompressionQSEC_constructDecompression (void *buffer, unsigned int nbits, const char *name)
 Initialise the buffer as a decompression structure.
QSEC_decompressionQSEC_newDecompression (unsigned int nbits, const char *name)
 Allocate and initialise a new decompression structure.
void QSEC_deleteDecompression (QSEC_decompression *dcm)
 Free the memory associated with the decompression structure.
void QSEC_clearDecompression (QSEC_decompression *dcm)
 Clear the decompression structrure of any data from a previous cycle.
unsigned int QSEC_getCount (QSEC_decompression *dcm)
 Return the number of non-zero bins in the histogram.
const unsigned int * QSEC_unpack (QSEC_decompression *dcm, const unsigned int *buffer)
 Build the lookup and freqency tables by retrieving and unpacking data from the consignment.
unsigned QSEC_decompress (QSEC_decompression *dcm, APD_dtx *dtx)
 Decode the next symbol.
void QSEC_reportDecompression (QSEC_decompression *dcm, FILE *fp)
 Describe the contents of the decompression structure in formatted ASCII send to the file fp.

Detailed Description

Routines used to manipulate the tables used to decode the compressed events.

Author:
James Swain & Owen Saxton
Id
decompress.c,v 1.8 2007/04/05 23:05:17 saxton Exp

Function Documentation

double calc_nbits const int *  f,
int  cnt,
int  tot
 

Calculate the number of bits need to encode a sample with the specified frequency distribution.

This is based on the following formula

nbits = - TOT * SUM [ f[i] / TOT * ln (f[i] / TOT) ] = - TOT/TOT * SUM [ f[i] * (ln (f[i]) - ln (TOT)) ] = - SUM [ f[i] * ln (f[i] ] + SUM [ f[i] * ln (TOT) ] = - SUM [ f[i] * ln (f[i] ] + TOT * ln (TOT) ]

Parameters:
f The frequency distribution
cnt The count of entries in the frequency distribution
tot The total number of entries in the frequency distribution

const unsigned * getwrd const unsigned *  buffer,
unsigned *  bcnt,
unsigned *  word,
unsigned  nbits
[inline, static]
 

Get bits from a buffer.

Parameters:
buffer Pointer to the current word in the buffer
bcnt Number of bits already used in the current word
word Word to add to the buffer
nbits Number of bits from the word to add to the buffer
Returns:
Pointer to the next word to use in the buffer

void QSEC_clearDecompression QSEC_decompression dcm  ) 
 

Clear the decompression structrure of any data from a previous cycle.

Parameters:
dcm Pointer to an allocated, initialised, decompression structure

QSEC_decompression* QSEC_constructDecompression void *  buffer,
unsigned int  nbits,
const char *  name
 

Initialise the buffer as a decompression structure.

Parameters:
buffer Pointer to the uninitialised memory to use for this decompression structure
nbits Number of bits in the symbols to be handled by this decompression strcuture
name String identifying this structure
Returns:
Pointer to an initialised decompression structure

unsigned QSEC_decompress QSEC_decompression dcm,
APD_dtx *  dtx
 

Decode the next symbol.

Parameters:
dcm Pointer to an initialsed, populated and processed decompression structure
dtx Pointer to the arithmetic encoder context
Returns:
The next symbol

void QSEC_deleteDecompression QSEC_decompression dcm  ) 
 

Free the memory associated with the decompression structure.

Parameters:
dcm Pointer to an allocated decompression structure

unsigned int QSEC_getCount QSEC_decompression dcm  ) 
 

Return the number of non-zero bins in the histogram.

Parameters:
dcm Pointer to a decompression structure
Returns:
Number of non-zero bins in the histogram

QSEC_decompression* QSEC_newDecompression unsigned int  nbits,
const char *  name
 

Allocate and initialise a new decompression structure.

Parameters:
name String used in the reporting of error to identify a decompression structure
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
Returns:
Pointer to an allocated and initialised QSEC_decompression structure

void QSEC_reportDecompression QSEC_decompression dcm,
FILE *  fp
 

Describe the contents of the decompression structure in formatted ASCII send to the file fp.

Parameters:
dcm Pointer to the decompression structure
fp Pointer to the file used as the destination

size_t QSEC_sizeofDecompression unsigned int  nbits  ) 
 

Calculate the total size required to accomodate a decompression structure.

Parameters:
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
Returns:
Size of memory block required to accomodate a decompression structure

const unsigned int* QSEC_unpack QSEC_decompression dcm,
const unsigned int *  buffer
 

Build the lookup and freqency tables by retrieving and unpacking data from the consignment.

Parameters:
dcm Pointer to an initialsed decompression structure
buffer Pointer to the start of the buffer holding the packed structure
Returns:
Pointer to the next input location or NULL if there is an error in the unpacking


Generated on Fri Apr 6 01:49:05 2007 by  doxygen 1.4.4