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

mxcpcHuffmanTree Class Reference
[mxcpc_core (Core Module - MxPEG Decoding Infrastructure)]

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

#include <mxcpcHuffmanTree.h>

List of all members.

Public Member Functions

 mxcpcHuffmanTree ()
 ~mxcpcHuffmanTree ()
const NodegetRoot (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

NodeRootNode
NodeGroundNode

Classes

struct  Node


Detailed Description

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

Definition at line 31 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 136 of file mxcpcHuffmanTree.cpp.

References addLeaf(), mxcpcHuffmanTree::Node::Child0, mxcpcHuffmanTree::Node::Child1, and mxcpcHuffmanTree::Node::IsLeaf.

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 112 of file mxcpcHuffmanTree.cpp.

References mxcpcHuffmanTree::Node::Child0, mxcpcHuffmanTree::Node::Child1, mxcpcHuffmanTree::Node::IsLeaf, RootNode, and mxcpcHuffmanTree::Node::Value.

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 78 of file mxcpcHuffmanTree.cpp.

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

Referenced by mxcpcFramewiseMxPEGScanDecoderSoftwareOnly::mxcpcFramewiseMxPEGScanDecoderSoftwareOnly().

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 203 of file mxcpcHuffmanTree.cpp.

References mxcpcHuffmanTree::Node::Child0, mxcpcHuffmanTree::Node::Child1, and GroundNode.

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 214 of file mxcpcHuffmanTree.cpp.

References mxcpcHuffmanTree::Node::Child0, mxcpcHuffmanTree::Node::Child1, and GroundNode.

Referenced by configureFromTable().


The documentation for this class was generated from the following files:
Generated on Mon Jan 30 15:13:10 2006 for mxcpc by  doxygen 1.4.4