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