ScummVM API documentation
truemotion1.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 // Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg
23 
24 #ifndef IMAGE_CODECS_TRUEMOTION1_H
25 #define IMAGE_CODECS_TRUEMOTION1_H
26 
27 #include "image/codecs/codec.h"
28 
29 namespace Image {
30 
36 class TrueMotion1Decoder : public Codec {
37 public:
39  ~TrueMotion1Decoder() override;
40 
42 
43  // Always return RGB565
44  Graphics::PixelFormat getPixelFormat() const override { return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); }
45 
46 private:
47  Graphics::Surface *_surface;
48 
49  int _mbChangeBitsRowSize;
50  byte *_buf, *_mbChangeBits, *_indexStream;
51  int _indexStreamSize;
52 
53  int _flags;
54 
55  struct PredictorTableEntry {
56  uint32 color;
57  bool getNextIndex;
58  };
59 
60  PredictorTableEntry _yPredictorTable[1024];
61  PredictorTableEntry _cPredictorTable[1024];
62 
63  int _blockType;
64  int _blockWidth;
65  int _blockHeight;
66 
67  int16 _ydt[8];
68  int16 _cdt[8];
69 
70  int _lastDeltaset, _lastVectable;
71 
72  uint32 *_vertPred;
73 
74  struct {
75  byte headerSize;
76  byte compression;
77  byte deltaset;
78  byte vectable;
79  uint16 ysize;
80  uint16 xsize;
81  uint16 checksum;
82  byte version;
83  byte headerType;
84  byte flags;
85  byte control;
86  uint16 xoffset;
87  uint16 yoffset;
88  uint16 width;
89  uint16 height;
90  } _header;
91 
92  void selectDeltaTables(int deltaTableIndex);
93  void decodeHeader(Common::SeekableReadStream &stream);
94  void decode16();
95  int makeYdt16Entry(int p1, int p2);
96  int makeCdt16Entry(int p1, int p2);
97  void genVectorTable16(const byte *selVectorTable);
98 };
99 
100 } // End of namespace Image
101 
102 #endif // IMAGE_CODECS_TRUEMOTION1_H
Definition: surface.h:67
Definition: pixelformat.h:138
Definition: stream.h:745
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
Definition: codec.h:57
Definition: truemotion1.h:36
Graphics::PixelFormat getPixelFormat() const override
Definition: truemotion1.h:44
Definition: movie_decoder.h:32