GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LDT / dev > encdec / rhel5-32


Interface   Data Structures   File List   Data Fields   Globals  

HDE.h File Reference

Interface to the routines to encodes a distribution of symbols using a Huffman encoding technique. Routines are available to encode both the distribution itself and the resulting Huffman table. More...

#include <LDT/HUFF.h>
#include <LDT/BA.h>
#include <PBI/FFS.ih>

Classes

struct  _HDE_assay
 The result of the histogram assessment. More...
struct  _HDE
 The control structure for the HDE facility. More...

Typedefs

typedef struct _HDE_assay HDE_assay
 Typedef for _struct _HDE_assay.
typedef struct _HDE HDE
 Typedef for struct _HDE.

Functions

static __inline HUFF_code _HDE_codeS (HDE *hde, short int symbol)
 Encodes a symbol using the encoding information in hde. This encoding information must have been previously setup using HDE_encodeTable.
static __inline unsigned int _HDE_symbolEncodeS (HDE *hde, unsigned int *buf, unsigned int pos, short int symbol)
 Encodes a symbol using the encoding information in hde. This encoding information must have been previously setup using HDE_encodeTable.
void * HDE_construct (HDE *hde, unsigned int huffman_nbins)
 Constructs (initializes) the specified HDE structure.
unsigned int HDE_sizeof (unsigned int huffman_nbins)
 Returns the size, in bytes, for a handle to hold a Huffman distribution of huffman_bins.
unsigned int HDE_encodeSS (HDE *hde, unsigned int *buf, unsigned int pos, unsigned int huffman_bins, const unsigned short int *hist, int nbins, const short int *symbols, int nsymbols)
 Encodes the specified symbols symbols using the specified histogram of frequencies. Both the symbols and the histogram are presented as 16-bit values.
const HDE_assayHDE_assayLocate (const HDE *hde)
 Returns a pointer to the publically defined piece of this structure. This can be a one-time call, i.e. for any given HDE structure, this routine always returns the same value.
void HDE_histClearS (const HDE *hde, unsigned short int *hist)
 Clears the histogram using the active bin range stored in the HDE_assay block of the HDE structure.
void HDE_histClearL (const HDE *hde, unsigned int *hist)
 Clears the histogram using the active bin range stored in the HDE_assay block of the HDE structure.
void HDE_tableConstructL (HDE *hde, unsigned int nhuff, const unsigned int *hist, int nbins, int nentries)
 Constructs HDE Huffman Table associated with the specified distribution.
unsigned int HDE_tableEncode (HDE *hde, unsigned int *buf, unsigned int pos)
 Encodes a previously constructed table.
unsigned int HDE_symbolsEncodeS (HDE *hde, unsigned int *buf, unsigned int pos, const short int *symbols, int nsymbols)
 Encodes the set of symbols using the encoding information in hde. This encoding information must have been previously setup using HDE_encodeTable.
unsigned int HDE_symbolEncodeS (HDE *hde, unsigned int *buf, unsigned int pos, short int symbol)


Detailed Description

Interface to the routines to encodes a distribution of symbols using a Huffman encoding technique. Routines are available to encode both the distribution itself and the resulting Huffman table.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: HDE.h,v 1.5 2011/03/25 23:57:13 russell Exp $

Typedef Documentation

Typedef for _struct _HDE_assay.

Warning:
The user should never allocate this structure. It should only be assessed via a pointer returned from HDE_assayLocate. The information in here is mainly for diagnostic purposes, allowing those outside the package to gain some insight or monitor the HDE's inner workings.
The one exception is that the field members min and cnt can be used to clear the histogram. This allows one to only zero those entries that have non-zero bins. Given that the size of the histogram may be large and that the number of incremented bins may be small, this is a big gain in efficiency. Consider histogramming an 12 bit ADC. A pedestal subtracted histogram could be out to 8192 bins, whereas the actual distribution may be < 100 bins


Function Documentation

