GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LDT / V0-4-0
Constituent: encdec     Tag: sun-gcc
#include "ffs.h"
#include "LDT/RLE.h"
#include "LDT/BA.h"
#include "LDT/BFP.h"
Functions | |
unsigned int | RLE_encode (unsigned int *buf, unsigned int pos, unsigned int word, int cnt) |
Uses a run length encoding method to encode the bits in the specified word. | |
int | RLE_compare (unsigned int word, int cnt, int max) |
Compares the size of the max with run length method and returns (almost) rle_size - max. | |
unsigned int | RLE_size (unsigned int word, int cnt) |
Returns the size of the run length encoding method. |
CVS $Id: RLE.c,v 1.1 2009/04/30 00:31:28 russell Exp $
int RLE_compare | ( | unsigned int | word, | |
int | cnt, | |||
int | max | |||
) |
Compares the size of the max with run length method and returns (almost) rle_size - max.
>0 | Indicates RLE encoding is larger than max. How much larger is not encoded, only that it is larger. | |
=0 | The number of bits needed by the RLE_encode is the same as max | |
<0 | The number of bits needed by the RLE_compare is less than max. In this case, max + return value = size of RLE encoding. |
word | The word to encode | |
cnt | The maximum bit number + 1 (LSB = 0) that can be set. For example, if all 32 bits can be set, then this is 32, if only 16 bits (right-jusified) then 16. This must be a value between 1 and 32. | |
max | The maximum number of bits. |
/ * Check if the run length encoding size is greater than or equal 16 * / if (RLE_compare (word, 16, 16) >= 0) { / * Yes, RLE method is greater than or equal to 16 bits use asis encoding * / pos = BFP_wordB (buf, pos, 1); pos = BFP_wordR (buf, pos, word, 16); } else { / * No, RLE_method is less than 16 bits * / pos = BFP_wordB (buf, pos, 0); pos = RLE_encode (buf, pos, word, 16); }
unsigned int RLE_encode | ( | unsigned int * | buf, | |
unsigned int | pos, | |||
unsigned int | word, | |||
int | cnt | |||
) |
Uses a run length encoding method to encode the bits in the specified word.
buf | The output buffer | |
pos | The current bit position | |
word | The word to encode | |
cnt | The maximum bit number + 1 (LSB = 0) that can be set. For example, if all 32 bits can be set, then this is 32, if only 16 bits (right-jusified) then 16. This must be a value between 1 and 32. |
unsigned int RLE_size | ( | unsigned int | word, | |
int | cnt | |||
) |
Returns the size of the run length encoding method.
word | The word to encode | |
cnt | The maximum bit number + 1 (LSB = 0) that can be set. For example, if all 32 bits can be set, then this is 32, if only 16 bits (right-jusified) then 16. This must be a value between 1 and 32. |