Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

AdaptiveHuffman.h

Go to the documentation of this file.
00001 #ifndef ADAPTIVEHUFFMAN_HPP 00002 #define ADAPTIVEHUFFMAN_HPP 00003 00004 struct HuffNode; 00005 struct HuffBlocks; 00006 00007 class CAdaptiveHuffman 00008 { 00009 private: 00010 // Global stuff 00011 int MaxValue; 00012 int LogValue; 00013 char Compressor; 00014 char UseMarks; 00015 00016 // Stuff for Huffman tree 00017 HuffNode **Values; 00018 HuffNode *Root, *Zero; 00019 int Count; 00020 HuffNode **Array; 00021 00022 // Compressor stuff 00023 char *Buffer; 00024 int BufferSize; // buffer size in bits! 00025 int BitPos, MarkedBitPos; // bit-position in buffer 00026 00027 // Decompressor state 00028 HuffNode *Walk; 00029 const char *BufP; 00030 char BufC; 00031 int State, BitShift; 00032 00033 void Allocate(); 00034 void CleanUp(); 00035 00036 bool Stuff(int code, int length); // Stuff bits in buffer 00037 00038 public: 00039 enum { 00040 ValueOutOfBounds = -1, 00041 BufferFull = -2, 00042 EndOfFile = -3, 00043 }; 00044 00045 CAdaptiveHuffman(int max_value); 00046 ~CAdaptiveHuffman(); 00047 00048 void InitCompressor(int buffer_size, char use_marks); 00049 int AddValue(int v); 00050 void Mark(); 00051 int GetBits() const; 00052 const char *GetBuffer() const; 00053 00054 void InitDecompressor(int bits, const char *buffer); 00055 int GetValue(); 00056 00057 void PrintTree(); 00058 void PrintAncestors(); 00059 }; 00060 00061 #endif

Generated on Wed Dec 13 23:38:46 2006 for CamStream by doxygen 1.3.7