diff options
author | Sven Hesse | 2008-12-24 15:57:43 +0000 |
---|---|---|
committer | Sven Hesse | 2008-12-24 15:57:43 +0000 |
commit | 74024ff3e52804b0247364a5dfeff2e9520e48f8 (patch) | |
tree | c5050b74e4241aab2e4d6d2cc51c2a3cd1f4a7e7 /engines/gob/indeo3.h | |
parent | 6fed0af5d1acc0a629bd21cea735abfebca38271 (diff) | |
download | scummvm-rg350-74024ff3e52804b0247364a5dfeff2e9520e48f8.tar.gz scummvm-rg350-74024ff3e52804b0247364a5dfeff2e9520e48f8.tar.bz2 scummvm-rg350-74024ff3e52804b0247364a5dfeff2e9520e48f8.zip |
Moving the dither code to graphics/
svn-id: r35526
Diffstat (limited to 'engines/gob/indeo3.h')
-rw-r--r-- | engines/gob/indeo3.h | 85 |
1 files changed, 8 insertions, 77 deletions
diff --git a/engines/gob/indeo3.h b/engines/gob/indeo3.h index 28eba336e5..f30b47806a 100644 --- a/engines/gob/indeo3.h +++ b/engines/gob/indeo3.h @@ -35,81 +35,12 @@ #include "common/stream.h" -namespace Gob { - -class PaletteLUT { -public: - enum PaletteFormat { - kPaletteRGB, - kPaletteYUV - }; - - inline static void YUV2RGB(byte y, byte u, byte v, byte &r, byte &g, byte &b) { - r = CLIP<int>(y + ((1357 * (v - 128)) >> 10), 0, 255); - g = CLIP<int>(y - (( 691 * (v - 128)) >> 10) - ((333 * (u - 128)) >> 10), 0, 255); - b = CLIP<int>(y + ((1715 * (u - 128)) >> 10), 0, 255); - } - inline static void RGB2YUV(byte r, byte g, byte b, byte &y, byte &u, byte &v) { - y = CLIP<int>( ((r * 306) >> 10) + ((g * 601) >> 10) + ((b * 117) >> 10) , 0, 255); - u = CLIP<int>(-((r * 172) >> 10) - ((g * 340) >> 10) + ((b * 512) >> 10) + 128, 0, 255); - v = CLIP<int>( ((r * 512) >> 10) - ((g * 429) >> 10) - ((b * 83) >> 10) + 128, 0, 255); - } - - PaletteLUT(byte depth, PaletteFormat format); - ~PaletteLUT(); - - void setPalette(const byte *palette, PaletteFormat format, byte depth); - - void buildNext(); - - void getEntry(byte index, byte &c1, byte &c2, byte &c3) const; - byte findNearest(byte c1, byte c2, byte c3); - byte findNearest(byte c1, byte c2, byte c3, byte &nC1, byte &nC2, byte &nC3); - - bool save(Common::WriteStream &stream); - bool load(Common::SeekableReadStream &stream); - -private: - byte _depth1, _depth2; - byte _shift; - - uint32 _dim1, _dim2, _dim3; +namespace Graphics { + class PaletteLUT; + class SierraLight; +} - PaletteFormat _format; - byte _lutPal[768]; - byte _realPal[768]; - - uint32 _got; - byte *_gots; - byte *_lut; - - void build(int d1); - inline int getIndex(byte c1, byte c2, byte c3) const; - inline void plotEntry(int x, int y, int z, byte e, byte *filled, int &free); -}; - -// The Sierra-2-4A ("Filter Light") dithering algorithm -class SierraLight { -public: - SierraLight(int16 width, int16 height, PaletteLUT *palLUT); - ~SierraLight(); - - void newFrame(); - void nextLine(); - byte dither(byte c1, byte c2, byte c3, uint32 x); - -protected: - int16 _width, _height; - - PaletteLUT *_palLUT; - - int32 *_errorBuf; - int32 *_errors[2]; - int _curLine; - - inline void getErrors(uint32 x, int32 &eC1, int32 &eC2, int32 &eC3); - inline void addErrors(uint32 x, int32 eC1, int32 eC2, int32 eC3); -}; +namespace Gob { class Indeo3 { public: @@ -118,7 +49,7 @@ public: kDitherSierraLight }; - Indeo3(int16 width, int16 height, PaletteLUT *palLUT); + Indeo3(int16 width, int16 height, Graphics::PaletteLUT *palLUT); ~Indeo3(); static bool isIndeo3(byte *data, uint32 dataLen); @@ -154,10 +85,10 @@ private: byte *_ModPred; uint16 *_corrector_type; - PaletteLUT *_palLUT; + Graphics::PaletteLUT *_palLUT; DitherAlgorithm _dither; - SierraLight *_ditherSL; + Graphics::SierraLight *_ditherSL; struct BlitState { uint32 curX, curY; |