1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM 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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef CODEC48_H
24 #define CODEC48_H
25 
26 #include "common/scummsys.h"
27 
28 namespace Grim {
29 
30 class Codec48Decoder {
31 public:
32 	Codec48Decoder();
33 	~Codec48Decoder();
34 	void init(int width, int height);
35 	void deinit();
36 	bool decode(byte *dst, const byte *src);
37 
38 private:
39 	void makeTable(int pitch, int index);
40 
41 	void bompDecodeLine(byte *dst, const byte *src, int len);
42 
43 	void decode3(byte *dst, const byte *src, int bufOffset);
44 	void scaleBlock(byte *dst, const byte *src);
45 	void copyBlock(byte *dst, int deltaBufOffset, int offset);
46 
47 	int _curBuf;
48 	byte *_deltaBuf[2];
49 	int _blockX, _blockY;
50 	int _pitch;
51 	int16 *_offsetTable;
52 	int _tableLastPitch, _tableLastIndex;
53 	int16 _prevSeqNb;
54 	int32 _frameSize;
55 	int _width, _height;
56 	byte *_interTable;
57 };
58 
59 } // end of namespace Grim
60 
61 #endif
62