~ubuntu-branches/ubuntu/utopic/libopenraw/utopic

« back to all changes in this revision

Viewing changes to lib/huffman.h

  • Committer: Bazaar Package Importer
  • Author(s): David Paleino
  • Date: 2009-04-03 22:41:08 UTC
  • mto: (7.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20090403224108-f90nhq50nv5ze5ce
Tags: upstream-0.0.6
ImportĀ upstreamĀ versionĀ 0.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode:c++; tab-width:4; c-basic-offset:4 -*- */
 
2
/*
 
3
 * libopenraw - huffman.h
 
4
 *
 
5
 * Copyright (C) 2008 Rafael Avila de Espindola.
 
6
 *
 
7
 * This library is free software: you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public License
 
9
 * as published by the Free Software Foundation, either version 3 of
 
10
 * the License, or (at your option) any later version.
 
11
 *
 
12
 * This library is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
 * Lesser General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Lesser General Public
 
18
 * License along with this library.  If not, see
 
19
 * <http://www.gnu.org/licenses/>.
 
20
 */
 
21
 
 
22
#ifndef __HUFFMAN_H_
 
23
#define __HUFFMAN_H_
 
24
 
 
25
#include <string>
 
26
#include "bititerator.h"
 
27
 
 
28
namespace OpenRaw {
 
29
namespace Internals {
 
30
 
 
31
struct HuffmanNode {
 
32
        unsigned isLeaf :1;
 
33
        unsigned data :31;
 
34
};
 
35
 
 
36
class HuffmanDecoder {
 
37
        unsigned int m_numNodes;
 
38
        const HuffmanNode * const m_p;
 
39
 
 
40
        void printTable_(std::string, unsigned int) const;
 
41
public:
 
42
        HuffmanDecoder(const HuffmanNode* const);
 
43
        void printTable() const;
 
44
        unsigned int decode(BitIterator& i);
 
45
};
 
46
 
 
47
}
 
48
}
 
49
 
 
50
#endif