Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members

mxcpcHuffmanTree Class Reference
[mxcpc (MOBOTIX Cross Platform Client Library)]

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.

Definition at line 28 of file mxcpcHuffmanTree.h.


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.

Definition at line 135 of file mxcpcHuffmanTree.cpp.

References addLeaf().

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.

Definition at line 111 of file mxcpcHuffmanTree.cpp.

Referenced by addLeaf(), and configureFromTable().

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.

Definition at line 75 of file mxcpcHuffmanTree.cpp.

References addLeaf(), clear(), and groundUnusedPaths().

Referenced by mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly().

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.

Definition at line 202 of file mxcpcHuffmanTree.cpp.

Referenced by clear().

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.

Definition at line 213 of file mxcpcHuffmanTree.cpp.

Referenced by configureFromTable().


The documentation for this class was generated from the following files:
Generated on Mon Aug 15 03:39:53 2005 for mxcpc by  doxygen 1.4.2-20050421