GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LDT / V0-0-0

Constituent: encdec_unit_test     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

encdec_unit_test.c File Reference

Tests the encode/decode library 'encdec'. More...

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include "PBS/TMR.h"
#include "LDT/APM.h"
#include "LDT/APE.h"
#include "LDT/APD.h"
#include <math.h>

Include dependency graph for encdec_unit_test.c:

Include dependency graph

Functions

int ap_test (int argc, char **argv)
 Tests the Arithmetic Probability Encoding/Decoding for byte-sized tables.

int ap_cheap_test (const char *banner, const int *freqs, int nfreqs, const unsigned char *symbols, int nsymbols, unsigned int *table)
 Does a cheap test of the Arithmetic Probability Encoding using a byte-wide table.

int ap_cheap_test1 (void)
 Cheap test of the encode/decode of a test distribution.

int ap_cheap_test2 (void)
 Cheap test of the encode/decode of a test distribution.

int ap_buffer_test (void)
 Does a cheap test of the Arithmetic Probability Encoding filling a buffer, encoding it, then decoding it.

int ap_composite_test (void)
 Composite test of byte encoder.

int ap_file_test (const char *fileName)
 Tests the encoding/decoding of the specified file.

int ap_self_encdec (const char *banner, const unsigned char *symbols, int nsymbols)
 Encodes, then decodes the specified set of symbols.

int fill_buffer (unsigned char *buffer)
 Fill a buffer with a semi-nontrivial pattern.

unsigned const char * get_contents (const char *fileName, int *rsize)
 Reads in the specified file.

void report_results (const char *banner, int encode_bit_count, double entropy_bit_count, int original_bit_count, int decode_bit_count, TMR_tick encode_time, TMR_tick decode_time, unsigned int status)
 Standard report of the results of an encode/decode.

double get_byte_esize (const unsigned int *freqs, int nfreqs, const unsigned char *samples, int nsamples)
 Calculates the size, in bits, of the sample distribution based on the specified frequency table.

int main (int argc, char **argv)
 Main program, it takes no arguments.


Variables

const unsigned int Freqs []
 Frequency distribution used in many of the tests.


Detailed Description

Tests the encode/decode library 'encdec'.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: encdec_unit_test.c,v 1.1.1.1 2005/09/23 06:41:07 russell Exp $

Function Documentation

int ap_buffer_test void   )  [static]
 

Does a cheap test of the Arithmetic Probability Encoding filling a buffer, encoding it, then decoding it.

Return values:
0,if successful
2,if not

Here is the call graph for this function:

int ap_cheap_test const char *  banner,
const int *  freqs,
int  nfreqs,
const unsigned char *  symbols,
int  nsymbols,
unsigned int *  table
[static]
 

Does a cheap test of the Arithmetic Probability Encoding using a byte-wide table.

Return values:
0,if successful
2,if not
Parameters:
banner The title banner
freqs The frequency distribution
nfreqs The number of entries in the frequency table
symbols The symbols to encode
nsymbols The number of symbols to encode
table Storage for the encoding table

Here is the call graph for this function:

int ap_cheap_test1 void   )  [static]
 

Cheap test of the encode/decode of a test distribution.

Return values:
0,if successful
2,if not

Here is the call graph for this function:

int ap_cheap_test2 void   )  [static]
 

Cheap test of the encode/decode of a test distribution.

Return values:
0,if successful
2,if not

Here is the call graph for this function:

int ap_composite_test void   )  [static]
 

Composite test of byte encoder.

Return values:
0 if successful
2 if failure
This tests the ability to use multiple encoding tables. The encoding tables for two distributions are computed from two separate distributions. The probablity distributions are then encoding by picking a symbol first from one distribution then the other. The decoding is then done with the result being checked against the original

Here is the call graph for this function:

int ap_file_test const char *  fileName  )  [static]
 

Tests the encoding/decoding of the specified file.

Parameters:
fileName The name of the file to encode

Here is the call graph for this function:

int ap_self_encdec const char *  banner,
const unsigned char *  symbols,
int  nsymbols
[static]
 

Encodes, then decodes the specified set of symbols.

Returns:
Status, 0 if successful
Parameters:
banner Arbitrary string to use as a title banner
symbols The set of symbols to encode/decode
nsymbols The number of symbols to encode/decode

Here is the call graph for this function:

int ap_test int  argc,
char **  argv
 

Tests the Arithmetic Probability Encoding/Decoding for byte-sized tables.

Return values:
0 if successful
2 if failure

Here is the call graph for this function:

int fill_buffer unsigned char *  buffer  )  [static]
 

Fill a buffer with a semi-nontrivial pattern.

Parameters:
buffer The buffer to fill

double get_byte_esize const unsigned int *  freqs,
int  nfreqs,
const unsigned char *  samples,
int  nsamples
[static]
 

Calculates the size, in bits, of the sample distribution based on the specified frequency table.

Returns:
The size, int bits, of the sample distribution
Parameters:
freqs The frequency table
nfreqs The number of entries in the frequency table
samples The array of samples
nsamples The number of samples

const unsigned char * get_contents const char *  fileName,
int *  rsize
[static]
 

Reads in the specified file.

Returns:
A pointer to the file's content and, in an argument, its size in bytes
Parameters:
fileName The name of the file to encode
rsize Pointer to receive the size of the file's content

int main int  argc,
char **  argv
 

Main program, it takes no arguments.

Returns:
0 if successful, else bit mask of those tests that failed

Here is the call graph for this function:

void report_results const char *  banner,
int  encode_bit_count,
double  entropy_bit_count,
int  original_bit_count,
int  decode_bit_count,
TMR_tick  encode_time,
TMR_tick  decode_time,
unsigned int  status
[static]
 

Standard report of the results of an encode/decode.

Parameters:
banner The title banner of this test
encode_bit_count Number of bits to encode the distribution.
entropy_bit_count Number of bits predicted to encode the distribution, based on the entropy of the distribution.
original_bit_count The number of bits in the original distribution
decode_bit_count The number of decoded bits.
encode_time The time to perform the encoding
decode_time The time to perform the decoding
status The status of comparing the original and decoded distributions.


Variable Documentation

const unsigned int Freqs
 

Initial value:

{
  1195,
  190,
  102,
  160,
  187,
  64,
  157,
  405,
  1
}
Frequency distribution used in many of the tests.


Generated on Sat Sep 24 20:26:17 2005 by doxygen 1.3.3