mxcpcHuffmanTree Class Reference

Huffman tree with unsigned char valued leaves - used for MxPEG decoding. More...

#include <mxcpcHuffmanTree.h>

List of all members.

Public Member Functions

const Node * getRoot (void)
 Returns the Huffman tree's root node.
void clear (void)
 Clears the Huffman tree.
bool configureFromTable (const unsigned char *table, int max_path_len=16)
 Reconfigures the Huffman tree as specified in the given table (JPEG Huffman table format).
bool addLeaf (int path_len, unsigned char value)
 Adds a leaf that is reached from the root via a path of length path_len bits.
int countLeaves (void)
 Returns the number of leaves in the tree.

Private Member Functions

void deleteSubTree (Node *subtree_root)
 Wastes the specified subtree.
bool addLeaf (Node *subtree_root, int path_len, Node *leaf)
 Adds to the specified subtree a leaf that is reached from the subtree root via a path of length path_len bits.
void groundUnusedPaths (Node *subtree)
 Recursively makes unused child pointers of all inner nodes point to the special ground node, from which tree traversals never recover.
int countLeaves (Node *subtree)
 Private helper method.

Private Attributes

Node * RootNode
Node * GroundNode

Classes

struct  Node


Detailed Description

Huffman tree with unsigned char valued leaves - used for MxPEG decoding.


Member Function Documentation

bool mxcpcHuffmanTree::addLeaf Node *  subtree_root,
int  path_len,
Node *  leaf
[private]
 

Adds to the specified subtree a leaf that is reached from the subtree root via a path of length path_len bits.

Returns false on success, and true otherwise. In any case the tree remains in defined state.

bool mxcpcHuffmanTree::addLeaf int  path_len,
unsigned char  value
 

Adds a leaf that is reached from the root via a path of length path_len bits.

Returns false on success, and true otherwise. In any case the tree remains in defined state.

bool mxcpcHuffmanTree::configureFromTable const unsigned char *  table,
int  max_path_len = 16
 

Reconfigures the Huffman tree as specified in the given table (JPEG Huffman table format).

Returns false on success, and true otherwise. In case of failue, the tree is cleared.

void mxcpcHuffmanTree::deleteSubTree Node *  subtree_root  )  [private]
 

Wastes the specified subtree.

Guards against killing the ground node.

Must not be called on the root node.

void mxcpcHuffmanTree::groundUnusedPaths Node *  subtree  )  [private]
 

Recursively makes unused child pointers of all inner nodes point to the special ground node, from which tree traversals never recover.

So if invalid bitstreams are encountered the tree traversal will forever be caught in the ground node and the Huffman decoder using the tree will simply cease to produce video tiles - without the need of timeconsuming code to detect such invalid bitstreams.


The documentation for this class was generated from the following files:
Generated on Fri Jun 29 17:21:04 2007 for MxPEG SDK by  doxygen 1.4.6