Speech bubbles can point down right.
[scummvm-innocent.git] / graphics / video / coktelvideo / indeo3.h
blobc417a543ec6eb71b76e13bf2a3126a2a71f1c81b
1 /* ScummVM - Graphic Adventure Engine
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.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * $URL$
22 * $Id$
26 /* Intel Indeo 3 decompressor, derived from ffmpeg.
28 * Original copyright note:
29 * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
30 * written, produced, and directed by Alan Smithee
33 #ifndef GRAPHICS_VIDEO_INDEO3_H
34 #define GRAPHICS_VIDEO_INDEO3_H
36 #include "common/stream.h"
38 namespace Graphics {
39 class PaletteLUT;
40 class SierraLight;
43 namespace Graphics {
45 class Indeo3 {
46 public:
47 enum DitherAlgorithm {
48 kDitherNone = 0,
49 kDitherSierraLight
52 Indeo3(int16 width, int16 height, Graphics::PaletteLUT *palLUT);
53 ~Indeo3();
55 static bool isIndeo3(byte *data, uint32 dataLen);
57 void setDither(DitherAlgorithm dither);
59 bool decompressFrame(byte *inData, uint32 dataLen,
60 byte *outData, uint16 width, uint16 height);
62 private:
63 static const int _corrector_type_0[24];
64 static const int _corrector_type_2[8];
65 static const uint32 correction[];
66 static const uint32 correctionloworder[];
67 static const uint32 correctionhighorder[];
69 struct YUVBufs {
70 byte *Ybuf;
71 byte *Ubuf;
72 byte *Vbuf;
73 byte *the_buf;
74 uint32 the_buf_size;
75 uint16 y_w, y_h;
76 uint16 uv_w, uv_h;
79 int16 _width;
80 int16 _height;
81 YUVBufs _iv_frame[2];
82 YUVBufs *_cur_frame;
83 YUVBufs *_ref_frame;
85 byte *_ModPred;
86 uint16 *_corrector_type;
88 Graphics::PaletteLUT *_palLUT;
90 DitherAlgorithm _dither;
91 Graphics::SierraLight *_ditherSL;
93 struct BlitState {
94 uint32 curX, curY;
95 uint16 widthY, widthUV;
96 uint16 heightY, heightUV;
97 uint16 uwidthUV, uwidthOut;
98 uint16 uheightUV, uheightOut;
99 uint16 scaleWYUV, scaleWYOut;
100 uint16 scaleHYUV, scaleHYOut;
101 uint16 lineWidthOut, lineHeightOut;
102 byte *bufY, *bufU, *bufV, *bufOut;
105 void buildModPred();
106 void allocFrames();
108 void decodeChunk(byte *cur, byte *ref, int width, int height,
109 const byte *buf1, uint32 fflags2, const byte *hdr,
110 const byte *buf2, int min_width_160);
112 void blitFrame(BlitState &s);
114 void blitLine(BlitState &s);
115 void blitLineDither(BlitState &s);
118 } // End of namespace Graphics
120 #endif // GRAPHICS_VIDEO_INDEO3_H