HUFF_code _HDE_codeS ( HDE hde,
short int  symbol 
) [static]

Encodes a symbol using the encoding information in hde. This encoding information must have been previously setup using HDE_encodeTable.

Returns:
The encoded value
Parameters:
hde The HDE control structure
symbol The symbol

References _HDE::assay, _HDE::codes, _HDE_assay::hcnt, _HDE_assay::hmin, _HDE_assay::nover, and _HDE_assay::nunder.

unsigned int _HDE_symbolEncodeS ( HDE hde,
unsigned int *  buf,
unsigned int  pos,
short int  symbol 
) [static]

Encodes a symbol using the encoding information in hde. This encoding information must have been previously setup using HDE_encodeTable.

Returns:
The updated bit write position
Parameters:
hde The HDE control structure
symbol The symbol
buf The output buffer address
pos The current write bit offset

References _HDE::assay, _HDE::codes, _HDE_assay::hcnt, _HDE_assay::hmin, _HDE_assay::nover, and _HDE_assay::nunder.

const HDE_assay * HDE_assayLocate ( const HDE hde  ) 

Returns a pointer to the publically defined piece of this structure. This can be a one-time call, i.e. for any given HDE structure, this routine always returns the same value.

Returns:
Pointer to the HDE_assay structure
Parameters:
hde The HDE control structure
The information returned is mainly of diagnostic use. However, knowing the min and max bin entry allows one to efficiently clear a previously used histogram.

References _HDE::assay.

void HDE_construct ( HDE hde,
unsigned int  nhuff 
)

Constructs (initializes) the specified HDE structure.

Returns:
The next address after this structure.
Parameters:
hde The HDE control structure to construct
nhuff The maximum number of Huffman encoding bins that this control structure is meant to support.
The size of this structure should be acquired by a call to HDE_sizeof. The parameter huffman_nbins must be the same in the call to HDE_sizeof and HDE_construct.

References _HDE::assay, _HDE::codes, _HDE::freq, HUFF_N_WA, _HDE::nhuff, and _HDE::wa.

unsigned int HDE_encodeSS ( HDE hde,
unsigned int *  buf,
unsigned int  pos,
unsigned int  nhuff,
const unsigned short int *  hist,
int  nbins,
const short int *  symbols,
int  nsymbols 
)

Encodes the specified symbols symbols using the specified histogram of frequencies. Both the symbols and the histogram are presented as 16-bit values.

Returns:
The updated bit write position
Parameters:
hde The HDE control structure
buf The output buffer address
pos The current write bit offset
nhuff Provides a means to limit the size of the huffman encoding region to a region that is smaller than what was specified during the HDE construction (i.e. the nhuff parameter) The construction value is used, if this value is 0 or larger.
hist The frequency histogram. The histogram is such that it extends -/+ nbins from this pointer. That is, this is the center of the histogram.
nbins The half width of the histogram
symbols The array of symbols
nsymbols The number of symbols

References _HDE::assay, BFP__wordB(), _HDE_assay::cnt, _HDE::codes, codes_condition(), declare, direct_symbols_encode(), dprintf, dprintf_1, _HistCore::f, _HistLimits::f, _HDE::freq, _HDE_assay::hcnt, hist_copy(), hist_limits_find(), hist_select(), _HDE_assay::hmin, HUFF_buildSparse(), HUFF_codesPrint(), huff_symbols_encode(), huff_table_encode(), _HistCore_f::max, _HistLimits_f::max, _HistCore_f::min, _HDE_assay::min, _HistLimits_f::min, _HDE::nhuff, _HDE_assay::nover, _HDE_assay::nunder, _HistCore_f::pitched, _CodesSummary::ui, _HistLimits::ui, _HistCore::ull, and _HDE::wa.

void HDE_histClearL ( const HDE hde,
unsigned int *  hist 
)

Clears the histogram using the active bin range stored in the HDE_assay block of the HDE structure.

