GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LDT / V0-5-0 > encdec / sun-gcc
#include "LDT/HDD.h"
#include "LDT/HUFF.h"
#include "LDT/BFU.h"
#include "ffs.h"
#include "PBI/Endianness.h"
#include "dprintf.h"
Classes | |
struct | _HDD |
union | _DeltaInfo_bf |
Union of the delta information word as (signed) bit fields. More... | |
union | _DeltaInfo |
Union of the delta information word as an interpretted 32-bit integer and its (signed) bit fields. More... | |
Defines | |
#define | _CV_TO_CODETREE(_0, _1, _2) ((_2 << 4) | (_1 << 2) | (_0 << 0)) |
#define | _CODES(_c0, _c1, _c2) ((_c2 << 4) | (_c1 << 2) | (_c0 << 0)) |
Typedefs | |
typedef struct _HDD | HDD |
typedef struct _DeltaInfo_bf | DeltaInfo_bf |
Typedef for union _DeltaInfo_bf. | |
typedef union _DeltaInfo | DeltaInfo |
Typedef for union _DeltaInfo. | |
Functions | |
static __inline BFU | unpack_short (BFU bfu, const unsigned int *src, int *val) |
static __inline BFU | unpack_nshort (BFU bfu, const unsigned int *src, int *val) |
static __inline BFU | unpack_ushort (BFU bfu, const unsigned int *src, unsigned int *val) |
static __inline BFU | unpack_delta_min_max_seed (BFU bfu, const unsigned int *src, int *delta_min, int *delta_max, unsigned int *seed) |
static __inline void | fill_code_lens (unsigned char *lens, int nlens, unsigned int seed, int delta) |
Routine to form the code length when all the deltas are the same. | |
static __inline BFU | unpack_code_lens1 (unsigned char *lens, int nlens, unsigned int seed, int min, const unsigned int *src, unsigned int max, BFU bfu) |
Optimized routine to unpack the deltas and form the code length array when the deltas are all 0s or 1s. | |
static __inline BFU | unpack_code_lens2 (unsigned char *lens, int nlens, unsigned int seed, int min, const unsigned int *src, unsigned int max, BFU bfu) |
Optimized routine to unpack the deltas and form the code length array when the deltas ranges is 2 (0,1,2). | |
static __inline BFU | unpack_code_lensN (unsigned char *lens, int nlens, unsigned int seed, int delta_min, int delta_max, const unsigned int *src, unsigned int max, BFU bfu, HUFF_dtable *dtable) |
Generic routine to unpack the deltas and form the code length array when the deltas are themselves encoded as a Huffman table The routines unpack_deltas1 and deltas2 are used when the range of the huffman encoding table is only 1 (2 symbols) or 2 (3 symbols) In these cases, a more optimal scheme, tailored to these small tables is used. | |
static __inline BFU | unpack_code_lens (unsigned char *lens, int nlens, const unsigned int *src, unsigned int max, BFU bfu, HUFF_dtable *dtable) |
Dispatch routine to unpack the deltas and form the code length array when the deltas are themselves encoded as a Huffman table. | |
static __inline BFU | unpack_syms (signed short int *syms, int nsyms, const HUFF_dtable *dtable, int nlens, int min, unsigned int nunderflow, unsigned int noverflow, const unsigned int *src, unsigned int max_pos, BFU bfu) |
Restores the differences between the original PHA value and its pedestal. | |
unsigned int | HDD_sizeof (unsigned int nhuff) |
Returns the size, in bytes, for a handle to hold a Huffman distribution of huffman_bins. | |
void * | HDD_construct (HDD *hdd, unsigned int nhuff) |
Constructs (initializes) the specified HDD structure. | |
unsigned int | HDD_tableDecode (HDD *hdd, const unsigned int *src, unsigned int pos, unsigned int max_pos) |
Unpacks the table encoded with HDE_tableEncode. | |
unsigned int | HDD_symbolsDecodeS (HDD *hdd, const unsigned int *src, unsigned int pos, unsigned int max_pos, short *syms, unsigned int nsyms) |
Unpacks the distribution encoded with HDD_symbolsEncodeS. | |
unsigned int | HDD_decodeS (HDD *hdd, const unsigned int *src, unsigned int pos, unsigned int max_pos, short *syms, unsigned int nsyms) |
Unpacks the distribution encoded with HDD_encodeSS. |
CVS $Id: HDD.c,v 1.10 2010/08/23 16:32:41 saxton Exp $
Typedef for union _DeltaInfo_bf.
The advantage of defining these structures is that it allows the compiler to sign-extend the bit fields where needed.
static __inline BFU fill_code_lens | ( | unsigned char * | lens, | |
int | nlens, | |||
unsigned int | seed, | |||
int | delta | |||
) | [static] |
Routine to form the code length when all the deltas are the same.
lens | The array of code lengths to fill in | |
nlens | The number of lengths to fill in | |
seed | The starting value to integrate the deltas from | |
delta | The delta length |
void* HDD_construct | ( | HDD * | hdd, | |
unsigned int | nhuff | |||
) |
Constructs (initializes) the specified HDD structure.
hdd | The HDD control structure to construct | |
nhuff | The maximum number of Huffman encoding bins that this control structure is meant to support. |
unsigned int HDD_decodeS | ( | HDD * | hdd, | |
const unsigned int * | src, | |||
unsigned int | pos, | |||
unsigned int | max_pos, | |||
short * | syms, | |||
unsigned int | nsyms | |||
) |
Unpacks the distribution encoded with HDD_encodeSS.
hdd | The decode handle | |
src | The source stream | |
pos | The current bit read position | |
max_pos | The maximum bit position, i.e. do not read past this point | |
syms | The array to receive the decoded symbols | |
nsyms | The number of symbols to decode |
unsigned int HDD_sizeof | ( | unsigned int | nhuff | ) |
Returns the size, in bytes, for a handle to hold a Huffman distribution of huffman_bins.
nhuff | The maximum number of Huffman codes |
unsigned int HDD_symbolsDecodeS | ( | HDD * | hdd, | |
const unsigned int * | src, | |||
unsigned int | pos, | |||
unsigned int | max_pos, | |||
short * | syms, | |||
unsigned int | nsyms | |||
) |
Unpacks the distribution encoded with HDD_symbolsEncodeS.
hdd | The decode handle | |
src | The source stream | |
pos | The current bit read position | |
max_pos | The maximum bit position, i.e. do not read past this point | |
syms | The array to receive the decoded symbols | |
nsyms | The number of symbols to decode |
unsigned int HDD_tableDecode | ( | HDD * | hdd, | |
const unsigned int * | src, | |||
unsigned int | pos, | |||
unsigned int | max_pos | |||
) |
Unpacks the table encoded with HDE_tableEncode.
hdd | The decode handle | |
src | The source stream | |
pos | The current bit read position | |
max_pos | The maximum bit position, i.e. do not read past this point |
static __inline BFU unpack_code_lens | ( | unsigned char * | lens, | |
int | nlens, | |||
const unsigned int * | src, | |||
unsigned int | max, | |||
BFU | bfu, | |||
HUFF_dtable * | dtable | |||
) | [static] |
Dispatch routine to unpack the deltas and form the code length array when the deltas are themselves encoded as a Huffman table.
lens | The array of code lengths to fill in | |
nlens | The number of lengths to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer | |
dtable | Temporary storage to hold the huffman decode table for the lengths |
static __inline BFU unpack_code_lens1 | ( | unsigned char * | lens, | |
int | nlens, | |||
unsigned int | seed, | |||
int | min, | |||
const unsigned int * | src, | |||
unsigned int | max, | |||
BFU | bfu | |||
) | [static] |
Optimized routine to unpack the deltas and form the code length array when the deltas are all 0s or 1s.
lens | The array of code lengths to fill in | |
nlens | The number of lengths to fill in | |
seed | The starting value to integrate the deltas from | |
min | The minimum delta, this is almost certainly 0, but.. | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer |
static __inline BFU unpack_code_lens2 | ( | unsigned char * | lens, | |
int | nlens, | |||
unsigned int | seed, | |||
int | min, | |||
const unsigned int * | src, | |||
unsigned int | max, | |||
BFU | bfu | |||
) | [static] |
Optimized routine to unpack the deltas and form the code length array when the deltas ranges is 2 (0,1,2).
lens | The array of code lengths to fill in | |
nlens | The number of lengths to fill in | |
seed | The starting value to integrate the deltas from | |
min | The minimum delta, this is almost certainly -1 or 0 | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer |
static __inline BFU unpack_code_lensN | ( | unsigned char * | lens, | |
int | nlens, | |||
unsigned int | seed, | |||
int | delta_min, | |||
int | delta_max, | |||
const unsigned int * | src, | |||
unsigned int | max, | |||
BFU | bfu, | |||
HUFF_dtable * | dtable | |||
) | [static] |
Generic routine to unpack the deltas and form the code length array when the deltas are themselves encoded as a Huffman table The routines unpack_deltas1 and deltas2 are used when the range of the huffman encoding table is only 1 (2 symbols) or 2 (3 symbols) In these cases, a more optimal scheme, tailored to these small tables is used.
lens | The array of code lengths to fill in | |
nlens | The number of lengths to fill in | |
delta_min | The minimum delta value | |
delta_max | The maximum delta value | |
seed | The starting value to integrate the deltas from | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer | |
dtable | Temporary storage to hold the huffman decode table for the lengths. While this is returned to the caller, its purpose, to extract the lengths of the codes, has already been served. |
static __inline BFU unpack_syms | ( | signed short int * | syms, | |
int | nsyms, | |||
const HUFF_dtable * | dtable, | |||
int | nlens, | |||
int | min, | |||
unsigned int | nunderflow, | |||
unsigned int | noverflow, | |||
const unsigned int * | src, | |||
unsigned int | max_pos, | |||
BFU | bfu | |||
) | [static] |
Restores the differences between the original PHA value and its pedestal.
syms | The array of symbol values, corresponding to the difference between the PHA value and its pedestal to be filled in | |
nsyms | The number of symbols to decode | |
dtable | The decoding table | |
nlens | The number of code lengths | |
min | The minimum symbol value. This is the biase that most be added to all symbols when they are decoded. It restores the symbol to its original value. | |
nunderflow | The number of bins below the first HUFFman bin to be decoded | |
noverflow | The number of bins above the last HUFFman bin to be decoded | |
src | The data source, i.e. the bit stream | |
max_pos | The maximum bit position | |
bfu | The current bit position and temporary buffer |