huffman.h

00001 /* -*- mode:c++; tab-width:4; c-basic-offset:4 -*- */
00002 /*
00003  * libopenraw - huffman.h
00004  *
00005  * Copyright (C) 2008 Rafael Avila de Espindola.
00006  *
00007  * This library is free software: you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation, either version 3 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library.  If not, see
00019  * <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 #ifndef __HUFFMAN_H_
00023 #define __HUFFMAN_H_
00024 
00025 #include <string>
00026 #include "bititerator.h"
00027 
00028 namespace OpenRaw {
00029 namespace Internals {
00030 
00031 struct HuffmanNode {
00032     unsigned isLeaf :1;
00033     unsigned data :31;
00034 };
00035 
00036 class HuffmanDecoder {
00037     unsigned int m_numNodes;
00038     const HuffmanNode * const m_p;
00039 
00040     void printTable_(std::string, unsigned int) const;
00041 public:
00042     HuffmanDecoder(const HuffmanNode* const);
00043     void printTable() const;
00044     unsigned int decode(BitIterator& i);
00045 };
00046 
00047 }
00048 }
00049 
00050 #endif

Generated on Sat Aug 15 16:52:19 2009 for libopenraw by  doxygen 1.5.9