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