ScummVM API documentation
decompress.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program 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
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef DGDS_DECOMPRESS_H
23 #define DGDS_DECOMPRESS_H
24 
25 #include "common/scummsys.h"
26 
27 namespace Common {
28 class SeekableReadStream;
29 }
30 
31 namespace Dgds {
32 
34 public:
35  uint32 decompress(byte *dest, uint32 sz, Common::SeekableReadStream &input);
36 };
37 
39 public:
41  uint32 decompress(byte *dest, uint32 sz, Common::SeekableReadStream &input);
42 
43 protected:
44  void reset();
45  uint32 getCode(uint32 totalBits, Common::SeekableReadStream &input);
46 
47 private:
48  struct {
49  byte str[256];
50  uint8 len;
51  } _codeTable[0x4000];
52 
53  byte _codeCur[256];
54 
55  uint32 _bitsData;
56  uint32 _bitsSize;
57 
58  uint32 _codeSize;
59  uint32 _codeLen;
60  uint32 _cacheBits;
61 
62  uint32 _tableSize;
63  uint32 _tableMax;
64  bool _tableFull;
65 };
66 
67 class Decompressor {
68 public:
69  Decompressor();
70  virtual ~Decompressor();
71 
72  byte *decompress(Common::SeekableReadStream *input, int size, uint32 &uncompressedSize);
73 
74 private:
75  RleDecompressor _rleDecompressor;
76  LzwDecompressor _lzwDecompressor;
77 };
78 
79 } // End of namespace Dgds
80 
81 #endif // DGDS_DECOMPRESS_H
82 
Definition: decompress.h:33
Definition: ads.h:28
Definition: stream.h:745
Definition: algorithm.h:29
Definition: decompress.h:38
Definition: decompress.h:67