GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LDT / V0-3-2
Constituent: encdec     Tag: mv2304
#include "LDT/BTE.h"
Include dependency graph for BTE.c:
Functions | |
static __inline unsigned int | encode (unsigned int e, unsigned int w, unsigned int p1, unsigned int p3) |
Encodes the input word w into the output word e. | |
unsigned int __inline | BTE_wordCnts (unsigned int w, unsigned int pattern) |
Returns a packed 32-bit word, where each byte represents the count of the how times each of the 4 possible node values occurs. | |
unsigned int | BTE_wordEncode (unsigned int w, unsigned int pattern, unsigned int scheme_size) |
Encodes the original word and its higher level binary tree pattern returning a 32 bit output word. The algorithm is such that at most 32 bits are used, not counting the bits needed to encode the scheme. | |
unsigned int | BTE_wordPattern (unsigned int w) |
Prepares a pattern word which includes all but the lowest level of the binary tree. | |
unsigned int __inline | BTE_wordSizes (unsigned int w, unsigned int pattern) |
Computes the bit size of the encoded word using each of the 4 possible encoding schemes. | |
unsigned int | BTE_wordSchemeSize (unsigned int w, unsigned int pattern) |
Computes the optimal encoding scheme and size using of the 4 possible encoding schemes. | |
unsigned int | BTE_wordSize (unsigned int w, unsigned int pattern, unsigned int scheme) |
Computes the size using of the specified encoding schemes. | |
BTE_compressed | BTE_wordCompress (unsigned int w) |
Computes and returns the compressed word plus its size, in bits, plus the encoding scheme used. |
CVS $Id: BTE.c,v 1.3 2006/11/01 21:23:35 russell Exp $
EXAMPLE The following shard of code shows how one ties these routines together to encode a 32 bit word, word.
unsigned int pattern = BTE_wordPatten (word); unsigned int scheme_size = BTE_wordSchemeSize (word, pattern); unsigned int encoded = BTE_wordEncode (word, pattern, scheme);
|
Returns a packed 32-bit word, where each byte represents the count of the how times each of the 4 possible node values occurs.
|
|
Computes and returns the compressed word plus its size, in bits, plus the encoding scheme used.
|
|
Encodes the original word and its higher level binary tree pattern returning a 32 bit output word. The algorithm is such that at most 32 bits are used, not counting the bits needed to encode the scheme.
Without resorting to statistical encoding methods one can pick the the state occuring most of the time to be represented by the symbol with only 1 bit, i.e. 0. Of course, to properly decode the encoded word, one needs the symbol. The user is free to carry the which encoding is to be used by any means he wishes. An extreme example would be to use a fixed scheme for all the symbols. One might compute the size of a collection of symbols using all each scheme, then pick the one that gives the smallest size. |
|
Prepares a pattern word which includes all but the lowest level of the binary tree.
+---------- x ----------+ word = 1 bit | | +---- x ----+ +---- x ----+ half = 2 bits | | | | +- x -+ +- x -+ +- x -+ +- x -+ byte = 4 bits | | | | | | | | x x x x x x x x nibble = 8 bits / \ / \ / \ / \ / \ / \ / \ / \ x x x x x x x x x x x x x x x x 2 bit = 16 bits ab cd ef gh ij kl mn op qr st uv wx yz AB CD EF 1 bit = 32 bits -- 63 bits This pattern word is arranged by levels from the highest levels in the most significant bits to the lowest levels. Note that the lowest level of the tree is original 32 bit word. Here is an example of tree for w = 0x00011000
1 L0 | 1--------------+----------------1 L1 | | 0-------+-------1 1-------+-------0 L2 | | | | 0---+---0 0---+---1 1---+---0 0---+---0 L3 | | | | | | | | 0-+-0 0-+-0 0-+-0 0-+-1 0-+-1 0-+-0 0-+-0 0-+-0 L4 00 00 00 00 00 00 00 01 00 01 00 00 00 00 00 00 L5
l0 1 L1 1 1 L2 01 10 L3 0001 0100 L4 00000001 01000000 L5 0000000000000001 0001000000000000 Which, ignoring the lowest level, l5, is the pattern.
0 1 11 0110 00010100 0000000101000000 = 0x76180140 Note, by convention, the highest level of the tree is ignored, so that only the upper 30 bits are used. This is beccause the upper bit only indicates whether the word is 0 or non-zero, something the user can easily determine. |
|
Computes the optimal encoding scheme and size using of the 4 possible encoding schemes.
0: Just use the original 32 bit number 1: Use the scheme that assignes the 01 pattern the value 0 2: Use the scheme that assignes the 10 pattern the value 0 3: Use the scheme that assignes the 11 pattern the value 0 |
|
Computes the size using of the specified encoding schemes.
|
|
Computes the bit size of the encoded word using each of the 4 possible encoding schemes.
0: Use the original 32-bit number (implies low byte = 32) 1: Use the scheme that assigns the 01 pattern the value 0 2: Use the scheme that assigns the 10 pattern the value 0 3: Use the scheme that assigns the 11 pattern the value 0 |
|
Encodes the input word w into the output word e.
|