00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef IMAGE_CODECS_SVQ1_H
00024 #define IMAGE_CODECS_SVQ1_H
00025
00026 #include "common/bitstream.h"
00027 #include "image/codecs/codec.h"
00028
00029 namespace Common {
00030 class Huffman;
00031 struct Point;
00032 }
00033
00034 namespace Image {
00035
00041 class SVQ1Decoder : public Codec {
00042 public:
00043 SVQ1Decoder(uint16 width, uint16 height);
00044 ~SVQ1Decoder();
00045
00046 const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream);
00047 Graphics::PixelFormat getPixelFormat() const { return _surface->format; }
00048
00049 private:
00050 Graphics::Surface *_surface;
00051 uint16 _width, _height;
00052 uint16 _frameWidth, _frameHeight;
00053
00054 byte *_last[3];
00055
00056 Common::Huffman *_blockType;
00057 Common::Huffman *_intraMultistage[6];
00058 Common::Huffman *_interMultistage[6];
00059 Common::Huffman *_intraMean;
00060 Common::Huffman *_interMean;
00061 Common::Huffman *_motionComponent;
00062
00063 bool svq1DecodeBlockIntra(Common::BitStream32BEMSB *s, byte *pixels, int pitch);
00064 bool svq1DecodeBlockNonIntra(Common::BitStream32BEMSB *s, byte *pixels, int pitch);
00065 bool svq1DecodeMotionVector(Common::BitStream32BEMSB *s, Common::Point *mv, Common::Point **pmv);
00066 void svq1SkipBlock(byte *current, byte *previous, int pitch, int x, int y);
00067 bool svq1MotionInterBlock(Common::BitStream32BEMSB *ss, byte *current, byte *previous, int pitch,
00068 Common::Point *motion, int x, int y);
00069 bool svq1MotionInter4vBlock(Common::BitStream32BEMSB *ss, byte *current, byte *previous, int pitch,
00070 Common::Point *motion, int x, int y);
00071 bool svq1DecodeDeltaBlock(Common::BitStream32BEMSB *ss, byte *current, byte *previous, int pitch,
00072 Common::Point *motion, int x, int y);
00073
00074 void putPixels8C(byte *block, const byte *pixels, int lineSize, int h);
00075 void putPixels8L2(byte *dst, const byte *src1, const byte *src2, int dstStride, int srcStride1, int srcStride2, int h);
00076 void putPixels8X2C(byte *block, const byte *pixels, int lineSize, int h);
00077 void putPixels8Y2C(byte *block, const byte *pixels, int lineSize, int h);
00078 void putPixels8XY2C(byte *block, const byte *pixels, int lineSize, int h);
00079 void putPixels16C(byte *block, const byte *pixels, int lineSize, int h);
00080 void putPixels16X2C(byte *block, const byte *pixels, int lineSize, int h);
00081 void putPixels16Y2C(byte *block, const byte *pixels, int lineSize, int h);
00082 void putPixels16XY2C(byte *block, const byte *pixels, int lineSize, int h);
00083 };
00084
00085 }
00086
00087 #endif