ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

truemotion1.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 // Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg
00024 
00025 // Only compile if SCI32 is enabled, ZVISION is enabled, or if we're building dynamic modules
00026 #if defined(ENABLE_SCI32) || defined(ENABLE_ZVISION) || defined(DYNAMIC_MODULES)
00027 
00028 #ifndef IMAGE_CODECS_TRUEMOTION1_H
00029 #define IMAGE_CODECS_TRUEMOTION1_H
00030 
00031 #include "image/codecs/codec.h"
00032 
00033 namespace Image {
00034 
00040 class TrueMotion1Decoder : public Codec {
00041 public:
00042     TrueMotion1Decoder();
00043     ~TrueMotion1Decoder();
00044 
00045     const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream);
00046 
00047     // Always return RGB565
00048     Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); }
00049 
00050 private:
00051     Graphics::Surface *_surface;
00052 
00053     int _mbChangeBitsRowSize;
00054     byte *_buf, *_mbChangeBits, *_indexStream;
00055     int _indexStreamSize;
00056 
00057     int _flags;
00058 
00059     struct PredictorTableEntry {
00060         uint32 color;
00061         bool getNextIndex;
00062     };
00063 
00064     PredictorTableEntry _yPredictorTable[1024];
00065     PredictorTableEntry _cPredictorTable[1024];
00066 
00067     int _blockType;
00068     int _blockWidth;
00069     int _blockHeight;
00070 
00071     int16 _ydt[8];
00072     int16 _cdt[8];
00073 
00074     int _lastDeltaset, _lastVectable;
00075 
00076     uint32 *_vertPred;
00077 
00078     struct {
00079         byte headerSize;
00080         byte compression;
00081         byte deltaset;
00082         byte vectable;
00083         uint16 ysize;
00084         uint16 xsize;
00085         uint16 checksum;
00086         byte version;
00087         byte headerType;
00088         byte flags;
00089         byte control;
00090         uint16 xoffset;
00091         uint16 yoffset;
00092         uint16 width;
00093         uint16 height;
00094     } _header;
00095 
00096     void selectDeltaTables(int deltaTableIndex);
00097     void decodeHeader(Common::SeekableReadStream &stream);
00098     void decode16();
00099     int makeYdt16Entry(int p1, int p2);
00100     int makeCdt16Entry(int p1, int p2);
00101     void genVectorTable16(const byte *selVectorTable);
00102 };
00103 
00104 } // End of namespace Image
00105 
00106 #endif // IMAGE_CODECS_TRUEMOTION1_H
00107 #endif // SCI32/Plugins guard


Generated on Sat Feb 16 2019 05:01:10 for ResidualVM by doxygen 1.7.1
curved edge   curved edge