ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
indeo3.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 #include "common/scummsys.h"
23 
24 /* Intel Indeo 3 decompressor, derived from ffmpeg.
25  *
26  * Original copyright note:
27  * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
28  * written, produced, and directed by Alan Smithee
29  */
30 
31 #ifndef IMAGE_CODECS_INDEO3_H
32 #define IMAGE_CODECS_INDEO3_H
33 
34 #include "image/codecs/codec.h"
35 
36 namespace Image {
37 
46 class Indeo3Decoder : public Codec {
47 public:
48  Indeo3Decoder(uint16 width, uint16 height, uint bitsPerPixel = 24);
49  ~Indeo3Decoder() override;
50 
52  Graphics::PixelFormat getPixelFormat() const override;
53  bool setOutputPixelFormat(const Graphics::PixelFormat &format) override {
54  if (format.bytesPerPixel != 2 && format.bytesPerPixel != 4)
55  return false;
56  _pixelFormat = format;
57  return true;
58  }
59 
60  static bool isIndeo3(Common::SeekableReadStream &stream);
61 
62 private:
63  Graphics::Surface *_surface;
64 
65  uint16 _width;
66  uint16 _height;
67  Graphics::PixelFormat _pixelFormat;
68 
69  static const byte _corrector_type_0[24];
70  static const byte _corrector_type_2[8];
71  static const uint32 correction[];
72  static const uint32 correctionloworder[];
73  static const uint32 correctionhighorder[];
74 
75  struct YUVBufs {
76  byte *Ybuf;
77  byte *Ubuf;
78  byte *Vbuf;
79  byte *the_buf;
80  uint32 the_buf_size;
81  uint16 y_w, y_h;
82  uint16 uv_w, uv_h;
83  };
84 
85  YUVBufs _iv_frame[2];
86  YUVBufs *_cur_frame;
87  YUVBufs *_ref_frame;
88 
89  byte *_ModPred;
90  byte *_corrector_type;
91 
92  void buildModPred();
93  void allocFrames();
94 
95  void decodeChunk(byte *cur, byte *ref, int width, int height,
96  const byte *buf1, uint32 fflags2, const byte *hdr,
97  const byte *buf2, int min_width_160);
98 };
99 
100 } // End of namespace Image
101 
102 #endif
Definition: surface.h:67
Definition: pixelformat.h:138
Definition: stream.h:745
Definition: codec.h:57
Definition: indeo3.h:46
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
Definition: indeo3.h:53
Graphics::PixelFormat getPixelFormat() const override
Definition: movie_decoder.h:32
byte bytesPerPixel
Definition: pixelformat.h:139