Parameters:
hde The HDE control handle
hist The histogram to clear
This routine must be called after HDE_encodeSS has been called, since it is that routine that sets up the HDE_assay block

References _HDE::assay, _HDE_assay::cnt, and _HDE_assay::min.

void HDE_histClearS ( const HDE hde,
unsigned short int *  hist 
)

Clears the histogram using the active bin range stored in the HDE_assay block of the HDE structure.

Parameters:
hde The HDE control handle
hist The histogram to clear
This routine must be called after HDE_encodeSS has been called, since it is that routine that sets up the HDE_assay block

References _HDE::assay, _HDE_assay::cnt, and _HDE_assay::min.

unsigned int HDE_sizeof ( unsigned int  nhuff  ) 

Returns the size, in bytes, for a handle to hold a Huffman distribution of huffman_bins.

Parameters:
nhuff The maximum size of the Huffman encoding area Suggested values are small powers of 2 like 32, 64, 128. Note also up to 3 bins may be used to hold describe the underflow, overflow and exception areas. Currently these 3 are mapped into 1 bin, but this may change in a future implementation
For the most part, this only provides a working area. On host-based workstations with expandable stacks, this memory would go on the stack, but, it is too large to do this for embedded systems.

References HUFF_N_WA.

unsigned int HDE_symbolsEncodeS ( HDE hde,
unsigned int *  buf,
unsigned int  pos,
const short int *  symbols,
int  nsymbols 
)

Encodes the set of symbols using the encoding information in hde. This encoding information must have been previously setup using HDE_encodeTable.

Returns:
The updated bit write position
Parameters:
hde The HDE control structure
symbols The array of symbols
nsymbols The number of symbols
buf The output buffer address
pos The current write bit offset

References _HDE::assay, _HDE::codes, dprintf_1, _HDE::freq, _HDE_assay::hcnt, _HDE_assay::hmin, huff_symbols_encode(), _HDE_assay::nover, and _HDE_assay::nunder.

void HDE_tableConstructL ( HDE hde,
unsigned int  nhuff,
const unsigned int *  hist,
int  nbins,
int  nentries 
)

Constructs HDE Huffman Table associated with the specified distribution.

Returns:
The updated bit write position
Parameters:
hde The HDE control structure
nhuff Provides a means to limit the size of the huffman encoding region to a region that is smaller than what was specified during the HDE construction (i.e. the nhuff parameter) The construction value is used, if this value is 0 or larger.
hist The frequency histogram. The histogram is such that it extends -/+ nbins from this pointer. That is, this is the center of the histogram.
nbins The half width of the histogram
nentries The number of entries in the histogram

References _HDE::assay, _HDE_assay::cnt, _HDE::codes, codes_condition(), _HDE_assay::cs, declare, _HistCore::f, _HistLimits::f, _HDE::freq, _HDE_assay::hcnt, hist_copyL(), hist_limits_findL(), hist_selectL(), _HDE_assay::hmin, HUFF_buildSparse(), HUFF_codesPrint(), _HistCore_f::max, _HistLimits_f::max, _HistCore_f::min, _HDE_assay::min, _HistLimits_f::min, _HDE::nhuff, _HDE_assay::nover, _HDE_assay::nunder, _HistCore_f::pitched, _CodesSummary::ui, _HistLimits::ui, _HistCore::ull, and _HDE::wa.

unsigned int HDE_tableEncode ( HDE hde,
unsigned int *  buf,
unsigned int  pos 
)

Encodes a previously constructed table.

Returns:
The updated bit write position
Parameters:
hde The HDE control structure
buf The output buffer address
pos The current write bit offset

References _HDE::assay, BFP__wordB(), _HDE::codes, _HDE_assay::cs, _HDE::freq, _HDE_assay::hcnt, _HDE_assay::hmin, huff_table_encode(), _HDE_assay::nover, _HDE_assay::nunder, and _HDE::wa.


Generated on Thu Feb 9 12:20:46 2012 by  doxygen 1.5.8