ScummVM API documentation
msmpeg4.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_MSMPEG4_H
23 #define IMAGE_CODECS_MSMPEG4_H
24 
25 #include "image/codecs/codec.h"
26 
27 namespace Image {
28 
29 class MSMPEG4Decoder : public Codec {
30 public:
31  struct Context;
32 
33  MSMPEG4Decoder(int width, int height, int bitsPerPixel);
34  ~MSMPEG4Decoder() override;
35 
37  Graphics::PixelFormat getPixelFormat() const override { return _pixelFormat; }
38  bool setOutputPixelFormat(const Graphics::PixelFormat &format) override;
39 
40 private:
41  bool initialize();
42  bool decodePictureHeader();
43  bool decodeMacroblock(int16 block[6][64]);
44  bool decodeBlock(int16 *block, int blockIndex, bool coded);
45  int decodeDc(int blockIndex, int *direction);
46  bool decodeMotion(int *motionX, int *motionY);
47  void decodeMacroblockPixels(int16 block[6][64]);
48  void frameStart();
49  void frameEnd();
50  void resetPredictorsForSlice();
51  void drawEdges(byte *plane, int pitch, int width, int height, int edge);
52  void convertToSurface();
53 
54  Context *_ctx;
55  Graphics::Surface *_surface;
56  Graphics::PixelFormat _pixelFormat;
57  int _width;
58  int _height;
59  int _bitsPerPixel;
60  bool _tablesInitialized;
61 };
62 
63 } // End of namespace Image
64 
65 #endif
Definition: surface.h:67
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
Definition: pixelformat.h:138
Definition: stream.h:745
Definition: codec.h:57
Graphics::PixelFormat getPixelFormat() const override
Definition: msmpeg4.h:37
Definition: msmpeg4.h:29
Definition: movie_decoder.h:32
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override