ScummVM API documentation
svq1.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 IMAGE_CODECS_SVQ1_H
23#define IMAGE_CODECS_SVQ1_H
24
25#include "common/scummsys.h"
26
27#include "common/bitstream.h"
28#include "image/codecs/codec.h"
29
30namespace Common {
31template <class BITSTREAM>
32class Huffman;
33struct Point;
34}
35
36namespace Image {
37
43class SVQ1Decoder : public Codec {
44public:
45 SVQ1Decoder(uint16 width, uint16 height);
46 ~SVQ1Decoder() override;
47
49 Graphics::PixelFormat getPixelFormat() const override { return _pixelFormat; }
50 bool setOutputPixelFormat(const Graphics::PixelFormat &format) override {
51 if (format.bytesPerPixel != 2 && format.bytesPerPixel != 4)
52 return false;
53 _pixelFormat = format;
54 return true;
55 }
56
57private:
58 Graphics::PixelFormat _pixelFormat;
59 Graphics::Surface *_surface;
60 uint16 _width, _height;
61 uint16 _frameWidth, _frameHeight;
62
63 byte *_last[3];
64
65 typedef Common::Huffman<Common::BitStream32BEMSB> HuffmanDecoder;
66
67 HuffmanDecoder *_blockType;
68 HuffmanDecoder *_intraMultistage[6];
69 HuffmanDecoder *_interMultistage[6];
70 HuffmanDecoder *_intraMean;
71 HuffmanDecoder *_interMean;
72 HuffmanDecoder *_motionComponent;
73
74 bool svq1DecodeBlockIntra(Common::BitStream32BEMSB *s, byte *pixels, int pitch);
75 bool svq1DecodeBlockNonIntra(Common::BitStream32BEMSB *s, byte *pixels, int pitch);
76 bool svq1DecodeMotionVector(Common::BitStream32BEMSB *s, Common::Point *mv, Common::Point **pmv);
77 void svq1SkipBlock(byte *current, byte *previous, int pitch, int x, int y);
78 bool svq1MotionInterBlock(Common::BitStream32BEMSB *ss, byte *current, byte *previous, int pitch,
79 Common::Point *motion, int x, int y);
80 bool svq1MotionInter4vBlock(Common::BitStream32BEMSB *ss, byte *current, byte *previous, int pitch,
81 Common::Point *motion, int x, int y);
82 bool svq1DecodeDeltaBlock(Common::BitStream32BEMSB *ss, byte *current, byte *previous, int pitch,
83 Common::Point *motion, int x, int y);
84
85 void putPixels8C(byte *block, const byte *pixels, int lineSize, int h);
86 void putPixels8L2(byte *dst, const byte *src1, const byte *src2, int dstStride, int srcStride1, int srcStride2, int h);
87 void putPixels8X2C(byte *block, const byte *pixels, int lineSize, int h);
88 void putPixels8Y2C(byte *block, const byte *pixels, int lineSize, int h);
89 void putPixels8XY2C(byte *block, const byte *pixels, int lineSize, int h);
90 void putPixels16C(byte *block, const byte *pixels, int lineSize, int h);
91 void putPixels16X2C(byte *block, const byte *pixels, int lineSize, int h);
92 void putPixels16Y2C(byte *block, const byte *pixels, int lineSize, int h);
93 void putPixels16XY2C(byte *block, const byte *pixels, int lineSize, int h);
94};
95
96} // End of namespace Image
97
98#endif
Definition: bitstream.h:55
Definition: huffman.h:60
Definition: stream.h:745
Definition: codec.h:57
Definition: svq1.h:43
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
Definition: svq1.h:50
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
Graphics::PixelFormat getPixelFormat() const override
Definition: svq1.h:49
Definition: algorithm.h:29
Definition: rect.h:144
Definition: pixelformat.h:138
Definition: surface.h:67
Definition: display_client.h:58