[Scummvm-devel] [Scummvm-cvs-logs] scummvm master -> 57aa610f0c6199fbe41fc5de495356aa29fae6b8

Eugene Sandulenko sev.mail at gmail.com
Wed Mar 12 08:57:57 CET 2014


Hi Matt,

Could you please enlighten me where this was discussed? And what is the
reason for this refactoring?


Eugene


On 28 February 2014 07:42, clone2727 <clone2727 at gmail.com> wrote:

> This automated email contains information about 10 new commits which have
> been
> pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm.
>
> Summary:
> 740b6e8fbd IMAGE: Move all ImageDecoders to image/
> b568ac73b9 IMAGE: Move video codecs to image/
> c432b96cf6 IMAGE: Merge the JPEG codec into the ImageDecoder
> e6717aaf43 IMAGE: Clarify difference between ImageDecoder and Codec a bit
> 08ea14a8d0 IMAGE: Make Codec take a stream reference; change function name
> to decodeFrame
> 0f07f85a94 IMAGE: Split raw bitmap decoding into a Codec
> 231a02c759 VIDEO: Use the bitmap header compression field for AVI codecs
> 05e9ff136a IMAGE: Share the same pool of codecs between bitmap and AVI
> acec700c11 IMAGE: Share the same pool of codecs between PICT and QuickTime
> 57aa610f0c IMAGE: Update comments
>
>
> Commit: 740b6e8fbdece44ae2a5295cb0549a53b6dc6ae7
>
> https://github.com/scummvm/scummvm/commit/740b6e8fbdece44ae2a5295cb0549a53b6dc6ae7
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:27:28-08:00
>
> Commit Message:
> IMAGE: Move all ImageDecoders to image/
>
> Changed paths:
>   A image/bmp.cpp
>   A image/bmp.h
>   A image/iff.cpp
>   A image/iff.h
>   A image/image_decoder.h
>   A image/jpeg.cpp
>   A image/jpeg.h
>   A image/module.mk
>   A image/pcx.cpp
>   A image/pcx.h
>   A image/pict.cpp
>   A image/pict.h
>   A image/png.cpp
>   A image/png.h
>   A image/tga.cpp
>   A image/tga.h
>   R graphics/decoders/bmp.cpp
>   R graphics/decoders/bmp.h
>   R graphics/decoders/iff.cpp
>   R graphics/decoders/iff.h
>   R graphics/decoders/image_decoder.h
>   R graphics/decoders/jpeg.cpp
>   R graphics/decoders/jpeg.h
>   R graphics/decoders/pcx.cpp
>   R graphics/decoders/pcx.h
>   R graphics/decoders/pict.cpp
>   R graphics/decoders/pict.h
>   R graphics/decoders/png.cpp
>   R graphics/decoders/png.h
>   R graphics/decoders/tga.cpp
>   R graphics/decoders/tga.h
>     Makefile.common
>     backends/vkeybd/virtual-keyboard-parser.cpp
>     devtools/create_project/create_project.cpp
>     engines/dreamweb/vgagrafx.cpp
>     engines/gob/inter_v7.cpp
>     engines/gob/surface.cpp
>     engines/groovie/roq.cpp
>     engines/hopkins/graphics.cpp
>     engines/hugo/dialogs.cpp
>     engines/hugo/file.cpp
>     engines/mohawk/bitmap.cpp
>     engines/mohawk/myst_graphics.cpp
>     engines/parallaction/disk_br.cpp
>     engines/parallaction/disk_ns.cpp
>     engines/pegasus/cursor.cpp
>     engines/pegasus/surface.cpp
>     engines/queen/display.cpp
>     engines/saga/scene.cpp
>     engines/sci/graphics/maciconbar.cpp
>     engines/sword25/gfx/image/imgloader.cpp
>     engines/tucker/resource.cpp
>     engines/wintermute/base/base_persistence_manager.cpp
>     engines/wintermute/base/gfx/base_image.cpp
>     engines/wintermute/base/gfx/base_image.h
>     engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
>     engines/zvision/graphics/render_manager.cpp
>     graphics/module.mk
>     gui/ThemeEngine.cpp
>     video/codecs/jpeg.cpp
>     video/codecs/mjpeg.cpp
>
>
>
> diff --git a/Makefile.common b/Makefile.common
> index b56300a..4071d97 100644
> --- a/Makefile.common
> +++ b/Makefile.common
> @@ -25,6 +25,7 @@ MODULES += \
>         engines \
>         video \
>         graphics \
> +       image \
>         audio \
>         common \
>         po
> diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp
> b/backends/vkeybd/virtual-keyboard-parser.cpp
> index bb8286d..25c0161 100644
> --- a/backends/vkeybd/virtual-keyboard-parser.cpp
> +++ b/backends/vkeybd/virtual-keyboard-parser.cpp
> @@ -34,7 +34,7 @@
>  #include "common/tokenizer.h"
>  #include "common/stream.h"
>
> -#include "graphics/decoders/bmp.h"
> +#include "image/bmp.h"
>
>  namespace Common {
>
> @@ -267,7 +267,7 @@ bool
> VirtualKeyboardParser::parserCallback_layout(ParserNode *node) {
>         const Graphics::PixelFormat format = g_system->getOverlayFormat();
>
>         {
> -               Graphics::BitmapDecoder bmp;
> +               Image::BitmapDecoder bmp;
>                 if (!bmp.loadStream(*file))
>                         return parserError("Error loading bitmap '" +
> _mode->bitmapName + "'");
>
> diff --git a/devtools/create_project/create_project.cpp
> b/devtools/create_project/create_project.cpp
> index 9d7ed53..876c116 100644
> --- a/devtools/create_project/create_project.cpp
> +++ b/devtools/create_project/create_project.cpp
> @@ -1305,6 +1305,7 @@ void ProjectProvider::createProject(BuildSetup
> &setup) {
>                 createModuleList(setup.srcDir + "/audio", setup.defines,
> setup.testDirs, in, ex);
>                 createModuleList(setup.srcDir + "/audio/softsynth/mt32",
> setup.defines, setup.testDirs, in, ex);
>                 createModuleList(setup.srcDir + "/video", setup.defines,
> setup.testDirs, in, ex);
> +               createModuleList(setup.srcDir + "/image", setup.defines,
> setup.testDirs, in, ex);
>
>                 // Resource files
>                 in.push_back(setup.srcDir + "/icons/" + setup.projectName
> + ".ico");
> diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
> index e853134..c59d3e3 100644
> --- a/engines/dreamweb/vgagrafx.cpp
> +++ b/engines/dreamweb/vgagrafx.cpp
> @@ -23,7 +23,7 @@
>  #include "dreamweb/dreamweb.h"
>  #include "engines/util.h"
>  #include "graphics/surface.h"
> -#include "graphics/decoders/pcx.h"
> +#include "image/pcx.h"
>
>  namespace DreamWeb {
>
> @@ -161,7 +161,7 @@ void DreamWebEngine::showPCX(const Common::String
> &suffix) {
>                 return;
>         }
>
> -       Graphics::PCXDecoder pcx;
> +       Image::PCXDecoder pcx;
>         if (!pcx.loadStream(pcxFile)) {
>                 warning("showpcx: Could not process '%s'", name.c_str());
>                 return;
> diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp
> index 75278d9..fd94060 100644
> --- a/engines/gob/inter_v7.cpp
> +++ b/engines/gob/inter_v7.cpp
> @@ -27,7 +27,8 @@
>
>  #include "graphics/cursorman.h"
>  #include "graphics/wincursor.h"
> -#include "graphics/decoders/iff.h"
> +
> +#include "image/iff.h"
>
>  #include "gob/gob.h"
>  #include "gob/global.h"
> @@ -547,7 +548,7 @@ void Inter_v7::o7_loadIFFPalette() {
>                 return;
>         }
>
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         decoder.loadStream(*iffFile);
>         if (!decoder.getPalette() || decoder.getPaletteColorCount() !=
> 256) {
>                 warning("o7_loadIFFPalette(): Failed reading palette from
> IFF \"%s\"", file.c_str());
> diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp
> index 00203ff..42ac2b0 100644
> --- a/engines/gob/surface.cpp
> +++ b/engines/gob/surface.cpp
> @@ -31,7 +31,8 @@
>  #include "graphics/primitives.h"
>  #include "graphics/pixelformat.h"
>  #include "graphics/surface.h"
> -#include "graphics/decoders/iff.h"
> +
> +#include "image/iff.h"
>
>  namespace Gob {
>
> @@ -814,7 +815,7 @@ bool Surface::loadTGA(Common::SeekableReadStream
> &stream) {
>  }
>
>  bool Surface::loadIFF(Common::SeekableReadStream &stream) {
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         decoder.loadStream(stream);
>
>         if (!decoder.getSurface())
> diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
> index 88f14b8..4b3fb81 100644
> --- a/engines/groovie/roq.cpp
> +++ b/engines/groovie/roq.cpp
> @@ -32,7 +32,7 @@
>  #include "common/textconsole.h"
>
>  #include "graphics/palette.h"
> -#include "graphics/decoders/jpeg.h"
> +#include "image/jpeg.h"
>
>  #ifdef USE_RGB_COLOR
>  // Required for the YUV to RGB conversion
> @@ -435,20 +435,18 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader
> &blockHeader) {
>
>         warning("Groovie::ROQ: JPEG frame (unfinished)");
>
> -       Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder();
> -       jpg->setOutputColorSpace(Graphics::JPEGDecoder::kColorSpaceYUV);
> +       Image::JPEGDecoder jpg;
> +       jpg.setOutputColorSpace(Image::JPEGDecoder::kColorSpaceYUV);
>
>         uint32 startPos = _file->pos();
>         Common::SeekableSubReadStream subStream(_file, startPos, startPos
> + blockHeader.size, DisposeAfterUse::NO);
> -       jpg->loadStream(subStream);
> +       jpg.loadStream(subStream);
>
> -       const Graphics::Surface *srcSurf = jpg->getSurface();
> +       const Graphics::Surface *srcSurf = jpg.getSurface();
>         const byte *src = (const byte *)srcSurf->getPixels();
>         byte *ptr = (byte *)_currBuf->getPixels();
>         memcpy(ptr, src, _currBuf->w * _currBuf->h *
> srcSurf->format.bytesPerPixel);
>
> -       delete jpg;
> -
>         _file->seek(startPos + blockHeader.size);
>         return true;
>  }
> diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
> index e1f5037..7227c3e 100644
> --- a/engines/hopkins/graphics.cpp
> +++ b/engines/hopkins/graphics.cpp
> @@ -28,7 +28,7 @@
>
>  #include "common/system.h"
>  #include "graphics/palette.h"
> -#include "graphics/decoders/pcx.h"
> +#include "image/pcx.h"
>  #include "common/file.h"
>  #include "common/rect.h"
>  #include "engines/util.h"
> @@ -301,7 +301,7 @@ void GraphicsManager::fillSurface(byte *surface, byte
> *col, int size) {
>
>  void GraphicsManager::loadPCX640(byte *surface, const Common::String
> &file, byte *palette, bool typeFlag) {
>         Common::File f;
> -       Graphics::PCXDecoder pcxDecoder;
> +       Image::PCXDecoder pcxDecoder;
>
>         // Clear the passed surface
>         memset(surface, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
> diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp
> index 6894030..8b145b7 100644
> --- a/engines/hugo/dialogs.cpp
> +++ b/engines/hugo/dialogs.cpp
> @@ -21,9 +21,9 @@
>   */
>
>  #include "common/substream.h"
> -#include "graphics/decoders/bmp.h"
>  #include "gui/gui-manager.h"
>  #include "gui/ThemeEval.h"
> +#include "image/bmp.h"
>
>  #include "hugo/hugo.h"
>  #include "hugo/display.h"
> @@ -130,7 +130,7 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream
> &in) {
>                 uint32 filPos = in.pos();
>                 Common::SeekableSubReadStream stream(&in, filPos, filPos +
> bmpSize);
>
> -               Graphics::BitmapDecoder bitmapDecoder;
> +               Image::BitmapDecoder bitmapDecoder;
>                 if (!bitmapDecoder.loadStream(stream))
>                         error("TopMenu::loadBmpArr(): Could not load
> bitmap");
>
> diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
> index 359d4a3..e263397 100644
> --- a/engines/hugo/file.cpp
> +++ b/engines/hugo/file.cpp
> @@ -34,11 +34,12 @@
>  #include "common/config-manager.h"
>
>  #include "graphics/surface.h"
> -#include "graphics/decoders/pcx.h"
>  #include "graphics/thumbnail.h"
>
>  #include "gui/saveload.h"
>
> +#include "image/pcx.h"
> +
>  #include "hugo/hugo.h"
>  #include "hugo/file.h"
>  #include "hugo/schedule.h"
> @@ -110,7 +111,7 @@ Seq *FileManager::readPCX(Common::SeekableReadStream
> &f, Seq *seqPtr, byte *imag
>                         error("Insufficient memory to run game.");
>         }
>
> -       Graphics::PCXDecoder pcx;
> +       Image::PCXDecoder pcx;
>         if (!pcx.loadStream(f))
>                 error("Error while reading PCX image");
>
> diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp
> index fe2a308..6435daf 100644
> --- a/engines/mohawk/bitmap.cpp
> +++ b/engines/mohawk/bitmap.cpp
> @@ -29,7 +29,7 @@
>  #include "common/substream.h"
>  #include "common/system.h"
>  #include "common/textconsole.h"
> -#include "graphics/decoders/bmp.h"
> +#include "image/bmp.h"
>
>  namespace Mohawk {
>
> @@ -635,7 +635,7 @@ MohawkSurface
> *MystBitmap::decodeImage(Common::SeekableReadStream *stream) {
>         Common::SeekableReadStream *bmpStream = decompressLZ(stream,
> uncompressedSize);
>         delete stream;
>
> -       Graphics::BitmapDecoder bitmapDecoder;
> +       Image::BitmapDecoder bitmapDecoder;
>         if (!bitmapDecoder.loadStream(*bmpStream))
>                 error("Could not decode Myst bitmap");
>
> diff --git a/engines/mohawk/myst_graphics.cpp
> b/engines/mohawk/myst_graphics.cpp
> index 6f7e8a8..9ea9f15 100644
> --- a/engines/mohawk/myst_graphics.cpp
> +++ b/engines/mohawk/myst_graphics.cpp
> @@ -28,8 +28,7 @@
>  #include "common/system.h"
>  #include "common/textconsole.h"
>  #include "engines/util.h"
> -#include "graphics/decoders/jpeg.h"
> -#include "graphics/decoders/pict.h"
> +#include "image/pict.h"
>
>  namespace Mohawk {
>
> @@ -94,7 +93,7 @@ MohawkSurface *MystGraphics::decodeImage(uint16 id) {
>         MohawkSurface *mhkSurface = 0;
>
>         if (isPict) {
> -               Graphics::PICTDecoder pict;
> +               Image::PICTDecoder pict;
>
>                 if (!pict.loadStream(*dataStream))
>                         error("Could not decode Myst ME PICT");
> diff --git a/engines/parallaction/disk_br.cpp
> b/engines/parallaction/disk_br.cpp
> index b31418a..7458065 100644
> --- a/engines/parallaction/disk_br.cpp
> +++ b/engines/parallaction/disk_br.cpp
> @@ -23,7 +23,7 @@
>  #include "common/config-manager.h"
>  #include "common/fs.h"
>  #include "common/textconsole.h"
> -#include "graphics/decoders/iff.h"
> +#include "image/iff.h"
>  #include "parallaction/parallaction.h"
>  #include "parallaction/parser.h"
>
> @@ -460,7 +460,7 @@ void AmigaDisk_br::loadBackground(BackgroundInfo&
> info, const char *filename) {
>         byte r,g,b;
>         const byte *p;
>         Common::SeekableReadStream *stream;
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         uint i;
>
>         stream = tryOpenFile("backs/" + Common::String(filename), ".ap");
> @@ -544,7 +544,7 @@ MaskBuffer *AmigaDisk_br::loadMask(const char *name,
> uint32 w, uint32 h) {
>                 return 0;
>         }
>
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         decoder.setNumRelevantPlanes(2); // use only 2 first bits from
> each pixels
>         decoder.setPixelPacking(true); // pack 4 2bit pixels into 1 byte
>         decoder.loadStream(*stream);
> @@ -583,7 +583,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) {
>
>         Common::String sName = name;
>         Common::SeekableReadStream *stream = openFile("ras/" + sName,
> ".ras");
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         decoder.loadStream(*stream);
>
>         Graphics::Surface *surf = new Graphics::Surface;
> @@ -720,7 +720,7 @@ GfxObj* AmigaDisk_br::loadObjects(const char *name,
> uint8 part) {
>         debugC(5, kDebugDisk, "AmigaDisk_br::loadObjects");
>
>         Common::SeekableReadStream *stream = openFile(name);
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         decoder.loadStream(*stream);
>
>         uint16 max = objectsMax[part];
> diff --git a/engines/parallaction/disk_ns.cpp
> b/engines/parallaction/disk_ns.cpp
> index a5fef16..28e61b0 100644
> --- a/engines/parallaction/disk_ns.cpp
> +++ b/engines/parallaction/disk_ns.cpp
> @@ -26,7 +26,7 @@
>  #include "common/memstream.h"
>  #include "common/substream.h"
>  #include "common/textconsole.h"
> -#include "graphics/decoders/iff.h"
> +#include "image/iff.h"
>  #include "parallaction/parser.h"
>  #include "parallaction/parallaction.h"
>
> @@ -917,7 +917,7 @@ void AmigaDisk_ns::buildMask(byte* buf) {
>
>  void AmigaDisk_ns::loadBackground(BackgroundInfo& info, const char *name)
> {
>         Common::SeekableReadStream *s = openFile(name);
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         decoder.loadStream(*s);
>
>         info.bg.copyFrom(*decoder.getSurface());
> @@ -935,7 +935,7 @@ void AmigaDisk_ns::loadBackground(BackgroundInfo&
> info, const char *name) {
>                 info.palette.setEntry(i, r, g, b);
>         }
>
> -       const Common::Array<Graphics::IFFDecoder::PaletteRange>
> &paletteRanges = decoder.getPaletteRanges();
> +       const Common::Array<Image::IFFDecoder::PaletteRange>
> &paletteRanges = decoder.getPaletteRanges();
>         for (uint j = 0; j < 6 && j < paletteRanges.size(); j++) {
>                 PaletteFxRange range;
>                 range._timer = paletteRanges[j].timer;
> @@ -959,7 +959,7 @@ void AmigaDisk_ns::loadMask_internal(BackgroundInfo&
> info, const char *name) {
>                 return; // no errors if missing mask files: not every
> location has one
>         }
>
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         decoder.setNumRelevantPlanes(2); // use only 2 first bits from
> each pixel
>         decoder.setPixelPacking(true); // pack 4 2bit pixels into 1 byte
>         decoder.loadStream(*s);
> @@ -990,7 +990,7 @@ void AmigaDisk_ns::loadPath_internal(BackgroundInfo&
> info, const char *name) {
>                 return; // no errors if missing path files: not every
> location has one
>         }
>
> -       Graphics::IFFDecoder decoder;
> +       Image::IFFDecoder decoder;
>         decoder.setNumRelevantPlanes(1); // use only first bit from each
> pixel
>         decoder.setPixelPacking(true); // pack 8 1bit pixels into 1 byte
>         decoder.loadStream(*s);
> diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp
> index ad0d2c2..602ae88 100644
> --- a/engines/pegasus/cursor.cpp
> +++ b/engines/pegasus/cursor.cpp
> @@ -28,7 +28,7 @@
>  #include "common/system.h"
>  #include "graphics/cursorman.h"
>  #include "graphics/surface.h"
> -#include "graphics/decoders/pict.h"
> +#include "image/pict.h"
>
>  #include "pegasus/cursor.h"
>  #include "pegasus/graphics.h"
> @@ -148,7 +148,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) {
>                 Common::SeekableReadStream *pictStream =
> vm->_resFork->getResource(MKTAG('P', 'I', 'C', 'T'), cursorInfo.tag + 1000);
>
>                 if (pictStream) {
> -                       Graphics::PICTDecoder pict;
> +                       Image::PICTDecoder pict;
>                         if (!pict.loadStream(*pictStream))
>                                 error("Failed to decode cursor PICT %d",
> cursorInfo.tag + 1000);
>
> @@ -166,7 +166,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) {
>                 error("Failed to find color icon %d", cursorInfo.tag);
>
>         // PixMap section
> -       Graphics::PICTDecoder::PixMap pixMap =
> Graphics::PICTDecoder::readPixMap(*cicnStream);
> +       Image::PICTDecoder::PixMap pixMap =
> Image::PICTDecoder::readPixMap(*cicnStream);
>
>         // Mask section
>         cicnStream->readUint32BE(); // mask baseAddr
> diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp
> index cdcb3c6..cb1e2e7 100644
> --- a/engines/pegasus/surface.cpp
> +++ b/engines/pegasus/surface.cpp
> @@ -28,7 +28,7 @@
>  #include "common/stream.h"
>  #include "common/system.h"
>  #include "graphics/surface.h"
> -#include "graphics/decoders/pict.h"
> +#include "image/pict.h"
>  #include "video/video_decoder.h"
>
>  #include "pegasus/pegasus.h"
> @@ -101,7 +101,7 @@ void
> Surface::getImageFromPICTResource(Common::MacResManager *resFork, uint16 id
>  }
>
>  bool Surface::getImageFromPICTStream(Common::SeekableReadStream *stream) {
> -       Graphics::PICTDecoder pict;
> +       Image::PICTDecoder pict;
>
>         if (!pict.loadStream(*stream))
>                 return false;
> diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp
> index 85cc7ca..b2213f7 100644
> --- a/engines/queen/display.cpp
> +++ b/engines/queen/display.cpp
> @@ -29,8 +29,9 @@
>  #include "graphics/cursorman.h"
>  #include "graphics/palette.h"
>  #include "graphics/surface.h"
> -#include "graphics/decoders/iff.h"
> -#include "graphics/decoders/pcx.h"
> +
> +#include "image/iff.h"
> +#include "image/pcx.h"
>
>  #include "queen/display.h"
>  #include "queen/input.h"
> @@ -813,7 +814,7 @@ void Display::fill(uint8 *dstBuf, uint16 dstPitch,
> uint16 x, uint16 y, uint16 w,
>  void Display::decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst,
> uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16
> palEnd) {
>         Common::MemoryReadStream str(src, srcSize);
>
> -       ::Graphics::PCXDecoder pcx;
> +       Image::PCXDecoder pcx;
>         if (!pcx.loadStream(str))
>                 error("Error while reading PCX image");
>
> @@ -832,7 +833,7 @@ void Display::decodePCX(const uint8 *src, uint32
> srcSize, uint8 *dst, uint16 dst
>  void Display::decodeIFF(const uint8 *src, uint32 srcSize, uint8 *dst,
> uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16
> palEnd, uint8 colorBase) {
>         Common::MemoryReadStream str(src, srcSize);
>
> -       ::Graphics::IFFDecoder iff;
> +       Image::IFFDecoder iff;
>         if (!iff.loadStream(str))
>                 error("Error while reading IFF image");
>
> diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp
> index 5ca2f8d..7f77cba 100644
> --- a/engines/saga/scene.cpp
> +++ b/engines/saga/scene.cpp
> @@ -43,7 +43,7 @@
>
>  #include "common/util.h"
>
> -#include "graphics/decoders/iff.h"
> +#include "image/iff.h"
>
>  namespace Saga {
>
> @@ -463,7 +463,7 @@ void Scene::changeScene(int16 sceneNumber, int
> actorsEntrance, SceneTransitionTy
>
> _vm->_interface->setMode(kPanelSceneSubstitute);
>
>                                 if (file.open(sceneSubstitutes[i].image)) {
> -                                       Graphics::IFFDecoder decoder;
> +                                       Image::IFFDecoder decoder;
>                                         decoder.loadStream(file);
>                                         pal = decoder.getPalette();
>
> rect.setWidth(decoder.getSurface()->w);
> diff --git a/engines/sci/graphics/maciconbar.cpp
> b/engines/sci/graphics/maciconbar.cpp
> index db9843f..8e2e12b 100644
> --- a/engines/sci/graphics/maciconbar.cpp
> +++ b/engines/sci/graphics/maciconbar.cpp
> @@ -32,7 +32,7 @@
>  #include "common/memstream.h"
>  #include "common/system.h"
>  #include "graphics/surface.h"
> -#include "graphics/decoders/pict.h"
> +#include "image/pict.h"
>
>  namespace Sci {
>
> @@ -201,12 +201,12 @@ void GfxMacIconBar::setInventoryIcon(int16 icon) {
>  }
>
>  Graphics::Surface *GfxMacIconBar::loadPict(ResourceId id) {
> -       Graphics::PICTDecoder pictDecoder;
>         Resource *res = g_sci->getResMan()->findResource(id, false);
>
>         if (!res || res->size == 0)
>                 return 0;
>
> +       Image::PICTDecoder pictDecoder;
>         Common::MemoryReadStream stream(res->data, res->size);
>         if (!pictDecoder.loadStream(stream))
>                 return 0;
> diff --git a/engines/sword25/gfx/image/imgloader.cpp
> b/engines/sword25/gfx/image/imgloader.cpp
> index 3212c8d..b4b3030 100644
> --- a/engines/sword25/gfx/image/imgloader.cpp
> +++ b/engines/sword25/gfx/image/imgloader.cpp
> @@ -33,14 +33,14 @@
>  #include "sword25/gfx/image/image.h"
>  #include "sword25/gfx/image/imgloader.h"
>  #include "graphics/pixelformat.h"
> -#include "graphics/decoders/png.h"
> +#include "image/png.h"
>
>  namespace Sword25 {
>
>  bool ImgLoader::decodePNGImage(const byte *fileDataPtr, uint fileSize,
> byte *&uncompressedDataPtr, int &width, int &height, int &pitch) {
>         Common::MemoryReadStream *fileStr = new
> Common::MemoryReadStream(fileDataPtr, fileSize, DisposeAfterUse::NO);
>
> -       Graphics::PNGDecoder png;
> +       ::Image::PNGDecoder png;
>         if (!png.loadStream(*fileStr)) // the fileStr pointer, and thus
> pFileData will be deleted after this is done
>                 error("Error while reading PNG image");
>
> diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
> index 1c223c6..48ddefe 100644
> --- a/engines/tucker/resource.cpp
> +++ b/engines/tucker/resource.cpp
> @@ -30,7 +30,8 @@
>  #include "audio/decoders/wave.h"
>
>  #include "graphics/surface.h"
> -#include "graphics/decoders/pcx.h"
> +
> +#include "image/pcx.h"
>
>  #include "tucker/tucker.h"
>  #include "tucker/graphics.h"
> @@ -302,7 +303,7 @@ void TuckerEngine::loadImage(const char *fname, uint8
> *dst, int type) {
>                 }
>         }
>
> -       ::Graphics::PCXDecoder pcx;
> +       Image::PCXDecoder pcx;
>         if (!pcx.loadStream(f))
>                 error("Error while reading PCX image");
>
> diff --git a/engines/wintermute/base/base_persistence_manager.cpp
> b/engines/wintermute/base/base_persistence_manager.cpp
> index 3b7026c..bea55fb 100644
> --- a/engines/wintermute/base/base_persistence_manager.cpp
> +++ b/engines/wintermute/base/base_persistence_manager.cpp
> @@ -38,8 +38,8 @@
>  #include "engines/wintermute/base/sound/base_sound.h"
>  #include "engines/wintermute/graphics/transparent_surface.h"
>  #include "engines/wintermute/wintermute.h"
> -#include "graphics/decoders/bmp.h"
>  #include "graphics/scaler.h"
> +#include "image/bmp.h"
>  #include "common/memstream.h"
>  #include "common/str.h"
>  #include "common/system.h"
> @@ -170,7 +170,7 @@ void BasePersistenceManager::getSaveStateDesc(int
> slot, SaveStateDescriptor &des
>
>         if (thumbSize > 0) {
>                 Common::MemoryReadStream thumbStream(thumbData, thumbSize,
> DisposeAfterUse::NO);
> -               Graphics::BitmapDecoder bmpDecoder;
> +               Image::BitmapDecoder bmpDecoder;
>                 if (bmpDecoder.loadStream(thumbStream)) {
>                         const Graphics::Surface *bmpSurface =
> bmpDecoder.getSurface();
>                         TransparentSurface *scaleableSurface = new
> TransparentSurface(*bmpSurface, false);
> diff --git a/engines/wintermute/base/gfx/base_image.cpp
> b/engines/wintermute/base/gfx/base_image.cpp
> index e5ec879..e676faf 100644
> --- a/engines/wintermute/base/gfx/base_image.cpp
> +++ b/engines/wintermute/base/gfx/base_image.cpp
> @@ -29,11 +29,11 @@
>  #include "engines/wintermute/base/gfx/base_image.h"
>  #include "engines/wintermute/base/base_file_manager.h"
>  #include "engines/wintermute/graphics/transparent_surface.h"
> -#include "graphics/decoders/png.h"
> -#include "graphics/decoders/jpeg.h"
> -#include "graphics/decoders/bmp.h"
> -#include "graphics/decoders/tga.h"
>  #include "graphics/surface.h"
> +#include "image/png.h"
> +#include "image/jpeg.h"
> +#include "image/bmp.h"
> +#include "image/tga.h"
>  #include "common/textconsole.h"
>  #include "common/stream.h"
>  #include "common/system.h"
> @@ -62,16 +62,14 @@ BaseImage::~BaseImage() {
>  bool BaseImage::loadFile(const Common::String &filename) {
>         _filename = filename;
>         _filename.toLowercase();
> -       if (filename.hasPrefix("savegame:")) {
> -               _decoder = new Graphics::BitmapDecoder();
> +       if (filename.hasPrefix("savegame:") ||
> _filename.hasSuffix(".bmp")) {
> +               _decoder = new Image::BitmapDecoder();
>         } else if (_filename.hasSuffix(".png")) {
> -               _decoder = new Graphics::PNGDecoder();
> -       } else if (_filename.hasSuffix(".bmp")) {
> -               _decoder = new Graphics::BitmapDecoder();
> +               _decoder = new Image::PNGDecoder();
>         } else if (_filename.hasSuffix(".tga")) {
> -               _decoder = new Graphics::TGADecoder();
> +               _decoder = new Image::TGADecoder();
>         } else if (_filename.hasSuffix(".jpg")) {
> -               _decoder = new Graphics::JPEGDecoder();
> +               _decoder = new Image::JPEGDecoder();
>         } else {
>                 error("BaseImage::loadFile : Unsupported fileformat %s",
> filename.c_str());
>         }
> diff --git a/engines/wintermute/base/gfx/base_image.h
> b/engines/wintermute/base/gfx/base_image.h
> index a7d6846..56be9fc 100644
> --- a/engines/wintermute/base/gfx/base_image.h
> +++ b/engines/wintermute/base/gfx/base_image.h
> @@ -31,11 +31,14 @@
>
>  #include "graphics/surface.h"
>  #include "graphics/pixelformat.h"
> -#include "graphics/decoders/image_decoder.h"
>  #include "common/endian.h"
>  #include "common/str.h"
>  #include "common/stream.h"
>
> +namespace Image {
> +class ImageDecoder;
> +}
> +
>  namespace Wintermute {
>  class BaseSurface;
>  class BaseFileManager;
> @@ -60,7 +63,7 @@ public:
>         void copyFrom(const Graphics::Surface *surface);
>  private:
>         Common::String _filename;
> -       Graphics::ImageDecoder *_decoder;
> +       Image::ImageDecoder *_decoder;
>         const Graphics::Surface *_surface;
>         Graphics::Surface *_deletableSurface;
>         const byte *_palette;
> diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
> b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
> index bb57d30..983f9c1 100644
> --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
> +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
> @@ -32,10 +32,6 @@
>  #include "engines/wintermute/base/gfx/osystem/base_render_osystem.h"
>  #include "engines/wintermute/base/gfx/base_image.h"
>  #include "engines/wintermute/platform_osystem.h"
> -#include "graphics/decoders/png.h"
> -#include "graphics/decoders/bmp.h"
> -#include "graphics/decoders/jpeg.h"
> -#include "graphics/decoders/tga.h"
>  #include "engines/wintermute/graphics/transparent_surface.h"
>  #include "engines/wintermute/graphics/transform_tools.h"
>  #include "graphics/pixelformat.h"
> diff --git a/engines/zvision/graphics/render_manager.cpp
> b/engines/zvision/graphics/render_manager.cpp
> index 86e27aa..aed30ea 100644
> --- a/engines/zvision/graphics/render_manager.cpp
> +++ b/engines/zvision/graphics/render_manager.cpp
> @@ -32,7 +32,7 @@
>
>  #include "engines/util.h"
>
> -#include "graphics/decoders/tga.h"
> +#include "image/tga.h"
>
>
>  namespace ZVision {
> @@ -238,7 +238,7 @@ void RenderManager::readImageToSurface(const
> Common::String &fileName, Graphics:
>
>         uint32 imageWidth;
>         uint32 imageHeight;
> -       Graphics::TGADecoder tga;
> +       Image::TGADecoder tga;
>         uint16 *buffer;
>         bool isTransposed = _renderTable.getRenderState() ==
> RenderTable::PANORAMA;
>         // All ZVision images are in RGB 555
> diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp
> deleted file mode 100644
> index 608c843..0000000
> --- a/graphics/decoders/bmp.cpp
> +++ /dev/null
> @@ -1,183 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -#include "common/stream.h"
> -#include "common/textconsole.h"
> -
> -#include "graphics/pixelformat.h"
> -#include "graphics/surface.h"
> -#include "graphics/decoders/bmp.h"
> -
> -namespace Graphics {
> -
> -BitmapDecoder::BitmapDecoder() {
> -       _surface = 0;
> -       _palette = 0;
> -       _paletteColorCount = 0;
> -}
> -
> -BitmapDecoder::~BitmapDecoder() {
> -       destroy();
> -}
> -
> -void BitmapDecoder::destroy() {
> -       if (_surface) {
> -               _surface->free();
> -               delete _surface; _surface = 0;
> -       }
> -
> -       delete[] _palette; _palette = 0;
> -       _paletteColorCount = 0;
> -}
> -
> -bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
> -       destroy();
> -
> -       if (stream.readByte() != 'B')
> -               return false;
> -
> -       if (stream.readByte() != 'M')
> -               return false;
> -
> -       /* uint32 fileSize = */ stream.readUint32LE();
> -       /* uint16 res1 = */ stream.readUint16LE();
> -       /* uint16 res2 = */ stream.readUint16LE();
> -       uint32 imageOffset = stream.readUint32LE();
> -
> -       uint32 infoSize = stream.readUint32LE();
> -       if (infoSize != 40) {
> -               warning("Only Windows v3 bitmaps are supported");
> -               return false;
> -       }
> -
> -       uint32 width = stream.readUint32LE();
> -       int32 height = stream.readSint32LE();
> -
> -       if (width == 0 || height == 0)
> -               return false;
> -
> -       if (height < 0) {
> -               warning("Right-side up bitmaps not supported");
> -               return false;
> -       }
> -
> -       /* uint16 planes = */ stream.readUint16LE();
> -       uint16 bitsPerPixel = stream.readUint16LE();
> -
> -       if (bitsPerPixel != 8 && bitsPerPixel != 24 && bitsPerPixel != 32)
> {
> -               warning("%dbpp bitmaps not supported", bitsPerPixel);
> -               return false;
> -       }
> -
> -       uint32 compression = stream.readUint32LE();
> -
> -       if (compression != 0) {
> -               warning("Compressed bitmaps not supported");
> -               return false;
> -       }
> -
> -       /* uint32 imageSize = */ stream.readUint32LE();
> -       /* uint32 pixelsPerMeterX = */ stream.readUint32LE();
> -       /* uint32 pixelsPerMeterY = */ stream.readUint32LE();
> -       _paletteColorCount = stream.readUint32LE();
> -       /* uint32 colorsImportant = */ stream.readUint32LE();
> -
> -       if (bitsPerPixel == 8) {
> -               if (_paletteColorCount == 0)
> -                       _paletteColorCount = 256;
> -
> -               // Read the palette
> -               _palette = new byte[_paletteColorCount * 3];
> -               for (uint16 i = 0; i < _paletteColorCount; i++) {
> -                       _palette[i * 3 + 2] = stream.readByte();
> -                       _palette[i * 3 + 1] = stream.readByte();
> -                       _palette[i * 3 + 0] = stream.readByte();
> -                       stream.readByte();
> -               }
> -       }
> -
> -       // Start us at the beginning of the image
> -       stream.seek(imageOffset);
> -
> -       Graphics::PixelFormat format =
> Graphics::PixelFormat::createFormatCLUT8();
> -
> -       // BGRA for 24bpp and 32 bpp
> -       if (bitsPerPixel == 24 || bitsPerPixel == 32)
> -               format = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24,
> 0);
> -
> -       _surface = new Graphics::Surface();
> -       _surface->create(width, height, format);
> -
> -       int srcPitch = width * (bitsPerPixel >> 3);
> -       const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) :
> 0;
> -
> -       if (bitsPerPixel == 8) {
> -               byte *dst = (byte *)_surface->getPixels();
> -
> -               for (int32 i = 0; i < height; i++) {
> -                       stream.read(dst + (height - i - 1) * width, width);
> -                       stream.skip(extraDataLength);
> -               }
> -       } else if (bitsPerPixel == 24) {
> -               byte *dst = (byte *)_surface->getBasePtr(0, height - 1);
> -
> -               for (int32 i = 0; i < height; i++) {
> -                       for (uint32 j = 0; j < width; j++) {
> -                               byte b = stream.readByte();
> -                               byte g = stream.readByte();
> -                               byte r = stream.readByte();
> -                               uint32 color = format.RGBToColor(r, g, b);
> -
> -                               *((uint32 *)dst) = color;
> -                               dst += format.bytesPerPixel;
> -                       }
> -
> -                       stream.skip(extraDataLength);
> -                       dst -= _surface->pitch * 2;
> -               }
> -       } else { // 32 bpp
> -               byte *dst = (byte *)_surface->getBasePtr(0, height - 1);
> -
> -               for (int32 i = 0; i < height; i++) {
> -                       for (uint32 j = 0; j < width; j++) {
> -                               byte b = stream.readByte();
> -                               byte g = stream.readByte();
> -                               byte r = stream.readByte();
> -                               // Ignore the last byte, as in v3 it is
> unused
> -                               // and should thus NOT be used as alpha.
> -                               // ref:
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx
> -                               stream.readByte();
> -                               uint32 color = format.RGBToColor(r, g, b);
> -
> -                               *((uint32 *)dst) = color;
> -                               dst += format.bytesPerPixel;
> -                       }
> -
> -                       stream.skip(extraDataLength);
> -                       dst -= _surface->pitch * 2;
> -               }
> -       }
> -
> -       return true;
> -}
> -
> -} // End of namespace Graphics
> diff --git a/graphics/decoders/bmp.h b/graphics/decoders/bmp.h
> deleted file mode 100644
> index da11f04..0000000
> --- a/graphics/decoders/bmp.h
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -/**
> - * @file
> - * Image decoder used in engines:
> - *  - hugo
> - *  - mohawk
> - *  - wintermute
> - */
> -
> -#ifndef GRAPHICS_DECODERS_BMP_H
> -#define GRAPHICS_DECODERS_BMP_H
> -
> -#include "common/scummsys.h"
> -#include "common/str.h"
> -#include "graphics/decoders/image_decoder.h"
> -
> -namespace Common{
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -
> -struct PixelFormat;
> -struct Surface;
> -
> -class BitmapDecoder : public ImageDecoder {
> -public:
> -       BitmapDecoder();
> -       virtual ~BitmapDecoder();
> -
> -       // ImageDecoder API
> -       void destroy();
> -       virtual bool loadStream(Common::SeekableReadStream &stream);
> -       virtual const Surface *getSurface() const { return _surface; }
> -       const byte *getPalette() const { return _palette; }
> -       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> -
> -private:
> -       Surface *_surface;
> -       byte *_palette;
> -       uint16 _paletteColorCount;
> -};
> -
> -} // End of namespace Graphics
> -
> -#endif
> diff --git a/graphics/decoders/iff.cpp b/graphics/decoders/iff.cpp
> deleted file mode 100644
> index c5fd46b..0000000
> --- a/graphics/decoders/iff.cpp
> +++ /dev/null
> @@ -1,244 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -#include "common/iff_container.h"
> -#include "common/stream.h"
> -#include "common/util.h"
> -
> -#include "graphics/decoders/iff.h"
> -
> -namespace Graphics {
> -
> -IFFDecoder::IFFDecoder() {
> -       _surface = 0;
> -       _palette = 0;
> -
> -       // these 2 properties are not reset by destroy(), so the default
> is set here.
> -       _numRelevantPlanes = 8;
> -       _pixelPacking = false;
> -
> -       destroy();
> -}
> -
> -IFFDecoder::~IFFDecoder() {
> -       destroy();
> -}
> -
> -void IFFDecoder::destroy() {
> -       if (_surface) {
> -               _surface->free();
> -               delete _surface;
> -               _surface = 0;
> -       }
> -
> -       if (_palette) {
> -               delete[] _palette;
> -               _palette = 0;
> -       }
> -
> -       memset(&_header, 0, sizeof(Header));
> -       _paletteRanges.clear();
> -       _type = TYPE_UNKNOWN;
> -       _paletteColorCount = 0;
> -}
> -
> -bool IFFDecoder::loadStream(Common::SeekableReadStream &stream) {
> -       destroy();
> -
> -       const uint32 form = stream.readUint32BE();
> -
> -       if (form != ID_FORM) {
> -               warning("Failed reading IFF-file");
> -               return false;
> -       }
> -
> -       stream.skip(4);
> -
> -       const uint32 type = stream.readUint32BE();
> -
> -       switch (type) {
> -               case ID_ILBM:
> -                       _type = TYPE_ILBM;
> -                       break;
> -               case ID_PBM:
> -                       _type = TYPE_PBM;
> -                       break;
> -       }
> -
> -       if (type == TYPE_UNKNOWN) {
> -               warning("Failed reading IFF-file");
> -               return false;
> -       }
> -
> -       while (1) {
> -               const uint32 chunkType = stream.readUint32BE();
> -               const uint32 chunkSize = stream.readUint32BE();
> -
> -               if (stream.eos())
> -                       break;
> -
> -               switch (chunkType) {
> -               case ID_BMHD:
> -                       loadHeader(stream);
> -                       break;
> -               case ID_CMAP:
> -                       loadPalette(stream, chunkSize);
> -                       break;
> -               case ID_CRNG:
> -                       loadPaletteRange(stream, chunkSize);
> -                       break;
> -               case ID_BODY:
> -                       loadBitmap(stream);
> -                       break;
> -               default:
> -                       stream.skip(chunkSize);
> -               }
> -       }
> -
> -       return true;
> -}
> -
> -void IFFDecoder::loadHeader(Common::SeekableReadStream &stream) {
> -       _header.width = stream.readUint16BE();
> -       _header.height = stream.readUint16BE();
> -       _header.x = stream.readUint16BE();
> -       _header.y = stream.readUint16BE();
> -       _header.numPlanes = stream.readByte();
> -       _header.masking = stream.readByte();
> -       _header.compression = stream.readByte();
> -       _header.flags = stream.readByte();
> -       _header.transparentColor = stream.readUint16BE();
> -       _header.xAspect = stream.readByte();
> -       _header.yAspect = stream.readByte();
> -       _header.pageWidth = stream.readUint16BE();
> -       _header.pageHeight = stream.readUint16BE();
> -
> -       assert(_header.width >= 1);
> -       assert(_header.height >= 1);
> -       assert(_header.numPlanes >= 1 && _header.numPlanes <= 8 &&
> _header.numPlanes != 7);
> -}
> -
> -void IFFDecoder::loadPalette(Common::SeekableReadStream &stream, const
> uint32 size) {
> -       _palette = new byte[size];
> -       stream.read(_palette, size);
> -       _paletteColorCount = size / 3;
> -}
> -
> -void IFFDecoder::loadPaletteRange(Common::SeekableReadStream &stream,
> const uint32 size) {
> -       PaletteRange range;
> -
> -       range.timer = stream.readSint16BE();
> -       range.step = stream.readSint16BE();
> -       range.flags = stream.readSint16BE();
> -       range.first = stream.readByte();
> -       range.last = stream.readByte();
> -
> -       _paletteRanges.push_back(range);
> -}
> -
> -void IFFDecoder::loadBitmap(Common::SeekableReadStream &stream) {
> -       _numRelevantPlanes = MIN(_numRelevantPlanes, _header.numPlanes);
> -
> -       if (_numRelevantPlanes != 1 && _numRelevantPlanes != 2 &&
> _numRelevantPlanes != 4)
> -               _pixelPacking = false;
> -
> -       uint16 outPitch = _header.width;
> -
> -       if (_pixelPacking)
> -               outPitch /= (8 / _numRelevantPlanes);
> -
> -       // FIXME: CLUT8 is not a proper format for packed bitmaps but
> there is no way to tell it to use 1, 2 or 4 bits per pixel
> -       _surface = new Graphics::Surface();
> -       _surface->create(outPitch, _header.height,
> Graphics::PixelFormat::createFormatCLUT8());
> -
> -       if (_type == TYPE_ILBM) {
> -               uint32 scanlinePitch = ((_header.width + 15) >> 4) << 1;
> -               byte *scanlines = new byte[scanlinePitch *
> _header.numPlanes];
> -               byte *data = (byte *)_surface->getPixels();
> -
> -               for (uint16 i = 0; i < _header.height; ++i) {
> -                       byte *scanline = scanlines;
> -
> -                       for (uint16 j = 0; j < _header.numPlanes; ++j) {
> -                               uint16 outSize = scanlinePitch;
> -
> -                               if (_header.compression) {
> -                                       Common::PackBitsReadStream
> packStream(stream);
> -                                       packStream.read(scanline, outSize);
> -                               } else {
> -                                       stream.read(scanline, outSize);
> -                               }
> -
> -                               scanline += outSize;
> -                       }
> -
> -                       packPixels(scanlines, data, scanlinePitch,
> outPitch);
> -                       data += outPitch;
> -               }
> -
> -               delete[] scanlines;
> -       } else if (_type == TYPE_PBM) {
> -               byte *data = (byte *)_surface->getPixels();
> -               uint32 outSize = _header.width * _header.height;
> -
> -               if (_header.compression) {
> -                       Common::PackBitsReadStream packStream(stream);
> -                       packStream.read(data, outSize);
> -               } else {
> -                       stream.read(data, outSize);
> -               }
> -       }
> -}
> -
> -void IFFDecoder::packPixels(byte *scanlines, byte *data, const uint16
> scanlinePitch, const uint16 outPitch) {
> -       uint32 numPixels = _header.width;
> -
> -       if (_pixelPacking)
> -               numPixels = outPitch * (8 / _numRelevantPlanes);
> -
> -       for (uint32 x = 0; x < numPixels; ++x) {
> -               byte *scanline = scanlines;
> -               byte pixel = 0;
> -               byte offset = x >> 3;
> -               byte bit = 0x80 >> (x & 7);
> -
> -               // first build a pixel by scanning all the usable planes
> in the input
> -               for (uint32 plane = 0; plane < _numRelevantPlanes;
> ++plane) {
> -                       if (scanline[offset] & bit)
> -                               pixel |= (1 << plane);
> -
> -                       scanline += scanlinePitch;
> -               }
> -
> -               // then output the pixel according to the requested packing
> -               if (!_pixelPacking)
> -                       data[x] = pixel;
> -               else if (_numRelevantPlanes == 1)
> -                       data[x / 8] |= (pixel << (x & 7));
> -               else if (_numRelevantPlanes == 2)
> -                       data[x / 4] |= (pixel << ((x & 3) << 1));
> -               else if (_numRelevantPlanes == 4)
> -                       data[x / 2] |= (pixel << ((x & 1) << 2));
> -       }
> -}
> -
> -} // End of namespace Graphics
> diff --git a/graphics/decoders/iff.h b/graphics/decoders/iff.h
> deleted file mode 100644
> index eb8e0b9..0000000
> --- a/graphics/decoders/iff.h
> +++ /dev/null
> @@ -1,124 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -/**
> - * @file
> - * Image decoder used in engines:
> - *  - gob
> - *  - parallaction
> - *  - queen
> - *  - saga
> - */
> -
> -#ifndef GRAPHICS_DECODERS_IFF_H
> -#define GRAPHICS_DECODERS_IFF_H
> -
> -#include "common/array.h"
> -#include "common/endian.h"
> -
> -#include "graphics/surface.h"
> -#include "graphics/decoders/image_decoder.h"
> -
> -namespace Common {
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -
> -struct Surface;
> -
> -class IFFDecoder : public ImageDecoder {
> -public:
> -       struct Header {
> -               uint16 width, height;
> -               uint16 x, y;
> -               byte numPlanes;
> -               byte masking;
> -               byte compression;
> -               byte flags;
> -               uint16 transparentColor;
> -               byte xAspect, yAspect;
> -               uint16 pageWidth, pageHeight;
> -       };
> -
> -       struct PaletteRange {
> -               int16  timer, step, flags;
> -               byte first, last;
> -       };
> -
> -       enum Type {
> -               TYPE_UNKNOWN = 0,
> -               TYPE_ILBM,
> -               TYPE_PBM
> -       };
> -
> -       IFFDecoder();
> -       virtual ~IFFDecoder();
> -
> -       // ImageDecoder API
> -       void destroy();
> -       bool loadStream(Common::SeekableReadStream &stream);
> -       const Header *getHeader() const { return &_header; }
> -       const Surface *getSurface() const { return _surface; }
> -       const byte *getPalette() const { return _palette; }
> -       const Common::Array<PaletteRange> &getPaletteRanges() const {
> return _paletteRanges; }
> -       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> -
> -       /**
> -       * The number of planes to decode, also determines the pixel
> packing if _packPixels is true.
> -       * 8 == decode all planes, map 1 pixel in 1 byte. (default, no
> packing even if _packPixels is true)
> -       *
> -       * NOTE: this property must be reset manually, and is not reset by
> a call to destroy().
> -       */
> -       void setNumRelevantPlanes(const uint8 numRelevantPlanes) {
> _numRelevantPlanes = numRelevantPlanes; }
> -
> -       /**
> -       * Enables pixel packing, the amount of packing is determined by
> _numRelevantPlanes
> -       * 1 == decode first plane, pack 8 pixels in 1 byte. This makes
> _surface->w 1/8th of _header.width
> -       * 2 == decode first 2 planes, pack 4 pixels in 1 byte. This makes
> _surface->w 1/4th of _header.width
> -       * 4 == decode first 4 planes, pack 2 pixels in 1 byte. This makes
> _surface->w half of _header.width
> -       * Packed bitmaps won't have a proper surface format since there is
> no way to tell it to use 1, 2 or 4 bits per pixel
> -       *
> -       * NOTE: this property must be reset manually, and is not reset by
> a call to destroy().
> -       */
> -       void setPixelPacking(const bool pixelPacking) { _pixelPacking =
> pixelPacking; }
> -private:
> -
> -       Header _header;
> -       Surface *_surface;
> -       byte *_palette;
> -       Common::Array<PaletteRange> _paletteRanges;
> -       Type _type;
> -       uint16 _paletteColorCount;
> -       uint8 _numRelevantPlanes;
> -       bool _pixelPacking;
> -
> -       void loadHeader(Common::SeekableReadStream &stream);
> -       void loadPalette(Common::SeekableReadStream &stream, const uint32
> size);
> -       void loadPaletteRange(Common::SeekableReadStream &stream, const
> uint32 size);
> -       void loadBitmap(Common::SeekableReadStream &stream);
> -       void packPixels(byte *scanlines, byte *data, const uint16
> scanlinePitch, const uint16 outPitch);
> -};
> -
> -} // End of namespace Graphics
> -
> -#endif // GRAPHICS_DECODERS_IFF_H
> diff --git a/graphics/decoders/image_decoder.h
> b/graphics/decoders/image_decoder.h
> deleted file mode 100644
> index cad3a1d..0000000
> --- a/graphics/decoders/image_decoder.h
> +++ /dev/null
> @@ -1,105 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -#ifndef GRAPHICS_DECODERS_IMAGEDECODER_H
> -#define GRAPHICS_DECODERS_IMAGEDECODER_H
> -
> -#include "common/scummsys.h"
> -#include "common/str.h"
> -
> -namespace Common{
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -
> -struct PixelFormat;
> -struct Surface;
> -
> -/**
> - * A representation of an image decoder that maintains ownership of the
> surface
> - * and palette it decodes to.
> - */
> -class ImageDecoder {
> -public:
> -       virtual ~ImageDecoder() {}
> -
> -       /**
> -        * Load an image from the specified stream
> -        *
> -        * loadStream() should implicitly call destroy() to free the memory
> -        * of the last loadStream() call.
> -        *
> -        * @param stream the input stream
> -        * @return whether loading the file succeeded
> -        * @see getSurface
> -        * @see getPalette
> -        */
> -       virtual bool loadStream(Common::SeekableReadStream &stream) = 0;
> -
> -       /**
> -        * Destroy this decoder's surface and palette
> -        *
> -        * This should be called by a loadStream() implementation as well
> -        * as the destructor.
> -        */
> -       virtual void destroy() = 0;
> -
> -       /**
> -        * Get the decoded surface
> -        *
> -        * This surface is owned by this ImageDecoder and will remain valid
> -        * until destroy() or loadStream() is called, or until this
> ImageDecoder's
> -        * destructor is called.
> -        *
> -        * @return the decoded surface, or 0 if no surface is present
> -        */
> -       virtual const Surface *getSurface() const = 0;
> -
> -       /**
> -        * Get the decoded palette
> -        *
> -        * This palette is owned by this ImageDecoder and will remain valid
> -        * until destroy() or loadStream() is called, or until this
> ImageDecoder's
> -        * destructor is called.
> -        *
> -        * The palette's format is the same as PaletteManager's palette
> -        * (interleaved RGB values).
> -        *
> -        * @return the decoded palette, or undefined if no palette is
> present
> -        */
> -       virtual const byte *getPalette() const { return 0; }
> -
> -       /**
> -        * Query if the decoded image has a palette.
> -        */
> -       virtual bool hasPalette() const { return getPaletteColorCount() !=
> 0; }
> -
> -       /** Return the starting index of the palette. */
> -       virtual byte getPaletteStartIndex() const { return 0; }
> -       /** Return the number of colors in the palette. */
> -       virtual uint16 getPaletteColorCount() const { return 0; }
> -};
> -
> -} // End of namespace Graphics
> -
> -#endif
> diff --git a/graphics/decoders/jpeg.cpp b/graphics/decoders/jpeg.cpp
> deleted file mode 100644
> index aa62ff9..0000000
> --- a/graphics/decoders/jpeg.cpp
> +++ /dev/null
> @@ -1,266 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -// libjpeg uses forbidden symbols in its header. Thus, we need to allow
> them
> -// here.
> -#define FORBIDDEN_SYMBOL_ALLOW_ALL
> -
> -#include "graphics/pixelformat.h"
> -#include "graphics/decoders/jpeg.h"
> -
> -#include "common/debug.h"
> -#include "common/endian.h"
> -#include "common/stream.h"
> -#include "common/textconsole.h"
> -
> -#ifdef USE_JPEG
> -// The original release of libjpeg v6b did not contain any extern "C" in
> case
> -// its header files are included in a C++ environment. To avoid any
> linking
> -// issues we need to add it on our own.
> -extern "C" {
> -#include <jpeglib.h>
> -#include <jerror.h>
> -}
> -#endif
> -
> -namespace Graphics {
> -
> -JPEGDecoder::JPEGDecoder() : ImageDecoder(), _surface(),
> _colorSpace(kColorSpaceRGBA) {
> -}
> -
> -JPEGDecoder::~JPEGDecoder() {
> -       destroy();
> -}
> -
> -const Surface *JPEGDecoder::getSurface() const {
> -       return &_surface;
> -}
> -
> -void JPEGDecoder::destroy() {
> -       _surface.free();
> -}
> -
> -#ifdef USE_JPEG
> -namespace {
> -
> -#define JPEG_BUFFER_SIZE 4096
> -
> -struct StreamSource : public jpeg_source_mgr {
> -       Common::SeekableReadStream *stream;
> -       bool startOfFile;
> -       JOCTET buffer[JPEG_BUFFER_SIZE];
> -};
> -
> -void initSource(j_decompress_ptr cinfo) {
> -       StreamSource *source = (StreamSource *)cinfo->src;
> -       source->startOfFile = true;
> -}
> -
> -boolean fillInputBuffer(j_decompress_ptr cinfo) {
> -       StreamSource *source = (StreamSource *)cinfo->src;
> -
> -       uint32 bufferSize = source->stream->read((byte *)source->buffer,
> sizeof(source->buffer));
> -       if (bufferSize == 0) {
> -               if (source->startOfFile) {
> -                       // An empty file is a fatal error
> -                       ERREXIT(cinfo, JERR_INPUT_EMPTY);
> -               } else {
> -                       // Otherwise we insert an EOF marker
> -                       WARNMS(cinfo, JWRN_JPEG_EOF);
> -                       source->buffer[0] = (JOCTET)0xFF;
> -                       source->buffer[1] = (JOCTET)JPEG_EOI;
> -                       bufferSize = 2;
> -               }
> -       }
> -
> -       source->next_input_byte = source->buffer;
> -       source->bytes_in_buffer = bufferSize;
> -       source->startOfFile = false;
> -
> -       return TRUE;
> -}
> -
> -void skipInputData(j_decompress_ptr cinfo, long numBytes) {
> -       StreamSource *source = (StreamSource *)cinfo->src;
> -
> -       if (numBytes > 0) {
> -               if (numBytes > (long)source->bytes_in_buffer) {
> -                       // In case we need to skip more bytes than there
> are in the buffer
> -                       // we will skip the remaining data and fill the
> buffer again
> -                       numBytes -= (long)source->bytes_in_buffer;
> -
> -                       // Skip the remaining bytes
> -                       source->stream->skip(numBytes);
> -
> -                       // Fill up the buffer again
> -                       (*source->fill_input_buffer)(cinfo);
> -               } else {
> -                       source->next_input_byte += (size_t)numBytes;
> -                       source->bytes_in_buffer -= (size_t)numBytes;
> -               }
> -
> -       }
> -}
> -
> -void termSource(j_decompress_ptr cinfo) {
> -}
> -
> -void jpeg_scummvm_src(j_decompress_ptr cinfo, Common::SeekableReadStream
> *stream) {
> -       StreamSource *source;
> -
> -       // Initialize the source in case it has not been done yet.
> -       if (cinfo->src == NULL) {
> -               cinfo->src = (jpeg_source_mgr
> *)(*cinfo->mem->alloc_small)((j_common_ptr)cinfo, JPOOL_PERMANENT,
> sizeof(StreamSource));
> -       }
> -
> -       source = (StreamSource *)cinfo->src;
> -       source->init_source       = &initSource;
> -       source->fill_input_buffer = &fillInputBuffer;
> -       source->skip_input_data   = &skipInputData;
> -       source->resync_to_restart = &jpeg_resync_to_restart;
> -       source->term_source       = &termSource;
> -       source->bytes_in_buffer   = 0;
> -       source->next_input_byte   = NULL;
> -
> -       source->stream = stream;
> -}
> -
> -void errorExit(j_common_ptr cinfo) {
> -       char buffer[JMSG_LENGTH_MAX];
> -       (*cinfo->err->format_message)(cinfo, buffer);
> -       // This function is not allowed to return to the caller, thus we
> simply
> -       // error out with our error handling here.
> -       error("%s", buffer);
> -}
> -
> -void outputMessage(j_common_ptr cinfo) {
> -       char buffer[JMSG_LENGTH_MAX];
> -       (*cinfo->err->format_message)(cinfo, buffer);
> -       // Is using debug here a good idea? Or do we want to ignore all
> libjpeg
> -       // messages?
> -       debug(3, "libjpeg: %s", buffer);
> -}
> -
> -} // End of anonymous namespace
> -#endif
> -
> -bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) {
> -#ifdef USE_JPEG
> -       // Reset member variables from previous decodings
> -       destroy();
> -
> -       jpeg_decompress_struct cinfo;
> -       jpeg_error_mgr jerr;
> -
> -       // Initialize error handling callbacks
> -       cinfo.err = jpeg_std_error(&jerr);
> -       cinfo.err->error_exit = &errorExit;
> -       cinfo.err->output_message = &outputMessage;
> -
> -       // Initialize the decompression structure
> -       jpeg_create_decompress(&cinfo);
> -
> -       // Initialize our buffer handling
> -       jpeg_scummvm_src(&cinfo, &stream);
> -
> -       // Read the file header
> -       jpeg_read_header(&cinfo, TRUE);
> -
> -       // We can request YUV output because Groovie requires it
> -       switch (_colorSpace) {
> -       case kColorSpaceRGBA:
> -               cinfo.out_color_space = JCS_RGB;
> -               break;
> -
> -       case kColorSpaceYUV:
> -               cinfo.out_color_space = JCS_YCbCr;
> -               break;
> -       }
> -
> -       // Actually start decompressing the image
> -       jpeg_start_decompress(&cinfo);
> -
> -       // Allocate buffers for the output data
> -       switch (_colorSpace) {
> -       case kColorSpaceRGBA:
> -               // We use RGBA8888 in this scenario
> -               _surface.create(cinfo.output_width, cinfo.output_height,
> Graphics::PixelFormat(4, 8, 8, 8, 0, 24, 16, 8, 0));
> -               break;
> -
> -       case kColorSpaceYUV:
> -               // We use YUV with 3 bytes per pixel otherwise.
> -               // This is pretty ugly since our PixelFormat cannot
> express YUV...
> -               _surface.create(cinfo.output_width, cinfo.output_height,
> Graphics::PixelFormat(3, 0, 0, 0, 0, 0, 0, 0, 0));
> -               break;
> -       }
> -
> -       // Allocate buffer for one scanline
> -       assert(cinfo.output_components == 3);
> -       JDIMENSION pitch = cinfo.output_width * cinfo.output_components;
> -       assert(_surface.pitch >= pitch);
> -       JSAMPARRAY buffer =
> (*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo, JPOOL_IMAGE, pitch, 1);
> -
> -       // Go through the image data scanline by scanline
> -       while (cinfo.output_scanline < cinfo.output_height) {
> -               byte *dst = (byte *)_surface.getBasePtr(0,
> cinfo.output_scanline);
> -
> -               jpeg_read_scanlines(&cinfo, buffer, 1);
> -
> -               const byte *src = buffer[0];
> -               switch (_colorSpace) {
> -               case kColorSpaceRGBA: {
> -                       for (int remaining = cinfo.output_width; remaining
> > 0; --remaining) {
> -                               byte r = *src++;
> -                               byte g = *src++;
> -                               byte b = *src++;
> -                               // We need to insert a alpha value of 255
> (opaque) here.
> -#ifdef SCUMM_BIG_ENDIAN
> -                               *dst++ = r;
> -                               *dst++ = g;
> -                               *dst++ = b;
> -                               *dst++ = 0xFF;
> -#else
> -                               *dst++ = 0xFF;
> -                               *dst++ = b;
> -                               *dst++ = g;
> -                               *dst++ = r;
> -#endif
> -                       }
> -                       } break;
> -
> -               case kColorSpaceYUV:
> -                       memcpy(dst, src, pitch);
> -                       break;
> -               }
> -       }
> -
> -       // We are done with decompressing, thus free all the data
> -       jpeg_finish_decompress(&cinfo);
> -       jpeg_destroy_decompress(&cinfo);
> -
> -       return true;
> -#else
> -       return false;
> -#endif
> -}
> -
> -} // End of Graphics namespace
> diff --git a/graphics/decoders/jpeg.h b/graphics/decoders/jpeg.h
> deleted file mode 100644
> index 8fd03ca..0000000
> --- a/graphics/decoders/jpeg.h
> +++ /dev/null
> @@ -1,95 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -/**
> - * @file
> - * Image decoder used in engines:
> - *  - groovie
> - *  - mohawk
> - *  - wintermute
> - */
> -
> -#ifndef GRAPHICS_JPEG_H
> -#define GRAPHICS_JPEG_H
> -
> -#include "graphics/surface.h"
> -#include "graphics/decoders/image_decoder.h"
> -
> -namespace Common {
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -
> -class JPEGDecoder : public ImageDecoder {
> -public:
> -       JPEGDecoder();
> -       ~JPEGDecoder();
> -
> -       // ImageDecoder API
> -       virtual void destroy();
> -       virtual bool loadStream(Common::SeekableReadStream &str);
> -       virtual const Surface *getSurface() const;
> -
> -       // Special API for JPEG
> -       enum ColorSpace {
> -               /**
> -                * Output 32bit RGBA data.
> -                *
> -                * This is the default output.
> -                */
> -               kColorSpaceRGBA,
> -
> -               /**
> -                * Output (interleaved) YUV data.
> -                *
> -                * Be aware that some images cannot be output in YUV mode.
> -                * These are (non-standard) JPEG images which are in RGB
> colorspace.
> -                *
> -                * The resulting Surface will have a PixelFormat with 3
> bytes per
> -                * pixel and the remaining entries are completely zeroed.
> This works
> -                * around the fact that PixelFormat can only describe RGB
> formats.
> -                *
> -                * You should only use this when you are really aware of
> what you are
> -                * doing!
> -                */
> -               kColorSpaceYUV
> -       };
> -
> -       /**
> -        * Request the output color space. This can be used to obtain raw
> YUV
> -        * data from the JPEG file. But this might not work for all files!
> -        *
> -        * The decoder itself defaults to RGBA.
> -        *
> -        * @param outSpace The color space to output.
> -        */
> -       void setOutputColorSpace(ColorSpace outSpace) { _colorSpace =
> outSpace; }
> -
> -private:
> -       Graphics::Surface _surface;
> -       ColorSpace _colorSpace;
> -};
> -
> -} // End of Graphics namespace
> -
> -#endif // GRAPHICS_JPEG_H
> diff --git a/graphics/decoders/pcx.cpp b/graphics/decoders/pcx.cpp
> deleted file mode 100644
> index bc82275..0000000
> --- a/graphics/decoders/pcx.cpp
> +++ /dev/null
> @@ -1,214 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -#include "common/stream.h"
> -#include "common/textconsole.h"
> -
> -#include "graphics/pixelformat.h"
> -#include "graphics/surface.h"
> -#include "graphics/decoders/pcx.h"
> -
> -/**
> - * Based on the PCX specs:
> - *
> http://www.fileformat.info/format/pcx/spec/a10e75307b3a4cc49c3bbe6db4c41fa2/view.htm
> - * and the PCX decoder of FFmpeg (libavcodec/pcx.c):
> - * http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/pcx.c
> - */
> -
> -namespace Graphics {
> -
> -PCXDecoder::PCXDecoder() {
> -       _surface = 0;
> -       _palette = 0;
> -       _paletteColorCount = 0;
> -}
> -
> -PCXDecoder::~PCXDecoder() {
> -       destroy();
> -}
> -
> -void PCXDecoder::destroy() {
> -       if (_surface) {
> -               _surface->free();
> -               delete _surface;
> -               _surface = 0;
> -       }
> -
> -       delete[] _palette;
> -       _palette = 0;
> -       _paletteColorCount = 0;
> -}
> -
> -bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) {
> -       destroy();
> -
> -       if (stream.readByte() != 0x0a)  // ZSoft PCX
> -               return false;
> -
> -       byte version = stream.readByte();       // 0 - 5
> -       if (version > 5)
> -               return false;
> -
> -       bool compressed = stream.readByte(); // encoding, 1 = run length
> encoding
> -       byte bitsPerPixel = stream.readByte();  // 1, 2, 4 or 8
> -
> -       // Window
> -       uint16 xMin = stream.readUint16LE();
> -       uint16 yMin = stream.readUint16LE();
> -       uint16 xMax = stream.readUint16LE();
> -       uint16 yMax = stream.readUint16LE();
> -
> -       uint16 width  = xMax - xMin + 1;
> -       uint16 height = yMax - yMin + 1;
> -
> -       if (xMax < xMin || yMax < yMin) {
> -               warning("Invalid PCX image dimensions");
> -               return false;
> -       }
> -
> -       stream.skip(4); // HDpi, VDpi
> -
> -       // Read the EGA palette (colormap)
> -       _palette = new byte[16 * 3];
> -       for (uint16 i = 0; i < 16; i++) {
> -               _palette[i * 3 + 0] = stream.readByte();
> -               _palette[i * 3 + 1] = stream.readByte();
> -               _palette[i * 3 + 2] = stream.readByte();
> -       }
> -
> -       if (stream.readByte() != 0)     // reserved, should be set to 0
> -               return false;
> -
> -       byte nPlanes = stream.readByte();
> -       uint16 bytesPerLine = stream.readUint16LE();
> -       uint16 bytesPerscanLine = nPlanes * bytesPerLine;
> -
> -       if (bytesPerscanLine < width * bitsPerPixel * nPlanes / 8) {
> -               warning("PCX data is corrupted");
> -               return false;
> -       }
> -
> -       stream.skip(60);        // PaletteInfo, HscreenSize, VscreenSize,
> Filler
> -
> -       _surface = new Graphics::Surface();
> -
> -       byte *scanLine = new byte[bytesPerscanLine];
> -       byte *dst;
> -       int x, y;
> -
> -       if (nPlanes == 3 && bitsPerPixel == 8) {        // 24bpp
> -               Graphics::PixelFormat format = Graphics::PixelFormat(4, 8,
> 8, 8, 8, 24, 16, 8, 0);
> -               _surface->create(width, height, format);
> -               dst = (byte *)_surface->getPixels();
> -               _paletteColorCount = 0;
> -
> -               for (y = 0; y < height; y++) {
> -                       decodeRLE(stream, scanLine, bytesPerscanLine,
> compressed);
> -
> -                       for (x = 0; x < width; x++) {
> -                               byte b = scanLine[x];
> -                               byte g = scanLine[x +  bytesPerLine];
> -                               byte r = scanLine[x + (bytesPerLine << 1)];
> -                               uint32 color = format.RGBToColor(r, g, b);
> -
> -                               *((uint32 *)dst) = color;
> -                               dst += format.bytesPerPixel;
> -                       }
> -               }
> -       } else if (nPlanes == 1 && bitsPerPixel == 8) { // 8bpp indexed
> -               _surface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> -               dst = (byte *)_surface->getPixels();
> -               _paletteColorCount = 16;
> -
> -               for (y = 0; y < height; y++, dst += _surface->pitch) {
> -                       decodeRLE(stream, scanLine, bytesPerscanLine,
> compressed);
> -                       memcpy(dst, scanLine, width);
> -               }
> -
> -               if (version == 5) {
> -                       if (stream.readByte() != 12) {
> -                               warning("Expected a palette after the PCX
> image data");
> -                               delete[] scanLine;
> -                               return false;
> -                       }
> -
> -                       // Read the VGA palette
> -                       delete[] _palette;
> -                       _palette = new byte[256 * 3];
> -                       for (uint16 i = 0; i < 256; i++) {
> -                               _palette[i * 3 + 0] = stream.readByte();
> -                               _palette[i * 3 + 1] = stream.readByte();
> -                               _palette[i * 3 + 2] = stream.readByte();
> -                       }
> -
> -                       _paletteColorCount = 256;
> -               }
> -       } else if ((nPlanes == 2 || nPlanes == 3 || nPlanes == 4) &&
> bitsPerPixel == 1) {       // planar, 4, 8 or 16 colors
> -               _surface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> -               dst = (byte *)_surface->getPixels();
> -               _paletteColorCount = 16;
> -
> -               for (y = 0; y < height; y++, dst += _surface->pitch) {
> -                       decodeRLE(stream, scanLine, bytesPerscanLine,
> compressed);
> -
> -                       for (x = 0; x < width; x++) {
> -                               int m = 0x80 >> (x & 7), v = 0;
> -                               for (int i = nPlanes - 1; i >= 0; i--) {
> -                                       v <<= 1;
> -                                       v  += (scanLine[i * bytesPerLine +
> (x >> 3)] & m) == 0 ? 0 : 1;
> -                               }
> -                               dst[x] = v;
> -                       }
> -               }
> -       } else {
> -               // Known unsupported case: 1 plane and bpp < 8 (1, 2 or 4)
> -               warning("Invalid PCX file (%d planes, %d bpp)", nPlanes,
> bitsPerPixel);
> -               delete[] scanLine;
> -               return false;
> -       }
> -
> -       delete[] scanLine;
> -
> -       return true;
> -}
> -
> -void PCXDecoder::decodeRLE(Common::SeekableReadStream &stream, byte *dst,
> uint32 bytesPerscanLine, bool compressed) {
> -       uint32 i = 0;
> -       byte run, value;
> -
> -       if (compressed) {
> -               while (i < bytesPerscanLine) {
> -                       run = 1;
> -                       value = stream.readByte();
> -                       if (value >= 0xc0) {
> -                               run = value & 0x3f;
> -                               value = stream.readByte();
> -                       }
> -                       while (i < bytesPerscanLine && run--)
> -                               dst[i++] = value;
> -               }
> -       } else {
> -               stream.read(dst, bytesPerscanLine);
> -       }
> -}
> -
> -} // End of namespace Graphics
> diff --git a/graphics/decoders/pcx.h b/graphics/decoders/pcx.h
> deleted file mode 100644
> index 675ab50..0000000
> --- a/graphics/decoders/pcx.h
> +++ /dev/null
> @@ -1,69 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -/**
> - * PCX decoder used in engines:
> - *  - dreamweb
> - *  - hugo
> - *  - queen
> - *  - tucker
> - */
> -
> -#ifndef GRAPHICS_DECODERS_PCX_H
> -#define GRAPHICS_DECODERS_PCX_H
> -
> -#include "common/scummsys.h"
> -#include "common/str.h"
> -#include "graphics/decoders/image_decoder.h"
> -
> -namespace Common{
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -
> -struct PixelFormat;
> -struct Surface;
> -
> -class PCXDecoder : public ImageDecoder {
> -public:
> -       PCXDecoder();
> -       virtual ~PCXDecoder();
> -
> -       // ImageDecoder API
> -       void destroy();
> -       virtual bool loadStream(Common::SeekableReadStream &stream);
> -       virtual const Surface *getSurface() const { return _surface; }
> -       const byte *getPalette() const { return _palette; }
> -       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> -
> -private:
> -       void decodeRLE(Common::SeekableReadStream &stream, byte *dst,
> uint32 bytesPerScanline, bool compressed);
> -
> -       Surface *_surface;
> -       byte *_palette;
> -       uint16 _paletteColorCount;
> -};
> -
> -} // End of namespace Graphics
> -
> -#endif
> diff --git a/graphics/decoders/pict.cpp b/graphics/decoders/pict.cpp
> deleted file mode 100644
> index 8849a83..0000000
> --- a/graphics/decoders/pict.cpp
> +++ /dev/null
> @@ -1,580 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -#include "common/debug.h"
> -#include "common/endian.h"
> -#include "common/stream.h"
> -#include "common/substream.h"
> -#include "common/textconsole.h"
> -
> -#include "graphics/surface.h"
> -#include "graphics/decoders/jpeg.h"
> -#include "graphics/decoders/pict.h"
> -
> -namespace Graphics {
> -
> -// The PICT code is based off of the QuickDraw specs:
> -//
> http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-461.html
> -//
> http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-269.html
> -
> -PICTDecoder::PICTDecoder() {
> -       _outputSurface = 0;
> -       _paletteColorCount = 0;
> -}
> -
> -PICTDecoder::~PICTDecoder() {
> -       destroy();
> -}
> -
> -void PICTDecoder::destroy() {
> -       if (_outputSurface) {
> -               _outputSurface->free();
> -               delete _outputSurface;
> -               _outputSurface = 0;
> -       }
> -
> -       _paletteColorCount = 0;
> -}
> -
> -#define OPCODE(a, b, c) _opcodes.push_back(PICTOpcode(a, &PICTDecoder::b,
> c))
> -
> -void PICTDecoder::setupOpcodesCommon() {
> -       OPCODE(0x0000, o_nop, "NOP");
> -       OPCODE(0x0001, o_clip, "Clip");
> -       OPCODE(0x0003, o_txFont, "TxFont");
> -       OPCODE(0x0004, o_txFace, "TxFace");
> -       OPCODE(0x0007, o_pnSize, "PnSize");
> -       OPCODE(0x000D, o_txSize, "TxSize");
> -       OPCODE(0x0010, o_txRatio, "TxRatio");
> -       OPCODE(0x0011, o_versionOp, "VersionOp");
> -       OPCODE(0x001E, o_nop, "DefHilite");
> -       OPCODE(0x0028, o_longText, "LongText");
> -       OPCODE(0x00A1, o_longComment, "LongComment");
> -       OPCODE(0x00FF, o_opEndPic, "OpEndPic");
> -       OPCODE(0x0C00, o_headerOp, "HeaderOp");
> -}
> -
> -void PICTDecoder::setupOpcodesNormal() {
> -       setupOpcodesCommon();
> -       OPCODE(0x0098, on_packBitsRect, "PackBitsRect");
> -       OPCODE(0x009A, on_directBitsRect, "DirectBitsRect");
> -       OPCODE(0x8200, on_compressedQuickTime, "CompressedQuickTime");
> -}
> -
> -void PICTDecoder::setupOpcodesQuickTime() {
> -       setupOpcodesCommon();
> -       OPCODE(0x0098, oq_packBitsRect, "PackBitsRect");
> -       OPCODE(0x009A, oq_directBitsRect, "DirectBitsRect");
> -       OPCODE(0x8200, oq_compressedQuickTime, "CompressedQuickTime");
> -}
> -
> -#undef OPCODE
> -
> -void PICTDecoder::o_nop(Common::SeekableReadStream &) {
> -       // Nothing to do
> -}
> -
> -void PICTDecoder::o_clip(Common::SeekableReadStream &stream) {
> -       // Ignore
> -       stream.skip(stream.readUint16BE() - 2);
> -}
> -
> -void PICTDecoder::o_txFont(Common::SeekableReadStream &stream) {
> -       // Ignore
> -       stream.readUint16BE();
> -}
> -
> -void PICTDecoder::o_txFace(Common::SeekableReadStream &stream) {
> -       // Ignore
> -       stream.readByte();
> -}
> -
> -void PICTDecoder::o_pnSize(Common::SeekableReadStream &stream) {
> -       // Ignore
> -       stream.readUint16BE();
> -       stream.readUint16BE();
> -}
> -
> -void PICTDecoder::o_txSize(Common::SeekableReadStream &stream) {
> -       // Ignore
> -       stream.readUint16BE();
> -}
> -
> -void PICTDecoder::o_txRatio(Common::SeekableReadStream &stream) {
> -       // Ignore
> -       stream.readUint16BE();
> -       stream.readUint16BE();
> -       stream.readUint16BE();
> -       stream.readUint16BE();
> -}
> -
> -void PICTDecoder::o_versionOp(Common::SeekableReadStream &stream) {
> -       // We only support v2 extended
> -       if (stream.readUint16BE() != 0x02FF)
> -               error("Unknown PICT version");
> -}
> -
> -void PICTDecoder::o_longText(Common::SeekableReadStream &stream) {
> -       // Ignore
> -       stream.readUint16BE();
> -       stream.readUint16BE();
> -       stream.skip(stream.readByte());
> -}
> -
> -void PICTDecoder::o_longComment(Common::SeekableReadStream &stream) {
> -       // Ignore
> -       stream.readUint16BE();
> -       stream.skip(stream.readUint16BE());
> -}
> -
> -void PICTDecoder::o_opEndPic(Common::SeekableReadStream &stream) {
> -       // We've reached the end of the picture
> -       _continueParsing = false;
> -}
> -
> -void PICTDecoder::o_headerOp(Common::SeekableReadStream &stream) {
> -       // Read the basic header, but we don't really have to do anything
> with it
> -       /* uint16 version = */ stream.readUint16BE();
> -       stream.readUint16BE(); // Reserved
> -       /* uint32 hRes = */ stream.readUint32BE();
> -       /* uint32 vRes = */ stream.readUint32BE();
> -       Common::Rect origResRect;
> -       origResRect.top = stream.readUint16BE();
> -       origResRect.left = stream.readUint16BE();
> -       origResRect.bottom = stream.readUint16BE();
> -       origResRect.right = stream.readUint16BE();
> -       stream.readUint32BE(); // Reserved
> -}
> -
> -void PICTDecoder::on_packBitsRect(Common::SeekableReadStream &stream) {
> -       // Unpack data (8bpp or lower)
> -       unpackBitsRect(stream, true);
> -}
> -
> -void PICTDecoder::on_directBitsRect(Common::SeekableReadStream &stream) {
> -       // Unpack data (16bpp or higher)
> -       unpackBitsRect(stream, false);
> -}
> -
> -void PICTDecoder::on_compressedQuickTime(Common::SeekableReadStream
> &stream) {
> -       // OK, here's the fun. We get to completely change how QuickDraw
> draws
> -       // the data in PICT files.
> -
> -       // Swap out the opcodes to the new ones
> -       _opcodes.clear();
> -       setupOpcodesQuickTime();
> -
> -       // We'll decode the first QuickTime data from here, but the
> QuickTime-specific
> -       // opcodes will take over from here on out. Normal opcodes,
> signing off.
> -       decodeCompressedQuickTime(stream);
> -}
> -
> -void PICTDecoder::oq_packBitsRect(Common::SeekableReadStream &stream) {
> -       // Skip any data here (8bpp or lower)
> -       skipBitsRect(stream, true);
> -}
> -
> -void PICTDecoder::oq_directBitsRect(Common::SeekableReadStream &stream) {
> -       // Skip any data here (16bpp or higher)
> -       skipBitsRect(stream, false);
> -}
> -
> -void PICTDecoder::oq_compressedQuickTime(Common::SeekableReadStream
> &stream) {
> -       // Just pass the data along
> -       decodeCompressedQuickTime(stream);
> -}
> -
> -bool PICTDecoder::loadStream(Common::SeekableReadStream &stream) {
> -       destroy();
> -
> -       // Initialize opcodes to their normal state
> -       _opcodes.clear();
> -       setupOpcodesNormal();
> -
> -       _continueParsing = true;
> -       memset(_palette, 0, sizeof(_palette));
> -
> -       uint16 fileSize = stream.readUint16BE();
> -
> -       // If we have no file size here, we probably have a PICT from a
> file
> -       // and not a resource. The other two bytes are the fileSize which
> we
> -       // don't actually need (and already read if from a resource).
> -       if (!fileSize)
> -               stream.seek(512 + 2);
> -
> -       _imageRect.top = stream.readUint16BE();
> -       _imageRect.left = stream.readUint16BE();
> -       _imageRect.bottom = stream.readUint16BE();
> -       _imageRect.right = stream.readUint16BE();
> -       _imageRect.debugPrint(0, "PICT Rect:");
> -
> -       // NOTE: This is only a subset of the full PICT format.
> -       //     - Only V2 (Extended) Images Supported
> -       //     - CompressedQuickTime (JPEG) compressed data is supported
> -       //     - DirectBitsRect/PackBitsRect compressed data is supported
> -       for (uint32 opNum = 0; !stream.eos() && !stream.err() &&
> stream.pos() < stream.size() && _continueParsing; opNum++) {
> -               // PICT v2 opcodes are two bytes
> -               uint16 opcode = stream.readUint16BE();
> -
> -               if (opNum == 0 && opcode != 0x0011) {
> -                       warning("Cannot find PICT version opcode");
> -                       return false;
> -               } else if (opNum == 1 && opcode != 0x0C00) {
> -                       warning("Cannot find PICT header opcode");
> -                       return false;
> -               }
> -
> -               // Since opcodes are word-aligned, we need to mark our
> starting
> -               // position here.
> -               uint32 startPos = stream.pos();
> -
> -               for (uint32 i = 0; i < _opcodes.size(); i++) {
> -                       if (_opcodes[i].op == opcode) {
> -                               debug(4, "Running PICT opcode %04x '%s'",
> opcode, _opcodes[i].desc);
> -                               (this->*(_opcodes[i].proc))(stream);
> -                               break;
> -                       } else if (i == _opcodes.size() - 1) {
> -                               // Unknown opcode; attempt to continue
> forward
> -                               warning("Unknown PICT opcode %04x",
> opcode);
> -                       }
> -               }
> -
> -               // Align
> -               stream.skip((stream.pos() - startPos) & 1);
> -       }
> -
> -       return _outputSurface;
> -}
> -
> -PICTDecoder::PixMap PICTDecoder::readPixMap(Common::SeekableReadStream
> &stream, bool hasBaseAddr) {
> -       PixMap pixMap;
> -       pixMap.baseAddr = hasBaseAddr ? stream.readUint32BE() : 0;
> -       pixMap.rowBytes = stream.readUint16BE() & 0x3fff;
> -       pixMap.bounds.top = stream.readUint16BE();
> -       pixMap.bounds.left = stream.readUint16BE();
> -       pixMap.bounds.bottom = stream.readUint16BE();
> -       pixMap.bounds.right = stream.readUint16BE();
> -       pixMap.pmVersion = stream.readUint16BE();
> -       pixMap.packType = stream.readUint16BE();
> -       pixMap.packSize = stream.readUint32BE();
> -       pixMap.hRes = stream.readUint32BE();
> -       pixMap.vRes = stream.readUint32BE();
> -       pixMap.pixelType = stream.readUint16BE();
> -       pixMap.pixelSize = stream.readUint16BE();
> -       pixMap.cmpCount = stream.readUint16BE();
> -       pixMap.cmpSize = stream.readUint16BE();
> -       pixMap.planeBytes = stream.readUint32BE();
> -       pixMap.pmTable = stream.readUint32BE();
> -       pixMap.pmReserved = stream.readUint32BE();
> -       return pixMap;
> -}
> -
> -struct PackBitsRectData {
> -       PICTDecoder::PixMap pixMap;
> -       Common::Rect srcRect;
> -       Common::Rect dstRect;
> -       uint16 mode;
> -};
> -
> -void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool
> withPalette) {
> -       PackBitsRectData packBitsData;
> -       packBitsData.pixMap = readPixMap(stream, !withPalette);
> -
> -       // Read in the palette if there is one present
> -       if (withPalette) {
> -               // See
> http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-267.html
> -               stream.readUint32BE(); // seed
> -               stream.readUint16BE(); // flags
> -               _paletteColorCount = stream.readUint16BE() + 1;
> -
> -               for (uint32 i = 0; i < _paletteColorCount; i++) {
> -                       stream.readUint16BE();
> -                       _palette[i * 3] = stream.readUint16BE() >> 8;
> -                       _palette[i * 3 + 1] = stream.readUint16BE() >> 8;
> -                       _palette[i * 3 + 2] = stream.readUint16BE() >> 8;
> -               }
> -       }
> -
> -       packBitsData.srcRect.top = stream.readUint16BE();
> -       packBitsData.srcRect.left = stream.readUint16BE();
> -       packBitsData.srcRect.bottom = stream.readUint16BE();
> -       packBitsData.srcRect.right = stream.readUint16BE();
> -       packBitsData.dstRect.top = stream.readUint16BE();
> -       packBitsData.dstRect.left = stream.readUint16BE();
> -       packBitsData.dstRect.bottom = stream.readUint16BE();
> -       packBitsData.dstRect.right = stream.readUint16BE();
> -       packBitsData.mode = stream.readUint16BE();
> -
> -       uint16 width = packBitsData.srcRect.width();
> -       uint16 height = packBitsData.srcRect.height();
> -
> -       byte bytesPerPixel = 0;
> -
> -       if (packBitsData.pixMap.pixelSize <= 8)
> -               bytesPerPixel = 1;
> -       else if (packBitsData.pixMap.pixelSize == 32)
> -               bytesPerPixel = packBitsData.pixMap.cmpCount;
> -       else
> -               bytesPerPixel = packBitsData.pixMap.pixelSize / 8;
> -
> -       // Ensure we have enough space in the buffer to hold an entire
> line's worth of pixels
> -       uint32 lineSize = MAX<int>(width * bytesPerPixel + (8 * 2 /
> packBitsData.pixMap.pixelSize), packBitsData.pixMap.rowBytes);
> -       byte *buffer = new byte[lineSize * height];
> -
> -       // Read in amount of data per row
> -       for (uint16 i = 0; i < packBitsData.pixMap.bounds.height(); i++) {
> -               // NOTE: Compression 0 is "default". The format in SCI
> games is packed when 0.
> -               // In the future, we may need to have something to set the
>  "default" packing
> -               // format, but this is good for now.
> -
> -               if (packBitsData.pixMap.packType == 1 ||
> packBitsData.pixMap.rowBytes < 8) { // Unpacked, Pad-Byte (on 24-bit)
> -                       // TODO: Finish this. Hasn't been needed (yet).
> -                       error("Unpacked DirectBitsRect data (padded)");
> -               } else if (packBitsData.pixMap.packType == 2) { //
> Unpacked, No Pad-Byte (on 24-bit)
> -                       // TODO: Finish this. Hasn't been needed (yet).
> -                       error("Unpacked DirectBitsRect data (not padded)");
> -               } else if (packBitsData.pixMap.packType == 0 ||
> packBitsData.pixMap.packType > 2) { // Packed
> -                       uint16 byteCount = (packBitsData.pixMap.rowBytes >
> 250) ? stream.readUint16BE() : stream.readByte();
> -                       unpackBitsLine(buffer + i * width * bytesPerPixel,
> packBitsData.pixMap.rowBytes, stream.readStream(byteCount),
> packBitsData.pixMap.pixelSize, bytesPerPixel);
> -               }
> -       }
> -
> -       _outputSurface = new Graphics::Surface();
> -
> -       switch (bytesPerPixel) {
> -       case 1:
> -               // Just copy to the image
> -               _outputSurface->create(width, height,
> PixelFormat::createFormatCLUT8());
> -               memcpy(_outputSurface->getPixels(), buffer,
> _outputSurface->w * _outputSurface->h);
> -               break;
> -       case 2:
> -               // We have a 16-bit surface
> -               _outputSurface->create(width, height, PixelFormat(2, 5, 5,
> 5, 0, 10, 5, 0, 0));
> -               for (uint16 y = 0; y < _outputSurface->h; y++)
> -                       for (uint16 x = 0; x < _outputSurface->w; x++)
> -                               WRITE_UINT16(_outputSurface->getBasePtr(x,
> y), READ_UINT16(buffer + (y * _outputSurface->w + x) * 2));
> -               break;
> -       case 3:
> -               // We have a planar 24-bit surface
> -               _outputSurface->create(width, height,
> Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
> -               for (uint16 y = 0; y < _outputSurface->h; y++) {
> -                       for (uint16 x = 0; x < _outputSurface->w; x++) {
> -                               byte r = *(buffer + y * _outputSurface->w
> * 3 + x);
> -                               byte g = *(buffer + y * _outputSurface->w
> * 3 + _outputSurface->w + x);
> -                               byte b = *(buffer + y * _outputSurface->w
> * 3 + _outputSurface->w * 2 + x);
> -                               *((uint32 *)_outputSurface->getBasePtr(x,
> y)) = _outputSurface->format.RGBToColor(r, g, b);
> -                       }
> -               }
> -               break;
> -       case 4:
> -               // We have a planar 32-bit surface
> -               // Note that we ignore the alpha channel since it seems to
> not be correct
> -               // Mac OS X does not ignore it, but then displays it
> incorrectly. Photoshop
> -               // does ignore it and displays it correctly.
> -               _outputSurface->create(width, height,
> Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
> -               for (uint16 y = 0; y < _outputSurface->h; y++) {
> -                       for (uint16 x = 0; x < _outputSurface->w; x++) {
> -                               byte a = 0xFF;
> -                               byte r = *(buffer + y * _outputSurface->w
> * 4 + _outputSurface->w + x);
> -                               byte g = *(buffer + y * _outputSurface->w
> * 4 + _outputSurface->w * 2 + x);
> -                               byte b = *(buffer + y * _outputSurface->w
> * 4 + _outputSurface->w * 3 + x);
> -                               *((uint32 *)_outputSurface->getBasePtr(x,
> y)) = _outputSurface->format.ARGBToColor(a, r, g, b);
> -                       }
> -               }
> -               break;
> -       }
> -
> -       delete[] buffer;
> -}
> -
> -void PICTDecoder::unpackBitsLine(byte *out, uint32 length,
> Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel) {
> -       uint32 dataDecoded = 0;
> -       byte bytesPerDecode = (bytesPerPixel == 2) ? 2 : 1;
> -
> -       while (data->pos() < data->size() && dataDecoded < length) {
> -               byte op = data->readByte();
> -
> -               if (op & 0x80) {
> -                       uint32 runSize = (op ^ 255) + 2;
> -                       uint16 value = (bytesPerDecode == 2) ?
> data->readUint16BE() : data->readByte();
> -
> -                       for (uint32 i = 0; i < runSize; i++) {
> -                               if (bytesPerDecode == 2) {
> -                                       WRITE_UINT16(out, value);
> -                                       out += 2;
> -                               } else {
> -                                       outputPixelBuffer(out, value,
> bitsPerPixel);
> -                               }
> -                       }
> -                       dataDecoded += runSize * bytesPerDecode;
> -               } else {
> -                       uint32 runSize = op + 1;
> -
> -                       if (bytesPerDecode == 1) {
> -                               for (uint32 i = 0; i < runSize; i++)
> -                                       outputPixelBuffer(out,
> data->readByte(), bitsPerPixel);
> -                       } else {
> -                               for (uint32 i = 0; i < runSize; i++) {
> -                                       WRITE_UINT16(out,
> data->readUint16BE());
> -                                       out += 2;
> -                               }
> -                       }
> -
> -                       dataDecoded += runSize * bytesPerDecode;
> -               }
> -       }
> -
> -       // HACK: Even if the data is 24-bit, rowBytes is still 32-bit
> -       if (bytesPerPixel == 3)
> -               dataDecoded += length / 4;
> -
> -       if (length != dataDecoded)
> -               warning("Mismatched PackBits read (%d/%d)", dataDecoded,
> length);
> -
> -       delete data;
> -}
> -
> -void PICTDecoder::outputPixelBuffer(byte *&out, byte value, byte
> bitsPerPixel) {
> -       switch (bitsPerPixel) {
> -       case 1:
> -               for (int i = 7; i >= 0; i--)
> -                       *out++ = (value >> i) & 1;
> -               break;
> -       case 2:
> -               for (int i = 6; i >= 0; i -= 2)
> -                       *out++ = (value >> i) & 3;
> -               break;
> -       case 4:
> -               *out++ = (value >> 4) & 0xf;
> -               *out++ = value & 0xf;
> -               break;
> -       default:
> -               *out++ = value;
> -       }
> -}
> -
> -void PICTDecoder::skipBitsRect(Common::SeekableReadStream &stream, bool
> withPalette) {
> -       // Step through a PackBitsRect/DirectBitsRect function
> -
> -       if (!withPalette)
> -               stream.readUint32BE();
> -
> -       uint16 rowBytes = stream.readUint16BE();
> -       uint16 height = stream.readUint16BE();
> -       stream.readUint16BE();
> -       height = stream.readUint16BE() - height;
> -       stream.readUint16BE();
> -
> -       uint16 packType;
> -
> -       // Top two bits signify PixMap vs BitMap
> -       if (rowBytes & 0xC000) {
> -               // PixMap
> -               stream.readUint16BE();
> -               packType = stream.readUint16BE();
> -               stream.skip(14);
> -               stream.readUint16BE(); // pixelSize
> -               stream.skip(16);
> -
> -               if (withPalette) {
> -                       stream.readUint32BE();
> -                       stream.readUint16BE();
> -                       stream.skip((stream.readUint16BE() + 1) * 8);
> -               }
> -
> -               rowBytes &= 0x3FFF;
> -       } else {
> -               // BitMap
> -               packType = 0;
> -       }
> -
> -       stream.skip(18);
> -
> -       for (uint16 i = 0; i < height; i++) {
> -               if (packType == 1 || packType == 2 || rowBytes < 8)
> -                       error("Unpacked PackBitsRect data");
> -               else if (packType == 0 || packType > 2)
> -                       stream.skip((rowBytes > 250) ?
> stream.readUint16BE() : stream.readByte());
> -       }
> -}
> -
> -// Compressed QuickTime details can be found here:
> -//
> http://developer.apple.com/legacy/mac/library/#documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/B-Chapter/2TheImageCompression.html
> -//
> http://developer.apple.com/legacy/mac/library/#documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/F-Chapter/6WorkingwiththeImage.html
> -void PICTDecoder::decodeCompressedQuickTime(Common::SeekableReadStream
> &stream) {
> -       // First, read all the fields from the opcode
> -       uint32 dataSize = stream.readUint32BE();
> -       uint32 startPos = stream.pos();
> -
> -       /* uint16 version = */ stream.readUint16BE();
> -
> -       // Read in the display matrix
> -       uint32 matrix[3][3];
> -       for (uint32 i = 0; i < 3; i++)
> -               for (uint32 j = 0; j < 3; j++)
> -                       matrix[i][j] = stream.readUint32BE();
> -
> -       // We currently only support offseting images vertically from the
> matrix
> -       uint16 xOffset = 0;
> -       uint16 yOffset = matrix[2][1] >> 16;
> -
> -       uint32 matteSize = stream.readUint32BE();
> -       stream.skip(8); // matte rect
> -       /* uint16 transferMode = */ stream.readUint16BE();
> -       stream.skip(8); // src rect
> -       /* uint32 accuracy = */ stream.readUint32BE();
> -       uint32 maskSize = stream.readUint32BE();
> -
> -       // Skip the matte and mask
> -       stream.skip(matteSize + maskSize);
> -
> -       // Now we've reached the image descriptor, so read the relevant
> data from that
> -       uint32 idStart = stream.pos();
> -       uint32 idSize = stream.readUint32BE();
> -       uint32 codec = stream.readUint32BE();
> -       stream.skip(36); // miscellaneous stuff
> -       uint32 jpegSize = stream.readUint32BE();
> -       stream.skip(idSize - (stream.pos() - idStart)); // more useless
> stuff
> -
> -       if (codec != MKTAG('j', 'p', 'e', 'g'))
> -               error("Unhandled CompressedQuickTime format '%s'",
> tag2str(codec));
> -
> -       Common::SeekableSubReadStream jpegStream(&stream, stream.pos(),
> stream.pos() + jpegSize);
> -
> -       JPEGDecoder jpeg;
> -       if (!jpeg.loadStream(jpegStream))
> -               error("PICTDecoder::decodeCompressedQuickTime(): Could not
> decode JPEG data");
> -
> -       const Graphics::Surface *jpegSurface = jpeg.getSurface();
> -
> -       if (!_outputSurface) {
> -               _outputSurface = new Graphics::Surface();
> -               _outputSurface->create(_imageRect.width(),
> _imageRect.height(), jpegSurface->format);
> -       }
> -
> -       for (uint16 y = 0; y < jpegSurface->h; y++)
> -               memcpy(_outputSurface->getBasePtr(0 + xOffset, y +
> yOffset), jpegSurface->getBasePtr(0, y), jpegSurface->w *
> jpegSurface->format.bytesPerPixel);
> -
> -       stream.seek(startPos + dataSize);
> -}
> -
> -} // End of namespace Graphics
> diff --git a/graphics/decoders/pict.h b/graphics/decoders/pict.h
> deleted file mode 100644
> index 554b149..0000000
> --- a/graphics/decoders/pict.h
> +++ /dev/null
> @@ -1,140 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -/**
> - * @file
> - * Image decoder used in engines:
> - *  - mohawk
> - *  - pegasus
> - *  - sci
> - */
> -
> -#ifndef GRAPHICS_PICT_H
> -#define GRAPHICS_PICT_H
> -
> -#include "common/array.h"
> -#include "common/rect.h"
> -#include "common/scummsys.h"
> -
> -#include "graphics/decoders/image_decoder.h"
> -#include "graphics/pixelformat.h"
> -
> -namespace Common {
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -
> -struct Surface;
> -
> -#define DECLARE_OPCODE(x) void x(Common::SeekableReadStream &stream)
> -
> -class PICTDecoder : public ImageDecoder {
> -public:
> -       PICTDecoder();
> -       ~PICTDecoder();
> -
> -       // ImageDecoder API
> -       bool loadStream(Common::SeekableReadStream &stream);
> -       void destroy();
> -       const Surface *getSurface() const { return _outputSurface; }
> -       const byte *getPalette() const { return _palette; }
> -       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> -
> -       struct PixMap {
> -               uint32 baseAddr;
> -               uint16 rowBytes;
> -               Common::Rect bounds;
> -               uint16 pmVersion;
> -               uint16 packType;
> -               uint32 packSize;
> -               uint32 hRes;
> -               uint32 vRes;
> -               uint16 pixelType;
> -               uint16 pixelSize;
> -               uint16 cmpCount;
> -               uint16 cmpSize;
> -               uint32 planeBytes;
> -               uint32 pmTable;
> -               uint32 pmReserved;
> -       };
> -
> -       static PixMap readPixMap(Common::SeekableReadStream &stream, bool
> hasBaseAddr = true);
> -
> -private:
> -       Common::Rect _imageRect;
> -       byte _palette[256 * 3];
> -       uint16 _paletteColorCount;
> -       Graphics::Surface *_outputSurface;
> -       bool _continueParsing;
> -
> -       // Utility Functions
> -       void unpackBitsRect(Common::SeekableReadStream &stream, bool
> withPalette);
> -       void unpackBitsLine(byte *out, uint32 length,
> Common::SeekableReadStream *stream, byte bitsPerPixel, byte bytesPerPixel);
> -       void skipBitsRect(Common::SeekableReadStream &stream, bool
> withPalette);
> -       void decodeCompressedQuickTime(Common::SeekableReadStream &stream);
> -       void outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel);
> -
> -       // Opcodes
> -       typedef void
> (PICTDecoder::*OpcodeProcPICT)(Common::SeekableReadStream &stream);
> -       struct PICTOpcode {
> -               PICTOpcode() { op = 0; proc = 0; desc = 0; }
> -               PICTOpcode(uint16 o, OpcodeProcPICT p, const char *d) { op
> = o; proc = p; desc = d; }
> -               uint16 op;
> -               OpcodeProcPICT proc;
> -               const char *desc;
> -       };
> -       Common::Array<PICTOpcode> _opcodes;
> -
> -       // Common Opcodes
> -       void setupOpcodesCommon();
> -       DECLARE_OPCODE(o_nop);
> -       DECLARE_OPCODE(o_clip);
> -       DECLARE_OPCODE(o_txFont);
> -       DECLARE_OPCODE(o_txFace);
> -       DECLARE_OPCODE(o_pnSize);
> -       DECLARE_OPCODE(o_txSize);
> -       DECLARE_OPCODE(o_txRatio);
> -       DECLARE_OPCODE(o_versionOp);
> -       DECLARE_OPCODE(o_longText);
> -       DECLARE_OPCODE(o_longComment);
> -       DECLARE_OPCODE(o_opEndPic);
> -       DECLARE_OPCODE(o_headerOp);
> -
> -       // Regular-mode Opcodes
> -       void setupOpcodesNormal();
> -       DECLARE_OPCODE(on_packBitsRect);
> -       DECLARE_OPCODE(on_directBitsRect);
> -       DECLARE_OPCODE(on_compressedQuickTime);
> -
> -       // QuickTime-mode Opcodes
> -       void setupOpcodesQuickTime();
> -       DECLARE_OPCODE(oq_packBitsRect);
> -       DECLARE_OPCODE(oq_directBitsRect);
> -       DECLARE_OPCODE(oq_compressedQuickTime);
> -};
> -
> -#undef DECLARE_OPCODE
> -
> -} // End of namespace Graphics
> -
> -#endif
> diff --git a/graphics/decoders/png.cpp b/graphics/decoders/png.cpp
> deleted file mode 100644
> index 2282ea2..0000000
> --- a/graphics/decoders/png.cpp
> +++ /dev/null
> @@ -1,245 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -// Since we need to work with libpng here, we need to allow all symbols
> -// to avoid compilation issues.
> -#define FORBIDDEN_SYMBOL_ALLOW_ALL
> -#include "common/scummsys.h"
> -
> -#ifdef USE_PNG
> -#include <png.h>
> -#endif
> -
> -#include "graphics/decoders/png.h"
> -
> -#include "graphics/pixelformat.h"
> -#include "graphics/surface.h"
> -
> -#include "common/stream.h"
> -
> -namespace Graphics {
> -
> -PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0),
> _paletteColorCount(0), _stream(0) {
> -}
> -
> -PNGDecoder::~PNGDecoder() {
> -       destroy();
> -}
> -
> -void PNGDecoder::destroy() {
> -       if (_outputSurface) {
> -               _outputSurface->free();
> -               delete _outputSurface;
> -               _outputSurface = 0;
> -       }
> -       delete[] _palette;
> -       _palette = NULL;
> -}
> -
> -#ifdef USE_PNG
> -// libpng-error-handling:
> -void pngError(png_structp pngptr, png_const_charp errorMsg) {
> -       error("%s", errorMsg);
> -}
> -
> -void pngWarning(png_structp pngptr, png_const_charp warningMsg) {
> -       warning("%s", warningMsg);
> -}
> -
> -// libpng-I/O-helper:
> -void pngReadFromStream(png_structp pngPtr, png_bytep data, png_size_t
> length) {
> -       void *readIOptr = png_get_io_ptr(pngPtr);
> -       Common::SeekableReadStream *stream = (Common::SeekableReadStream
> *)readIOptr;
> -       stream->read(data, length);
> -}
> -#endif
> -
> -/*
> - * This code is based on Broken Sword 2.5 engine
> - *
> - * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
> - *
> - * Licensed under GNU GPL v2
> - *
> - */
> -
> -bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
> -#ifdef USE_PNG
> -       destroy();
> -
> -       _stream = &stream;
> -
> -       // First, check the PNG signature
> -       if (_stream->readUint32BE() != MKTAG(0x89, 'P', 'N', 'G')) {
> -               delete _stream;
> -               return false;
> -       }
> -       if (_stream->readUint32BE() != MKTAG(0x0d, 0x0a, 0x1a, 0x0a)) {
> -               delete _stream;
> -               return false;
> -       }
> -
> -       // The following is based on the guide provided in:
> -       //http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-3
> -       //http://www.libpng.org/pub/png/libpng-1.4.0-manual.pdf
> -       // along with the png-loading code used in the sword25-engine.
> -       png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
> NULL, NULL, NULL);
> -       if (!pngPtr) {
> -               delete _stream;
> -               return false;
> -       }
> -       png_infop infoPtr = png_create_info_struct(pngPtr);
> -       if (!infoPtr) {
> -               png_destroy_read_struct(&pngPtr, NULL, NULL);
> -               delete _stream;
> -               return false;
> -       }
> -       png_infop endInfo = png_create_info_struct(pngPtr);
> -       if (!endInfo) {
> -               png_destroy_read_struct(&pngPtr, &infoPtr, NULL);
> -               delete _stream;
> -               return false;
> -       }
> -
> -       png_set_error_fn(pngPtr, NULL, pngError, pngWarning);
> -       // TODO: The manual says errors should be handled via setjmp
> -
> -       png_set_read_fn(pngPtr, _stream, pngReadFromStream);
> -       png_set_crc_action(pngPtr, PNG_CRC_DEFAULT, PNG_CRC_WARN_USE);
> -       // We already verified the PNG-header
> -       png_set_sig_bytes(pngPtr, 8);
> -
> -       // Read PNG header
> -       png_read_info(pngPtr, infoPtr);
> -
> -       // No handling for unknown chunks yet.
> -       int bitDepth, colorType, width, height, interlaceType;
> -       png_uint_32 w, h;
> -       png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType,
> &interlaceType, NULL, NULL);
> -       width = w;
> -       height = h;
> -
> -       // Allocate memory for the final image data.
> -       // To keep memory framentation low this happens before allocating
> memory for temporary image data.
> -       _outputSurface = new Graphics::Surface();
> -
> -       // Images of all color formats except PNG_COLOR_TYPE_PALETTE
> -       // will be transformed into ARGB images
> -       if (colorType == PNG_COLOR_TYPE_PALETTE && !png_get_valid(pngPtr,
> infoPtr, PNG_INFO_tRNS)) {
> -               int numPalette = 0;
> -               png_colorp palette = NULL;
> -               uint32 success = png_get_PLTE(pngPtr, infoPtr, &palette,
> &numPalette);
> -               if (success != PNG_INFO_PLTE) {
> -                       png_destroy_read_struct(&pngPtr, &infoPtr, NULL);
> -                       return false;
> -               }
> -               _paletteColorCount = numPalette;
> -               _palette = new byte[_paletteColorCount * 3];
> -               for (int i = 0; i < _paletteColorCount; i++) {
> -                       _palette[(i * 3)] = palette[i].red;
> -                       _palette[(i * 3) + 1] = palette[i].green;
> -                       _palette[(i * 3) + 2] = palette[i].blue;
> -
> -               }
> -               _outputSurface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> -               png_set_packing(pngPtr);
> -       } else {
> -               bool isAlpha = (colorType & PNG_COLOR_MASK_ALPHA);
> -               if (png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) {
> -                       isAlpha = true;
> -                       png_set_expand(pngPtr);
> -               }
> -               _outputSurface->create(width, height,
> Graphics::PixelFormat(4,
> -                                      8, 8, 8, isAlpha ? 8 : 0, 24, 16,
> 8, 0));
> -               if (!_outputSurface->getPixels()) {
> -                       error("Could not allocate memory for output
> image.");
> -               }
> -               if (bitDepth == 16)
> -                       png_set_strip_16(pngPtr);
> -               if (bitDepth < 8)
> -                       png_set_expand(pngPtr);
> -               if (colorType == PNG_COLOR_TYPE_GRAY ||
> -                       colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
> -                       png_set_gray_to_rgb(pngPtr);
> -
> -               // PNGs are Big-Endian:
> -#ifdef SCUMM_LITTLE_ENDIAN
> -               png_set_bgr(pngPtr);
> -               png_set_swap_alpha(pngPtr);
> -               if (colorType != PNG_COLOR_TYPE_RGB_ALPHA)
> -                       png_set_filler(pngPtr, 0xff, PNG_FILLER_BEFORE);
> -#else
> -               if (colorType != PNG_COLOR_TYPE_RGB_ALPHA)
> -                       png_set_filler(pngPtr, 0xff, PNG_FILLER_AFTER);
> -#endif
> -
> -       }
> -
> -       // After the transformations have been registered, the image data
> is read again.
> -       png_set_interlace_handling(pngPtr);
> -       png_read_update_info(pngPtr, infoPtr);
> -       png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType, NULL,
> NULL, NULL);
> -       width = w;
> -       height = h;
> -
> -       if (interlaceType == PNG_INTERLACE_NONE) {
> -               // PNGs without interlacing can simply be read row by row.
> -               for (int i = 0; i < height; i++) {
> -                       png_read_row(pngPtr,
> (png_bytep)_outputSurface->getBasePtr(0, i), NULL);
> -               }
> -       } else {
> -               // PNGs with interlacing require us to allocate an
> auxillary
> -               // buffer with pointers to all row starts.
> -
> -               // Allocate row pointer buffer
> -               png_bytep *rowPtr = new png_bytep[height];
> -               if (!rowPtr) {
> -                       error("Could not allocate memory for row
> pointers.");
> -               }
> -
> -               // Initialize row pointers
> -               for (int i = 0; i < height; i++)
> -                       rowPtr[i] =
> (png_bytep)_outputSurface->getBasePtr(0, i);
> -
> -               // Read image data
> -               png_read_image(pngPtr, rowPtr);
> -
> -               // Free row pointer buffer
> -               delete[] rowPtr;
> -       }
> -
> -       // Read additional data at the end.
> -       png_read_end(pngPtr, NULL);
> -
> -       // Destroy libpng structures
> -       png_destroy_read_struct(&pngPtr, &infoPtr, &endInfo);
> -
> -       // We no longer need the file stream, thus close it here
> -       _stream = 0;
> -
> -       return true;
> -#else
> -       return false;
> -#endif
> -}
> -
> -} // End of Graphics namespace
> diff --git a/graphics/decoders/png.h b/graphics/decoders/png.h
> deleted file mode 100644
> index d47d362..0000000
> --- a/graphics/decoders/png.h
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -/*
> - * PNG decoder used in engines:
> - *  - sword25
> - *  - wintermute
> - * Dependencies:
> - *  - libpng
> - */
> -
> -#ifndef GRAPHICS_PNG_H
> -#define GRAPHICS_PNG_H
> -
> -#include "common/scummsys.h"
> -#include "common/textconsole.h"
> -#include "graphics/decoders/image_decoder.h"
> -
> -namespace Common {
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -
> -struct Surface;
> -struct PixelFormat;
> -
> -class PNGDecoder : public ImageDecoder {
> -public:
> -       PNGDecoder();
> -       ~PNGDecoder();
> -
> -       bool loadStream(Common::SeekableReadStream &stream);
> -       void destroy();
> -       const Graphics::Surface *getSurface() const { return
> _outputSurface; }
> -       const byte *getPalette() const { return _palette; }
> -       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> -private:
> -       Common::SeekableReadStream *_stream;
> -       byte *_palette;
> -       uint16 _paletteColorCount;
> -
> -       Graphics::Surface *_outputSurface;
> -};
> -
> -} // End of namespace Graphics
> -
> -#endif // GRAPHICS_PNG_H
> diff --git a/graphics/decoders/tga.cpp b/graphics/decoders/tga.cpp
> deleted file mode 100644
> index a342d0a..0000000
> --- a/graphics/decoders/tga.cpp
> +++ /dev/null
> @@ -1,430 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -/* Based on code from xoreos https://github.com/DrMcCoy/xoreos/
> - * relicensed under GPLv2+ with permission from DrMcCoy and clone2727
> - */
> -
> -#include "common/util.h"
> -#include "common/stream.h"
> -#include "common/textconsole.h"
> -#include "common/error.h"
> -
> -#include "graphics/decoders/tga.h"
> -
> -namespace Graphics {
> -
> -TGADecoder::TGADecoder() {
> -       _colorMapSize = 0;
> -       _colorMapOrigin = 0;
> -       _colorMapLength = 0;
> -       _colorMapEntryLength = 0;
> -       _colorMap = NULL;
> -}
> -
> -TGADecoder::~TGADecoder() {
> -       destroy();
> -}
> -
> -void TGADecoder::destroy() {
> -       _surface.free();
> -       delete[] _colorMap;
> -}
> -
> -bool TGADecoder::loadStream(Common::SeekableReadStream &tga) {
> -       destroy();
> -
> -       byte imageType, pixelDepth;
> -       bool success;
> -       success = readHeader(tga, imageType, pixelDepth);
> -       if (success) {
> -               switch (imageType) {
> -               case TYPE_BW:
> -               case TYPE_TRUECOLOR:
> -                       success = readData(tga, imageType, pixelDepth);
> -                       break;
> -               case TYPE_RLE_BW:
> -               case TYPE_RLE_TRUECOLOR:
> -               case TYPE_RLE_CMAP:
> -                       success = readDataRLE(tga, imageType, pixelDepth);
> -                       break;
> -               case TYPE_CMAP:
> -                       success = readDataColorMapped(tga, imageType,
> pixelDepth);
> -                       break;
> -               default:
> -                       success = false;
> -                       break;
> -               }
> -       }
> -       if (tga.err() || !success) {
> -               warning("Failed reading TGA-file");
> -               return false;
> -       }
> -       return success;
> -}
> -
> -bool TGADecoder::readHeader(Common::SeekableReadStream &tga, byte
> &imageType, byte &pixelDepth) {
> -       if (!tga.seek(0)) {
> -               warning("Failed reading TGA-file");
> -               return false;
> -       }
> -
> -       // TGAs have an optional "id" string in the header
> -       uint32 idLength = tga.readByte();
> -
> -       // Number of colors in the color map / palette
> -       int hasColorMap = tga.readByte();
> -
> -       // Image type. See header for numeric constants
> -       imageType = tga.readByte();
> -
> -       switch (imageType) {
> -       case TYPE_CMAP:
> -       case TYPE_TRUECOLOR:
> -       case TYPE_BW:
> -       case TYPE_RLE_CMAP:
> -       case TYPE_RLE_TRUECOLOR:
> -       case TYPE_RLE_BW:
> -               break;
> -       default:
> -               warning("Unsupported image type: %d", imageType);
> -               return false;
> -       }
> -
> -       // Color map specifications
> -       if (hasColorMap == 0) {
> -               tga.skip(5);
> -       } else {
> -               _colorMapOrigin = tga.readUint16LE();
> -               _colorMapLength = tga.readUint16LE();
> -               _colorMapEntryLength = tga.readByte();
> -       }
> -       // Origin-defintions
> -       tga.skip(2 + 2);
> -
> -       // Image dimensions
> -       _surface.w = tga.readUint16LE();
> -       _surface.h = tga.readUint16LE();
> -
> -       // Bits per pixel
> -       pixelDepth = tga.readByte();
> -       _surface.format.bytesPerPixel = pixelDepth / 8;
> -
> -       // Image descriptor
> -       byte imgDesc = tga.readByte();
> -       int attributeBits = imgDesc & 0x0F;
> -       assert((imgDesc & 0x10) == 0);
> -       _originTop = (imgDesc & 0x20);
> -
> -       // Interleaving is not handled at this point
> -       //int interleave = (imgDesc & 0xC);
> -       if (imageType == TYPE_CMAP || imageType == TYPE_RLE_CMAP) {
> -               if (pixelDepth == 8) {
> -                       _format = PixelFormat::createFormatCLUT8();
> -               } else {
> -                       warning("Unsupported index-depth: %d", pixelDepth);
> -                       return false;
> -               }
> -       } else if (imageType == TYPE_TRUECOLOR || imageType ==
> TYPE_RLE_TRUECOLOR) {
> -               if (pixelDepth == 24) {
> -                       _format = PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0);
> -               } else if (pixelDepth == 32) {
> -                       // HACK: According to the spec, attributeBits
> should determine the amount
> -                       // of alpha-bits, however, as the game files that
> use this decoder seems
> -                       // to ignore that fact, we force the amount to 8
> for 32bpp files for now.
> -                       _format = PixelFormat(4, 8, 8, 8, /* attributeBits
> */ 8, 16, 8, 0, 24);
> -               } else if (pixelDepth == 16 && imageType ==
> TYPE_TRUECOLOR) {
> -                       // 16bpp TGA is ARGB1555
> -                       _format = PixelFormat(2, 5, 5, 5, attributeBits,
> 10, 5, 0, 15);
> -               } else {
> -                       warning("Unsupported pixel depth: %d, %d",
> imageType, pixelDepth);
> -                       return false;
> -               }
> -       } else if (imageType == TYPE_BW || TYPE_RLE_BW) {
> -               if (pixelDepth == 8) {
> -                       _format = PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
> -               } else {
> -                       warning("Unsupported pixel depth: %d, %d",
> imageType, pixelDepth);
> -                       return false;
> -               }
> -
> -       } else {
> -               warning("Unsupported image type: %d", imageType);
> -               return false;
> -       }
> -
> -       // Skip the id string
> -       tga.skip(idLength);
> -
> -       if (hasColorMap) {
> -               return readColorMap(tga, imageType, pixelDepth);
> -       }
> -       return true;
> -}
> -
> -bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte
> imageType, byte pixelDepth) {
> -       _colorMap = new byte[3 * _colorMapLength];
> -       for (int i = 0; i < _colorMapLength * 3; i += 3) {
> -               byte r, g, b;
> -               if (_colorMapEntryLength == 32) {
> -                       byte a;
> -                       PixelFormat format(4, 8, 8, 8, 0, 16, 8, 0, 24);
> -                       uint32 color = tga.readUint32LE();
> -                       format.colorToARGB(color, a, r, g, b);
> -               } else if (_colorMapEntryLength == 24) {
> -                       r = tga.readByte();
> -                       g = tga.readByte();
> -                       b = tga.readByte();
> -               } else if (_colorMapEntryLength == 16) {
> -                       byte a;
> -                       PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15);
> -                       uint16 color = tga.readUint16LE();
> -                       format.colorToARGB(color, a, r, g, b);
> -               } else {
> -                       warning("Unsupported image type: %d", imageType);
> -                       r = g = b = 0;
> -               }
> -#ifdef SCUMM_LITTLE_ENDIAN
> -               _colorMap[i] = r;
> -               _colorMap[i + 1] = g;
> -               _colorMap[i + 2] = b;
> -#else
> -               _colorMap[i] = b;
> -               _colorMap[i + 1] = g;
> -               _colorMap[i + 2] = r;
> -#endif
> -       }
> -       return true;
> -}
> -
> -// Additional information found from
> http://paulbourke.net/dataformats/tga/
> -// With some details from the link referenced in the header.
> -bool TGADecoder::readData(Common::SeekableReadStream &tga, byte
> imageType, byte pixelDepth) {
> -       // TrueColor
> -       if (imageType == TYPE_TRUECOLOR) {
> -               _surface.create(_surface.w, _surface.h, _format);
> -
> -               if (pixelDepth == 16) {
> -                       for (int i = 0; i < _surface.h; i++) {
> -                               uint16 *dst;
> -                               if (!_originTop) {
> -                                       dst = (uint16
> *)_surface.getBasePtr(0, _surface.h - i - 1);
> -                               } else {
> -                                       dst = (uint16
> *)_surface.getBasePtr(0, i);
> -                               }
> -                               for (int j = 0; j < _surface.w; j++) {
> -                                       *dst++ = tga.readUint16LE();
> -                               }
> -                       }
> -               } else if (pixelDepth == 32) {
> -                       for (int i = 0; i < _surface.h; i++) {
> -                               uint32 *dst;
> -                               if (!_originTop) {
> -                                       dst = (uint32
> *)_surface.getBasePtr(0, _surface.h - i - 1);
> -                               } else {
> -                                       dst = (uint32
> *)_surface.getBasePtr(0, i);
> -                               }
> -                               for (int j = 0; j < _surface.w; j++) {
> -                                       *dst++ = tga.readUint32LE();
> -                               }
> -                       }
> -               } else if (pixelDepth == 24) {
> -                       for (int i = 0; i < _surface.h; i++) {
> -                               byte *dst;
> -                               if (!_originTop) {
> -                                       dst = (byte
> *)_surface.getBasePtr(0, _surface.h - i - 1);
> -                               } else {
> -                                       dst = (byte
> *)_surface.getBasePtr(0, i);
> -                               }
> -                               for (int j = 0; j < _surface.w; j++) {
> -                                       byte r = tga.readByte();
> -                                       byte g = tga.readByte();
> -                                       byte b = tga.readByte();
> -#ifdef SCUMM_LITTLE_ENDIAN
> -                                       *dst++ = r;
> -                                       *dst++ = g;
> -                                       *dst++ = b;
> -#else
> -                                       *dst++ = b;
> -                                       *dst++ = g;
> -                                       *dst++ = r;
> -#endif
> -                               }
> -                       }
> -               }
> -               // Black/White
> -       } else if (imageType == TYPE_BW) {
> -               _surface.create(_surface.w, _surface.h, _format);
> -
> -               byte *data  = (byte *)_surface.getPixels();
> -               uint32 count = _surface.w * _surface.h;
> -
> -               while (count-- > 0) {
> -                       byte g = tga.readByte();
> -                       *data++ = g;
> -                       *data++ = g;
> -                       *data++ = g;
> -                       *data++ = g;
> -               }
> -       }
> -       return true;
> -}
> -
> -bool TGADecoder::readDataColorMapped(Common::SeekableReadStream &tga,
> byte imageType, byte indexDepth) {
> -       // Color-mapped
> -       if (imageType == TYPE_CMAP) {
> -               _surface.create(_surface.w, _surface.h, _format);
> -               if (indexDepth == 8) {
> -                       for (int i = 0; i < _surface.h; i++) {
> -                               byte *dst;
> -                               if (!_originTop) {
> -                                       dst = (byte
> *)_surface.getBasePtr(0, _surface.h - i - 1);
> -                               } else {
> -                                       dst = (byte
> *)_surface.getBasePtr(0, i);
> -                               }
> -                               for (int j = 0; j < _surface.w; j++) {
> -                                       byte index = tga.readByte();
> -                                       *dst++ = index;
> -                               }
> -                       }
> -               } else if (indexDepth == 16) {
> -                       warning("16 bit indexes not supported");
> -                       return false;
> -               }
> -       } else {
> -               return false;
> -       }
> -       return true;
> -}
> -
> -bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte
> imageType, byte pixelDepth) {
> -       // RLE-TrueColor / RLE-Black/White
> -       if (imageType == TYPE_RLE_TRUECOLOR || imageType == TYPE_RLE_BW ||
> imageType == TYPE_RLE_CMAP) {
> -               _surface.create(_surface.w, _surface.h, _format);
> -               uint32 count = _surface.w * _surface.h;
> -               byte *data = (byte *)_surface.getPixels();
> -
> -               while (count > 0) {
> -                       uint32 header = tga.readByte();
> -                       byte type = (header & 0x80) >> 7;
> -                       uint32 rleCount = (header & 0x7F) + 1;
> -
> -                       // RLE-packet
> -                       if (type == 1) {
> -                               if (pixelDepth == 32 && imageType ==
> TYPE_RLE_TRUECOLOR) {
> -                                       uint32 color = tga.readUint32LE();
> -                                       while (rleCount-- > 0) {
> -                                               *((uint32 *)data) = color;
> -                                               data += 4;
> -                                               count--;
> -                                       }
> -                               } else if (pixelDepth == 24 && imageType
> == TYPE_RLE_TRUECOLOR) {
> -                                       byte r = tga.readByte();
> -                                       byte g = tga.readByte();
> -                                       byte b = tga.readByte();
> -                                       while (rleCount-- > 0) {
> -#ifdef SCUMM_LITTLE_ENDIAN
> -                                               *data++ = r;
> -                                               *data++ = g;
> -                                               *data++ = b;
> -#else
> -                                               *data++ = b;
> -                                               *data++ = g;
> -                                               *data++ = r;
> -#endif
> -                                               count--;
> -                                       }
> -                               } else if (pixelDepth == 8 && imageType ==
> TYPE_RLE_BW) {
> -                                       byte color = tga.readByte();
> -                                       while (rleCount-- > 0) {
> -                                               *data++ = color;
> -                                               *data++ = color;
> -                                               *data++ = color;
> -                                               *data++ = color;
> -                                               count--;
> -                                       }
> -                               } else if (pixelDepth == 8 && imageType ==
> TYPE_RLE_CMAP) {
> -                                       byte index = tga.readByte();
> -                                       while (rleCount-- > 0) {
> -                                               *data++ = index;
> -                                               count--;
> -                                       }
> -                               } else {
> -                                       warning("Unhandled pixel-depth for
> image-type 10");
> -                                       return false;
> -                               }
> -                               // Raw-packet
> -                       } else if (type == 0) {
> -                               if (pixelDepth == 32 && imageType ==
> TYPE_RLE_TRUECOLOR) {
> -                                       while (rleCount-- > 0) {
> -                                               uint32 color =
> tga.readUint32LE();
> -                                               *((uint32 *)data) = color;
> -                                               data += 4;
> -                                               count--;
> -                                       }
> -                               } else if (pixelDepth == 24 && imageType
> == TYPE_RLE_TRUECOLOR) {
> -                                       while (rleCount-- > 0) {
> -                                               byte r = tga.readByte();
> -                                               byte g = tga.readByte();
> -                                               byte b = tga.readByte();
> -#ifdef SCUMM_LITTLE_ENDIAN
> -                                               *data++ = r;
> -                                               *data++ = g;
> -                                               *data++ = b;
> -#else
> -                                               *data++ = b;
> -                                               *data++ = g;
> -                                               *data++ = r;
> -#endif
> -                                               count--;
> -                                       }
> -                               } else if (pixelDepth == 8 && imageType ==
> TYPE_RLE_BW) {
> -                                       while (rleCount-- > 0) {
> -                                               byte color =
> tga.readByte();
> -                                               *data++ = color;
> -                                               *data++ = color;
> -                                               *data++ = color;
> -                                               *data++ = color;
> -                                               count--;
> -                                       }
> -                               } else if (pixelDepth == 8 && imageType ==
> TYPE_RLE_CMAP) {
> -                                       while (rleCount-- > 0) {
> -                                               byte index =
> tga.readByte();
> -                                               *data++ = index;
> -                                               count--;
> -                                       }
> -                               } else {
> -                                       warning("Unhandled pixel-depth for
> image-type 10");
> -                                       return false;
> -                               }
> -                       } else {
> -                               warning("Unknown header for RLE-packet
> %d", type);
> -                               return false;
> -                       }
> -               }
> -       } else {
> -               return false;
> -       }
> -       return true;
> -}
> -
> -} // End of namespace Graphics
> diff --git a/graphics/decoders/tga.h b/graphics/decoders/tga.h
> deleted file mode 100644
> index a2949fb..0000000
> --- a/graphics/decoders/tga.h
> +++ /dev/null
> @@ -1,100 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -/* Based on code from eos https://github.com/DrMcCoy/xoreos/
> - * relicensed under GPLv2+ with permission from DrMcCoy and clone2727
> - */
> -
> -/*
> - * TGA decoder used in engines:
> - *  - wintermute
> - *  - zvision
> - */
> -
> -#ifndef GRAPHICS_DECODERS_TGA_H
> -#define GRAPHICS_DECODERS_TGA_H
> -
> -#include "graphics/surface.h"
> -#include "graphics/decoders/image_decoder.h"
> -
> -namespace Common {
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -
> -/** TarGa image-decoder
> - * The following variations of TGA are supported:
> - * - Type 1 - Color-mapped images in 16/24/32 bpp with 8 bit indexes
> - * - Type 2 - 16/24/32 bpp Top AND Bottom origined.
> - * - Type 3 - Black/White images, 8bpp.
> - * - Type 9 - RLE-encoded color-mapped images. (8 bit indexes only)
> - * - Type 10 - RLE-encoded TrueColor, 24/32bpp.
> - * - Type 11 - RLE-encoded Black/White, 8bpp.
> - *
> - * No images are returned with a palette, instead they are converted
> - * to 16 bpp for Type 1, or 32 bpp for Black/White-images.
> - */
> -class TGADecoder : public ImageDecoder {
> -public:
> -       TGADecoder();
> -       virtual ~TGADecoder();
> -       virtual void destroy();
> -       virtual const Surface *getSurface() const { return &_surface; }
> -       virtual const byte *getPalette() const { return _colorMap; }
> -       virtual uint16 getPaletteColorCount() const { return
> _colorMapLength; }
> -       virtual bool loadStream(Common::SeekableReadStream &stream);
> -private:
> -       // Format-spec from:
> -       //http://www.ludorg.net/amnesia/TGA_File_Format_Spec.html
> -       enum {
> -           TYPE_CMAP = 1,
> -           TYPE_TRUECOLOR = 2,
> -           TYPE_BW = 3,
> -           TYPE_RLE_CMAP = 9,
> -           TYPE_RLE_TRUECOLOR = 10,
> -           TYPE_RLE_BW = 11
> -       };
> -
> -       // Color-map:
> -       bool _colorMapSize;
> -       byte *_colorMap;
> -       int16 _colorMapOrigin;
> -       int16 _colorMapLength;
> -       byte _colorMapEntryLength;
> -
> -       // Origin may be at the top, or bottom
> -       bool _originTop;
> -
> -       PixelFormat _format;
> -       Surface _surface;
> -       // Loading helpers
> -       bool readHeader(Common::SeekableReadStream &tga, byte &imageType,
> byte &pixelDepth);
> -       bool readData(Common::SeekableReadStream &tga, byte imageType,
> byte pixelDepth);
> -       bool readDataColorMapped(Common::SeekableReadStream &tga, byte
> imageType, byte indexDepth);
> -       bool readDataRLE(Common::SeekableReadStream &tga, byte imageType,
> byte pixelDepth);
> -       bool readColorMap(Common::SeekableReadStream &tga, byte imageType,
> byte pixelDepth);
> -};
> -
> -} // End of namespace Graphics
> -
> -#endif // GRAPHICS_DECODERS_TGA_H
> diff --git a/graphics/module.mk b/graphics/module.mk
> index 8b63435..5918775 100644
> --- a/graphics/module.mk
> +++ b/graphics/module.mk
> @@ -21,14 +21,7 @@ MODULE_OBJS := \
>         VectorRenderer.o \
>         VectorRendererSpec.o \
>         wincursor.o \
> -       yuv_to_rgb.o \
> -       decoders/bmp.o \
> -       decoders/iff.o \
> -       decoders/jpeg.o \
> -       decoders/pcx.o \
> -       decoders/pict.o \
> -       decoders/png.o \
> -       decoders/tga.o
> +       yuv_to_rgb.o
>
>  ifdef USE_SCALERS
>  MODULE_OBJS += \
> diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
> index 9fe482d..9e54597 100644
> --- a/gui/ThemeEngine.cpp
> +++ b/gui/ThemeEngine.cpp
> @@ -34,7 +34,8 @@
>  #include "graphics/VectorRenderer.h"
>  #include "graphics/fonts/bdf.h"
>  #include "graphics/fonts/ttf.h"
> -#include "graphics/decoders/bmp.h"
> +
> +#include "image/bmp.h"
>
>  #include "gui/widget.h"
>  #include "gui/ThemeEngine.h"
> @@ -638,7 +639,7 @@ bool ThemeEngine::addBitmap(const Common::String
> &filename) {
>                 return true;
>
>         // If not, try to load the bitmap via the BitmapDecoder class.
> -       Graphics::BitmapDecoder bitmapDecoder;
> +       Image::BitmapDecoder bitmapDecoder;
>         const Graphics::Surface *srcSurface = 0;
>         Common::ArchiveMemberList members;
>         _themeFiles.listMatchingMembers(members, filename);
> diff --git a/image/bmp.cpp b/image/bmp.cpp
> new file mode 100644
> index 0000000..113e268
> --- /dev/null
> +++ b/image/bmp.cpp
> @@ -0,0 +1,183 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "image/bmp.h"
> +
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +#include "graphics/pixelformat.h"
> +#include "graphics/surface.h"
> +
> +namespace Image {
> +
> +BitmapDecoder::BitmapDecoder() {
> +       _surface = 0;
> +       _palette = 0;
> +       _paletteColorCount = 0;
> +}
> +
> +BitmapDecoder::~BitmapDecoder() {
> +       destroy();
> +}
> +
> +void BitmapDecoder::destroy() {
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface; _surface = 0;
> +       }
> +
> +       delete[] _palette; _palette = 0;
> +       _paletteColorCount = 0;
> +}
> +
> +bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
> +       destroy();
> +
> +       if (stream.readByte() != 'B')
> +               return false;
> +
> +       if (stream.readByte() != 'M')
> +               return false;
> +
> +       /* uint32 fileSize = */ stream.readUint32LE();
> +       /* uint16 res1 = */ stream.readUint16LE();
> +       /* uint16 res2 = */ stream.readUint16LE();
> +       uint32 imageOffset = stream.readUint32LE();
> +
> +       uint32 infoSize = stream.readUint32LE();
> +       if (infoSize != 40) {
> +               warning("Only Windows v3 bitmaps are supported");
> +               return false;
> +       }
> +
> +       uint32 width = stream.readUint32LE();
> +       int32 height = stream.readSint32LE();
> +
> +       if (width == 0 || height == 0)
> +               return false;
> +
> +       if (height < 0) {
> +               warning("Right-side up bitmaps not supported");
> +               return false;
> +       }
> +
> +       /* uint16 planes = */ stream.readUint16LE();
> +       uint16 bitsPerPixel = stream.readUint16LE();
> +
> +       if (bitsPerPixel != 8 && bitsPerPixel != 24 && bitsPerPixel != 32)
> {
> +               warning("%dbpp bitmaps not supported", bitsPerPixel);
> +               return false;
> +       }
> +
> +       uint32 compression = stream.readUint32LE();
> +
> +       if (compression != 0) {
> +               warning("Compressed bitmaps not supported");
> +               return false;
> +       }
> +
> +       /* uint32 imageSize = */ stream.readUint32LE();
> +       /* uint32 pixelsPerMeterX = */ stream.readUint32LE();
> +       /* uint32 pixelsPerMeterY = */ stream.readUint32LE();
> +       _paletteColorCount = stream.readUint32LE();
> +       /* uint32 colorsImportant = */ stream.readUint32LE();
> +
> +       if (bitsPerPixel == 8) {
> +               if (_paletteColorCount == 0)
> +                       _paletteColorCount = 256;
> +
> +               // Read the palette
> +               _palette = new byte[_paletteColorCount * 3];
> +               for (uint16 i = 0; i < _paletteColorCount; i++) {
> +                       _palette[i * 3 + 2] = stream.readByte();
> +                       _palette[i * 3 + 1] = stream.readByte();
> +                       _palette[i * 3 + 0] = stream.readByte();
> +                       stream.readByte();
> +               }
> +       }
> +
> +       // Start us at the beginning of the image
> +       stream.seek(imageOffset);
> +
> +       Graphics::PixelFormat format =
> Graphics::PixelFormat::createFormatCLUT8();
> +
> +       // BGRA for 24bpp and 32 bpp
> +       if (bitsPerPixel == 24 || bitsPerPixel == 32)
> +               format = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24,
> 0);
> +
> +       _surface = new Graphics::Surface();
> +       _surface->create(width, height, format);
> +
> +       int srcPitch = width * (bitsPerPixel >> 3);
> +       const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) :
> 0;
> +
> +       if (bitsPerPixel == 8) {
> +               byte *dst = (byte *)_surface->getPixels();
> +
> +               for (int32 i = 0; i < height; i++) {
> +                       stream.read(dst + (height - i - 1) * width, width);
> +                       stream.skip(extraDataLength);
> +               }
> +       } else if (bitsPerPixel == 24) {
> +               byte *dst = (byte *)_surface->getBasePtr(0, height - 1);
> +
> +               for (int32 i = 0; i < height; i++) {
> +                       for (uint32 j = 0; j < width; j++) {
> +                               byte b = stream.readByte();
> +                               byte g = stream.readByte();
> +                               byte r = stream.readByte();
> +                               uint32 color = format.RGBToColor(r, g, b);
> +
> +                               *((uint32 *)dst) = color;
> +                               dst += format.bytesPerPixel;
> +                       }
> +
> +                       stream.skip(extraDataLength);
> +                       dst -= _surface->pitch * 2;
> +               }
> +       } else { // 32 bpp
> +               byte *dst = (byte *)_surface->getBasePtr(0, height - 1);
> +
> +               for (int32 i = 0; i < height; i++) {
> +                       for (uint32 j = 0; j < width; j++) {
> +                               byte b = stream.readByte();
> +                               byte g = stream.readByte();
> +                               byte r = stream.readByte();
> +                               // Ignore the last byte, as in v3 it is
> unused
> +                               // and should thus NOT be used as alpha.
> +                               // ref:
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx
> +                               stream.readByte();
> +                               uint32 color = format.RGBToColor(r, g, b);
> +
> +                               *((uint32 *)dst) = color;
> +                               dst += format.bytesPerPixel;
> +                       }
> +
> +                       stream.skip(extraDataLength);
> +                       dst -= _surface->pitch * 2;
> +               }
> +       }
> +
> +       return true;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/bmp.h b/image/bmp.h
> new file mode 100644
> index 0000000..bc4cfc3
> --- /dev/null
> +++ b/image/bmp.h
> @@ -0,0 +1,68 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +/**
> + * @file
> + * Image decoder used in engines:
> + *  - hugo
> + *  - mohawk
> + *  - wintermute
> + */
> +
> +#ifndef IMAGE_BMP_H
> +#define IMAGE_BMP_H
> +
> +#include "common/scummsys.h"
> +#include "common/str.h"
> +#include "image/image_decoder.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Graphics {
> +struct Surface;
> +}
> +
> +namespace Image {
> +
> +class BitmapDecoder : public ImageDecoder {
> +public:
> +       BitmapDecoder();
> +       virtual ~BitmapDecoder();
> +
> +       // ImageDecoder API
> +       void destroy();
> +       virtual bool loadStream(Common::SeekableReadStream &stream);
> +       virtual const Graphics::Surface *getSurface() const { return
> _surface; }
> +       const byte *getPalette() const { return _palette; }
> +       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> +
> +private:
> +       Graphics::Surface *_surface;
> +       byte *_palette;
> +       uint16 _paletteColorCount;
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/iff.cpp b/image/iff.cpp
> new file mode 100644
> index 0000000..d93e9ff
> --- /dev/null
> +++ b/image/iff.cpp
> @@ -0,0 +1,244 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "image/iff.h"
> +
> +#include "common/iff_container.h"
> +#include "common/stream.h"
> +#include "common/util.h"
> +
> +namespace Image {
> +
> +IFFDecoder::IFFDecoder() {
> +       _surface = 0;
> +       _palette = 0;
> +
> +       // these 2 properties are not reset by destroy(), so the default
> is set here.
> +       _numRelevantPlanes = 8;
> +       _pixelPacking = false;
> +
> +       destroy();
> +}
> +
> +IFFDecoder::~IFFDecoder() {
> +       destroy();
> +}
> +
> +void IFFDecoder::destroy() {
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +               _surface = 0;
> +       }
> +
> +       if (_palette) {
> +               delete[] _palette;
> +               _palette = 0;
> +       }
> +
> +       memset(&_header, 0, sizeof(Header));
> +       _paletteRanges.clear();
> +       _type = TYPE_UNKNOWN;
> +       _paletteColorCount = 0;
> +}
> +
> +bool IFFDecoder::loadStream(Common::SeekableReadStream &stream) {
> +       destroy();
> +
> +       const uint32 form = stream.readUint32BE();
> +
> +       if (form != ID_FORM) {
> +               warning("Failed reading IFF-file");
> +               return false;
> +       }
> +
> +       stream.skip(4);
> +
> +       const uint32 type = stream.readUint32BE();
> +
> +       switch (type) {
> +               case ID_ILBM:
> +                       _type = TYPE_ILBM;
> +                       break;
> +               case ID_PBM:
> +                       _type = TYPE_PBM;
> +                       break;
> +       }
> +
> +       if (type == TYPE_UNKNOWN) {
> +               warning("Failed reading IFF-file");
> +               return false;
> +       }
> +
> +       while (1) {
> +               const uint32 chunkType = stream.readUint32BE();
> +               const uint32 chunkSize = stream.readUint32BE();
> +
> +               if (stream.eos())
> +                       break;
> +
> +               switch (chunkType) {
> +               case ID_BMHD:
> +                       loadHeader(stream);
> +                       break;
> +               case ID_CMAP:
> +                       loadPalette(stream, chunkSize);
> +                       break;
> +               case ID_CRNG:
> +                       loadPaletteRange(stream, chunkSize);
> +                       break;
> +               case ID_BODY:
> +                       loadBitmap(stream);
> +                       break;
> +               default:
> +                       stream.skip(chunkSize);
> +               }
> +       }
> +
> +       return true;
> +}
> +
> +void IFFDecoder::loadHeader(Common::SeekableReadStream &stream) {
> +       _header.width = stream.readUint16BE();
> +       _header.height = stream.readUint16BE();
> +       _header.x = stream.readUint16BE();
> +       _header.y = stream.readUint16BE();
> +       _header.numPlanes = stream.readByte();
> +       _header.masking = stream.readByte();
> +       _header.compression = stream.readByte();
> +       _header.flags = stream.readByte();
> +       _header.transparentColor = stream.readUint16BE();
> +       _header.xAspect = stream.readByte();
> +       _header.yAspect = stream.readByte();
> +       _header.pageWidth = stream.readUint16BE();
> +       _header.pageHeight = stream.readUint16BE();
> +
> +       assert(_header.width >= 1);
> +       assert(_header.height >= 1);
> +       assert(_header.numPlanes >= 1 && _header.numPlanes <= 8 &&
> _header.numPlanes != 7);
> +}
> +
> +void IFFDecoder::loadPalette(Common::SeekableReadStream &stream, const
> uint32 size) {
> +       _palette = new byte[size];
> +       stream.read(_palette, size);
> +       _paletteColorCount = size / 3;
> +}
> +
> +void IFFDecoder::loadPaletteRange(Common::SeekableReadStream &stream,
> const uint32 size) {
> +       PaletteRange range;
> +
> +       range.timer = stream.readSint16BE();
> +       range.step = stream.readSint16BE();
> +       range.flags = stream.readSint16BE();
> +       range.first = stream.readByte();
> +       range.last = stream.readByte();
> +
> +       _paletteRanges.push_back(range);
> +}
> +
> +void IFFDecoder::loadBitmap(Common::SeekableReadStream &stream) {
> +       _numRelevantPlanes = MIN(_numRelevantPlanes, _header.numPlanes);
> +
> +       if (_numRelevantPlanes != 1 && _numRelevantPlanes != 2 &&
> _numRelevantPlanes != 4)
> +               _pixelPacking = false;
> +
> +       uint16 outPitch = _header.width;
> +
> +       if (_pixelPacking)
> +               outPitch /= (8 / _numRelevantPlanes);
> +
> +       // FIXME: CLUT8 is not a proper format for packed bitmaps but
> there is no way to tell it to use 1, 2 or 4 bits per pixel
> +       _surface = new Graphics::Surface();
> +       _surface->create(outPitch, _header.height,
> Graphics::PixelFormat::createFormatCLUT8());
> +
> +       if (_type == TYPE_ILBM) {
> +               uint32 scanlinePitch = ((_header.width + 15) >> 4) << 1;
> +               byte *scanlines = new byte[scanlinePitch *
> _header.numPlanes];
> +               byte *data = (byte *)_surface->getPixels();
> +
> +               for (uint16 i = 0; i < _header.height; ++i) {
> +                       byte *scanline = scanlines;
> +
> +                       for (uint16 j = 0; j < _header.numPlanes; ++j) {
> +                               uint16 outSize = scanlinePitch;
> +
> +                               if (_header.compression) {
> +                                       Common::PackBitsReadStream
> packStream(stream);
> +                                       packStream.read(scanline, outSize);
> +                               } else {
> +                                       stream.read(scanline, outSize);
> +                               }
> +
> +                               scanline += outSize;
> +                       }
> +
> +                       packPixels(scanlines, data, scanlinePitch,
> outPitch);
> +                       data += outPitch;
> +               }
> +
> +               delete[] scanlines;
> +       } else if (_type == TYPE_PBM) {
> +               byte *data = (byte *)_surface->getPixels();
> +               uint32 outSize = _header.width * _header.height;
> +
> +               if (_header.compression) {
> +                       Common::PackBitsReadStream packStream(stream);
> +                       packStream.read(data, outSize);
> +               } else {
> +                       stream.read(data, outSize);
> +               }
> +       }
> +}
> +
> +void IFFDecoder::packPixels(byte *scanlines, byte *data, const uint16
> scanlinePitch, const uint16 outPitch) {
> +       uint32 numPixels = _header.width;
> +
> +       if (_pixelPacking)
> +               numPixels = outPitch * (8 / _numRelevantPlanes);
> +
> +       for (uint32 x = 0; x < numPixels; ++x) {
> +               byte *scanline = scanlines;
> +               byte pixel = 0;
> +               byte offset = x >> 3;
> +               byte bit = 0x80 >> (x & 7);
> +
> +               // first build a pixel by scanning all the usable planes
> in the input
> +               for (uint32 plane = 0; plane < _numRelevantPlanes;
> ++plane) {
> +                       if (scanline[offset] & bit)
> +                               pixel |= (1 << plane);
> +
> +                       scanline += scanlinePitch;
> +               }
> +
> +               // then output the pixel according to the requested packing
> +               if (!_pixelPacking)
> +                       data[x] = pixel;
> +               else if (_numRelevantPlanes == 1)
> +                       data[x / 8] |= (pixel << (x & 7));
> +               else if (_numRelevantPlanes == 2)
> +                       data[x / 4] |= (pixel << ((x & 3) << 1));
> +               else if (_numRelevantPlanes == 4)
> +                       data[x / 2] |= (pixel << ((x & 1) << 2));
> +       }
> +}
> +
> +} // End of namespace Image
> diff --git a/image/iff.h b/image/iff.h
> new file mode 100644
> index 0000000..3d342b3
> --- /dev/null
> +++ b/image/iff.h
> @@ -0,0 +1,126 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +/**
> + * @file
> + * Image decoder used in engines:
> + *  - gob
> + *  - parallaction
> + *  - queen
> + *  - saga
> + */
> +
> +#ifndef IMAGE_IFF_H
> +#define IMAGE_IFF_H
> +
> +#include "common/array.h"
> +#include "common/endian.h"
> +#include "graphics/surface.h"
> +
> +#include "image/image_decoder.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Graphics {
> +struct Surface;
> +}
> +
> +namespace Image {
> +
> +class IFFDecoder : public ImageDecoder {
> +public:
> +       struct Header {
> +               uint16 width, height;
> +               uint16 x, y;
> +               byte numPlanes;
> +               byte masking;
> +               byte compression;
> +               byte flags;
> +               uint16 transparentColor;
> +               byte xAspect, yAspect;
> +               uint16 pageWidth, pageHeight;
> +       };
> +
> +       struct PaletteRange {
> +               int16  timer, step, flags;
> +               byte first, last;
> +       };
> +
> +       enum Type {
> +               TYPE_UNKNOWN = 0,
> +               TYPE_ILBM,
> +               TYPE_PBM
> +       };
> +
> +       IFFDecoder();
> +       virtual ~IFFDecoder();
> +
> +       // ImageDecoder API
> +       void destroy();
> +       bool loadStream(Common::SeekableReadStream &stream);
> +       const Header *getHeader() const { return &_header; }
> +       const Graphics::Surface *getSurface() const { return _surface; }
> +       const byte *getPalette() const { return _palette; }
> +       const Common::Array<PaletteRange> &getPaletteRanges() const {
> return _paletteRanges; }
> +       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> +
> +       /**
> +       * The number of planes to decode, also determines the pixel
> packing if _packPixels is true.
> +       * 8 == decode all planes, map 1 pixel in 1 byte. (default, no
> packing even if _packPixels is true)
> +       *
> +       * NOTE: this property must be reset manually, and is not reset by
> a call to destroy().
> +       */
> +       void setNumRelevantPlanes(const uint8 numRelevantPlanes) {
> _numRelevantPlanes = numRelevantPlanes; }
> +
> +       /**
> +       * Enables pixel packing, the amount of packing is determined by
> _numRelevantPlanes
> +       * 1 == decode first plane, pack 8 pixels in 1 byte. This makes
> _surface->w 1/8th of _header.width
> +       * 2 == decode first 2 planes, pack 4 pixels in 1 byte. This makes
> _surface->w 1/4th of _header.width
> +       * 4 == decode first 4 planes, pack 2 pixels in 1 byte. This makes
> _surface->w half of _header.width
> +       * Packed bitmaps won't have a proper surface format since there is
> no way to tell it to use 1, 2 or 4 bits per pixel
> +       *
> +       * NOTE: this property must be reset manually, and is not reset by
> a call to destroy().
> +       */
> +       void setPixelPacking(const bool pixelPacking) { _pixelPacking =
> pixelPacking; }
> +private:
> +
> +       Header _header;
> +       Graphics::Surface *_surface;
> +       byte *_palette;
> +       Common::Array<PaletteRange> _paletteRanges;
> +       Type _type;
> +       uint16 _paletteColorCount;
> +       uint8 _numRelevantPlanes;
> +       bool _pixelPacking;
> +
> +       void loadHeader(Common::SeekableReadStream &stream);
> +       void loadPalette(Common::SeekableReadStream &stream, const uint32
> size);
> +       void loadPaletteRange(Common::SeekableReadStream &stream, const
> uint32 size);
> +       void loadBitmap(Common::SeekableReadStream &stream);
> +       void packPixels(byte *scanlines, byte *data, const uint16
> scanlinePitch, const uint16 outPitch);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/image_decoder.h b/image/image_decoder.h
> new file mode 100644
> index 0000000..08fa4d8
> --- /dev/null
> +++ b/image/image_decoder.h
> @@ -0,0 +1,106 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_IMAGEDECODER_H
> +#define IMAGE_IMAGEDECODER_H
> +
> +#include "common/scummsys.h"
> +#include "common/str.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Graphics {
> +struct Surface;
> +}
> +
> +namespace Image {
> +
> +/**
> + * A representation of an image decoder that maintains ownership of the
> surface
> + * and palette it decodes to.
> + */
> +class ImageDecoder {
> +public:
> +       virtual ~ImageDecoder() {}
> +
> +       /**
> +        * Load an image from the specified stream
> +        *
> +        * loadStream() should implicitly call destroy() to free the memory
> +        * of the last loadStream() call.
> +        *
> +        * @param stream the input stream
> +        * @return whether loading the file succeeded
> +        * @see getSurface
> +        * @see getPalette
> +        */
> +       virtual bool loadStream(Common::SeekableReadStream &stream) = 0;
> +
> +       /**
> +        * Destroy this decoder's surface and palette
> +        *
> +        * This should be called by a loadStream() implementation as well
> +        * as the destructor.
> +        */
> +       virtual void destroy() = 0;
> +
> +       /**
> +        * Get the decoded surface
> +        *
> +        * This surface is owned by this ImageDecoder and will remain valid
> +        * until destroy() or loadStream() is called, or until this
> ImageDecoder's
> +        * destructor is called.
> +        *
> +        * @return the decoded surface, or 0 if no surface is present
> +        */
> +       virtual const Graphics::Surface *getSurface() const = 0;
> +
> +       /**
> +        * Get the decoded palette
> +        *
> +        * This palette is owned by this ImageDecoder and will remain valid
> +        * until destroy() or loadStream() is called, or until this
> ImageDecoder's
> +        * destructor is called.
> +        *
> +        * The palette's format is the same as PaletteManager's palette
> +        * (interleaved RGB values).
> +        *
> +        * @return the decoded palette, or undefined if no palette is
> present
> +        */
> +       virtual const byte *getPalette() const { return 0; }
> +
> +       /**
> +        * Query if the decoded image has a palette.
> +        */
> +       virtual bool hasPalette() const { return getPaletteColorCount() !=
> 0; }
> +
> +       /** Return the starting index of the palette. */
> +       virtual byte getPaletteStartIndex() const { return 0; }
> +       /** Return the number of colors in the palette. */
> +       virtual uint16 getPaletteColorCount() const { return 0; }
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/jpeg.cpp b/image/jpeg.cpp
> new file mode 100644
> index 0000000..9d4b0a7
> --- /dev/null
> +++ b/image/jpeg.cpp
> @@ -0,0 +1,266 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// libjpeg uses forbidden symbols in its header. Thus, we need to allow
> them
> +// here.
> +#define FORBIDDEN_SYMBOL_ALLOW_ALL
> +
> +#include "image/jpeg.h"
> +
> +#include "common/debug.h"
> +#include "common/endian.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +#include "graphics/pixelformat.h"
> +
> +#ifdef USE_JPEG
> +// The original release of libjpeg v6b did not contain any extern "C" in
> case
> +// its header files are included in a C++ environment. To avoid any
> linking
> +// issues we need to add it on our own.
> +extern "C" {
> +#include <jpeglib.h>
> +#include <jerror.h>
> +}
> +#endif
> +
> +namespace Image {
> +
> +JPEGDecoder::JPEGDecoder() : ImageDecoder(), _surface(),
> _colorSpace(kColorSpaceRGBA) {
> +}
> +
> +JPEGDecoder::~JPEGDecoder() {
> +       destroy();
> +}
> +
> +const Graphics::Surface *JPEGDecoder::getSurface() const {
> +       return &_surface;
> +}
> +
> +void JPEGDecoder::destroy() {
> +       _surface.free();
> +}
> +
> +#ifdef USE_JPEG
> +namespace {
> +
> +#define JPEG_BUFFER_SIZE 4096
> +
> +struct StreamSource : public jpeg_source_mgr {
> +       Common::SeekableReadStream *stream;
> +       bool startOfFile;
> +       JOCTET buffer[JPEG_BUFFER_SIZE];
> +};
> +
> +void initSource(j_decompress_ptr cinfo) {
> +       StreamSource *source = (StreamSource *)cinfo->src;
> +       source->startOfFile = true;
> +}
> +
> +boolean fillInputBuffer(j_decompress_ptr cinfo) {
> +       StreamSource *source = (StreamSource *)cinfo->src;
> +
> +       uint32 bufferSize = source->stream->read((byte *)source->buffer,
> sizeof(source->buffer));
> +       if (bufferSize == 0) {
> +               if (source->startOfFile) {
> +                       // An empty file is a fatal error
> +                       ERREXIT(cinfo, JERR_INPUT_EMPTY);
> +               } else {
> +                       // Otherwise we insert an EOF marker
> +                       WARNMS(cinfo, JWRN_JPEG_EOF);
> +                       source->buffer[0] = (JOCTET)0xFF;
> +                       source->buffer[1] = (JOCTET)JPEG_EOI;
> +                       bufferSize = 2;
> +               }
> +       }
> +
> +       source->next_input_byte = source->buffer;
> +       source->bytes_in_buffer = bufferSize;
> +       source->startOfFile = false;
> +
> +       return TRUE;
> +}
> +
> +void skipInputData(j_decompress_ptr cinfo, long numBytes) {
> +       StreamSource *source = (StreamSource *)cinfo->src;
> +
> +       if (numBytes > 0) {
> +               if (numBytes > (long)source->bytes_in_buffer) {
> +                       // In case we need to skip more bytes than there
> are in the buffer
> +                       // we will skip the remaining data and fill the
> buffer again
> +                       numBytes -= (long)source->bytes_in_buffer;
> +
> +                       // Skip the remaining bytes
> +                       source->stream->skip(numBytes);
> +
> +                       // Fill up the buffer again
> +                       (*source->fill_input_buffer)(cinfo);
> +               } else {
> +                       source->next_input_byte += (size_t)numBytes;
> +                       source->bytes_in_buffer -= (size_t)numBytes;
> +               }
> +
> +       }
> +}
> +
> +void termSource(j_decompress_ptr cinfo) {
> +}
> +
> +void jpeg_scummvm_src(j_decompress_ptr cinfo, Common::SeekableReadStream
> *stream) {
> +       StreamSource *source;
> +
> +       // Initialize the source in case it has not been done yet.
> +       if (cinfo->src == NULL) {
> +               cinfo->src = (jpeg_source_mgr
> *)(*cinfo->mem->alloc_small)((j_common_ptr)cinfo, JPOOL_PERMANENT,
> sizeof(StreamSource));
> +       }
> +
> +       source = (StreamSource *)cinfo->src;
> +       source->init_source       = &initSource;
> +       source->fill_input_buffer = &fillInputBuffer;
> +       source->skip_input_data   = &skipInputData;
> +       source->resync_to_restart = &jpeg_resync_to_restart;
> +       source->term_source       = &termSource;
> +       source->bytes_in_buffer   = 0;
> +       source->next_input_byte   = NULL;
> +
> +       source->stream = stream;
> +}
> +
> +void errorExit(j_common_ptr cinfo) {
> +       char buffer[JMSG_LENGTH_MAX];
> +       (*cinfo->err->format_message)(cinfo, buffer);
> +       // This function is not allowed to return to the caller, thus we
> simply
> +       // error out with our error handling here.
> +       error("%s", buffer);
> +}
> +
> +void outputMessage(j_common_ptr cinfo) {
> +       char buffer[JMSG_LENGTH_MAX];
> +       (*cinfo->err->format_message)(cinfo, buffer);
> +       // Is using debug here a good idea? Or do we want to ignore all
> libjpeg
> +       // messages?
> +       debug(3, "libjpeg: %s", buffer);
> +}
> +
> +} // End of anonymous namespace
> +#endif
> +
> +bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) {
> +#ifdef USE_JPEG
> +       // Reset member variables from previous decodings
> +       destroy();
> +
> +       jpeg_decompress_struct cinfo;
> +       jpeg_error_mgr jerr;
> +
> +       // Initialize error handling callbacks
> +       cinfo.err = jpeg_std_error(&jerr);
> +       cinfo.err->error_exit = &errorExit;
> +       cinfo.err->output_message = &outputMessage;
> +
> +       // Initialize the decompression structure
> +       jpeg_create_decompress(&cinfo);
> +
> +       // Initialize our buffer handling
> +       jpeg_scummvm_src(&cinfo, &stream);
> +
> +       // Read the file header
> +       jpeg_read_header(&cinfo, TRUE);
> +
> +       // We can request YUV output because Groovie requires it
> +       switch (_colorSpace) {
> +       case kColorSpaceRGBA:
> +               cinfo.out_color_space = JCS_RGB;
> +               break;
> +
> +       case kColorSpaceYUV:
> +               cinfo.out_color_space = JCS_YCbCr;
> +               break;
> +       }
> +
> +       // Actually start decompressing the image
> +       jpeg_start_decompress(&cinfo);
> +
> +       // Allocate buffers for the output data
> +       switch (_colorSpace) {
> +       case kColorSpaceRGBA:
> +               // We use RGBA8888 in this scenario
> +               _surface.create(cinfo.output_width, cinfo.output_height,
> Graphics::PixelFormat(4, 8, 8, 8, 0, 24, 16, 8, 0));
> +               break;
> +
> +       case kColorSpaceYUV:
> +               // We use YUV with 3 bytes per pixel otherwise.
> +               // This is pretty ugly since our PixelFormat cannot
> express YUV...
> +               _surface.create(cinfo.output_width, cinfo.output_height,
> Graphics::PixelFormat(3, 0, 0, 0, 0, 0, 0, 0, 0));
> +               break;
> +       }
> +
> +       // Allocate buffer for one scanline
> +       assert(cinfo.output_components == 3);
> +       JDIMENSION pitch = cinfo.output_width * cinfo.output_components;
> +       assert(_surface.pitch >= pitch);
> +       JSAMPARRAY buffer =
> (*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo, JPOOL_IMAGE, pitch, 1);
> +
> +       // Go through the image data scanline by scanline
> +       while (cinfo.output_scanline < cinfo.output_height) {
> +               byte *dst = (byte *)_surface.getBasePtr(0,
> cinfo.output_scanline);
> +
> +               jpeg_read_scanlines(&cinfo, buffer, 1);
> +
> +               const byte *src = buffer[0];
> +               switch (_colorSpace) {
> +               case kColorSpaceRGBA: {
> +                       for (int remaining = cinfo.output_width; remaining
> > 0; --remaining) {
> +                               byte r = *src++;
> +                               byte g = *src++;
> +                               byte b = *src++;
> +                               // We need to insert a alpha value of 255
> (opaque) here.
> +#ifdef SCUMM_BIG_ENDIAN
> +                               *dst++ = r;
> +                               *dst++ = g;
> +                               *dst++ = b;
> +                               *dst++ = 0xFF;
> +#else
> +                               *dst++ = 0xFF;
> +                               *dst++ = b;
> +                               *dst++ = g;
> +                               *dst++ = r;
> +#endif
> +                       }
> +                       } break;
> +
> +               case kColorSpaceYUV:
> +                       memcpy(dst, src, pitch);
> +                       break;
> +               }
> +       }
> +
> +       // We are done with decompressing, thus free all the data
> +       jpeg_finish_decompress(&cinfo);
> +       jpeg_destroy_decompress(&cinfo);
> +
> +       return true;
> +#else
> +       return false;
> +#endif
> +}
> +
> +} // End of Graphics namespace
> diff --git a/image/jpeg.h b/image/jpeg.h
> new file mode 100644
> index 0000000..f578170
> --- /dev/null
> +++ b/image/jpeg.h
> @@ -0,0 +1,95 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +/**
> + * @file
> + * Image decoder used in engines:
> + *  - groovie
> + *  - mohawk
> + *  - wintermute
> + */
> +
> +#ifndef IMAGE_JPEG_H
> +#define IMAGE_JPEG_H
> +
> +#include "graphics/surface.h"
> +#include "image/image_decoder.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Image {
> +
> +class JPEGDecoder : public ImageDecoder {
> +public:
> +       JPEGDecoder();
> +       ~JPEGDecoder();
> +
> +       // ImageDecoder API
> +       virtual void destroy();
> +       virtual bool loadStream(Common::SeekableReadStream &str);
> +       virtual const Graphics::Surface *getSurface() const;
> +
> +       // Special API for JPEG
> +       enum ColorSpace {
> +               /**
> +                * Output 32bit RGBA data.
> +                *
> +                * This is the default output.
> +                */
> +               kColorSpaceRGBA,
> +
> +               /**
> +                * Output (interleaved) YUV data.
> +                *
> +                * Be aware that some images cannot be output in YUV mode.
> +                * These are (non-standard) JPEG images which are in RGB
> colorspace.
> +                *
> +                * The resulting Surface will have a PixelFormat with 3
> bytes per
> +                * pixel and the remaining entries are completely zeroed.
> This works
> +                * around the fact that PixelFormat can only describe RGB
> formats.
> +                *
> +                * You should only use this when you are really aware of
> what you are
> +                * doing!
> +                */
> +               kColorSpaceYUV
> +       };
> +
> +       /**
> +        * Request the output color space. This can be used to obtain raw
> YUV
> +        * data from the JPEG file. But this might not work for all files!
> +        *
> +        * The decoder itself defaults to RGBA.
> +        *
> +        * @param outSpace The color space to output.
> +        */
> +       void setOutputColorSpace(ColorSpace outSpace) { _colorSpace =
> outSpace; }
> +
> +private:
> +       Graphics::Surface _surface;
> +       ColorSpace _colorSpace;
> +};
> +
> +} // End of Graphics namespace
> +
> +#endif // GRAPHICS_JPEG_H
> diff --git a/image/module.mk b/image/module.mk
> new file mode 100644
> index 0000000..22febe1
> --- /dev/null
> +++ b/image/module.mk
> @@ -0,0 +1,13 @@
> +MODULE := image
> +
> +MODULE_OBJS := \
> +       bmp.o \
> +       iff.o \
> +       jpeg.o \
> +       pcx.o \
> +       pict.o \
> +       png.o \
> +       tga.o
> +
> +# Include common rules
> +include $(srcdir)/rules.mk
> diff --git a/image/pcx.cpp b/image/pcx.cpp
> new file mode 100644
> index 0000000..282a6c6
> --- /dev/null
> +++ b/image/pcx.cpp
> @@ -0,0 +1,214 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "image/pcx.h"
> +
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +#include "graphics/pixelformat.h"
> +#include "graphics/surface.h"
> +
> +/**
> + * Based on the PCX specs:
> + *
> http://www.fileformat.info/format/pcx/spec/a10e75307b3a4cc49c3bbe6db4c41fa2/view.htm
> + * and the PCX decoder of FFmpeg (libavcodec/pcx.c):
> + * http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/pcx.c
> + */
> +
> +namespace Image {
> +
> +PCXDecoder::PCXDecoder() {
> +       _surface = 0;
> +       _palette = 0;
> +       _paletteColorCount = 0;
> +}
> +
> +PCXDecoder::~PCXDecoder() {
> +       destroy();
> +}
> +
> +void PCXDecoder::destroy() {
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +               _surface = 0;
> +       }
> +
> +       delete[] _palette;
> +       _palette = 0;
> +       _paletteColorCount = 0;
> +}
> +
> +bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) {
> +       destroy();
> +
> +       if (stream.readByte() != 0x0a)  // ZSoft PCX
> +               return false;
> +
> +       byte version = stream.readByte();       // 0 - 5
> +       if (version > 5)
> +               return false;
> +
> +       bool compressed = stream.readByte(); // encoding, 1 = run length
> encoding
> +       byte bitsPerPixel = stream.readByte();  // 1, 2, 4 or 8
> +
> +       // Window
> +       uint16 xMin = stream.readUint16LE();
> +       uint16 yMin = stream.readUint16LE();
> +       uint16 xMax = stream.readUint16LE();
> +       uint16 yMax = stream.readUint16LE();
> +
> +       uint16 width  = xMax - xMin + 1;
> +       uint16 height = yMax - yMin + 1;
> +
> +       if (xMax < xMin || yMax < yMin) {
> +               warning("Invalid PCX image dimensions");
> +               return false;
> +       }
> +
> +       stream.skip(4); // HDpi, VDpi
> +
> +       // Read the EGA palette (colormap)
> +       _palette = new byte[16 * 3];
> +       for (uint16 i = 0; i < 16; i++) {
> +               _palette[i * 3 + 0] = stream.readByte();
> +               _palette[i * 3 + 1] = stream.readByte();
> +               _palette[i * 3 + 2] = stream.readByte();
> +       }
> +
> +       if (stream.readByte() != 0)     // reserved, should be set to 0
> +               return false;
> +
> +       byte nPlanes = stream.readByte();
> +       uint16 bytesPerLine = stream.readUint16LE();
> +       uint16 bytesPerscanLine = nPlanes * bytesPerLine;
> +
> +       if (bytesPerscanLine < width * bitsPerPixel * nPlanes / 8) {
> +               warning("PCX data is corrupted");
> +               return false;
> +       }
> +
> +       stream.skip(60);        // PaletteInfo, HscreenSize, VscreenSize,
> Filler
> +
> +       _surface = new Graphics::Surface();
> +
> +       byte *scanLine = new byte[bytesPerscanLine];
> +       byte *dst;
> +       int x, y;
> +
> +       if (nPlanes == 3 && bitsPerPixel == 8) {        // 24bpp
> +               Graphics::PixelFormat format = Graphics::PixelFormat(4, 8,
> 8, 8, 8, 24, 16, 8, 0);
> +               _surface->create(width, height, format);
> +               dst = (byte *)_surface->getPixels();
> +               _paletteColorCount = 0;
> +
> +               for (y = 0; y < height; y++) {
> +                       decodeRLE(stream, scanLine, bytesPerscanLine,
> compressed);
> +
> +                       for (x = 0; x < width; x++) {
> +                               byte b = scanLine[x];
> +                               byte g = scanLine[x +  bytesPerLine];
> +                               byte r = scanLine[x + (bytesPerLine << 1)];
> +                               uint32 color = format.RGBToColor(r, g, b);
> +
> +                               *((uint32 *)dst) = color;
> +                               dst += format.bytesPerPixel;
> +                       }
> +               }
> +       } else if (nPlanes == 1 && bitsPerPixel == 8) { // 8bpp indexed
> +               _surface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> +               dst = (byte *)_surface->getPixels();
> +               _paletteColorCount = 16;
> +
> +               for (y = 0; y < height; y++, dst += _surface->pitch) {
> +                       decodeRLE(stream, scanLine, bytesPerscanLine,
> compressed);
> +                       memcpy(dst, scanLine, width);
> +               }
> +
> +               if (version == 5) {
> +                       if (stream.readByte() != 12) {
> +                               warning("Expected a palette after the PCX
> image data");
> +                               delete[] scanLine;
> +                               return false;
> +                       }
> +
> +                       // Read the VGA palette
> +                       delete[] _palette;
> +                       _palette = new byte[256 * 3];
> +                       for (uint16 i = 0; i < 256; i++) {
> +                               _palette[i * 3 + 0] = stream.readByte();
> +                               _palette[i * 3 + 1] = stream.readByte();
> +                               _palette[i * 3 + 2] = stream.readByte();
> +                       }
> +
> +                       _paletteColorCount = 256;
> +               }
> +       } else if ((nPlanes == 2 || nPlanes == 3 || nPlanes == 4) &&
> bitsPerPixel == 1) {       // planar, 4, 8 or 16 colors
> +               _surface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> +               dst = (byte *)_surface->getPixels();
> +               _paletteColorCount = 16;
> +
> +               for (y = 0; y < height; y++, dst += _surface->pitch) {
> +                       decodeRLE(stream, scanLine, bytesPerscanLine,
> compressed);
> +
> +                       for (x = 0; x < width; x++) {
> +                               int m = 0x80 >> (x & 7), v = 0;
> +                               for (int i = nPlanes - 1; i >= 0; i--) {
> +                                       v <<= 1;
> +                                       v  += (scanLine[i * bytesPerLine +
> (x >> 3)] & m) == 0 ? 0 : 1;
> +                               }
> +                               dst[x] = v;
> +                       }
> +               }
> +       } else {
> +               // Known unsupported case: 1 plane and bpp < 8 (1, 2 or 4)
> +               warning("Invalid PCX file (%d planes, %d bpp)", nPlanes,
> bitsPerPixel);
> +               delete[] scanLine;
> +               return false;
> +       }
> +
> +       delete[] scanLine;
> +
> +       return true;
> +}
> +
> +void PCXDecoder::decodeRLE(Common::SeekableReadStream &stream, byte *dst,
> uint32 bytesPerscanLine, bool compressed) {
> +       uint32 i = 0;
> +       byte run, value;
> +
> +       if (compressed) {
> +               while (i < bytesPerscanLine) {
> +                       run = 1;
> +                       value = stream.readByte();
> +                       if (value >= 0xc0) {
> +                               run = value & 0x3f;
> +                               value = stream.readByte();
> +                       }
> +                       while (i < bytesPerscanLine && run--)
> +                               dst[i++] = value;
> +               }
> +       } else {
> +               stream.read(dst, bytesPerscanLine);
> +       }
> +}
> +
> +} // End of namespace Image
> diff --git a/image/pcx.h b/image/pcx.h
> new file mode 100644
> index 0000000..ce30ab5
> --- /dev/null
> +++ b/image/pcx.h
> @@ -0,0 +1,66 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +/**
> + * PCX decoder used in engines:
> + *  - dreamweb
> + *  - hugo
> + *  - queen
> + *  - tucker
> + */
> +
> +#ifndef IMAGE_PCX_H
> +#define IMAGE_PCX_H
> +
> +#include "common/scummsys.h"
> +#include "common/str.h"
> +#include "image/image_decoder.h"
> +
> +namespace Common{
> +class SeekableReadStream;
> +}
> +
> +namespace Image {
> +
> +class PCXDecoder : public ImageDecoder {
> +public:
> +       PCXDecoder();
> +       virtual ~PCXDecoder();
> +
> +       // ImageDecoder API
> +       void destroy();
> +       virtual bool loadStream(Common::SeekableReadStream &stream);
> +       virtual const Graphics::Surface *getSurface() const { return
> _surface; }
> +       const byte *getPalette() const { return _palette; }
> +       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> +
> +private:
> +       void decodeRLE(Common::SeekableReadStream &stream, byte *dst,
> uint32 bytesPerScanline, bool compressed);
> +
> +       Graphics::Surface *_surface;
> +       byte *_palette;
> +       uint16 _paletteColorCount;
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/pict.cpp b/image/pict.cpp
> new file mode 100644
> index 0000000..07e657f
> --- /dev/null
> +++ b/image/pict.cpp
> @@ -0,0 +1,580 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "image/jpeg.h"
> +#include "image/pict.h"
> +
> +#include "common/debug.h"
> +#include "common/endian.h"
> +#include "common/stream.h"
> +#include "common/substream.h"
> +#include "common/textconsole.h"
> +#include "graphics/surface.h"
> +
> +namespace Image {
> +
> +// The PICT code is based off of the QuickDraw specs:
> +//
> http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-461.html
> +//
> http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-269.html
> +
> +PICTDecoder::PICTDecoder() {
> +       _outputSurface = 0;
> +       _paletteColorCount = 0;
> +}
> +
> +PICTDecoder::~PICTDecoder() {
> +       destroy();
> +}
> +
> +void PICTDecoder::destroy() {
> +       if (_outputSurface) {
> +               _outputSurface->free();
> +               delete _outputSurface;
> +               _outputSurface = 0;
> +       }
> +
> +       _paletteColorCount = 0;
> +}
> +
> +#define OPCODE(a, b, c) _opcodes.push_back(PICTOpcode(a, &PICTDecoder::b,
> c))
> +
> +void PICTDecoder::setupOpcodesCommon() {
> +       OPCODE(0x0000, o_nop, "NOP");
> +       OPCODE(0x0001, o_clip, "Clip");
> +       OPCODE(0x0003, o_txFont, "TxFont");
> +       OPCODE(0x0004, o_txFace, "TxFace");
> +       OPCODE(0x0007, o_pnSize, "PnSize");
> +       OPCODE(0x000D, o_txSize, "TxSize");
> +       OPCODE(0x0010, o_txRatio, "TxRatio");
> +       OPCODE(0x0011, o_versionOp, "VersionOp");
> +       OPCODE(0x001E, o_nop, "DefHilite");
> +       OPCODE(0x0028, o_longText, "LongText");
> +       OPCODE(0x00A1, o_longComment, "LongComment");
> +       OPCODE(0x00FF, o_opEndPic, "OpEndPic");
> +       OPCODE(0x0C00, o_headerOp, "HeaderOp");
> +}
> +
> +void PICTDecoder::setupOpcodesNormal() {
> +       setupOpcodesCommon();
> +       OPCODE(0x0098, on_packBitsRect, "PackBitsRect");
> +       OPCODE(0x009A, on_directBitsRect, "DirectBitsRect");
> +       OPCODE(0x8200, on_compressedQuickTime, "CompressedQuickTime");
> +}
> +
> +void PICTDecoder::setupOpcodesQuickTime() {
> +       setupOpcodesCommon();
> +       OPCODE(0x0098, oq_packBitsRect, "PackBitsRect");
> +       OPCODE(0x009A, oq_directBitsRect, "DirectBitsRect");
> +       OPCODE(0x8200, oq_compressedQuickTime, "CompressedQuickTime");
> +}
> +
> +#undef OPCODE
> +
> +void PICTDecoder::o_nop(Common::SeekableReadStream &) {
> +       // Nothing to do
> +}
> +
> +void PICTDecoder::o_clip(Common::SeekableReadStream &stream) {
> +       // Ignore
> +       stream.skip(stream.readUint16BE() - 2);
> +}
> +
> +void PICTDecoder::o_txFont(Common::SeekableReadStream &stream) {
> +       // Ignore
> +       stream.readUint16BE();
> +}
> +
> +void PICTDecoder::o_txFace(Common::SeekableReadStream &stream) {
> +       // Ignore
> +       stream.readByte();
> +}
> +
> +void PICTDecoder::o_pnSize(Common::SeekableReadStream &stream) {
> +       // Ignore
> +       stream.readUint16BE();
> +       stream.readUint16BE();
> +}
> +
> +void PICTDecoder::o_txSize(Common::SeekableReadStream &stream) {
> +       // Ignore
> +       stream.readUint16BE();
> +}
> +
> +void PICTDecoder::o_txRatio(Common::SeekableReadStream &stream) {
> +       // Ignore
> +       stream.readUint16BE();
> +       stream.readUint16BE();
> +       stream.readUint16BE();
> +       stream.readUint16BE();
> +}
> +
> +void PICTDecoder::o_versionOp(Common::SeekableReadStream &stream) {
> +       // We only support v2 extended
> +       if (stream.readUint16BE() != 0x02FF)
> +               error("Unknown PICT version");
> +}
> +
> +void PICTDecoder::o_longText(Common::SeekableReadStream &stream) {
> +       // Ignore
> +       stream.readUint16BE();
> +       stream.readUint16BE();
> +       stream.skip(stream.readByte());
> +}
> +
> +void PICTDecoder::o_longComment(Common::SeekableReadStream &stream) {
> +       // Ignore
> +       stream.readUint16BE();
> +       stream.skip(stream.readUint16BE());
> +}
> +
> +void PICTDecoder::o_opEndPic(Common::SeekableReadStream &stream) {
> +       // We've reached the end of the picture
> +       _continueParsing = false;
> +}
> +
> +void PICTDecoder::o_headerOp(Common::SeekableReadStream &stream) {
> +       // Read the basic header, but we don't really have to do anything
> with it
> +       /* uint16 version = */ stream.readUint16BE();
> +       stream.readUint16BE(); // Reserved
> +       /* uint32 hRes = */ stream.readUint32BE();
> +       /* uint32 vRes = */ stream.readUint32BE();
> +       Common::Rect origResRect;
> +       origResRect.top = stream.readUint16BE();
> +       origResRect.left = stream.readUint16BE();
> +       origResRect.bottom = stream.readUint16BE();
> +       origResRect.right = stream.readUint16BE();
> +       stream.readUint32BE(); // Reserved
> +}
> +
> +void PICTDecoder::on_packBitsRect(Common::SeekableReadStream &stream) {
> +       // Unpack data (8bpp or lower)
> +       unpackBitsRect(stream, true);
> +}
> +
> +void PICTDecoder::on_directBitsRect(Common::SeekableReadStream &stream) {
> +       // Unpack data (16bpp or higher)
> +       unpackBitsRect(stream, false);
> +}
> +
> +void PICTDecoder::on_compressedQuickTime(Common::SeekableReadStream
> &stream) {
> +       // OK, here's the fun. We get to completely change how QuickDraw
> draws
> +       // the data in PICT files.
> +
> +       // Swap out the opcodes to the new ones
> +       _opcodes.clear();
> +       setupOpcodesQuickTime();
> +
> +       // We'll decode the first QuickTime data from here, but the
> QuickTime-specific
> +       // opcodes will take over from here on out. Normal opcodes,
> signing off.
> +       decodeCompressedQuickTime(stream);
> +}
> +
> +void PICTDecoder::oq_packBitsRect(Common::SeekableReadStream &stream) {
> +       // Skip any data here (8bpp or lower)
> +       skipBitsRect(stream, true);
> +}
> +
> +void PICTDecoder::oq_directBitsRect(Common::SeekableReadStream &stream) {
> +       // Skip any data here (16bpp or higher)
> +       skipBitsRect(stream, false);
> +}
> +
> +void PICTDecoder::oq_compressedQuickTime(Common::SeekableReadStream
> &stream) {
> +       // Just pass the data along
> +       decodeCompressedQuickTime(stream);
> +}
> +
> +bool PICTDecoder::loadStream(Common::SeekableReadStream &stream) {
> +       destroy();
> +
> +       // Initialize opcodes to their normal state
> +       _opcodes.clear();
> +       setupOpcodesNormal();
> +
> +       _continueParsing = true;
> +       memset(_palette, 0, sizeof(_palette));
> +
> +       uint16 fileSize = stream.readUint16BE();
> +
> +       // If we have no file size here, we probably have a PICT from a
> file
> +       // and not a resource. The other two bytes are the fileSize which
> we
> +       // don't actually need (and already read if from a resource).
> +       if (!fileSize)
> +               stream.seek(512 + 2);
> +
> +       _imageRect.top = stream.readUint16BE();
> +       _imageRect.left = stream.readUint16BE();
> +       _imageRect.bottom = stream.readUint16BE();
> +       _imageRect.right = stream.readUint16BE();
> +       _imageRect.debugPrint(0, "PICT Rect:");
> +
> +       // NOTE: This is only a subset of the full PICT format.
> +       //     - Only V2 (Extended) Images Supported
> +       //     - CompressedQuickTime (JPEG) compressed data is supported
> +       //     - DirectBitsRect/PackBitsRect compressed data is supported
> +       for (uint32 opNum = 0; !stream.eos() && !stream.err() &&
> stream.pos() < stream.size() && _continueParsing; opNum++) {
> +               // PICT v2 opcodes are two bytes
> +               uint16 opcode = stream.readUint16BE();
> +
> +               if (opNum == 0 && opcode != 0x0011) {
> +                       warning("Cannot find PICT version opcode");
> +                       return false;
> +               } else if (opNum == 1 && opcode != 0x0C00) {
> +                       warning("Cannot find PICT header opcode");
> +                       return false;
> +               }
> +
> +               // Since opcodes are word-aligned, we need to mark our
> starting
> +               // position here.
> +               uint32 startPos = stream.pos();
> +
> +               for (uint32 i = 0; i < _opcodes.size(); i++) {
> +                       if (_opcodes[i].op == opcode) {
> +                               debug(4, "Running PICT opcode %04x '%s'",
> opcode, _opcodes[i].desc);
> +                               (this->*(_opcodes[i].proc))(stream);
> +                               break;
> +                       } else if (i == _opcodes.size() - 1) {
> +                               // Unknown opcode; attempt to continue
> forward
> +                               warning("Unknown PICT opcode %04x",
> opcode);
> +                       }
> +               }
> +
> +               // Align
> +               stream.skip((stream.pos() - startPos) & 1);
> +       }
> +
> +       return _outputSurface;
> +}
> +
> +PICTDecoder::PixMap PICTDecoder::readPixMap(Common::SeekableReadStream
> &stream, bool hasBaseAddr) {
> +       PixMap pixMap;
> +       pixMap.baseAddr = hasBaseAddr ? stream.readUint32BE() : 0;
> +       pixMap.rowBytes = stream.readUint16BE() & 0x3fff;
> +       pixMap.bounds.top = stream.readUint16BE();
> +       pixMap.bounds.left = stream.readUint16BE();
> +       pixMap.bounds.bottom = stream.readUint16BE();
> +       pixMap.bounds.right = stream.readUint16BE();
> +       pixMap.pmVersion = stream.readUint16BE();
> +       pixMap.packType = stream.readUint16BE();
> +       pixMap.packSize = stream.readUint32BE();
> +       pixMap.hRes = stream.readUint32BE();
> +       pixMap.vRes = stream.readUint32BE();
> +       pixMap.pixelType = stream.readUint16BE();
> +       pixMap.pixelSize = stream.readUint16BE();
> +       pixMap.cmpCount = stream.readUint16BE();
> +       pixMap.cmpSize = stream.readUint16BE();
> +       pixMap.planeBytes = stream.readUint32BE();
> +       pixMap.pmTable = stream.readUint32BE();
> +       pixMap.pmReserved = stream.readUint32BE();
> +       return pixMap;
> +}
> +
> +struct PackBitsRectData {
> +       PICTDecoder::PixMap pixMap;
> +       Common::Rect srcRect;
> +       Common::Rect dstRect;
> +       uint16 mode;
> +};
> +
> +void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool
> withPalette) {
> +       PackBitsRectData packBitsData;
> +       packBitsData.pixMap = readPixMap(stream, !withPalette);
> +
> +       // Read in the palette if there is one present
> +       if (withPalette) {
> +               // See
> http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-267.html
> +               stream.readUint32BE(); // seed
> +               stream.readUint16BE(); // flags
> +               _paletteColorCount = stream.readUint16BE() + 1;
> +
> +               for (uint32 i = 0; i < _paletteColorCount; i++) {
> +                       stream.readUint16BE();
> +                       _palette[i * 3] = stream.readUint16BE() >> 8;
> +                       _palette[i * 3 + 1] = stream.readUint16BE() >> 8;
> +                       _palette[i * 3 + 2] = stream.readUint16BE() >> 8;
> +               }
> +       }
> +
> +       packBitsData.srcRect.top = stream.readUint16BE();
> +       packBitsData.srcRect.left = stream.readUint16BE();
> +       packBitsData.srcRect.bottom = stream.readUint16BE();
> +       packBitsData.srcRect.right = stream.readUint16BE();
> +       packBitsData.dstRect.top = stream.readUint16BE();
> +       packBitsData.dstRect.left = stream.readUint16BE();
> +       packBitsData.dstRect.bottom = stream.readUint16BE();
> +       packBitsData.dstRect.right = stream.readUint16BE();
> +       packBitsData.mode = stream.readUint16BE();
> +
> +       uint16 width = packBitsData.srcRect.width();
> +       uint16 height = packBitsData.srcRect.height();
> +
> +       byte bytesPerPixel = 0;
> +
> +       if (packBitsData.pixMap.pixelSize <= 8)
> +               bytesPerPixel = 1;
> +       else if (packBitsData.pixMap.pixelSize == 32)
> +               bytesPerPixel = packBitsData.pixMap.cmpCount;
> +       else
> +               bytesPerPixel = packBitsData.pixMap.pixelSize / 8;
> +
> +       // Ensure we have enough space in the buffer to hold an entire
> line's worth of pixels
> +       uint32 lineSize = MAX<int>(width * bytesPerPixel + (8 * 2 /
> packBitsData.pixMap.pixelSize), packBitsData.pixMap.rowBytes);
> +       byte *buffer = new byte[lineSize * height];
> +
> +       // Read in amount of data per row
> +       for (uint16 i = 0; i < packBitsData.pixMap.bounds.height(); i++) {
> +               // NOTE: Compression 0 is "default". The format in SCI
> games is packed when 0.
> +               // In the future, we may need to have something to set the
>  "default" packing
> +               // format, but this is good for now.
> +
> +               if (packBitsData.pixMap.packType == 1 ||
> packBitsData.pixMap.rowBytes < 8) { // Unpacked, Pad-Byte (on 24-bit)
> +                       // TODO: Finish this. Hasn't been needed (yet).
> +                       error("Unpacked DirectBitsRect data (padded)");
> +               } else if (packBitsData.pixMap.packType == 2) { //
> Unpacked, No Pad-Byte (on 24-bit)
> +                       // TODO: Finish this. Hasn't been needed (yet).
> +                       error("Unpacked DirectBitsRect data (not padded)");
> +               } else if (packBitsData.pixMap.packType == 0 ||
> packBitsData.pixMap.packType > 2) { // Packed
> +                       uint16 byteCount = (packBitsData.pixMap.rowBytes >
> 250) ? stream.readUint16BE() : stream.readByte();
> +                       unpackBitsLine(buffer + i * width * bytesPerPixel,
> packBitsData.pixMap.rowBytes, stream.readStream(byteCount),
> packBitsData.pixMap.pixelSize, bytesPerPixel);
> +               }
> +       }
> +
> +       _outputSurface = new Graphics::Surface();
> +
> +       switch (bytesPerPixel) {
> +       case 1:
> +               // Just copy to the image
> +               _outputSurface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> +               memcpy(_outputSurface->getPixels(), buffer,
> _outputSurface->w * _outputSurface->h);
> +               break;
> +       case 2:
> +               // We have a 16-bit surface
> +               _outputSurface->create(width, height,
> Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
> +               for (uint16 y = 0; y < _outputSurface->h; y++)
> +                       for (uint16 x = 0; x < _outputSurface->w; x++)
> +                               WRITE_UINT16(_outputSurface->getBasePtr(x,
> y), READ_UINT16(buffer + (y * _outputSurface->w + x) * 2));
> +               break;
> +       case 3:
> +               // We have a planar 24-bit surface
> +               _outputSurface->create(width, height,
> Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
> +               for (uint16 y = 0; y < _outputSurface->h; y++) {
> +                       for (uint16 x = 0; x < _outputSurface->w; x++) {
> +                               byte r = *(buffer + y * _outputSurface->w
> * 3 + x);
> +                               byte g = *(buffer + y * _outputSurface->w
> * 3 + _outputSurface->w + x);
> +                               byte b = *(buffer + y * _outputSurface->w
> * 3 + _outputSurface->w * 2 + x);
> +                               *((uint32 *)_outputSurface->getBasePtr(x,
> y)) = _outputSurface->format.RGBToColor(r, g, b);
> +                       }
> +               }
> +               break;
> +       case 4:
> +               // We have a planar 32-bit surface
> +               // Note that we ignore the alpha channel since it seems to
> not be correct
> +               // Mac OS X does not ignore it, but then displays it
> incorrectly. Photoshop
> +               // does ignore it and displays it correctly.
> +               _outputSurface->create(width, height,
> Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
> +               for (uint16 y = 0; y < _outputSurface->h; y++) {
> +                       for (uint16 x = 0; x < _outputSurface->w; x++) {
> +                               byte a = 0xFF;
> +                               byte r = *(buffer + y * _outputSurface->w
> * 4 + _outputSurface->w + x);
> +                               byte g = *(buffer + y * _outputSurface->w
> * 4 + _outputSurface->w * 2 + x);
> +                               byte b = *(buffer + y * _outputSurface->w
> * 4 + _outputSurface->w * 3 + x);
> +                               *((uint32 *)_outputSurface->getBasePtr(x,
> y)) = _outputSurface->format.ARGBToColor(a, r, g, b);
> +                       }
> +               }
> +               break;
> +       }
> +
> +       delete[] buffer;
> +}
> +
> +void PICTDecoder::unpackBitsLine(byte *out, uint32 length,
> Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel) {
> +       uint32 dataDecoded = 0;
> +       byte bytesPerDecode = (bytesPerPixel == 2) ? 2 : 1;
> +
> +       while (data->pos() < data->size() && dataDecoded < length) {
> +               byte op = data->readByte();
> +
> +               if (op & 0x80) {
> +                       uint32 runSize = (op ^ 255) + 2;
> +                       uint16 value = (bytesPerDecode == 2) ?
> data->readUint16BE() : data->readByte();
> +
> +                       for (uint32 i = 0; i < runSize; i++) {
> +                               if (bytesPerDecode == 2) {
> +                                       WRITE_UINT16(out, value);
> +                                       out += 2;
> +                               } else {
> +                                       outputPixelBuffer(out, value,
> bitsPerPixel);
> +                               }
> +                       }
> +                       dataDecoded += runSize * bytesPerDecode;
> +               } else {
> +                       uint32 runSize = op + 1;
> +
> +                       if (bytesPerDecode == 1) {
> +                               for (uint32 i = 0; i < runSize; i++)
> +                                       outputPixelBuffer(out,
> data->readByte(), bitsPerPixel);
> +                       } else {
> +                               for (uint32 i = 0; i < runSize; i++) {
> +                                       WRITE_UINT16(out,
> data->readUint16BE());
> +                                       out += 2;
> +                               }
> +                       }
> +
> +                       dataDecoded += runSize * bytesPerDecode;
> +               }
> +       }
> +
> +       // HACK: Even if the data is 24-bit, rowBytes is still 32-bit
> +       if (bytesPerPixel == 3)
> +               dataDecoded += length / 4;
> +
> +       if (length != dataDecoded)
> +               warning("Mismatched PackBits read (%d/%d)", dataDecoded,
> length);
> +
> +       delete data;
> +}
> +
> +void PICTDecoder::outputPixelBuffer(byte *&out, byte value, byte
> bitsPerPixel) {
> +       switch (bitsPerPixel) {
> +       case 1:
> +               for (int i = 7; i >= 0; i--)
> +                       *out++ = (value >> i) & 1;
> +               break;
> +       case 2:
> +               for (int i = 6; i >= 0; i -= 2)
> +                       *out++ = (value >> i) & 3;
> +               break;
> +       case 4:
> +               *out++ = (value >> 4) & 0xf;
> +               *out++ = value & 0xf;
> +               break;
> +       default:
> +               *out++ = value;
> +       }
> +}
> +
> +void PICTDecoder::skipBitsRect(Common::SeekableReadStream &stream, bool
> withPalette) {
> +       // Step through a PackBitsRect/DirectBitsRect function
> +
> +       if (!withPalette)
> +               stream.readUint32BE();
> +
> +       uint16 rowBytes = stream.readUint16BE();
> +       uint16 height = stream.readUint16BE();
> +       stream.readUint16BE();
> +       height = stream.readUint16BE() - height;
> +       stream.readUint16BE();
> +
> +       uint16 packType;
> +
> +       // Top two bits signify PixMap vs BitMap
> +       if (rowBytes & 0xC000) {
> +               // PixMap
> +               stream.readUint16BE();
> +               packType = stream.readUint16BE();
> +               stream.skip(14);
> +               stream.readUint16BE(); // pixelSize
> +               stream.skip(16);
> +
> +               if (withPalette) {
> +                       stream.readUint32BE();
> +                       stream.readUint16BE();
> +                       stream.skip((stream.readUint16BE() + 1) * 8);
> +               }
> +
> +               rowBytes &= 0x3FFF;
> +       } else {
> +               // BitMap
> +               packType = 0;
> +       }
> +
> +       stream.skip(18);
> +
> +       for (uint16 i = 0; i < height; i++) {
> +               if (packType == 1 || packType == 2 || rowBytes < 8)
> +                       error("Unpacked PackBitsRect data");
> +               else if (packType == 0 || packType > 2)
> +                       stream.skip((rowBytes > 250) ?
> stream.readUint16BE() : stream.readByte());
> +       }
> +}
> +
> +// Compressed QuickTime details can be found here:
> +//
> http://developer.apple.com/legacy/mac/library/#documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/B-Chapter/2TheImageCompression.html
> +//
> http://developer.apple.com/legacy/mac/library/#documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/F-Chapter/6WorkingwiththeImage.html
> +void PICTDecoder::decodeCompressedQuickTime(Common::SeekableReadStream
> &stream) {
> +       // First, read all the fields from the opcode
> +       uint32 dataSize = stream.readUint32BE();
> +       uint32 startPos = stream.pos();
> +
> +       /* uint16 version = */ stream.readUint16BE();
> +
> +       // Read in the display matrix
> +       uint32 matrix[3][3];
> +       for (uint32 i = 0; i < 3; i++)
> +               for (uint32 j = 0; j < 3; j++)
> +                       matrix[i][j] = stream.readUint32BE();
> +
> +       // We currently only support offseting images vertically from the
> matrix
> +       uint16 xOffset = 0;
> +       uint16 yOffset = matrix[2][1] >> 16;
> +
> +       uint32 matteSize = stream.readUint32BE();
> +       stream.skip(8); // matte rect
> +       /* uint16 transferMode = */ stream.readUint16BE();
> +       stream.skip(8); // src rect
> +       /* uint32 accuracy = */ stream.readUint32BE();
> +       uint32 maskSize = stream.readUint32BE();
> +
> +       // Skip the matte and mask
> +       stream.skip(matteSize + maskSize);
> +
> +       // Now we've reached the image descriptor, so read the relevant
> data from that
> +       uint32 idStart = stream.pos();
> +       uint32 idSize = stream.readUint32BE();
> +       uint32 codec = stream.readUint32BE();
> +       stream.skip(36); // miscellaneous stuff
> +       uint32 jpegSize = stream.readUint32BE();
> +       stream.skip(idSize - (stream.pos() - idStart)); // more useless
> stuff
> +
> +       if (codec != MKTAG('j', 'p', 'e', 'g'))
> +               error("Unhandled CompressedQuickTime format '%s'",
> tag2str(codec));
> +
> +       Common::SeekableSubReadStream jpegStream(&stream, stream.pos(),
> stream.pos() + jpegSize);
> +
> +       JPEGDecoder jpeg;
> +       if (!jpeg.loadStream(jpegStream))
> +               error("PICTDecoder::decodeCompressedQuickTime(): Could not
> decode JPEG data");
> +
> +       const Graphics::Surface *jpegSurface = jpeg.getSurface();
> +
> +       if (!_outputSurface) {
> +               _outputSurface = new Graphics::Surface();
> +               _outputSurface->create(_imageRect.width(),
> _imageRect.height(), jpegSurface->format);
> +       }
> +
> +       for (uint16 y = 0; y < jpegSurface->h; y++)
> +               memcpy(_outputSurface->getBasePtr(0 + xOffset, y +
> yOffset), jpegSurface->getBasePtr(0, y), jpegSurface->w *
> jpegSurface->format.bytesPerPixel);
> +
> +       stream.seek(startPos + dataSize);
> +}
> +
> +} // End of namespace Image
> diff --git a/image/pict.h b/image/pict.h
> new file mode 100644
> index 0000000..77b450f
> --- /dev/null
> +++ b/image/pict.h
> @@ -0,0 +1,141 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +/**
> + * @file
> + * Image decoder used in engines:
> + *  - mohawk
> + *  - pegasus
> + *  - sci
> + */
> +
> +#ifndef IMAGE_PICT_H
> +#define IMAGE_PICT_H
> +
> +#include "common/array.h"
> +#include "common/rect.h"
> +#include "common/scummsys.h"
> +
> +#include "image/image_decoder.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Graphics {
> +struct Surface;
> +}
> +
> +namespace Image {
> +
> +#define DECLARE_OPCODE(x) void x(Common::SeekableReadStream &stream)
> +
> +class PICTDecoder : public ImageDecoder {
> +public:
> +       PICTDecoder();
> +       ~PICTDecoder();
> +
> +       // ImageDecoder API
> +       bool loadStream(Common::SeekableReadStream &stream);
> +       void destroy();
> +       const Graphics::Surface *getSurface() const { return
> _outputSurface; }
> +       const byte *getPalette() const { return _palette; }
> +       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> +
> +       struct PixMap {
> +               uint32 baseAddr;
> +               uint16 rowBytes;
> +               Common::Rect bounds;
> +               uint16 pmVersion;
> +               uint16 packType;
> +               uint32 packSize;
> +               uint32 hRes;
> +               uint32 vRes;
> +               uint16 pixelType;
> +               uint16 pixelSize;
> +               uint16 cmpCount;
> +               uint16 cmpSize;
> +               uint32 planeBytes;
> +               uint32 pmTable;
> +               uint32 pmReserved;
> +       };
> +
> +       static PixMap readPixMap(Common::SeekableReadStream &stream, bool
> hasBaseAddr = true);
> +
> +private:
> +       Common::Rect _imageRect;
> +       byte _palette[256 * 3];
> +       uint16 _paletteColorCount;
> +       Graphics::Surface *_outputSurface;
> +       bool _continueParsing;
> +
> +       // Utility Functions
> +       void unpackBitsRect(Common::SeekableReadStream &stream, bool
> withPalette);
> +       void unpackBitsLine(byte *out, uint32 length,
> Common::SeekableReadStream *stream, byte bitsPerPixel, byte bytesPerPixel);
> +       void skipBitsRect(Common::SeekableReadStream &stream, bool
> withPalette);
> +       void decodeCompressedQuickTime(Common::SeekableReadStream &stream);
> +       void outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel);
> +
> +       // Opcodes
> +       typedef void
> (PICTDecoder::*OpcodeProcPICT)(Common::SeekableReadStream &stream);
> +       struct PICTOpcode {
> +               PICTOpcode() { op = 0; proc = 0; desc = 0; }
> +               PICTOpcode(uint16 o, OpcodeProcPICT p, const char *d) { op
> = o; proc = p; desc = d; }
> +               uint16 op;
> +               OpcodeProcPICT proc;
> +               const char *desc;
> +       };
> +       Common::Array<PICTOpcode> _opcodes;
> +
> +       // Common Opcodes
> +       void setupOpcodesCommon();
> +       DECLARE_OPCODE(o_nop);
> +       DECLARE_OPCODE(o_clip);
> +       DECLARE_OPCODE(o_txFont);
> +       DECLARE_OPCODE(o_txFace);
> +       DECLARE_OPCODE(o_pnSize);
> +       DECLARE_OPCODE(o_txSize);
> +       DECLARE_OPCODE(o_txRatio);
> +       DECLARE_OPCODE(o_versionOp);
> +       DECLARE_OPCODE(o_longText);
> +       DECLARE_OPCODE(o_longComment);
> +       DECLARE_OPCODE(o_opEndPic);
> +       DECLARE_OPCODE(o_headerOp);
> +
> +       // Regular-mode Opcodes
> +       void setupOpcodesNormal();
> +       DECLARE_OPCODE(on_packBitsRect);
> +       DECLARE_OPCODE(on_directBitsRect);
> +       DECLARE_OPCODE(on_compressedQuickTime);
> +
> +       // QuickTime-mode Opcodes
> +       void setupOpcodesQuickTime();
> +       DECLARE_OPCODE(oq_packBitsRect);
> +       DECLARE_OPCODE(oq_directBitsRect);
> +       DECLARE_OPCODE(oq_compressedQuickTime);
> +};
> +
> +#undef DECLARE_OPCODE
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/png.cpp b/image/png.cpp
> new file mode 100644
> index 0000000..158acfa
> --- /dev/null
> +++ b/image/png.cpp
> @@ -0,0 +1,245 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// Since we need to work with libpng here, we need to allow all symbols
> +// to avoid compilation issues.
> +#define FORBIDDEN_SYMBOL_ALLOW_ALL
> +#include "common/scummsys.h"
> +
> +#ifdef USE_PNG
> +#include <png.h>
> +#endif
> +
> +#include "image/png.h"
> +
> +#include "graphics/pixelformat.h"
> +#include "graphics/surface.h"
> +
> +#include "common/stream.h"
> +
> +namespace Image {
> +
> +PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0),
> _paletteColorCount(0), _stream(0) {
> +}
> +
> +PNGDecoder::~PNGDecoder() {
> +       destroy();
> +}
> +
> +void PNGDecoder::destroy() {
> +       if (_outputSurface) {
> +               _outputSurface->free();
> +               delete _outputSurface;
> +               _outputSurface = 0;
> +       }
> +       delete[] _palette;
> +       _palette = NULL;
> +}
> +
> +#ifdef USE_PNG
> +// libpng-error-handling:
> +void pngError(png_structp pngptr, png_const_charp errorMsg) {
> +       error("%s", errorMsg);
> +}
> +
> +void pngWarning(png_structp pngptr, png_const_charp warningMsg) {
> +       warning("%s", warningMsg);
> +}
> +
> +// libpng-I/O-helper:
> +void pngReadFromStream(png_structp pngPtr, png_bytep data, png_size_t
> length) {
> +       void *readIOptr = png_get_io_ptr(pngPtr);
> +       Common::SeekableReadStream *stream = (Common::SeekableReadStream
> *)readIOptr;
> +       stream->read(data, length);
> +}
> +#endif
> +
> +/*
> + * This code is based on Broken Sword 2.5 engine
> + *
> + * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
> + *
> + * Licensed under GNU GPL v2
> + *
> + */
> +
> +bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
> +#ifdef USE_PNG
> +       destroy();
> +
> +       _stream = &stream;
> +
> +       // First, check the PNG signature
> +       if (_stream->readUint32BE() != MKTAG(0x89, 'P', 'N', 'G')) {
> +               delete _stream;
> +               return false;
> +       }
> +       if (_stream->readUint32BE() != MKTAG(0x0d, 0x0a, 0x1a, 0x0a)) {
> +               delete _stream;
> +               return false;
> +       }
> +
> +       // The following is based on the guide provided in:
> +       //http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-3
> +       //http://www.libpng.org/pub/png/libpng-1.4.0-manual.pdf
> +       // along with the png-loading code used in the sword25-engine.
> +       png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
> NULL, NULL, NULL);
> +       if (!pngPtr) {
> +               delete _stream;
> +               return false;
> +       }
> +       png_infop infoPtr = png_create_info_struct(pngPtr);
> +       if (!infoPtr) {
> +               png_destroy_read_struct(&pngPtr, NULL, NULL);
> +               delete _stream;
> +               return false;
> +       }
> +       png_infop endInfo = png_create_info_struct(pngPtr);
> +       if (!endInfo) {
> +               png_destroy_read_struct(&pngPtr, &infoPtr, NULL);
> +               delete _stream;
> +               return false;
> +       }
> +
> +       png_set_error_fn(pngPtr, NULL, pngError, pngWarning);
> +       // TODO: The manual says errors should be handled via setjmp
> +
> +       png_set_read_fn(pngPtr, _stream, pngReadFromStream);
> +       png_set_crc_action(pngPtr, PNG_CRC_DEFAULT, PNG_CRC_WARN_USE);
> +       // We already verified the PNG-header
> +       png_set_sig_bytes(pngPtr, 8);
> +
> +       // Read PNG header
> +       png_read_info(pngPtr, infoPtr);
> +
> +       // No handling for unknown chunks yet.
> +       int bitDepth, colorType, width, height, interlaceType;
> +       png_uint_32 w, h;
> +       png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType,
> &interlaceType, NULL, NULL);
> +       width = w;
> +       height = h;
> +
> +       // Allocate memory for the final image data.
> +       // To keep memory framentation low this happens before allocating
> memory for temporary image data.
> +       _outputSurface = new Graphics::Surface();
> +
> +       // Images of all color formats except PNG_COLOR_TYPE_PALETTE
> +       // will be transformed into ARGB images
> +       if (colorType == PNG_COLOR_TYPE_PALETTE && !png_get_valid(pngPtr,
> infoPtr, PNG_INFO_tRNS)) {
> +               int numPalette = 0;
> +               png_colorp palette = NULL;
> +               uint32 success = png_get_PLTE(pngPtr, infoPtr, &palette,
> &numPalette);
> +               if (success != PNG_INFO_PLTE) {
> +                       png_destroy_read_struct(&pngPtr, &infoPtr, NULL);
> +                       return false;
> +               }
> +               _paletteColorCount = numPalette;
> +               _palette = new byte[_paletteColorCount * 3];
> +               for (int i = 0; i < _paletteColorCount; i++) {
> +                       _palette[(i * 3)] = palette[i].red;
> +                       _palette[(i * 3) + 1] = palette[i].green;
> +                       _palette[(i * 3) + 2] = palette[i].blue;
> +
> +               }
> +               _outputSurface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> +               png_set_packing(pngPtr);
> +       } else {
> +               bool isAlpha = (colorType & PNG_COLOR_MASK_ALPHA);
> +               if (png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) {
> +                       isAlpha = true;
> +                       png_set_expand(pngPtr);
> +               }
> +               _outputSurface->create(width, height,
> Graphics::PixelFormat(4,
> +                                      8, 8, 8, isAlpha ? 8 : 0, 24, 16,
> 8, 0));
> +               if (!_outputSurface->getPixels()) {
> +                       error("Could not allocate memory for output
> image.");
> +               }
> +               if (bitDepth == 16)
> +                       png_set_strip_16(pngPtr);
> +               if (bitDepth < 8)
> +                       png_set_expand(pngPtr);
> +               if (colorType == PNG_COLOR_TYPE_GRAY ||
> +                       colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
> +                       png_set_gray_to_rgb(pngPtr);
> +
> +               // PNGs are Big-Endian:
> +#ifdef SCUMM_LITTLE_ENDIAN
> +               png_set_bgr(pngPtr);
> +               png_set_swap_alpha(pngPtr);
> +               if (colorType != PNG_COLOR_TYPE_RGB_ALPHA)
> +                       png_set_filler(pngPtr, 0xff, PNG_FILLER_BEFORE);
> +#else
> +               if (colorType != PNG_COLOR_TYPE_RGB_ALPHA)
> +                       png_set_filler(pngPtr, 0xff, PNG_FILLER_AFTER);
> +#endif
> +
> +       }
> +
> +       // After the transformations have been registered, the image data
> is read again.
> +       png_set_interlace_handling(pngPtr);
> +       png_read_update_info(pngPtr, infoPtr);
> +       png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType, NULL,
> NULL, NULL);
> +       width = w;
> +       height = h;
> +
> +       if (interlaceType == PNG_INTERLACE_NONE) {
> +               // PNGs without interlacing can simply be read row by row.
> +               for (int i = 0; i < height; i++) {
> +                       png_read_row(pngPtr,
> (png_bytep)_outputSurface->getBasePtr(0, i), NULL);
> +               }
> +       } else {
> +               // PNGs with interlacing require us to allocate an
> auxillary
> +               // buffer with pointers to all row starts.
> +
> +               // Allocate row pointer buffer
> +               png_bytep *rowPtr = new png_bytep[height];
> +               if (!rowPtr) {
> +                       error("Could not allocate memory for row
> pointers.");
> +               }
> +
> +               // Initialize row pointers
> +               for (int i = 0; i < height; i++)
> +                       rowPtr[i] =
> (png_bytep)_outputSurface->getBasePtr(0, i);
> +
> +               // Read image data
> +               png_read_image(pngPtr, rowPtr);
> +
> +               // Free row pointer buffer
> +               delete[] rowPtr;
> +       }
> +
> +       // Read additional data at the end.
> +       png_read_end(pngPtr, NULL);
> +
> +       // Destroy libpng structures
> +       png_destroy_read_struct(&pngPtr, &infoPtr, &endInfo);
> +
> +       // We no longer need the file stream, thus close it here
> +       _stream = 0;
> +
> +       return true;
> +#else
> +       return false;
> +#endif
> +}
> +
> +} // End of namespace Image
> diff --git a/image/png.h b/image/png.h
> new file mode 100644
> index 0000000..c4532fd
> --- /dev/null
> +++ b/image/png.h
> @@ -0,0 +1,68 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +/*
> + * PNG decoder used in engines:
> + *  - sword25
> + *  - wintermute
> + * Dependencies:
> + *  - libpng
> + */
> +
> +#ifndef IMAGE_PNG_H
> +#define IMAGE_PNG_H
> +
> +#include "common/scummsys.h"
> +#include "common/textconsole.h"
> +#include "image/image_decoder.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Graphics {
> +struct Surface;
> +}
> +
> +namespace Image {
> +
> +class PNGDecoder : public ImageDecoder {
> +public:
> +       PNGDecoder();
> +       ~PNGDecoder();
> +
> +       bool loadStream(Common::SeekableReadStream &stream);
> +       void destroy();
> +       const Graphics::Surface *getSurface() const { return
> _outputSurface; }
> +       const byte *getPalette() const { return _palette; }
> +       uint16 getPaletteColorCount() const { return _paletteColorCount; }
> +private:
> +       Common::SeekableReadStream *_stream;
> +       byte *_palette;
> +       uint16 _paletteColorCount;
> +
> +       Graphics::Surface *_outputSurface;
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/tga.cpp b/image/tga.cpp
> new file mode 100644
> index 0000000..e251f64
> --- /dev/null
> +++ b/image/tga.cpp
> @@ -0,0 +1,430 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +/* Based on code from xoreos https://github.com/DrMcCoy/xoreos/
> + * relicensed under GPLv2+ with permission from DrMcCoy and clone2727
> + */
> +
> +#include "image/tga.h"
> +
> +#include "common/util.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +#include "common/error.h"
> +
> +namespace Image {
> +
> +TGADecoder::TGADecoder() {
> +       _colorMapSize = 0;
> +       _colorMapOrigin = 0;
> +       _colorMapLength = 0;
> +       _colorMapEntryLength = 0;
> +       _colorMap = NULL;
> +}
> +
> +TGADecoder::~TGADecoder() {
> +       destroy();
> +}
> +
> +void TGADecoder::destroy() {
> +       _surface.free();
> +       delete[] _colorMap;
> +}
> +
> +bool TGADecoder::loadStream(Common::SeekableReadStream &tga) {
> +       destroy();
> +
> +       byte imageType, pixelDepth;
> +       bool success;
> +       success = readHeader(tga, imageType, pixelDepth);
> +       if (success) {
> +               switch (imageType) {
> +               case TYPE_BW:
> +               case TYPE_TRUECOLOR:
> +                       success = readData(tga, imageType, pixelDepth);
> +                       break;
> +               case TYPE_RLE_BW:
> +               case TYPE_RLE_TRUECOLOR:
> +               case TYPE_RLE_CMAP:
> +                       success = readDataRLE(tga, imageType, pixelDepth);
> +                       break;
> +               case TYPE_CMAP:
> +                       success = readDataColorMapped(tga, imageType,
> pixelDepth);
> +                       break;
> +               default:
> +                       success = false;
> +                       break;
> +               }
> +       }
> +       if (tga.err() || !success) {
> +               warning("Failed reading TGA-file");
> +               return false;
> +       }
> +       return success;
> +}
> +
> +bool TGADecoder::readHeader(Common::SeekableReadStream &tga, byte
> &imageType, byte &pixelDepth) {
> +       if (!tga.seek(0)) {
> +               warning("Failed reading TGA-file");
> +               return false;
> +       }
> +
> +       // TGAs have an optional "id" string in the header
> +       uint32 idLength = tga.readByte();
> +
> +       // Number of colors in the color map / palette
> +       int hasColorMap = tga.readByte();
> +
> +       // Image type. See header for numeric constants
> +       imageType = tga.readByte();
> +
> +       switch (imageType) {
> +       case TYPE_CMAP:
> +       case TYPE_TRUECOLOR:
> +       case TYPE_BW:
> +       case TYPE_RLE_CMAP:
> +       case TYPE_RLE_TRUECOLOR:
> +       case TYPE_RLE_BW:
> +               break;
> +       default:
> +               warning("Unsupported image type: %d", imageType);
> +               return false;
> +       }
> +
> +       // Color map specifications
> +       if (hasColorMap == 0) {
> +               tga.skip(5);
> +       } else {
> +               _colorMapOrigin = tga.readUint16LE();
> +               _colorMapLength = tga.readUint16LE();
> +               _colorMapEntryLength = tga.readByte();
> +       }
> +       // Origin-defintions
> +       tga.skip(2 + 2);
> +
> +       // Image dimensions
> +       _surface.w = tga.readUint16LE();
> +       _surface.h = tga.readUint16LE();
> +
> +       // Bits per pixel
> +       pixelDepth = tga.readByte();
> +       _surface.format.bytesPerPixel = pixelDepth / 8;
> +
> +       // Image descriptor
> +       byte imgDesc = tga.readByte();
> +       int attributeBits = imgDesc & 0x0F;
> +       assert((imgDesc & 0x10) == 0);
> +       _originTop = (imgDesc & 0x20);
> +
> +       // Interleaving is not handled at this point
> +       //int interleave = (imgDesc & 0xC);
> +       if (imageType == TYPE_CMAP || imageType == TYPE_RLE_CMAP) {
> +               if (pixelDepth == 8) {
> +                       _format =
> Graphics::PixelFormat::createFormatCLUT8();
> +               } else {
> +                       warning("Unsupported index-depth: %d", pixelDepth);
> +                       return false;
> +               }
> +       } else if (imageType == TYPE_TRUECOLOR || imageType ==
> TYPE_RLE_TRUECOLOR) {
> +               if (pixelDepth == 24) {
> +                       _format = Graphics::PixelFormat(3, 8, 8, 8, 0, 16,
> 8, 0, 0);
> +               } else if (pixelDepth == 32) {
> +                       // HACK: According to the spec, attributeBits
> should determine the amount
> +                       // of alpha-bits, however, as the game files that
> use this decoder seems
> +                       // to ignore that fact, we force the amount to 8
> for 32bpp files for now.
> +                       _format = Graphics::PixelFormat(4, 8, 8, 8, /*
> attributeBits */ 8, 16, 8, 0, 24);
> +               } else if (pixelDepth == 16 && imageType ==
> TYPE_TRUECOLOR) {
> +                       // 16bpp TGA is ARGB1555
> +                       _format = Graphics::PixelFormat(2, 5, 5, 5,
> attributeBits, 10, 5, 0, 15);
> +               } else {
> +                       warning("Unsupported pixel depth: %d, %d",
> imageType, pixelDepth);
> +                       return false;
> +               }
> +       } else if (imageType == TYPE_BW || TYPE_RLE_BW) {
> +               if (pixelDepth == 8) {
> +                       _format = Graphics::PixelFormat(4, 8, 8, 8, 0, 16,
> 8, 0, 0);
> +               } else {
> +                       warning("Unsupported pixel depth: %d, %d",
> imageType, pixelDepth);
> +                       return false;
> +               }
> +
> +       } else {
> +               warning("Unsupported image type: %d", imageType);
> +               return false;
> +       }
> +
> +       // Skip the id string
> +       tga.skip(idLength);
> +
> +       if (hasColorMap) {
> +               return readColorMap(tga, imageType, pixelDepth);
> +       }
> +       return true;
> +}
> +
> +bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte
> imageType, byte pixelDepth) {
> +       _colorMap = new byte[3 * _colorMapLength];
> +       for (int i = 0; i < _colorMapLength * 3; i += 3) {
> +               byte r, g, b;
> +               if (_colorMapEntryLength == 32) {
> +                       byte a;
> +                       Graphics::PixelFormat format(4, 8, 8, 8, 0, 16, 8,
> 0, 24);
> +                       uint32 color = tga.readUint32LE();
> +                       format.colorToARGB(color, a, r, g, b);
> +               } else if (_colorMapEntryLength == 24) {
> +                       r = tga.readByte();
> +                       g = tga.readByte();
> +                       b = tga.readByte();
> +               } else if (_colorMapEntryLength == 16) {
> +                       byte a;
> +                       Graphics::PixelFormat format(2, 5, 5, 5, 0, 10, 5,
> 0, 15);
> +                       uint16 color = tga.readUint16LE();
> +                       format.colorToARGB(color, a, r, g, b);
> +               } else {
> +                       warning("Unsupported image type: %d", imageType);
> +                       r = g = b = 0;
> +               }
> +#ifdef SCUMM_LITTLE_ENDIAN
> +               _colorMap[i] = r;
> +               _colorMap[i + 1] = g;
> +               _colorMap[i + 2] = b;
> +#else
> +               _colorMap[i] = b;
> +               _colorMap[i + 1] = g;
> +               _colorMap[i + 2] = r;
> +#endif
> +       }
> +       return true;
> +}
> +
> +// Additional information found from
> http://paulbourke.net/dataformats/tga/
> +// With some details from the link referenced in the header.
> +bool TGADecoder::readData(Common::SeekableReadStream &tga, byte
> imageType, byte pixelDepth) {
> +       // TrueColor
> +       if (imageType == TYPE_TRUECOLOR) {
> +               _surface.create(_surface.w, _surface.h, _format);
> +
> +               if (pixelDepth == 16) {
> +                       for (int i = 0; i < _surface.h; i++) {
> +                               uint16 *dst;
> +                               if (!_originTop) {
> +                                       dst = (uint16
> *)_surface.getBasePtr(0, _surface.h - i - 1);
> +                               } else {
> +                                       dst = (uint16
> *)_surface.getBasePtr(0, i);
> +                               }
> +                               for (int j = 0; j < _surface.w; j++) {
> +                                       *dst++ = tga.readUint16LE();
> +                               }
> +                       }
> +               } else if (pixelDepth == 32) {
> +                       for (int i = 0; i < _surface.h; i++) {
> +                               uint32 *dst;
> +                               if (!_originTop) {
> +                                       dst = (uint32
> *)_surface.getBasePtr(0, _surface.h - i - 1);
> +                               } else {
> +                                       dst = (uint32
> *)_surface.getBasePtr(0, i);
> +                               }
> +                               for (int j = 0; j < _surface.w; j++) {
> +                                       *dst++ = tga.readUint32LE();
> +                               }
> +                       }
> +               } else if (pixelDepth == 24) {
> +                       for (int i = 0; i < _surface.h; i++) {
> +                               byte *dst;
> +                               if (!_originTop) {
> +                                       dst = (byte
> *)_surface.getBasePtr(0, _surface.h - i - 1);
> +                               } else {
> +                                       dst = (byte
> *)_surface.getBasePtr(0, i);
> +                               }
> +                               for (int j = 0; j < _surface.w; j++) {
> +                                       byte r = tga.readByte();
> +                                       byte g = tga.readByte();
> +                                       byte b = tga.readByte();
> +#ifdef SCUMM_LITTLE_ENDIAN
> +                                       *dst++ = r;
> +                                       *dst++ = g;
> +                                       *dst++ = b;
> +#else
> +                                       *dst++ = b;
> +                                       *dst++ = g;
> +                                       *dst++ = r;
> +#endif
> +                               }
> +                       }
> +               }
> +               // Black/White
> +       } else if (imageType == TYPE_BW) {
> +               _surface.create(_surface.w, _surface.h, _format);
> +
> +               byte *data  = (byte *)_surface.getPixels();
> +               uint32 count = _surface.w * _surface.h;
> +
> +               while (count-- > 0) {
> +                       byte g = tga.readByte();
> +                       *data++ = g;
> +                       *data++ = g;
> +                       *data++ = g;
> +                       *data++ = g;
> +               }
> +       }
> +       return true;
> +}
> +
> +bool TGADecoder::readDataColorMapped(Common::SeekableReadStream &tga,
> byte imageType, byte indexDepth) {
> +       // Color-mapped
> +       if (imageType == TYPE_CMAP) {
> +               _surface.create(_surface.w, _surface.h, _format);
> +               if (indexDepth == 8) {
> +                       for (int i = 0; i < _surface.h; i++) {
> +                               byte *dst;
> +                               if (!_originTop) {
> +                                       dst = (byte
> *)_surface.getBasePtr(0, _surface.h - i - 1);
> +                               } else {
> +                                       dst = (byte
> *)_surface.getBasePtr(0, i);
> +                               }
> +                               for (int j = 0; j < _surface.w; j++) {
> +                                       byte index = tga.readByte();
> +                                       *dst++ = index;
> +                               }
> +                       }
> +               } else if (indexDepth == 16) {
> +                       warning("16 bit indexes not supported");
> +                       return false;
> +               }
> +       } else {
> +               return false;
> +       }
> +       return true;
> +}
> +
> +bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte
> imageType, byte pixelDepth) {
> +       // RLE-TrueColor / RLE-Black/White
> +       if (imageType == TYPE_RLE_TRUECOLOR || imageType == TYPE_RLE_BW ||
> imageType == TYPE_RLE_CMAP) {
> +               _surface.create(_surface.w, _surface.h, _format);
> +               uint32 count = _surface.w * _surface.h;
> +               byte *data = (byte *)_surface.getPixels();
> +
> +               while (count > 0) {
> +                       uint32 header = tga.readByte();
> +                       byte type = (header & 0x80) >> 7;
> +                       uint32 rleCount = (header & 0x7F) + 1;
> +
> +                       // RLE-packet
> +                       if (type == 1) {
> +                               if (pixelDepth == 32 && imageType ==
> TYPE_RLE_TRUECOLOR) {
> +                                       uint32 color = tga.readUint32LE();
> +                                       while (rleCount-- > 0) {
> +                                               *((uint32 *)data) = color;
> +                                               data += 4;
> +                                               count--;
> +                                       }
> +                               } else if (pixelDepth == 24 && imageType
> == TYPE_RLE_TRUECOLOR) {
> +                                       byte r = tga.readByte();
> +                                       byte g = tga.readByte();
> +                                       byte b = tga.readByte();
> +                                       while (rleCount-- > 0) {
> +#ifdef SCUMM_LITTLE_ENDIAN
> +                                               *data++ = r;
> +                                               *data++ = g;
> +                                               *data++ = b;
> +#else
> +                                               *data++ = b;
> +                                               *data++ = g;
> +                                               *data++ = r;
> +#endif
> +                                               count--;
> +                                       }
> +                               } else if (pixelDepth == 8 && imageType ==
> TYPE_RLE_BW) {
> +                                       byte color = tga.readByte();
> +                                       while (rleCount-- > 0) {
> +                                               *data++ = color;
> +                                               *data++ = color;
> +                                               *data++ = color;
> +                                               *data++ = color;
> +                                               count--;
> +                                       }
> +                               } else if (pixelDepth == 8 && imageType ==
> TYPE_RLE_CMAP) {
> +                                       byte index = tga.readByte();
> +                                       while (rleCount-- > 0) {
> +                                               *data++ = index;
> +                                               count--;
> +                                       }
> +                               } else {
> +                                       warning("Unhandled pixel-depth for
> image-type 10");
> +                                       return false;
> +                               }
> +                               // Raw-packet
> +                       } else if (type == 0) {
> +                               if (pixelDepth == 32 && imageType ==
> TYPE_RLE_TRUECOLOR) {
> +                                       while (rleCount-- > 0) {
> +                                               uint32 color =
> tga.readUint32LE();
> +                                               *((uint32 *)data) = color;
> +                                               data += 4;
> +                                               count--;
> +                                       }
> +                               } else if (pixelDepth == 24 && imageType
> == TYPE_RLE_TRUECOLOR) {
> +                                       while (rleCount-- > 0) {
> +                                               byte r = tga.readByte();
> +                                               byte g = tga.readByte();
> +                                               byte b = tga.readByte();
> +#ifdef SCUMM_LITTLE_ENDIAN
> +                                               *data++ = r;
> +                                               *data++ = g;
> +                                               *data++ = b;
> +#else
> +                                               *data++ = b;
> +                                               *data++ = g;
> +                                               *data++ = r;
> +#endif
> +                                               count--;
> +                                       }
> +                               } else if (pixelDepth == 8 && imageType ==
> TYPE_RLE_BW) {
> +                                       while (rleCount-- > 0) {
> +                                               byte color =
> tga.readByte();
> +                                               *data++ = color;
> +                                               *data++ = color;
> +                                               *data++ = color;
> +                                               *data++ = color;
> +                                               count--;
> +                                       }
> +                               } else if (pixelDepth == 8 && imageType ==
> TYPE_RLE_CMAP) {
> +                                       while (rleCount-- > 0) {
> +                                               byte index =
> tga.readByte();
> +                                               *data++ = index;
> +                                               count--;
> +                                       }
> +                               } else {
> +                                       warning("Unhandled pixel-depth for
> image-type 10");
> +                                       return false;
> +                               }
> +                       } else {
> +                               warning("Unknown header for RLE-packet
> %d", type);
> +                               return false;
> +                       }
> +               }
> +       } else {
> +               return false;
> +       }
> +       return true;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/tga.h b/image/tga.h
> new file mode 100644
> index 0000000..677c178
> --- /dev/null
> +++ b/image/tga.h
> @@ -0,0 +1,100 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +/* Based on code from eos https://github.com/DrMcCoy/xoreos/
> + * relicensed under GPLv2+ with permission from DrMcCoy and clone2727
> + */
> +
> +/*
> + * TGA decoder used in engines:
> + *  - wintermute
> + *  - zvision
> + */
> +
> +#ifndef IMAGE_TGA_H
> +#define IMAGE_TGA_H
> +
> +#include "graphics/surface.h"
> +#include "image/image_decoder.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Image {
> +
> +/** TarGa image-decoder
> + * The following variations of TGA are supported:
> + * - Type 1 - Color-mapped images in 16/24/32 bpp with 8 bit indexes
> + * - Type 2 - 16/24/32 bpp Top AND Bottom origined.
> + * - Type 3 - Black/White images, 8bpp.
> + * - Type 9 - RLE-encoded color-mapped images. (8 bit indexes only)
> + * - Type 10 - RLE-encoded TrueColor, 24/32bpp.
> + * - Type 11 - RLE-encoded Black/White, 8bpp.
> + *
> + * No images are returned with a palette, instead they are converted
> + * to 16 bpp for Type 1, or 32 bpp for Black/White-images.
> + */
> +class TGADecoder : public ImageDecoder {
> +public:
> +       TGADecoder();
> +       virtual ~TGADecoder();
> +       virtual void destroy();
> +       virtual const Graphics::Surface *getSurface() const { return
> &_surface; }
> +       virtual const byte *getPalette() const { return _colorMap; }
> +       virtual uint16 getPaletteColorCount() const { return
> _colorMapLength; }
> +       virtual bool loadStream(Common::SeekableReadStream &stream);
> +private:
> +       // Format-spec from:
> +       //http://www.ludorg.net/amnesia/TGA_File_Format_Spec.html
> +       enum {
> +           TYPE_CMAP = 1,
> +           TYPE_TRUECOLOR = 2,
> +           TYPE_BW = 3,
> +           TYPE_RLE_CMAP = 9,
> +           TYPE_RLE_TRUECOLOR = 10,
> +           TYPE_RLE_BW = 11
> +       };
> +
> +       // Color-map:
> +       bool _colorMapSize;
> +       byte *_colorMap;
> +       int16 _colorMapOrigin;
> +       int16 _colorMapLength;
> +       byte _colorMapEntryLength;
> +
> +       // Origin may be at the top, or bottom
> +       bool _originTop;
> +
> +       Graphics::PixelFormat _format;
> +       Graphics::Surface _surface;
> +       // Loading helpers
> +       bool readHeader(Common::SeekableReadStream &tga, byte &imageType,
> byte &pixelDepth);
> +       bool readData(Common::SeekableReadStream &tga, byte imageType,
> byte pixelDepth);
> +       bool readDataColorMapped(Common::SeekableReadStream &tga, byte
> imageType, byte indexDepth);
> +       bool readDataRLE(Common::SeekableReadStream &tga, byte imageType,
> byte pixelDepth);
> +       bool readColorMap(Common::SeekableReadStream &tga, byte imageType,
> byte pixelDepth);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/video/codecs/jpeg.cpp b/video/codecs/jpeg.cpp
> index a5d29ce..77917f3 100644
> --- a/video/codecs/jpeg.cpp
> +++ b/video/codecs/jpeg.cpp
> @@ -23,7 +23,7 @@
>  #include "common/system.h"
>  #include "common/textconsole.h"
>  #include "graphics/surface.h"
> -#include "graphics/decoders/jpeg.h"
> +#include "image/jpeg.h"
>
>  #include "video/codecs/jpeg.h"
>
> @@ -46,7 +46,7 @@ JPEGDecoder::~JPEGDecoder() {
>  }
>
>  const Graphics::Surface
> *JPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
> -       Graphics::JPEGDecoder jpeg;
> +       Image::JPEGDecoder jpeg;
>
>         if (!jpeg.loadStream(*stream)) {
>                 warning("Failed to decode JPEG frame");
> diff --git a/video/codecs/mjpeg.cpp b/video/codecs/mjpeg.cpp
> index 443a06e..16fb4f3 100644
> --- a/video/codecs/mjpeg.cpp
> +++ b/video/codecs/mjpeg.cpp
> @@ -29,7 +29,7 @@
>  #include "common/system.h"
>  #include "common/textconsole.h"
>  #include "graphics/surface.h"
> -#include "graphics/decoders/jpeg.h"
> +#include "image/jpeg.h"
>
>  #include "video/codecs/mjpeg.h"
>
> @@ -197,7 +197,7 @@ const Graphics::Surface
> *MJPEGDecoder::decodeImage(Common::SeekableReadStream *s
>         stream->read(data + dataOffset, stream->size() - inputSkip);
>
>         Common::MemoryReadStream convertedStream(data, outputSize,
> DisposeAfterUse::YES);
> -       Graphics::JPEGDecoder jpeg;
> +       Image::JPEGDecoder jpeg;
>
>         if (!jpeg.loadStream(convertedStream)) {
>                 warning("Failed to decode MJPEG frame");
>
>
> Commit: b568ac73b9d2e063eb04693e4610a9932035b696
>
> https://github.com/scummvm/scummvm/commit/b568ac73b9d2e063eb04693e4610a9932035b696
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:27:36-08:00
>
> Commit Message:
> IMAGE: Move video codecs to image/
>
> Changed paths:
>   A image/codecs/cdtoons.cpp
>   A image/codecs/cdtoons.h
>   A image/codecs/cinepak.cpp
>   A image/codecs/cinepak.h
>   A image/codecs/codec.h
>   A image/codecs/indeo3.cpp
>   A image/codecs/indeo3.h
>   A image/codecs/jpeg.cpp
>   A image/codecs/jpeg.h
>   A image/codecs/mjpeg.cpp
>   A image/codecs/mjpeg.h
>   A image/codecs/mpeg.cpp
>   A image/codecs/mpeg.h
>   A image/codecs/msrle.cpp
>   A image/codecs/msrle.h
>   A image/codecs/msvideo1.cpp
>   A image/codecs/msvideo1.h
>   A image/codecs/qtrle.cpp
>   A image/codecs/qtrle.h
>   A image/codecs/rpza.cpp
>   A image/codecs/rpza.h
>   A image/codecs/smc.cpp
>   A image/codecs/smc.h
>   A image/codecs/svq1.cpp
>   A image/codecs/svq1.h
>   A image/codecs/svq1_cb.h
>   A image/codecs/svq1_vlc.h
>   A image/codecs/truemotion1.cpp
>   A image/codecs/truemotion1.h
>   A image/codecs/truemotion1data.h
>   R video/codecs/cdtoons.cpp
>   R video/codecs/cdtoons.h
>   R video/codecs/cinepak.cpp
>   R video/codecs/cinepak.h
>   R video/codecs/codec.h
>   R video/codecs/indeo3.cpp
>   R video/codecs/indeo3.h
>   R video/codecs/jpeg.cpp
>   R video/codecs/jpeg.h
>   R video/codecs/mjpeg.cpp
>   R video/codecs/mjpeg.h
>   R video/codecs/mpeg.cpp
>   R video/codecs/mpeg.h
>   R video/codecs/msrle.cpp
>   R video/codecs/msrle.h
>   R video/codecs/msvideo1.cpp
>   R video/codecs/msvideo1.h
>   R video/codecs/qtrle.cpp
>   R video/codecs/qtrle.h
>   R video/codecs/rpza.cpp
>   R video/codecs/rpza.h
>   R video/codecs/smc.cpp
>   R video/codecs/smc.h
>   R video/codecs/svq1.cpp
>   R video/codecs/svq1.h
>   R video/codecs/svq1_cb.h
>   R video/codecs/svq1_vlc.h
>   R video/codecs/truemotion1.cpp
>   R video/codecs/truemotion1.h
>   R video/codecs/truemotion1data.h
>     image/module.mk
>     video/avi_decoder.cpp
>     video/avi_decoder.h
>     video/coktel_decoder.cpp
>     video/coktel_decoder.h
>     video/module.mk
>     video/qt_decoder.cpp
>     video/qt_decoder.h
>
>
>
> diff --git a/image/codecs/cdtoons.cpp b/image/codecs/cdtoons.cpp
> new file mode 100644
> index 0000000..e1246a0
> --- /dev/null
> +++ b/image/codecs/cdtoons.cpp
> @@ -0,0 +1,448 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "image/codecs/cdtoons.h"
> +#include "common/rect.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +#include "common/array.h"
> +
> +namespace Image {
> +
> +struct CDToonsAction {
> +       uint16 blockId;
> +       Common::Rect rect;
> +};
> +
> +struct CDToonsDiff {
> +       byte *data;
> +       uint32 size;
> +       Common::Rect rect;
> +};
> +
> +static Common::Rect readRect(Common::SeekableReadStream *stream) {
> +       Common::Rect rect;
> +       rect.top = stream->readUint16BE();
> +       rect.left = stream->readUint16BE();
> +       rect.bottom = stream->readUint16BE();
> +       rect.right = stream->readUint16BE();
> +       return rect;
> +}
> +
> +CDToonsDecoder::CDToonsDecoder(uint16 width, uint16 height) {
> +       debugN(5, "CDToons: width %d, height %d\n", width, height);
> +
> +       _surface = new Graphics::Surface();
> +       _surface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> +
> +       _currentPaletteId = 0;
> +       memset(_palette, 0, 256 * 3);
> +       _dirtyPalette = false;
> +}
> +
> +CDToonsDecoder::~CDToonsDecoder() {
> +       _surface->free();
> +       delete _surface;
> +
> +       for (Common::HashMap<uint16, CDToonsBlock>::iterator i =
> _blocks.begin(); i != _blocks.end(); i++)
> +               delete[] i->_value.data;
> +}
> +
> +Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream
> *stream) {
> +       uint16 u0 = stream->readUint16BE(); // always 9?
> +       uint16 frameId = stream->readUint16BE();
> +       uint16 blocksValidUntil = stream->readUint16BE();
> +       byte u6 = stream->readByte();
> +       byte backgroundColor = stream->readByte();
> +       debugN(5, "CDToons frame %d, size %d, unknown %04x (at 0), blocks
> valid until %d, unknown 6 is %02x, bkg color is %02x\n",
> +               frameId, stream->size(), u0, blocksValidUntil, u6,
> backgroundColor);
> +
> +       Common::Rect clipRect = readRect(stream);
> +       debugN(9, "CDToons clipRect: (%d, %d) to (%d, %d)\n",
> +               clipRect.left, clipRect.top, clipRect.right,
> clipRect.bottom);
> +
> +       Common::Rect dirtyRect = readRect(stream);
> +       debugN(9, "CDToons dirtyRect: (%d, %d) to (%d, %d)\n",
> +               dirtyRect.left, dirtyRect.top, dirtyRect.right,
> dirtyRect.bottom);
> +
> +       uint32 flags = stream->readUint32BE();
> +       if (flags & 0x80)
> +               error("CDToons: frame already processed?");
> +       debugN(5, "CDToons flags: %08x\n", flags);
> +
> +       uint16 blockCount = stream->readUint16BE();
> +       uint16 blockOffset = stream->readUint16BE();
> +       debugN(9, "CDToons: %d blocks at 0x%04x\n",
> +               blockCount, blockOffset);
> +
> +       // max block id?
> +       uint16 u32 = stream->readUint16BE();
> +       debugN(5, "CDToons unknown at 32: %04x\n", u32);
> +
> +       byte actionCount = stream->readByte();
> +       byte u35 = stream->readByte();
> +
> +       uint16 paletteId = stream->readUint16BE();
> +       byte paletteSet = stream->readByte();
> +       debugN(9, "CDToons palette id %04x, palette byte %02x\n",
> +               paletteId, paletteSet);
> +
> +       byte u39 = stream->readByte();
> +       uint16 u40 = stream->readUint16BE();
> +       uint16 u42 = stream->readUint16BE();
> +       debugN(5, "CDToons: unknown at 35 is %02x, unknowns at 39: %02x,
> %04x, %04x\n",
> +               u35, u39, u40, u42);
> +
> +       Common::Array<CDToonsAction> actions;
> +
> +       for (uint i = 0; i < actionCount; i++) {
> +               CDToonsAction action;
> +               action.blockId = stream->readUint16BE();
> +               action.rect = readRect(stream);
> +               debugN(9, "CDToons action: render block %d at (%d, %d) to
> (%d, %d)\n",
> +                       action.blockId, action.rect.left, action.rect.top,
> action.rect.right, action.rect.bottom);
> +               actions.push_back(action);
> +       }
> +
> +       if (stream->pos() > blockOffset)
> +               error("CDToons header ended at 0x%08x, but blocks should
> have started at 0x%08x",
> +                       stream->pos(), blockOffset);
> +
> +       if (stream->pos() != blockOffset)
> +               error("CDToons had %d unknown bytes after header",
> blockOffset - stream->pos());
> +
> +       for (uint i = 0; i < blockCount; i++) {
> +               uint16 blockId = stream->readUint16BE();
> +               if (blockId >= 1200)
> +                       error("CDToons: block id %d was too high",
> blockId);
> +               if (_blocks.contains(blockId))
> +                       error("CDToons: new block %d was already seen",
> blockId);
> +
> +               CDToonsBlock block;
> +               block.flags = stream->readUint16BE();
> +               // flag 1 = palette, flag 2 = data?
> +               if (block.flags & 0x8000)
> +                       error("CDToons: block already processed?");
> +               block.size = stream->readUint32BE();
> +               if (block.size < 14)
> +                       error("CDToons: block size was %d, too small",
> block.size);
> +               block.size -= 14;
> +               block.startFrame = stream->readUint16BE();
> +               block.endFrame = stream->readUint16BE();
> +               block.unknown12 = stream->readUint16BE();
> +               block.data = new byte[block.size];
> +               stream->read(block.data, block.size);
> +
> +               debugN(9, "CDToons block id 0x%04x of size 0x%08x, flags
> %04x, from frame %d to %d, unknown at 12 is %04x\n",
> +                       blockId, block.size, block.flags,
> block.startFrame, block.endFrame, block.unknown12);
> +
> +               _blocks[blockId] = block;
> +       }
> +
> +       byte xFrmBegin = 0, xFrmCount;
> +       Common::Array<CDToonsDiff> diffs;
> +
> +       while (true) {
> +               int32 nextPos = stream->pos();
> +               uint32 tag = stream->readUint32BE();
> +               uint32 size = stream->readUint32BE();
> +               nextPos += size;
> +
> +               switch (tag) {
> +               case MKTAG('D','i','f','f'):
> +                       {
> +                       debugN(5, "CDToons: Diff\n");
> +                       uint16 count = stream->readUint16BE();
> +
> +                       Common::Rect diffClipRect = readRect(stream);
> +                       debugN(9, "CDToons diffClipRect: (%d, %d) to (%d,
> %d)\n",
> +                               diffClipRect.left, diffClipRect.top,
> diffClipRect.right, diffClipRect.bottom);
> +
> +                       debugN(5, "CDToons Diff: %d subentries\n", count);
> +                       for (uint i = 0; i < count; i++) {
> +                               CDToonsDiff diff;
> +
> +                               diff.rect = readRect(stream);
> +                               diff.size = stream->readUint32BE();
> +                               if (diff.size < 20)
> +                                       error("CDToons: Diff block size
> was %d, too small", diff.size);
> +
> +                               uint16 diffWidth = stream->readUint16BE();
> +                               uint16 diffHeight = stream->readUint16BE();
> +                               uint16 unknown16 = stream->readUint16BE();
> +                               uint16 unknown18 = stream->readUint16BE();
> +                               diff.size -= 8;
> +
> +                               if (diffWidth != diff.rect.width() ||
> diffHeight != diff.rect.height())
> +                                       error("CDToons: Diff sizes didn't
> match");
> +                               debugN(5, "CDToons Diff: size %d, frame
> from (%d, %d) to (%d, %d), unknowns %04x, %04x\n",
> +                                       diff.size, diff.rect.left,
> diff.rect.top, diff.rect.right, diff.rect.bottom,
> +                                       unknown16, unknown18);
> +
> +                               diff.data = new byte[diff.size];
> +                               stream->read(diff.data, diff.size);
> +                               diffs.push_back(diff);
> +                       }
> +                       }
> +                       break;
> +               case MKTAG('X','F','r','m'):
> +                       {
> +                       debugN(5, "CDToons: XFrm\n");
> +                       if (!(flags & 0x10))
> +                               error("CDToons: useless XFrm?");
> +
> +                       if (xFrmBegin)
> +                               error("CDToons: duplicate XFrm");
> +                       xFrmBegin = stream->readByte();
> +                       xFrmCount = stream->readByte();
> +                       debugN(9, "CDToons XFrm: run %d actions from
> %d\n", xFrmCount, xFrmBegin - 1);
> +
> +                       // TODO: don't ignore (if xFrmCount is non-zero)
> +                       Common::Rect dirtyRectXFrm = readRect(stream);
> +                       debugN(9, "CDToons XFrm dirtyRect: (%d, %d) to
> (%d, %d)\n",
> +                               dirtyRectXFrm.left, dirtyRectXFrm.top,
> dirtyRectXFrm.right, dirtyRectXFrm.bottom);
> +
> +                       // always zero?
> +                       Common::Rect dirtyRect2XFrm = readRect(stream);
> +                       debugN(9, "CDToons XFrm dirtyRect2: (%d, %d) to
> (%d, %d)\n",
> +                               dirtyRect2XFrm.left, dirtyRect2XFrm.top,
> dirtyRect2XFrm.right, dirtyRect2XFrm.bottom);
> +                       }
> +                       break;
> +               case MKTAG('M','r','k','s'):
> +                       debugN(5, "CDToons: Mrks\n");
> +                       if (!(flags & 0x2))
> +                               error("CDToons: useless Mrks?");
> +
> +                       // TODO
> +                       warning("CDToons: encountered Mrks, not
> implemented yet");
> +                       break;
> +               case MKTAG('S','c','a','l'):
> +                       // TODO
> +                       warning("CDToons: encountered Scal, not
> implemented yet");
> +                       break;
> +               case MKTAG('W','r','M','p'):
> +                       warning("CDToons: encountered WrMp, ignoring");
> +                       break;
> +               case MKTAG('F','r','t','R'):
> +                       {
> +                       debugN(5, "CDToons: FrtR\n");
> +                       if (!(flags & 0x40))
> +                               error("CDToons: useless FrtR?");
> +
> +                       uint16 count = stream->readUint16BE();
> +                       debugN(9, "CDToons FrtR: %d dirty rectangles\n",
> count);
> +                       for (uint i = 0; i < count; i++) {
> +                               Common::Rect dirtyRectFrtR =
> readRect(stream);
> +                               debugN(9, "CDToons FrtR dirtyRect: (%d,
> %d) to (%d, %d)\n",
> +                                       dirtyRectFrtR.left,
> dirtyRectFrtR.top, dirtyRectFrtR.right, dirtyRectFrtR.bottom);
> +                       }
> +                       }
> +                       break;
> +               case MKTAG('B','c','k','R'):
> +                       {
> +                       debugN(5, "CDToons: BckR\n");
> +                       if (!(flags & 0x20))
> +                               error("CDToons: useless BckR?");
> +
> +                       uint16 count = stream->readUint16BE();
> +                       debugN(9, "CDToons BckR: %d subentries\n", count);
> +                       for (uint i = 0; i < count; i++) {
> +                               Common::Rect dirtyRectBckR =
> readRect(stream);
> +                               debugN(9, "CDToons BckR dirtyRect: (%d,
> %d) to (%d, %d)\n",
> +                                       dirtyRectBckR.left,
> dirtyRectBckR.top, dirtyRectBckR.right, dirtyRectBckR.bottom);
> +                       }
> +                       }
> +                       break;
> +               default:
> +                       warning("Unknown CDToons tag '%s'", tag2str(tag));
> +               }
> +
> +               if (stream->pos() > nextPos)
> +                       error("CDToons ran off the end of a block while
> reading it (at %d, next block at %d)",
> +                               stream->pos(), nextPos);
> +               if (stream->pos() != nextPos) {
> +                       warning("CDToons had %d unknown bytes after
> block", nextPos - stream->pos());
> +                       stream->seek(nextPos);
> +               }
> +
> +               if (stream->pos() == stream->size())
> +                       break;
> +       }
> +
> +       for (uint i = 0; i < diffs.size(); i++) {
> +               renderBlock(diffs[i].data, diffs[i].size,
> diffs[i].rect.left, diffs[i].rect.top, diffs[i].rect.width(),
> diffs[i].rect.height());
> +               delete[] diffs[i].data;
> +       }
> +       if (!diffs.empty())
> +               return _surface;
> +
> +       for (uint i = 0; i < actions.size(); i++) {
> +               CDToonsAction &action = actions[i];
> +               if (i == 0 && action.blockId == 0)
> +                       memset(_surface->getPixels(), backgroundColor,
> _surface->w * _surface->h);
> +               if (!_blocks.contains(action.blockId))
> +                       continue;
> +               if (!action.rect.right)
> +                       continue;
> +               if (i == 0 && !diffs.empty())
> +                       continue;
> +
> +               CDToonsBlock &block = _blocks[action.blockId];
> +               uint16 width = READ_BE_UINT16(block.data + 2);
> +               uint16 height = READ_BE_UINT16(block.data);
> +
> +               renderBlock(block.data + 14, block.size - 14,
> action.rect.left, action.rect.top, width, height);
> +       }
> +
> +       if (paletteId && _currentPaletteId != paletteId) {
> +               if (!_blocks.contains(paletteId))
> +                       error("CDToons: no block for palette %04x",
> paletteId);
> +               if (_blocks[paletteId].size != 2 * 3 * 256)
> +                       error("CDToons: palette %04x is wrong size (%d)",
> paletteId, _blocks[paletteId].size);
> +
> +               _currentPaletteId = paletteId;
> +               if (!paletteSet)
> +                       setPalette(_blocks[paletteId].data);
> +       }
> +
> +       return _surface;
> +}
> +
> +void CDToonsDecoder::renderBlock(byte *data, uint dataSize, int destX,
> int destY, uint width, uint height) {
> +       byte *currData = data;
> +       byte *dataEnd = data + dataSize;
> +
> +       debugN(9, "CDToons renderBlock at (%d, %d), width %d, height %d\n",
> +               destX, destY, width, height);
> +
> +       if (destX + width > _surface->w)
> +               width = _surface->w - destX;
> +       if (destY + height > _surface->h)
> +               height = _surface->h - destY;
> +
> +       uint skip = 0;
> +       if (destX < 0) {
> +               skip = -destX;
> +               if (width <= skip)
> +                       return;
> +               width -= skip;
> +               destX = 0;
> +       }
> +
> +       for (uint y = 0; y < height; y++) {
> +               if (destY + (int)y >= _surface->h)
> +                       break;
> +
> +               if (currData + 2 > dataEnd)
> +                       error("CDToons renderBlock overran whole data by
> %d bytes", (uint32)(currData - dataEnd));
> +
> +               uint16 lineSize = READ_BE_UINT16(currData);
> +               currData += 2;
> +               byte *nextLine = currData + lineSize;
> +
> +               if (nextLine > dataEnd)
> +                       error("CDToons renderBlock was going to overrun
> data by %d bytes (line size %d)",
> +                               (uint32)(nextLine - dataEnd),
> (uint32)(nextLine - currData));
> +
> +               if (destY + (int)y < 0) {
> +                       currData = nextLine;
> +                       continue;
> +               }
> +
> +               byte *pixels = (byte *)_surface->getBasePtr(destX, destY +
> y);
> +
> +               int leftToSkip = skip;
> +               uint x = 0;
> +               bool done = false;
> +               while (x < width && !done) {
> +                       int size = (uint)*currData;
> +                       currData++;
> +                       bool raw = !(size & 0x80);
> +                       size = (size & 0x7f) + 1;
> +
> +                       if (leftToSkip) {
> +                               if (leftToSkip >= size) {
> +                                       leftToSkip -= size;
> +                                       if (raw)
> +                                               currData += size;
> +                                       else
> +                                               currData++;
> +                                       continue;
> +                               } else {
> +                                       size -= leftToSkip;
> +                                       if (raw)
> +                                               currData += leftToSkip;
> +                                       leftToSkip = 0;
> +                               }
> +                       }
> +
> +                       if (x + size >= width) {
> +                               size = width - x;
> +                               done = true;
> +                       }
> +                       if (destX + (int)x + size >= (int)_surface->w) {
> +                               size = MIN<int>((int)_surface->w - destX -
> (int)x, width - x);
> +                               done = true;
> +                       }
> +                       if (size <= 0) {
> +                               size = 0;
> +                               done = true;
> +                       }
> +
> +                       if (raw) {
> +                               memcpy(pixels + x, currData, size);
> +                               currData += size;
> +                               x += size;
> +                       } else {
> +                               byte color = *currData;
> +                               currData++;
> +                               if (color) {
> +                                       memset(pixels + x, color, size);
> +                               }
> +                               x += size;
> +                       }
> +
> +                       if (currData > nextLine) {
> +                               warning("CDToons renderBlock overran line
> by %d bytes", (uint32)(currData - nextLine));
> +                               return;
> +                       }
> +               }
> +
> +               currData = nextLine;
> +       }
> +}
> +
> +void CDToonsDecoder::setPalette(byte *data) {
> +       _dirtyPalette = true;
> +
> +       // A lovely QuickTime palette
> +       for (uint i = 0; i < 256; i++) {
> +               _palette[i * 3]     = *data;
> +               _palette[i * 3 + 1] = *(data + 2);
> +               _palette[i * 3 + 2] = *(data + 4);
> +               data += 6;
> +       }
> +
> +       _palette[0] = _palette[1] = _palette[2] = 0;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/cdtoons.h b/image/codecs/cdtoons.h
> new file mode 100644
> index 0000000..ac569b5
> --- /dev/null
> +++ b/image/codecs/cdtoons.h
> @@ -0,0 +1,72 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_CDTOONS_H
> +#define IMAGE_CODECS_CDTOONS_H
> +
> +#include "image/codecs/codec.h"
> +
> +#include "common/hashmap.h"
> +
> +namespace Image {
> +
> +struct CDToonsBlock {
> +       uint16 flags;
> +       uint32 size;
> +       uint16 startFrame;
> +       uint16 endFrame;
> +       uint16 unknown12;
> +       byte *data;
> +};
> +
> +/**
> + * Broderbund CDToons decoder.
> + *
> + * Used in video:
> + *  - QuickTimeDecoder
> + */
> +class CDToonsDecoder : public Codec {
> +public:
> +       CDToonsDecoder(uint16 width, uint16 height);
> +       ~CDToonsDecoder();
> +
> +       Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat::createFormatCLUT8(); }
> +       bool containsPalette() const { return true; }
> +       const byte *getPalette() { _dirtyPalette = false; return _palette;
> }
> +       bool hasDirtyPalette() const { return _dirtyPalette; }
> +
> +private:
> +       Graphics::Surface *_surface;
> +       byte _palette[256 * 3];
> +       bool _dirtyPalette;
> +       uint16 _currentPaletteId;
> +
> +       Common::HashMap<uint16, CDToonsBlock> _blocks;
> +
> +       void renderBlock(byte *data, uint size, int x, int y, uint width,
> uint height);
> +       void setPalette(byte *data);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/cinepak.cpp b/image/codecs/cinepak.cpp
> new file mode 100644
> index 0000000..6af7ab0
> --- /dev/null
> +++ b/image/codecs/cinepak.cpp
> @@ -0,0 +1,309 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "image/codecs/cinepak.h"
> +
> +#include "common/debug.h"
> +#include "common/stream.h"
> +#include "common/system.h"
> +#include "common/textconsole.h"
> +#include "common/util.h"
> +
> +#include "graphics/surface.h"
> +
> +// Code here partially based off of ffmpeg ;)
> +
> +namespace Image {
> +
> +#define PUT_PIXEL(offset, lum, u, v) \
> +       if (_pixelFormat.bytesPerPixel != 1) { \
> +               byte r = _clipTable[lum + (v << 1)]; \
> +               byte g = _clipTable[lum - (u >> 1) - v]; \
> +               byte b = _clipTable[lum + (u << 1)]; \
> +               \
> +               if (_pixelFormat.bytesPerPixel == 2) \
> +                       *((uint16 *)_curFrame.surface->getPixels() +
> offset) = _pixelFormat.RGBToColor(r, g, b); \
> +               else \
> +                       *((uint32 *)_curFrame.surface->getPixels() +
> offset) = _pixelFormat.RGBToColor(r, g, b); \
> +       } else \
> +               *((byte *)_curFrame.surface->getPixels() + offset) = lum
> +
> +CinepakDecoder::CinepakDecoder(int bitsPerPixel) : Codec() {
> +       _curFrame.surface = NULL;
> +       _curFrame.strips = NULL;
> +       _y = 0;
> +
> +       if (bitsPerPixel == 8)
> +               _pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
> +       else
> +               _pixelFormat = g_system->getScreenFormat();
> +
> +       // Create a lookup for the clip function
> +       // This dramatically improves the performance of the color
> conversion
> +       _clipTableBuf = new byte[1024];
> +
> +       for (uint i = 0; i < 1024; i++) {
> +               if (i <= 512)
> +                       _clipTableBuf[i] = 0;
> +               else if (i >= 768)
> +                       _clipTableBuf[i] = 255;
> +               else
> +                       _clipTableBuf[i] = i - 512;
> +       }
> +
> +       _clipTable = _clipTableBuf + 512;
> +}
> +
> +CinepakDecoder::~CinepakDecoder() {
> +       if (_curFrame.surface) {
> +               _curFrame.surface->free();
> +               delete _curFrame.surface;
> +       }
> +
> +       delete[] _curFrame.strips;
> +       delete[] _clipTableBuf;
> +}
> +
> +const Graphics::Surface
> *CinepakDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +       _curFrame.flags = stream->readByte();
> +       _curFrame.length = (stream->readByte() << 16);
> +       _curFrame.length |= stream->readUint16BE();
> +       _curFrame.width = stream->readUint16BE();
> +       _curFrame.height = stream->readUint16BE();
> +       _curFrame.stripCount = stream->readUint16BE();
> +
> +       if (_curFrame.strips == NULL)
> +               _curFrame.strips = new CinepakStrip[_curFrame.stripCount];
> +
> +       debug(4, "Cinepak Frame: Width = %d, Height = %d, Strip Count =
> %d", _curFrame.width, _curFrame.height, _curFrame.stripCount);
> +
> +       // Borrowed from FFMPEG. This should cut out the extra data
> Cinepak for Sega has (which is useless).
> +       // The theory behind this is that this is here to confuse standard
> Cinepak decoders. But, we won't let that happen! ;)
> +       if (_curFrame.length != (uint32)stream->size()) {
> +               if (stream->readUint16BE() == 0xFE00)
> +                       stream->readUint32BE();
> +               else if ((stream->size() % _curFrame.length) == 0)
> +                       stream->seek(-2, SEEK_CUR);
> +       }
> +
> +       if (!_curFrame.surface) {
> +               _curFrame.surface = new Graphics::Surface();
> +               _curFrame.surface->create(_curFrame.width,
> _curFrame.height, _pixelFormat);
> +       }
> +
> +       // Reset the y variable.
> +       _y = 0;
> +
> +       for (uint16 i = 0; i < _curFrame.stripCount; i++) {
> +               if (i > 0 && !(_curFrame.flags & 1)) { // Use codebooks
> from last strip
> +                       for (uint16 j = 0; j < 256; j++) {
> +                               _curFrame.strips[i].v1_codebook[j] =
> _curFrame.strips[i - 1].v1_codebook[j];
> +                               _curFrame.strips[i].v4_codebook[j] =
> _curFrame.strips[i - 1].v4_codebook[j];
> +                       }
> +               }
> +
> +               _curFrame.strips[i].id = stream->readUint16BE();
> +               _curFrame.strips[i].length = stream->readUint16BE() - 12;
> // Subtract the 12 byte header
> +               _curFrame.strips[i].rect.top = _y; stream->readUint16BE();
> // Ignore, substitute with our own.
> +               _curFrame.strips[i].rect.left = 0; stream->readUint16BE();
> // Ignore, substitute with our own
> +               _curFrame.strips[i].rect.bottom = _y +
> stream->readUint16BE();
> +               _curFrame.strips[i].rect.right = _curFrame.width;
> stream->readUint16BE(); // Ignore, substitute with our own
> +
> +               // Sanity check. Because Cinepak is based on 4x4 blocks,
> the width and height of each strip needs to be divisible by 4.
> +               assert(!(_curFrame.strips[i].rect.width() % 4) &&
> !(_curFrame.strips[i].rect.height() % 4));
> +
> +               uint32 pos = stream->pos();
> +
> +               while ((uint32)stream->pos() < (pos +
> _curFrame.strips[i].length) && !stream->eos()) {
> +                       byte chunkID = stream->readByte();
> +
> +                       if (stream->eos())
> +                               break;
> +
> +                       // Chunk Size is 24-bit, ignore the first 4 bytes
> +                       uint32 chunkSize = stream->readByte() << 16;
> +                       chunkSize += stream->readUint16BE() - 4;
> +
> +                       int32 startPos = stream->pos();
> +
> +                       switch (chunkID) {
> +                       case 0x20:
> +                       case 0x21:
> +                       case 0x24:
> +                       case 0x25:
> +                               loadCodebook(stream, i, 4, chunkID,
> chunkSize);
> +                               break;
> +                       case 0x22:
> +                       case 0x23:
> +                       case 0x26:
> +                       case 0x27:
> +                               loadCodebook(stream, i, 1, chunkID,
> chunkSize);
> +                               break;
> +                       case 0x30:
> +                       case 0x31:
> +                       case 0x32:
> +                               decodeVectors(stream, i, chunkID,
> chunkSize);
> +                               break;
> +                       default:
> +                               warning("Unknown Cinepak chunk ID %02x",
> chunkID);
> +                               return _curFrame.surface;
> +                       }
> +
> +                       if (stream->pos() != startPos + (int32)chunkSize)
> +                               stream->seek(startPos + chunkSize);
> +               }
> +
> +               _y = _curFrame.strips[i].rect.bottom;
> +       }
> +
> +       return _curFrame.surface;
> +}
> +
> +void CinepakDecoder::loadCodebook(Common::SeekableReadStream *stream,
> uint16 strip, byte codebookType, byte chunkID, uint32 chunkSize) {
> +       CinepakCodebook *codebook = (codebookType == 1) ?
> _curFrame.strips[strip].v1_codebook : _curFrame.strips[strip].v4_codebook;
> +
> +       int32 startPos = stream->pos();
> +       uint32 flag = 0, mask = 0;
> +
> +       for (uint16 i = 0; i < 256; i++) {
> +               if ((chunkID & 0x01) && !(mask >>= 1)) {
> +                       if ((stream->pos() - startPos + 4) >
> (int32)chunkSize)
> +                               break;
> +
> +                       flag  = stream->readUint32BE();
> +                       mask  = 0x80000000;
> +               }
> +
> +               if (!(chunkID & 0x01) || (flag & mask)) {
> +                       byte n = (chunkID & 0x04) ? 4 : 6;
> +                       if ((stream->pos() - startPos + n) >
> (int32)chunkSize)
> +                               break;
> +
> +                       for (byte j = 0; j < 4; j++)
> +                               codebook[i].y[j] = stream->readByte();
> +
> +                       if (n == 6) {
> +                               codebook[i].u = stream->readSByte();
> +                               codebook[i].v = stream->readSByte();
> +                       } else {
> +                               // This codebook type indicates either
> greyscale or
> +                               // palettized video. For greyscale,
> default us to
> +                               // 0 for both u and v.
> +                               codebook[i].u = 0;
> +                               codebook[i].v = 0;
> +                       }
> +               }
> +       }
> +}
> +
> +void CinepakDecoder::decodeVectors(Common::SeekableReadStream *stream,
> uint16 strip, byte chunkID, uint32 chunkSize) {
> +       uint32 flag = 0, mask = 0;
> +       uint32 iy[4];
> +       int32 startPos = stream->pos();
> +
> +       for (uint16 y = _curFrame.strips[strip].rect.top; y <
> _curFrame.strips[strip].rect.bottom; y += 4) {
> +               iy[0] = _curFrame.strips[strip].rect.left + y *
> _curFrame.width;
> +               iy[1] = iy[0] + _curFrame.width;
> +               iy[2] = iy[1] + _curFrame.width;
> +               iy[3] = iy[2] + _curFrame.width;
> +
> +               for (uint16 x = _curFrame.strips[strip].rect.left; x <
> _curFrame.strips[strip].rect.right; x += 4) {
> +                       if ((chunkID & 0x01) && !(mask >>= 1)) {
> +                               if ((stream->pos() - startPos + 4) >
> (int32)chunkSize)
> +                                       return;
> +
> +                               flag  = stream->readUint32BE();
> +                               mask  = 0x80000000;
> +                       }
> +
> +                       if (!(chunkID & 0x01) || (flag & mask)) {
> +                               if (!(chunkID & 0x02) && !(mask >>= 1)) {
> +                                       if ((stream->pos() - startPos + 4)
> > (int32)chunkSize)
> +                                               return;
> +
> +                                       flag  = stream->readUint32BE();
> +                                       mask  = 0x80000000;
> +                               }
> +
> +                               if ((chunkID & 0x02) || (~flag & mask)) {
> +                                       if ((stream->pos() - startPos + 1)
> > (int32)chunkSize)
> +                                               return;
> +
> +                                       // Get the codebook
> +                                       CinepakCodebook codebook =
> _curFrame.strips[strip].v1_codebook[stream->readByte()];
> +
> +                                       PUT_PIXEL(iy[0] + 0,
> codebook.y[0], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[0] + 1,
> codebook.y[0], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[1] + 0,
> codebook.y[0], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[1] + 1,
> codebook.y[0], codebook.u, codebook.v);
> +
> +                                       PUT_PIXEL(iy[0] + 2,
> codebook.y[1], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[0] + 3,
> codebook.y[1], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[1] + 2,
> codebook.y[1], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[1] + 3,
> codebook.y[1], codebook.u, codebook.v);
> +
> +                                       PUT_PIXEL(iy[2] + 0,
> codebook.y[2], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[2] + 1,
> codebook.y[2], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[3] + 0,
> codebook.y[2], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[3] + 1,
> codebook.y[2], codebook.u, codebook.v);
> +
> +                                       PUT_PIXEL(iy[2] + 2,
> codebook.y[3], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[2] + 3,
> codebook.y[3], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[3] + 2,
> codebook.y[3], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[3] + 3,
> codebook.y[3], codebook.u, codebook.v);
> +                               } else if (flag & mask) {
> +                                       if ((stream->pos() - startPos + 4)
> > (int32)chunkSize)
> +                                               return;
> +
> +                                       CinepakCodebook codebook =
> _curFrame.strips[strip].v4_codebook[stream->readByte()];
> +                                       PUT_PIXEL(iy[0] + 0,
> codebook.y[0], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[0] + 1,
> codebook.y[1], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[1] + 0,
> codebook.y[2], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[1] + 1,
> codebook.y[3], codebook.u, codebook.v);
> +
> +                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream->readByte()];
> +                                       PUT_PIXEL(iy[0] + 2,
> codebook.y[0], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[0] + 3,
> codebook.y[1], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[1] + 2,
> codebook.y[2], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[1] + 3,
> codebook.y[3], codebook.u, codebook.v);
> +
> +                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream->readByte()];
> +                                       PUT_PIXEL(iy[2] + 0,
> codebook.y[0], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[2] + 1,
> codebook.y[1], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[3] + 0,
> codebook.y[2], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[3] + 1,
> codebook.y[3], codebook.u, codebook.v);
> +
> +                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream->readByte()];
> +                                       PUT_PIXEL(iy[2] + 2,
> codebook.y[0], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[2] + 3,
> codebook.y[1], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[3] + 2,
> codebook.y[2], codebook.u, codebook.v);
> +                                       PUT_PIXEL(iy[3] + 3,
> codebook.y[3], codebook.u, codebook.v);
> +                               }
> +                       }
> +
> +                       for (byte i = 0; i < 4; i++)
> +                               iy[i] += 4;
> +               }
> +       }
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/cinepak.h b/image/codecs/cinepak.h
> new file mode 100644
> index 0000000..99a316e
> --- /dev/null
> +++ b/image/codecs/cinepak.h
> @@ -0,0 +1,89 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_CINEPAK_H
> +#define IMAGE_CODECS_CINEPAK_H
> +
> +#include "common/scummsys.h"
> +#include "common/rect.h"
> +#include "graphics/pixelformat.h"
> +
> +#include "image/codecs/codec.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Image {
> +
> +struct CinepakCodebook {
> +       // These are not in the normal YUV colorspace, but in the Cinepak
> YUV colorspace instead.
> +       byte y[4]; // [0, 255]
> +       int8 u, v; // [-128, 127]
> +};
> +
> +struct CinepakStrip {
> +       uint16 id;
> +       uint16 length;
> +       Common::Rect rect;
> +       CinepakCodebook v1_codebook[256], v4_codebook[256];
> +};
> +
> +struct CinepakFrame {
> +       byte flags;
> +       uint32 length;
> +       uint16 width;
> +       uint16 height;
> +       uint16 stripCount;
> +       CinepakStrip *strips;
> +
> +       Graphics::Surface *surface;
> +};
> +
> +/**
> + * Cinepak decoder.
> + *
> + * Used in video:
> + *  - AVIDecoder
> + *  - QuickTimeDecoder
> + */
> +class CinepakDecoder : public Codec {
> +public:
> +       CinepakDecoder(int bitsPerPixel = 24);
> +       ~CinepakDecoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> _pixelFormat; }
> +
> +private:
> +       CinepakFrame _curFrame;
> +       int32 _y;
> +       Graphics::PixelFormat _pixelFormat;
> +       byte *_clipTable, *_clipTableBuf;
> +
> +       void loadCodebook(Common::SeekableReadStream *stream, uint16
> strip, byte codebookType, byte chunkID, uint32 chunkSize);
> +       void decodeVectors(Common::SeekableReadStream *stream, uint16
> strip, byte chunkID, uint32 chunkSize);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/codec.h b/image/codecs/codec.h
> new file mode 100644
> index 0000000..c84f3e3
> --- /dev/null
> +++ b/image/codecs/codec.h
> @@ -0,0 +1,82 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_CODEC_H
> +#define IMAGE_CODECS_CODEC_H
> +
> +#include "graphics/surface.h"
> +#include "graphics/pixelformat.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Image {
> +
> +/**
> + * An abstract representation of a video codec used for decoding
> + * video frames.
> + *
> + * Used in video:
> + *  - AVIDecoder
> + *  - QuickTimeDecoder
> + *  - VMDDecoder
> + */
> +class Codec {
> +public:
> +       Codec() {}
> +       virtual ~Codec() {}
> +
> +       /**
> +        * Decode the frame for the given data and return a pointer to a
> surface
> +        * containing the decoded frame.
> +        *
> +        * @return a pointer to the decoded frame
> +        * @note stream is not deleted
> +        */
> +       virtual const Graphics::Surface
> *decodeImage(Common::SeekableReadStream *stream) = 0;
> +
> +       /**
> +        * Get the format that the surface returned from decodeImage() will
> +        * be in.
> +        */
> +       virtual Graphics::PixelFormat getPixelFormat() const = 0;
> +
> +       /**
> +        * Can this codec's frames contain a palette?
> +        */
> +       virtual bool containsPalette() const { return false; }
> +
> +       /**
> +        * Get the palette last decoded from decodeImage
> +        */
> +       virtual const byte *getPalette() { return 0; }
> +
> +       /**
> +        * Does the codec have a dirty palette?
> +        */
> +       virtual bool hasDirtyPalette() const { return false; }
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/indeo3.cpp b/image/codecs/indeo3.cpp
> new file mode 100644
> index 0000000..77bcec0
> --- /dev/null
> +++ b/image/codecs/indeo3.cpp
> @@ -0,0 +1,3487 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "common/scummsys.h"
> +
> +/* Intel Indeo 3 decompressor, derived from ffmpeg.
> + *
> + * Original copyright note: * Intel Indeo 3 (IV31, IV32, etc.) video
> decoder for ffmpeg
> + * written, produced, and directed by Alan Smithee
> + */
> +
> +#include "common/system.h"
> +#include "common/endian.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +#include "common/util.h"
> +
> +#include "graphics/yuv_to_rgb.h"
> +
> +#include "image/codecs/indeo3.h"
> +
> +namespace Image {
> +
> +Indeo3Decoder::Indeo3Decoder(uint16 width, uint16 height) : _ModPred(0),
> _corrector_type(0) {
> +       _iv_frame[0].the_buf = 0;
> +       _iv_frame[1].the_buf = 0;
> +
> +       _pixelFormat = g_system->getScreenFormat();
> +
> +       _surface = new Graphics::Surface;
> +       _surface->create(width, height, _pixelFormat);
> +
> +       buildModPred();
> +       allocFrames();
> +}
> +
> +Indeo3Decoder::~Indeo3Decoder() {
> +       _surface->free();
> +       delete _surface;
> +
> +       delete[] _iv_frame[0].the_buf;
> +       delete[] _ModPred;
> +       delete[] _corrector_type;
> +}
> +
> +Graphics::PixelFormat Indeo3Decoder::getPixelFormat() const {
> +       return _pixelFormat;
> +}
> +
> +bool Indeo3Decoder::isIndeo3(Common::SeekableReadStream &stream) {
> +       // Less than 16 bytes? This can't be right
> +       if (stream.size() < 16)
> +               return false;
> +
> +       uint32 id0 = stream.readUint32LE();
> +       uint32 id1 = stream.readUint32LE();
> +       uint32 id2 = stream.readUint32LE();
> +       uint32 id3 = stream.readUint32LE();
> +
> +       // Unknown, but according to the docs, always 0
> +       if (id1 != 0)
> +               return false;
> +
> +       // These 4 uint32s XOR'd need to spell "FRMH"
> +       if ((id0 ^ id1 ^ id2 ^ id3) != MKTAG('F','R','M','H'))
> +               return false;
> +
> +       return true;
> +}
> +
> +void Indeo3Decoder::buildModPred() {
> +       _ModPred = new byte[8 * 128];
> +
> +       for (int i = 0; i < 128; i++) {
> +               _ModPred[i+0*128] = (i > 126) ? 254 : 2*((i + 1) - ((i +
> 1) % 2));
> +               _ModPred[i+1*128] = (i == 7)  ?  20 : ((i == 119 || i ==
> 120)
> +                                             ? 236 : 2*((i + 2) - ((i +
> 1) % 3)));
> +               _ModPred[i+2*128] = (i > 125) ? 248 : 2*((i + 2) - ((i +
> 2) % 4));
> +               _ModPred[i+3*128] =                   2*((i + 1) - ((i -
> 3) % 5));
> +               _ModPred[i+4*128] = (i == 8)  ?  20 : 2*((i + 1) - ((i -
> 3) % 6));
> +               _ModPred[i+5*128] =                   2*((i + 4) - ((i +
> 3) % 7));
> +               _ModPred[i+6*128] = (i > 123) ? 240 : 2*((i + 4) - ((i +
> 4) % 8));
> +               _ModPred[i+7*128] =                   2*((i + 5) - ((i +
> 4) % 9));
> +       }
> +
> +       _corrector_type = new uint16[24 * 256];
> +
> +       for (int i = 0; i < 24; i++) {
> +               for (int j = 0; j < 256; j++) {
> +                       _corrector_type[i*256+j] =
> +                                (j < _corrector_type_0[i])         ? 1 :
> +                         ((j < 248 || (i == 16 && j == 248)) ? 0 :
> +                         _corrector_type_2[j - 248]);
> +               }
> +       }
> +}
> +
> +void Indeo3Decoder::allocFrames() {
> +       int32 luma_width   = (_surface->w + 3) & (~3);
> +       int32 luma_height  = (_surface->h + 3) & (~3);
> +
> +       int32 chroma_width  = ((luma_width  >> 2) + 3) & (~3);
> +       int32 chroma_height = ((luma_height >> 2) + 3) & (~3);
> +
> +       int32 luma_pixels = luma_width * luma_height;
> +       int32 chroma_pixels = chroma_width * chroma_height;
> +
> +       uint32 bufsize = luma_pixels * 2 + luma_width * 3 +
> +               (chroma_pixels + chroma_width) * 4;
> +
> +       _iv_frame[0].y_w  = _iv_frame[1].y_w  = luma_width;
> +       _iv_frame[0].y_h  = _iv_frame[1].y_h  = luma_height;
> +       _iv_frame[0].uv_w = _iv_frame[1].uv_w = chroma_width;
> +       _iv_frame[0].uv_h = _iv_frame[1].uv_h = chroma_height;
> +
> +       _iv_frame[0].the_buf_size = bufsize;
> +       _iv_frame[1].the_buf_size = 0;
> +
> +       _iv_frame[0].the_buf = new byte[bufsize];
> +       memset(_iv_frame[0].the_buf, 0, bufsize);
> +       _iv_frame[1].the_buf = 0;
> +
> +       uint32 offs = 0;
> +
> +       _iv_frame[0].Ybuf = _iv_frame[0].the_buf + luma_width;
> +       offs += luma_pixels + luma_width * 2;
> +       _iv_frame[1].Ybuf = _iv_frame[0].the_buf + offs;
> +       offs += (luma_pixels + luma_width);
> +       _iv_frame[0].Ubuf = _iv_frame[0].the_buf + offs;
> +       offs += (chroma_pixels + chroma_width);
> +       _iv_frame[1].Ubuf = _iv_frame[0].the_buf + offs;
> +       offs += (chroma_pixels + chroma_width);
> +       _iv_frame[0].Vbuf = _iv_frame[0].the_buf + offs;
> +       offs += (chroma_pixels + chroma_width);
> +       _iv_frame[1].Vbuf = _iv_frame[0].the_buf + offs;
> +
> +       for (int i = 1; i <= luma_width; i++)
> +               _iv_frame[0].Ybuf[-i] = _iv_frame[1].Ybuf[-i] =
> +                       _iv_frame[0].Ubuf[-i] = 0x80;
> +
> +       for (int i = 1; i <= chroma_width; i++) {
> +               _iv_frame[1].Ubuf[-i] = 0x80;
> +               _iv_frame[0].Vbuf[-i] = 0x80;
> +               _iv_frame[1].Vbuf[-i] = 0x80;
> +               _iv_frame[1].Vbuf[chroma_pixels+i-1] = 0x80;
> +       }
> +}
> +
> +const Graphics::Surface
> *Indeo3Decoder::decodeImage(Common::SeekableReadStream *stream) {
> +       // Not Indeo 3? Fail
> +       if (!isIndeo3(*stream))
> +               return 0;
> +
> +       stream->seek(12);
> +       uint32 frameDataLen = stream->readUint32LE();
> +
> +       // Less data than the frame should have? Fail
> +       if (stream->size() < (int)(frameDataLen - 16))
> +               return 0;
> +
> +       stream->seek(16); // Behind header
> +       stream->skip(2);  // Unknown
> +
> +       uint16 flags1 = stream->readUint16LE();
> +       uint32 flags3 = stream->readUint32LE();
> +       uint8  flags2 = stream->readByte();
> +
> +       // Finding the reference frame
> +       if (flags1 & 0x200) {
> +               _cur_frame = _iv_frame + 1;
> +               _ref_frame = _iv_frame;
> +       } else {
> +               _cur_frame = _iv_frame;
> +               _ref_frame = _iv_frame + 1;
> +       }
> +
> +       if (flags3 == 0x80)
> +               return _surface;
> +
> +       stream->skip(3);
> +
> +       uint16 fHeight = stream->readUint16LE();
> +       uint16 fWidth  = stream->readUint16LE();
> +
> +       uint32 chromaHeight = ((fHeight >> 2) + 3) & 0x7FFC;
> +       uint32 chromaWidth  = ((fWidth  >> 2) + 3) & 0x7FFC;
> +
> +       uint32 offs;
> +       uint32 offsY = stream->readUint32LE() + 16;
> +       uint32 offsU = stream->readUint32LE() + 16;
> +       uint32 offsV = stream->readUint32LE() + 16;
> +
> +       stream->skip(4);
> +
> +       uint32 hPos = stream->pos();
> +
> +       if (offsY < hPos) {
> +               warning("Indeo3Decoder::decodeImage: offsY < hPos");
> +               return 0;
> +       }
> +       if (offsU < hPos) {
> +               warning("Indeo3Decoder::decodeImage: offsY < hPos");
> +               return 0;
> +       }
> +       if (offsV < hPos) {
> +               warning("Indeo3Decoder::decodeImage: offsY < hPos");
> +               return 0;
> +       }
> +
> +       uint32 dataSize = stream->size() - hPos;
> +
> +       byte *inData = new byte[dataSize];
> +
> +       if (stream->read(inData, dataSize) != dataSize) {
> +               delete[] inData;
> +               return 0;
> +       }
> +
> +       byte *hdr_pos = inData;
> +       byte *buf_pos;
> +
> +       // Luminance Y
> +       stream->seek(offsY);
> +       buf_pos = inData + offsY + 4 - hPos;
> +       offs = stream->readUint32LE();
> +       decodeChunk(_cur_frame->Ybuf, _ref_frame->Ybuf, fWidth, fHeight,
> +                       buf_pos + offs * 2, flags2, hdr_pos, buf_pos,
> MIN<int>(fWidth, 160));
> +
> +       // Chrominance U
> +       stream->seek(offsU);
> +       buf_pos = inData + offsU + 4 - hPos;
> +       offs = stream->readUint32LE();
> +       decodeChunk(_cur_frame->Vbuf, _ref_frame->Vbuf, chromaWidth,
> chromaHeight,
> +                       buf_pos + offs * 2, flags2, hdr_pos, buf_pos,
> MIN<int>(chromaWidth, 40));
> +
> +       // Chrominance V
> +       stream->seek(offsV);
> +       buf_pos = inData + offsV + 4 - hPos;
> +       offs = stream->readUint32LE();
> +       decodeChunk(_cur_frame->Ubuf, _ref_frame->Ubuf, chromaWidth,
> chromaHeight,
> +                       buf_pos + offs * 2, flags2, hdr_pos, buf_pos,
> MIN<int>(chromaWidth, 40));
> +
> +       delete[] inData;
> +
> +       const byte *srcY = _cur_frame->Ybuf;
> +       const byte *srcU = _cur_frame->Ubuf;
> +       const byte *srcV = _cur_frame->Vbuf;
> +
> +       // Create buffers for U/V with an extra row/column copied from the
> second-to-last
> +       // row/column.
> +       byte *tempU = new byte[(chromaWidth + 1) * (chromaHeight + 1)];
> +       byte *tempV = new byte[(chromaWidth + 1) * (chromaHeight + 1)];
> +
> +       for (uint i = 0; i < chromaHeight; i++) {
> +               memcpy(tempU + (chromaWidth + 1) * i, srcU + chromaWidth *
> i, chromaWidth);
> +               memcpy(tempV + (chromaWidth + 1) * i, srcV + chromaWidth *
> i, chromaWidth);
> +               tempU[(chromaWidth + 1) * i + chromaWidth] =
> srcU[chromaWidth * (i + 1) - 1];
> +               tempV[(chromaWidth + 1) * i + chromaWidth] =
> srcV[chromaWidth * (i + 1) - 1];
> +       }
> +
> +       memcpy(tempU + (chromaWidth + 1) * chromaHeight, tempU +
> (chromaWidth + 1) * (chromaHeight - 1),
> +                       chromaWidth + 1);
> +       memcpy(tempV + (chromaWidth + 1) * chromaHeight, tempV +
> (chromaWidth + 1) * (chromaHeight - 1),
> +                       chromaWidth + 1);
> +
> +       // Blit the frame onto the surface
> +       uint32 scaleWidth  = _surface->w / fWidth;
> +       uint32 scaleHeight = _surface->h / fHeight;
> +
> +       if (scaleWidth == 1 && scaleHeight == 1) {
> +               // Shortcut: Don't need to scale so we can decode straight
> to the surface
> +               YUVToRGBMan.convert410(_surface,
> Graphics::YUVToRGBManager::kScaleITU, srcY, tempU, tempV,
> +                               fWidth, fHeight, fWidth, chromaWidth + 1);
> +       } else {
> +               // Need to upscale, so decode to a temp surface first
> +               Graphics::Surface tempSurface;
> +               tempSurface.create(fWidth, fHeight, _surface->format);
> +
> +               YUVToRGBMan.convert410(&tempSurface,
> Graphics::YUVToRGBManager::kScaleITU, srcY, tempU, tempV,
> +                               fWidth, fHeight, fWidth, chromaWidth + 1);
> +
> +               // Upscale
> +               for (int y = 0; y < _surface->h; y++) {
> +                       for (int x = 0; x < _surface->w; x++) {
> +                               if (_surface->format.bytesPerPixel == 1)
> +                                       *((byte *)_surface->getBasePtr(x,
> y)) = *((byte *)tempSurface.getBasePtr(x / scaleWidth, y / scaleHeight));
> +                               else if (_surface->format.bytesPerPixel ==
> 2)
> +                                       *((uint16
> *)_surface->getBasePtr(x, y)) = *((uint16 *)tempSurface.getBasePtr(x /
> scaleWidth, y / scaleHeight));
> +                               else if (_surface->format.bytesPerPixel ==
> 4)
> +                                       *((uint32
> *)_surface->getBasePtr(x, y)) = *((uint32 *)tempSurface.getBasePtr(x /
> scaleWidth, y / scaleHeight));
> +                       }
> +               }
> +
> +               tempSurface.free();
> +       }
> +
> +       delete[] tempU;
> +       delete[] tempV;
> +
> +       return _surface;
> +}
> +
> +typedef struct {
> +       int32 xpos;
> +       int32 ypos;
> +       int32 width;
> +       int32 height;
> +       int32 split_flag;
> +       int32 split_direction;
> +       int32 usl7;
> +} ustr_t;
> +
> +/* ----------------------------------------------------------------------
> */
> +
> +#define LV1_CHECK(buf1,rle_v3,lv1,lp2)  \
> +       if ((lv1 & 0x80) != 0) {   \
> +               if (rle_v3 != 0)         \
> +                       rle_v3 = 0;           \
> +               else {                  \
> +                       rle_v3 = 1;           \
> +                       buf1 -= 2;            \
> +               }                       \
> +       }                         \
> +       lp2 = 4;
> +
> +
> +#define RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)  \
> +       if (rle_v3 == 0) {         \
> +               rle_v2 = *buf1;         \
> +               rle_v1 = 1;             \
> +               if (rle_v2 > 32) {       \
> +                       rle_v2 -= 32;         \
> +                       rle_v1 = 0;           \
> +               }                       \
> +               rle_v3 = 1;             \
> +       }                         \
> +       buf1--;
> +
> +
> +#define LP2_CHECK(buf1,rle_v3,lp2)  \
> +       if (lp2 == 0 && rle_v3 != 0)     \
> +               rle_v3 = 0;           \
> +       else {                  \
> +               buf1--;               \
> +               rle_v3 = 1;           \
> +       }
> +
> +
> +#define RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2) \
> +       rle_v2--;             \
> +       if (rle_v2 == 0) {     \
> +               rle_v3 = 0;         \
> +               buf1 += 2;          \
> +       }                     \
> +       lp2 = 4;
> +
> +void Indeo3Decoder::decodeChunk(byte *cur, byte *ref, int width, int
> height,
> +               const byte *buf1, uint32 fflags2, const byte *hdr,
> +               const byte *buf2, int min_width_160) {
> +
> +       byte bit_buf;
> +       uint32 bit_pos, lv, lv1, lv2;
> +       int32 *width_tbl, width_tbl_arr[10];
> +       const int8 *ref_vectors;
> +       byte *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
> +       uint32 *cur_lp, *ref_lp;
> +       const uint32 *correction_lp[2], *correctionloworder_lp[2],
> *correctionhighorder_lp[2];
> +       uint16 *correction_type_sp[2];
> +       ustr_t strip_tbl[20], *strip;
> +       int i, j, k, lp1, lp2, flag1, cmd;
> +       int blks_width, blks_height, region_160_width;
> +       int rle_v1, rle_v2, rle_v3;
> +       uint16 res;
> +
> +       bit_buf = 0;
> +       ref_vectors = NULL;
> +
> +       width_tbl = width_tbl_arr + 1;
> +       i = (width < 0 ? width + 3 : width)/4;
> +       for (j = -1; j < 8; j++)
> +               width_tbl[j] = i * j;
> +
> +       strip = strip_tbl;
> +
> +       for (region_160_width = 0; region_160_width < (width -
> min_width_160); region_160_width += min_width_160)
> +               ;
> +
> +       strip->ypos = strip->xpos = 0;
> +       for (strip->width = min_width_160; width > strip->width;
> strip->width *= 2)
> +               ;
> +       strip->height = height;
> +       strip->split_direction = 0;
> +       strip->split_flag = 0;
> +       strip->usl7 = 0;
> +
> +       bit_pos = 0;
> +
> +       rle_v1 = rle_v2 = rle_v3 = 0;
> +
> +       while (strip >= strip_tbl) {
> +               if (bit_pos <= 0) {
> +                       bit_pos = 8;
> +                       bit_buf = *buf1++;
> +               }
> +
> +               bit_pos -= 2;
> +               cmd = (bit_buf >> bit_pos) & 0x03;
> +
> +               if (cmd == 0) {
> +                       strip++;
> +                       memcpy(strip, strip-1, sizeof(ustr_t));
> +                       strip->split_flag = 1;
> +                       strip->split_direction = 0;
> +                       strip->height = (strip->height > 8 ?
> ((strip->height+8)>>4)<<3 : 4);
> +                       continue;
> +               } else if (cmd == 1) {
> +                       strip++;
> +                       memcpy(strip, strip-1, sizeof(ustr_t));
> +                       strip->split_flag = 1;
> +                       strip->split_direction = 1;
> +                       strip->width = (strip->width > 8 ?
> ((strip->width+8)>>4)<<3 : 4);
> +                       continue;
> +               } else if (cmd == 2) {
> +                       if (strip->usl7 == 0) {
> +                               strip->usl7 = 1;
> +                               ref_vectors = NULL;
> +                               continue;
> +                       }
> +               } else if (cmd == 3) {
> +                       if (strip->usl7 == 0) {
> +                               strip->usl7 = 1;
> +                               ref_vectors = (const signed char*)buf2 +
> (*buf1 * 2);
> +                               buf1++;
> +                               continue;
> +                       }
> +               }
> +
> +               cur_frm_pos = cur + width * strip->ypos + strip->xpos;
> +
> +               if ((blks_width = strip->width) < 0)
> +                       blks_width += 3;
> +               blks_width >>= 2;
> +               blks_height = strip->height;
> +
> +               if (ref_vectors != NULL) {
> +                       ref_frm_pos = ref + (ref_vectors[0] + strip->ypos)
> * width +
> +                               ref_vectors[1] + strip->xpos;
> +               } else
> +                       ref_frm_pos = cur_frm_pos - width_tbl[4];
> +
> +               if (cmd == 2) {
> +                       if (bit_pos <= 0) {
> +                               bit_pos = 8;
> +                               bit_buf = *buf1++;
> +                       }
> +
> +                       bit_pos -= 2;
> +                       cmd = (bit_buf >> bit_pos) & 0x03;
> +
> +                       if (cmd == 0 || ref_vectors != NULL) {
> +                               for (lp1 = 0; lp1 < blks_width; lp1++) {
> +                                       for (i = 0, j = 0; i <
> blks_height; i++, j += width_tbl[1])
> +                                               ((uint32 *)cur_frm_pos)[j]
> = ((uint32 *)ref_frm_pos)[j];
> +                                       cur_frm_pos += 4;
> +                                       ref_frm_pos += 4;
> +                               }
> +                       } else if (cmd != 1)
> +                               return;
> +               } else {
> +                       k = *buf1 >> 4;
> +                       j = *buf1 & 0x0f;
> +                       buf1++;
> +                       lv = j + fflags2;
> +
> +                       if ((lv - 8) <= 7 && (k == 0 || k == 3 || k ==
> 10)) {
> +                               cp2 = _ModPred + ((lv - 8) << 7);
> +                               cp = ref_frm_pos;
> +                               for (i = 0; i < blks_width << 2; i++) {
> +                                               int v = *cp >> 1;
> +                                               *(cp++) = cp2[v];
> +                               }
> +                       }
> +
> +                       if (k == 1 || k == 4) {
> +                               lv = (hdr[j] & 0xf) + fflags2;
> +                               correction_type_sp[0] = _corrector_type +
> (lv << 8);
> +                               correction_lp[0] = correction + (lv << 8);
> +                               lv = (hdr[j] >> 4) + fflags2;
> +                               correction_lp[1] = correction + (lv << 8);
> +                               correction_type_sp[1] = _corrector_type +
> (lv << 8);
> +                       } else {
> +                               correctionloworder_lp[0] =
> correctionloworder_lp[1] = correctionloworder + (lv << 8);
> +                               correctionhighorder_lp[0] =
> correctionhighorder_lp[1] = correctionhighorder + (lv << 8);
> +                               correction_type_sp[0] =
> correction_type_sp[1] = _corrector_type + (lv << 8);
> +                               correction_lp[0] = correction_lp[1] =
> correction + (lv << 8);
> +                       }
> +
> +                       switch (k) {
> +                               case 1:
> +                               case 0:                    /**********
> CASE 0 **********/
> +                                       for ( ; blks_height > 0;
> blks_height -= 4) {
> +                                               for (lp1 = 0; lp1 <
> blks_width; lp1++) {
> +                                                       for (lp2 = 0; lp2
> < 4; ) {
> +                                                               k =
> *buf1++;
> +                                                               cur_lp =
> ((uint32 *)cur_frm_pos) + width_tbl[lp2];
> +                                                               ref_lp =
> ((uint32 *)ref_frm_pos) + width_tbl[lp2];
> +
> +                                                               switch
> (correction_type_sp[0][k]) {
> +
> case 0:
> +
>       *cur_lp = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2
> & 0x01][k]) << 1);
> +
>       lp2++;
> +
>       break;
> +
> case 1:
> +
>       if (correction_type_sp[0][*buf1] != 1) {
> +
>               // both correction types must be DYAD. If it's not the case
> +
>               // we have an incorrect data and we should skip the rest.
> +
>               // This occurs in some Urban Runner videos, and produced a
> glitch.
> +
>               // The glitch is not visible anymore if we skip this part of
> the frame.
> +
>               // The old Y values are then used.
> +
>               // This is also the behavior of the codec in the original
> game.
> +
>               //warning("Glitch");
> +
>               return;
> +
>       }
> +
>       res = ((FROM_LE_16(((uint16 *)(ref_lp))[0]) >> 1) + correction_lp[lp2
> & 0x01][*buf1]) << 1;
> +
>       ((uint16 *)cur_lp)[0] = FROM_LE_16(res);
> +
>       res = ((FROM_LE_16(((uint16 *)(ref_lp))[1]) >> 1) + correction_lp[lp2
> & 0x01][k]) << 1;
> +
>       ((uint16 *)cur_lp)[1] = FROM_LE_16(res);
> +
>       buf1++;
> +
>       lp2++;
> +
>       break;
> +
> case 2:
> +
>       if (lp2 == 0) {
> +
>               for (i = 0, j = 0; i < 2; i++, j += width_tbl[1])
> +
>                       cur_lp[j] = ref_lp[j];
> +
>               lp2 += 2;
> +
>       }
> +
>       break;
> +
> case 3:
> +
>       if (lp2 < 2) {
> +
>               for (i = 0, j = 0; i < (3 - lp2); i++, j += width_tbl[1])
> +
>                       cur_lp[j] = ref_lp[j];
> +
>               lp2 = 3;
> +
>       }
> +
>       break;
> +
> case 8:
> +
>       if (lp2 == 0) {
> +
>               RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
> +
> +
>               if (rle_v1 == 1 || ref_vectors != NULL) {
> +
>                       for (i = 0, j = 0; i < 4; i++, j += width_tbl[1])
> +
>                               cur_lp[j] = ref_lp[j];
> +
>               }
> +
> +
>               RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
> +
>               break;
> +
>       } else {
> +
>               rle_v1 = 1;
> +
>               rle_v2 = *buf1 - 1;
> +
>       }
> +
> case 5:
> +
>               LP2_CHECK(buf1,rle_v3,lp2)
> +
> case 4:
> +
>       for (i = 0, j = 0; i < (4 - lp2); i++, j += width_tbl[1])
> +
>               cur_lp[j] = ref_lp[j];
> +
>       lp2 = 4;
> +
>       break;
> +
> +
> case 7:
> +
>       if (rle_v3 != 0)
> +
>               rle_v3 = 0;
> +
>       else {
> +
>               buf1--;
> +
>               rle_v3 = 1;
> +
>       }
> +
> case 6:
> +
>       if (lp2 > 0) {
> +
>               //This case can't happen either.
> +
>               //If it occurs, it must happen on the first line.
> +
>               //warning("Glitch");
> +
>               return;
> +
>       }
> +
>       if (ref_vectors != NULL) {
> +
>               for (i = 0, j = 0; i < 4; i++, j += width_tbl[1])
> +
>                       cur_lp[j] = ref_lp[j];
> +
>       }
> +
>       lp2 = 4;
> +
>       break;
> +
> +
> case 9:
> +
>       lv1 = *buf1++;
> +
>       lv = (lv1 & 0x7F) << 1;
> +
>       lv += (lv << 8);
> +
>       lv += (lv << 16);
> +
>       for (i = 0, j = 0; i < 4; i++, j += width_tbl[1])
> +
>               cur_lp[j] = lv;
> +
> +
>       LV1_CHECK(buf1,rle_v3,lv1,lp2)
> +
>       break;
> +
> default:
> +
>       return;
> +                                                               }
> +                                                       }
> +
> +                                                       cur_frm_pos += 4;
> +                                                       ref_frm_pos += 4;
> +                                               }
> +
> +                                               cur_frm_pos += ((width -
> blks_width) * 4);
> +                                               ref_frm_pos += ((width -
> blks_width) * 4);
> +                                       }
> +                                       break;
> +
> +                               case 4:
> +                               case 3:                    /**********
> CASE 3 **********/
> +                                       if (ref_vectors != NULL)
> +                                               return;
> +                                       flag1 = 1;
> +
> +                                       for ( ; blks_height > 0;
> blks_height -= 8) {
> +                                               for (lp1 = 0; lp1 <
> blks_width; lp1++) {
> +                                                       for (lp2 = 0; lp2
> < 4; ) {
> +                                                               k =
> *buf1++;
> +
> +                                                               cur_lp =
> ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];
> +                                                               ref_lp =
> ((uint32 *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
> +
> +                                                               switch
> (correction_type_sp[lp2 & 0x01][k]) {
> +
> case 0:
> +
>       cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) +
> correction_lp[lp2 & 0x01][k]) << 1);
> +
>       if (lp2 > 0 || flag1 == 0 || strip->ypos != 0)
> +
>               cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) +
> (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
> +
>       else
> +
>               cur_lp[0] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) +
> correction_lp[lp2 & 0x01][k]) << 1);
> +
>       lp2++;
> +
>       break;
> +
> +
> case 1:
> +
>       res = ((FROM_LE_16(((uint16 *)ref_lp)[0]) >> 1) + correction_lp[lp2 &
> 0x01][*buf1]) << 1;
> +
>       ((uint16 *)cur_lp)[width_tbl[2]] = FROM_LE_16(res);
> +
>       res = ((FROM_LE_16(((uint16 *)ref_lp)[1]) >> 1) + correction_lp[lp2 &
> 0x01][k]) << 1;
> +
>       ((uint16 *)cur_lp)[width_tbl[2]+1] = FROM_LE_16(res);
> +
> +
>       if (lp2 > 0 || flag1 == 0 || strip->ypos != 0)
> +
>               cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) +
> (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
> +
>       else
> +
>               cur_lp[0] = cur_lp[width_tbl[1]];
> +
>       buf1++;
> +
>       lp2++;
> +
>       break;
> +
> +
> case 2:
> +
>       if (lp2 == 0) {
> +
>               for (i = 0, j = 0; i < 4; i++, j += width_tbl[1])
> +
>                       cur_lp[j] = *ref_lp;
> +
>               lp2 += 2;
> +
>       }
> +
>       break;
> +
> +
> case 3:
> +
>       if (lp2 < 2) {
> +
>               for (i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
> +
>                       cur_lp[j] = *ref_lp;
> +
>               lp2 = 3;
> +
>       }
> +
>       break;
> +
> +
> case 6:
> +
>       lp2 = 4;
> +
>       break;
> +
> +
> case 7:
> +
>       if (rle_v3 != 0)
> +
>               rle_v3 = 0;
> +
>       else {
> +
>               buf1--;
> +
>               rle_v3 = 1;
> +
>       }
> +
>       lp2 = 4;
> +
>       break;
> +
> +
> case 8:
> +
>       if (lp2 == 0) {
> +
>               RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
> +
> +
>               if (rle_v1 == 1) {
> +
>                       for (i = 0, j = 0; i < 8; i++, j += width_tbl[1])
> +
>                               cur_lp[j] = ref_lp[j];
> +
>               }
> +
> +
>               RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
> +
>               break;
> +
>       } else {
> +
>               rle_v2 = (*buf1) - 1;
> +
>               rle_v1 = 1;
> +
>       }
> +
> case 5:
> +
>               LP2_CHECK(buf1,rle_v3,lp2)
> +
> case 4:
> +
>       for (i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
> +
>               cur_lp[j] = *ref_lp;
> +
>       lp2 = 4;
> +
>       break;
> +
> +
> case 9:
> +
>       warning("Indeo3Decoder::decodeChunk: Untested (1)");
> +
>       lv1 = *buf1++;
> +
>       lv = (lv1 & 0x7F) << 1;
> +
>       lv += (lv << 8);
> +
>       lv += (lv << 16);
> +
> +
>       for (i = 0, j = 0; i < 4; i++, j += width_tbl[1])
> +
>               cur_lp[j] = lv;
> +
> +
>       LV1_CHECK(buf1,rle_v3,lv1,lp2)
> +
>       break;
> +
> +
> default:
> +
>       return;
> +                                                               }
> +                                                       }
> +
> +                                                       cur_frm_pos += 4;
> +                                               }
> +
> +                                               cur_frm_pos += (((width *
> 2) - blks_width) * 4);
> +                                               flag1 = 0;
> +                                       }
> +                                       break;
> +
> +                               case 10:                    /**********
> CASE 10 **********/
> +                                       if (ref_vectors == NULL) {
> +                                               flag1 = 1;
> +
> +                                               for ( ; blks_height > 0;
> blks_height -= 8) {
> +                                                       for (lp1 = 0; lp1
> < blks_width; lp1 += 2) {
> +                                                               for (lp2 =
> 0; lp2 < 4; ) {
> +                                                                       k
> = *buf1++;
> +
> cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];
> +
> ref_lp = ((uint32 *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
> +
> lv1 = ref_lp[0];
> +
> lv2 = ref_lp[1];
> +                                                                       if
> (lp2 == 0 && flag1 != 0) {
> +#if defined(SCUMM_BIG_ENDIAN)
> +
>       lv1 = lv1 & 0xFF00FF00;
> +
>       lv1 = (lv1 >> 8) | lv1;
> +
>       lv2 = lv2 & 0xFF00FF00;
> +
>       lv2 = (lv2 >> 8) | lv2;
> +#else
> +
>       lv1 = lv1 & 0x00FF00FF;
> +
>       lv1 = (lv1 << 8) | lv1;
> +
>       lv2 = lv2 & 0x00FF00FF;
> +
>       lv2 = (lv2 << 8) | lv2;
> +#endif
> +                                                                       }
> +
> +
> switch (correction_type_sp[lp2 & 0x01][k]) {
> +
>       case 0:
> +
>               cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(lv1) >> 1) +
> correctionloworder_lp[lp2 & 0x01][k]) << 1);
> +
>               cur_lp[width_tbl[1]+1] = FROM_LE_32(((FROM_LE_32(lv2) >> 1) +
> correctionhighorder_lp[lp2 & 0x01][k]) << 1);
> +
>               if (lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
> +
>                       cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) +
> (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
> +
>                       cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) +
> (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
> +
>               } else {
> +
>                       cur_lp[0] = cur_lp[width_tbl[1]];
> +
>                       cur_lp[1] = cur_lp[width_tbl[1]+1];
> +
>               }
> +
>               lp2++;
> +
>               break;
> +
> +
>       case 1:
> +
>               if (correction_type_sp[lp2 & 0x01][*buf1] != 1) {
> +
>                       //See the mode 0/1
> +
>                       //warning("Glitch");
> +
>                       return;
> +
>               }
> +
>               cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(lv1) >> 1) +
> correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
> +
>               cur_lp[width_tbl[1]+1] = FROM_LE_32(((FROM_LE_32(lv2) >> 1) +
> correctionloworder_lp[lp2 & 0x01][k]) << 1);
> +
>               if (lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
> +
>                       cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) +
> (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
> +
>                       cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) +
> (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
> +
>               } else {
> +
>                       cur_lp[0] = cur_lp[width_tbl[1]];
> +
>                       cur_lp[1] = cur_lp[width_tbl[1]+1];
> +
>               }
> +
>               buf1++;
> +
>               lp2++;
> +
>               break;
> +
> +
>       case 2:
> +
>               if (lp2 == 0) {
> +
>                       if (flag1 != 0) {
> +
>                               for (i = 0, j = width_tbl[1]; i < 3; i++, j
> += width_tbl[1]) {
> +
>                                       cur_lp[j] = lv1;
> +
>                                       cur_lp[j+1] = lv2;
> +
>                               }
> +
>                               cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) +
> (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
> +
>                               cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) +
> (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
> +
>                       } else {
> +
>                               for (i = 0, j = 0; i < 4; i++, j +=
> width_tbl[1]) {
> +
>                                       cur_lp[j] = lv1;
> +
>                                       cur_lp[j+1] = lv2;
> +
>                               }
> +
>                       }
> +
>                       lp2 += 2;
> +
>               }
> +
>               break;
> +
> +
>       case 3:
> +
>               if (lp2 < 2) {
> +
>                       if (lp2 == 0 && flag1 != 0) {
> +
>                               for (i = 0, j = width_tbl[1]; i < 5; i++, j
> += width_tbl[1]) {
> +
>                                       cur_lp[j] = lv1;
> +
>                                       cur_lp[j+1] = lv2;
> +
>                               }
> +
>                               cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) +
> (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
> +
>                               cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) +
> (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
> +
>                       } else {
> +
>                               for (i = 0, j = 0; i < 6 - (lp2 * 2); i++, j
> += width_tbl[1]) {
> +
>                                       cur_lp[j] = lv1;
> +
>                                       cur_lp[j+1] = lv2;
> +
>                               }
> +
>                       }
> +
>                       lp2 = 3;
> +
>               }
> +
>               break;
> +
> +
>       case 8:
> +
>               if (lp2 == 0) {
> +
>                       RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
> +
>                       if (rle_v1 == 1) {
> +
>                               if (flag1 != 0) {
> +
>                                       for (i = 0, j = width_tbl[1]; i < 7;
> i++, j += width_tbl[1]) {
> +
>                                               cur_lp[j] = lv1;
> +
>                                               cur_lp[j+1] = lv2;
> +
>                                       }
> +
>                                       cur_lp[0] = ((cur_lp[-width_tbl[1]]
> >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
> +
>                                       cur_lp[1] = ((cur_lp[-width_tbl[1]+1]
> >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
> +
>                               } else {
> +
>                                       for (i = 0, j = 0; i < 8; i++, j +=
> width_tbl[1]) {
> +
>                                               cur_lp[j] = lv1;
> +
>                                               cur_lp[j+1] = lv2;
> +
>                                       }
> +
>                               }
> +
>                       }
> +
>                       RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
> +
>                       break;
> +
>               } else {
> +
>                       rle_v1 = 1;
> +
>                       rle_v2 = (*buf1) - 1;
> +
>               }
> +
>       case 5:
> +
>                       LP2_CHECK(buf1,rle_v3,lp2)
> +
>       case 4:
> +
>               if (lp2 == 0 && flag1 != 0) {
> +
>                       for (i = 0, j = width_tbl[1]; i < 7; i++, j +=
> width_tbl[1]) {
> +
>                               cur_lp[j] = lv1;
> +
>                               cur_lp[j+1] = lv2;
> +
>                       }
> +
>                       cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) +
> (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
> +
>                       cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) +
> (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
> +
>               } else {
> +
>                       for (i = 0, j = 0; i < 8 - (lp2 * 2); i++, j +=
> width_tbl[1]) {
> +
>                               cur_lp[j] = lv1;
> +
>                               cur_lp[j+1] = lv2;
> +
>                       }
> +
>               }
> +
>               lp2 = 4;
> +
>               break;
> +
> +
>       case 6:
> +
>               lp2 = 4;
> +
>               break;
> +
> +
>       case 7:
> +
>               if (lp2 == 0) {
> +
>                       if (rle_v3 != 0)
> +
>                               rle_v3 = 0;
> +
>                       else {
> +
>                               buf1--;
> +
>                               rle_v3 = 1;
> +
>                       }
> +
>                       lp2 = 4;
> +
>               }
> +
>               break;
> +
> +
>       case 9:
> +
>               warning("Indeo3Decoder::decodeChunk: Untested (2)");
> +
>               lv1 = *buf1;
> +
>               lv = (lv1 & 0x7F) << 1;
> +
>               lv += (lv << 8);
> +
>               lv += (lv << 16);
> +
>               for (i = 0, j = 0; i < 8; i++, j += width_tbl[1])
> +
>                       cur_lp[j] = lv;
> +
>               LV1_CHECK(buf1,rle_v3,lv1,lp2)
> +
>               break;
> +
> +
>       default:
> +
>               return;
> +                                                                       }
> +                                                               }
> +
> +
> cur_frm_pos += 8;
> +                                                       }
> +
> +                                                       cur_frm_pos +=
> (((width * 2) - blks_width) * 4);
> +                                                       flag1 = 0;
> +                                               }
> +                                       } else {
> +                                               for ( ; blks_height > 0;
> blks_height -= 8) {
> +                                                       for (lp1 = 0; lp1
> < blks_width; lp1 += 2) {
> +                                                               for (lp2 =
> 0; lp2 < 4; ) {
> +                                                                       k
> = *buf1++;
> +
> cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];
> +
> ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2 * 2];
> +
> +
> switch (correction_type_sp[lp2 & 0x01][k]) {
> +
>       case 0:
> +
>               lv1 = correctionloworder_lp[lp2 & 0x01][k];
> +
>               lv2 = correctionhighorder_lp[lp2 & 0x01][k];
> +
>               cur_lp[0] = FROM_LE_32(((FROM_LE_32(ref_lp[0]) >> 1) + lv1)
> << 1);
> +
>               cur_lp[1] = FROM_LE_32(((FROM_LE_32(ref_lp[1]) >> 1) + lv2)
> << 1);
> +
>               cur_lp[width_tbl[1]] =
> FROM_LE_32(((FROM_LE_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
> +
>               cur_lp[width_tbl[1]+1] =
> FROM_LE_32(((FROM_LE_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
> +
>               lp2++;
> +
>               break;
> +
> +
>       case 1:
> +
>               lv1 = correctionloworder_lp[lp2 & 0x01][*buf1++];
> +
>               lv2 = correctionloworder_lp[lp2 & 0x01][k];
> +
>               cur_lp[0] = FROM_LE_32(((FROM_LE_32(ref_lp[0]) >> 1) + lv1)
> << 1);
> +
>               cur_lp[1] = FROM_LE_32(((FROM_LE_32(ref_lp[1]) >> 1) + lv2)
> << 1);
> +
>               cur_lp[width_tbl[1]] =
> FROM_LE_32(((FROM_LE_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
> +
>               cur_lp[width_tbl[1]+1] =
> FROM_LE_32(((FROM_LE_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
> +
>               lp2++;
> +
>               break;
> +
> +
>       case 2:
> +
>               if (lp2 == 0) {
> +
>                       for (i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
> +
>                               cur_lp[j] = ref_lp[j];
> +
>                               cur_lp[j+1] = ref_lp[j+1];
> +
>                       }
> +
>                       lp2 += 2;
> +
>               }
> +
>               break;
> +
> +
>       case 3:
> +
>               if (lp2 < 2) {
> +
>                       for (i = 0, j = 0; i < 6 - (lp2 * 2); i++, j +=
> width_tbl[1]) {
> +
>                               cur_lp[j] = ref_lp[j];
> +
>                               cur_lp[j+1] = ref_lp[j+1];
> +
>                       }
> +
>                       lp2 = 3;
> +
>               }
> +
>               break;
> +
> +
>       case 8:
> +
>               if (lp2 == 0) {
> +
>                       RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
> +
>                       for (i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
> +
>                               ((uint32 *)cur_frm_pos)[j] = ((uint32
> *)ref_frm_pos)[j];
> +
>                               ((uint32 *)cur_frm_pos)[j+1] = ((uint32
> *)ref_frm_pos)[j+1];
> +
>                       }
> +
>                       RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
> +
>                       break;
> +
>               } else {
> +
>                       rle_v1 = 1;
> +
>                       rle_v2 = (*buf1) - 1;
> +
>               }
> +
>       case 5:
> +
>       case 7:
> +
>                       LP2_CHECK(buf1,rle_v3,lp2)
> +
>       case 6:
> +
>       case 4:
> +
>               for (i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
> {
> +
>                       cur_lp[j] = ref_lp[j];
> +
>                       cur_lp[j+1] = ref_lp[j+1];
> +
>               }
> +
>               lp2 = 4;
> +
>               break;
> +
> +
>       case 9:
> +
>               warning("Indeo3Decoder::decodeChunk: Untested (3)");
> +
>               lv1 = *buf1;
> +
>               lv = (lv1 & 0x7F) << 1;
> +
>               lv += (lv << 8);
> +
>               lv += (lv << 16);
> +
>               for (i = 0, j = 0; i < 8; i++, j += width_tbl[1])
> +
>                       ((uint32 *)cur_frm_pos)[j] = ((uint32
> *)cur_frm_pos)[j+1] = lv;
> +
>               LV1_CHECK(buf1,rle_v3,lv1,lp2)
> +
>               break;
> +
> +
>       default:
> +
>               return;
> +                                                                       }
> +                                                               }
> +
> +
> cur_frm_pos += 8;
> +
> ref_frm_pos += 8;
> +                                                       }
> +
> +                                                       cur_frm_pos +=
> (((width * 2) - blks_width) * 4);
> +                                                       ref_frm_pos +=
> (((width * 2) - blks_width) * 4);
> +                                               }
> +                                       }
> +                                       break;
> +
> +                               case 11:                    /**********
> CASE 11 **********/
> +                                       if (ref_vectors == NULL)
> +                                               return;
> +
> +                                       for ( ; blks_height > 0;
> blks_height -= 8) {
> +                                               for (lp1 = 0; lp1 <
> blks_width; lp1++) {
> +                                                       for (lp2 = 0; lp2
> < 4; ) {
> +                                                               k =
> *buf1++;
> +                                                               cur_lp =
> ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];
> +                                                               ref_lp =
> ((uint32 *)ref_frm_pos) + width_tbl[lp2 * 2];
> +
> +                                                               switch
> (correction_type_sp[lp2 & 0x01][k]) {
> +
> case 0:
> +
>       cur_lp[0] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) +
> correction_lp[lp2 & 0x01][k]) << 1);
> +
>       cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(ref_lp[width_tbl[1]])
> >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
> +
>       lp2++;
> +
>       break;
> +
> +
> case 1:
> +
>       if (correction_type_sp[lp2 & 0x01][*buf1] != 1) {
> +
>               // See mode 0/1
> +
>               //warning("Glitch");
> +
>               return;
> +
>       }
> +
> +
>       lv1 = (uint16)(correction_lp[lp2 & 0x01][*buf1++]);
> +
>       lv2 = (uint16)(correction_lp[lp2 & 0x01][k]);
> +
>       res = (uint16)(((FROM_LE_16(((uint16 *)ref_lp)[0]) >> 1) + lv1) << 1);
> +
>       ((uint16 *)cur_lp)[0] = FROM_LE_16(res);
> +
>       res = (uint16)(((FROM_LE_16(((uint16 *)ref_lp)[1]) >> 1) + lv2) << 1);
> +
>       ((uint16 *)cur_lp)[1] = FROM_LE_16(res);
> +
>       res = (uint16)(((FROM_LE_16(((uint16 *)ref_lp)[width_tbl[2]]) >> 1) +
> lv1) << 1);
> +
>       ((uint16 *)cur_lp)[width_tbl[2]] = FROM_LE_16(res);
> +
>       res = (uint16)(((FROM_LE_16(((uint16 *)ref_lp)[width_tbl[2]+1]) >> 1)
> + lv2) << 1);
> +
>       ((uint16 *)cur_lp)[width_tbl[2]+1] = FROM_LE_16(res);
> +
>       lp2++;
> +
>       break;
> +
> +
> case 2:
> +
>       if (lp2 == 0) {
> +
>               for (i = 0, j = 0; i < 4; i++, j += width_tbl[1])
> +
>                       cur_lp[j] = ref_lp[j];
> +
>               lp2 += 2;
> +
>       }
> +
>       break;
> +
> +
> case 3:
> +
>       if (lp2 < 2) {
> +
>               for (i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
> +
>                       cur_lp[j] = ref_lp[j];
> +
>               lp2 = 3;
> +
>       }
> +
>       break;
> +
> +
> case 8:
> +
>       if (lp2 == 0) {
> +
>               RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
> +
> +
>               for (i = 0, j = 0; i < 8; i++, j += width_tbl[1])
> +
>                       cur_lp[j] = ref_lp[j];
> +
> +
>               RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
> +
>               break;
> +
>       } else {
> +
>               rle_v1 = 1;
> +
>               rle_v2 = (*buf1) - 1;
> +
>       }
> +
> case 5:
> +
> case 7:
> +
>               LP2_CHECK(buf1,rle_v3,lp2)
> +
> case 4:
> +
> case 6:
> +
>       for (i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
> +
>               cur_lp[j] = ref_lp[j];
> +
>       lp2 = 4;
> +
>       break;
> +
> +
> case 9:
> +
>       warning("Indeo3Decoder::decodeChunk: Untested (4)");
> +
>       lv1 = *buf1++;
> +
>       lv = (lv1 & 0x7F) << 1;
> +
>       lv += (lv << 8);
> +
>       lv += (lv << 16);
> +
>       for (i = 0, j = 0; i < 4; i++, j += width_tbl[1])
> +
>               cur_lp[j] = lv;
> +
>       LV1_CHECK(buf1,rle_v3,lv1,lp2)
> +
>       break;
> +
> +
> default:
> +
>       return;
> +                                                               }
> +                                                       }
> +
> +                                                       cur_frm_pos += 4;
> +                                                       ref_frm_pos += 4;
> +                                               }
> +
> +                                               cur_frm_pos += (((width *
> 2) - blks_width) * 4);
> +                                               ref_frm_pos += (((width *
> 2) - blks_width) * 4);
> +                                       }
> +                                       break;
> +
> +                               default:
> +                                       // FIXME: I've seen case 13 happen
> in Urban
> +                                       // Runner. Perhaps it uses a more
> recent form of
> +                                       // Indeo 3? There appears to have
> been several.
> +                                       // -> This should not happen
> anymore with the other skipping for bad data.
> +
> warning("Indeo3Decoder::decodeChunk: Unknown case %d", k);
> +                                       return;
> +                       }
> +               }
> +
> +               if (strip < strip_tbl)
> +                       return;
> +
> +               for ( ; strip >= strip_tbl; strip--) {
> +                       if (strip->split_flag != 0) {
> +                               strip->split_flag = 0;
> +                               strip->usl7 = (strip-1)->usl7;
> +
> +                               if (strip->split_direction) {
> +                                       strip->xpos += strip->width;
> +                                       strip->width = (strip-1)->width -
> strip->width;
> +                                       if (region_160_width <=
> strip->xpos && width < strip->width + strip->xpos)
> +                                               strip->width = width -
> strip->xpos;
> +                               } else {
> +                                       strip->ypos += strip->height;
> +                                       strip->height = (strip-1)->height
> - strip->height;
> +                               }
> +                               break;
> +                       }
> +               }
> +       }
> +}
> +
> +// static data
> +
> +const int Indeo3Decoder::_corrector_type_0[24] = {
> +       195, 159, 133, 115, 101,  93,  87,  77,
> +       195, 159, 133, 115, 101,  93,  87,  77,
> +       128,  79,  79,  79,  79,  79,  79,  79
> +};
> +
> +const int Indeo3Decoder::_corrector_type_2[8] = { 9, 7, 6, 8, 5, 4, 3, 2
> };
> +
> +const uint32 Indeo3Decoder::correction[] = {
> +       0x00000000, 0x00000202, 0xfffffdfe, 0x000002ff, 0xfffffd01,
> 0xffffff03, 0x000000fd, 0x00000404,
> +       0xfffffbfc, 0x00000501, 0xfffffaff, 0x00000105, 0xfffffefb,
> 0x000003fc, 0xfffffc04, 0x000005fe,
> +       0xfffffa02, 0xfffffe06, 0x000001fa, 0x00000904, 0xfffff6fc,
> 0x00000409, 0xfffffbf7, 0x00000909,
> +       0xfffff6f7, 0x00000a01, 0xfffff5ff, 0x0000010a, 0xfffffef6,
> 0x000007fb, 0xfffff805, 0xfffffb08,
> +       0x000004f8, 0x00000f09, 0xfffff0f7, 0x0000090f, 0xfffff6f1,
> 0x00000bfd, 0xfffff403, 0xfffffd0c,
> +       0x000002f4, 0x00001004, 0xffffeffc, 0x00000410, 0xfffffbf0,
> 0x00001010, 0xffffeff0, 0x00001200,
> +       0xffffee00, 0x00000012, 0xffffffee, 0x00000bf4, 0xfffff40c,
> 0x00000ff7, 0xfffff009, 0xfffff710,
> +       0x000008f0, 0x00001b0b, 0xffffe4f5, 0x00000b1b, 0xfffff4e5,
> 0x00001c13, 0xffffe3ed, 0x0000131c,
> +       0xffffece4, 0x000015fa, 0xffffea06, 0xfffffa16, 0x000005ea,
> 0x00001d04, 0xffffe2fc, 0x0000041d,
> +       0xfffffbe3, 0x00001e1e, 0xffffe1e2, 0x000020fe, 0xffffdf02,
> 0xfffffe21, 0x000001df, 0x000016ee,
> +       0xffffe912, 0xffffee17, 0x000011e9, 0x00001df1, 0xffffe20f,
> 0xfffff11e, 0x00000ee2, 0x00002e16,
> +       0xffffd1ea, 0x0000162e, 0xffffe9d2, 0x00002f0d, 0xffffd0f3,
> 0x00000d2f, 0xfffff2d1, 0x00003123,
> +       0xffffcedd, 0x00002331, 0xffffdccf, 0x000028f5, 0xffffd70b,
> 0xfffff529, 0x00000ad7, 0x00003304,
> +       0xffffccfc, 0x00000433, 0xfffffbcd, 0x00003636, 0xffffc9ca,
> 0x000021de, 0xffffde22, 0x000029e3,
> +       0xffffd61d, 0xffffe32a, 0x00001cd6, 0x00003bfa, 0xffffc406,
> 0xfffffa3c, 0x000005c4, 0x00004c1b,
> +       0xffffb3e5, 0x00001b4c, 0xffffe4b4, 0x00004d2b, 0xffffb2d5,
> 0x00002b4d, 0xffffd4b3, 0x000036e8,
> +       0xffffc918, 0xffffe837, 0x000017c9, 0x00004f0e, 0xffffb0f2,
> 0x00000e4f, 0xfffff1b1, 0x0000533f,
> +       0xffffacc1, 0x00003f53, 0xffffc0ad, 0x000049ec, 0xffffb614,
> 0xffffec4a, 0x000013b6, 0x00005802,
> +       0xffffa7fe, 0x00000258, 0xfffffda8, 0x00005d5d, 0xffffa2a3,
> 0x00003ccc, 0xffffc334, 0xffffcc3d,
> +       0x000033c3, 0x00007834, 0xffff87cc, 0x00003478, 0xffffcb88,
> 0x00004ad3, 0xffffb52d, 0xffffd34b,
> +       0x00002cb5, 0x00007d4b, 0xffff82b5, 0x00004b7d, 0xffffb483,
> 0x00007a21, 0xffff85df, 0x0000217a,
> +       0xffffde86, 0x000066f3, 0xffff990d, 0xfffff367, 0x00000c99,
> 0x00005fd8, 0xffffa028, 0xffffd860,
> +       0x000027a0, 0x00007ede, 0xffff8122, 0xffffde7f, 0x00002181,
> 0x000058a7, 0xffffa759, 0x000068b2,
> +       0xffff974e, 0xffffb269, 0x00004d97, 0x00000c0c, 0xfffff3f4,
> 0x00001717, 0xffffe8e9, 0x00002a2a,
> +       0xffffd5d6, 0x00004949, 0xffffb6b7, 0x00000000, 0x02020000,
> 0xfdfe0000, 0x02ff0000, 0xfd010000,
> +       0xff030000, 0x00fd0000, 0x00000202, 0x02020202, 0xfdfe0202,
> 0x02ff0202, 0xfd010202, 0xff030202,
> +       0x00fd0202, 0xfffffdfe, 0x0201fdfe, 0xfdfdfdfe, 0x02fefdfe,
> 0xfd00fdfe, 0xff02fdfe, 0x00fcfdfe,
> +       0x000002ff, 0x020202ff, 0xfdfe02ff, 0x02ff02ff, 0xfd0102ff,
> 0xff0302ff, 0x00fd02ff, 0xfffffd01,
> +       0x0201fd01, 0xfdfdfd01, 0x02fefd01, 0xfd00fd01, 0xff02fd01,
> 0x00fcfd01, 0xffffff03, 0x0201ff03,
> +       0xfdfdff03, 0x02feff03, 0xfd00ff03, 0xff02ff03, 0x00fcff03,
> 0x000000fd, 0x020200fd, 0xfdfe00fd,
> +       0x02ff00fd, 0xfd0100fd, 0xff0300fd, 0x00fd00fd, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000303, 0xfffffcfd, 0x000003ff, 0xfffffc01,
> 0xffffff04, 0x000000fc, 0x00000707,
> +       0xfffff8f9, 0x00000802, 0xfffff7fe, 0x00000208, 0xfffffdf8,
> 0x000008fe, 0xfffff702, 0xfffffe09,
> +       0x000001f7, 0x000005fa, 0xfffffa06, 0x00000d06, 0xfffff2fa,
> 0x0000060d, 0xfffff9f3, 0x00000d0d,
> +       0xfffff2f3, 0x00000e01, 0xfffff1ff, 0x0000010e, 0xfffffef2,
> 0x00000bf8, 0xfffff408, 0xfffff80c,
> +       0x000007f4, 0x0000170e, 0xffffe8f2, 0x00000e17, 0xfffff1e9,
> 0x000011fb, 0xffffee05, 0xfffffb12,
> +       0x000004ee, 0x00001806, 0xffffe7fa, 0x00000618, 0xfffff9e8,
> 0x00001818, 0xffffe7e8, 0x00001aff,
> +       0xffffe501, 0xffffff1b, 0x000000e5, 0x000010ef, 0xffffef11,
> 0x000016f3, 0xffffe90d, 0xfffff317,
> +       0x00000ce9, 0x00002810, 0xffffd7f0, 0x00001028, 0xffffefd8,
> 0x0000291c, 0xffffd6e4, 0x00001c29,
> +       0xffffe3d7, 0x000020f7, 0xffffdf09, 0xfffff721, 0x000008df,
> 0x00002b06, 0xffffd4fa, 0x0000062b,
> +       0xfffff9d5, 0x00002e2e, 0xffffd1d2, 0x000031fc, 0xffffce04,
> 0xfffffc32, 0x000003ce, 0x000021e5,
> +       0xffffde1b, 0xffffe522, 0x00001ade, 0x00002cea, 0xffffd316,
> 0xffffea2d, 0x000015d3, 0x00004522,
> +       0xffffbade, 0x00002245, 0xffffddbb, 0x00004613, 0xffffb9ed,
> 0x00001346, 0xffffecba, 0x00004935,
> +       0xffffb6cb, 0x00003549, 0xffffcab7, 0x00003def, 0xffffc211,
> 0xffffef3e, 0x000010c2, 0x00004d05,
> +       0xffffb2fb, 0x0000054d, 0xfffffab3, 0x00005252, 0xffffadae,
> 0x000032cd, 0xffffcd33, 0x00003fd5,
> +       0xffffc02b, 0xffffd540, 0x00002ac0, 0x000059f6, 0xffffa60a,
> 0xfffff65a, 0x000009a6, 0x00007229,
> +       0xffff8dd7, 0x00002972, 0xffffd68e, 0x00007440, 0xffff8bc0,
> 0x00004074, 0xffffbf8c, 0x000051db,
> +       0xffffae25, 0xffffdb52, 0x000024ae, 0x00007716, 0xffff88ea,
> 0x00001677, 0xffffe989, 0x00007c5f,
> +       0xffff83a1, 0x00005f7c, 0xffffa084, 0x00006ee2, 0xffff911e,
> 0xffffe26f, 0x00001d91, 0x00005bb2,
> +       0xffffa44e, 0xffffb25c, 0x00004da4, 0x000070bc, 0xffff8f44,
> 0xffffbc71, 0x0000438f, 0x00001212,
> +       0xffffedee, 0x00002222, 0xffffddde, 0x00003f3f, 0xffffc0c1,
> 0x00006d6d, 0xffff9293, 0x00000000,
> +       0x03030000, 0xfcfd0000, 0x03ff0000, 0xfc010000, 0xff040000,
> 0x00fc0000, 0x07070000, 0xf8f90000,
> +       0x00000303, 0x03030303, 0xfcfd0303, 0x03ff0303, 0xfc010303,
> 0xff040303, 0x00fc0303, 0x07070303,
> +       0xf8f90303, 0xfffffcfd, 0x0302fcfd, 0xfcfcfcfd, 0x03fefcfd,
> 0xfc00fcfd, 0xff03fcfd, 0x00fbfcfd,
> +       0x0706fcfd, 0xf8f8fcfd, 0x000003ff, 0x030303ff, 0xfcfd03ff,
> 0x03ff03ff, 0xfc0103ff, 0xff0403ff,
> +       0x00fc03ff, 0x070703ff, 0xf8f903ff, 0xfffffc01, 0x0302fc01,
> 0xfcfcfc01, 0x03fefc01, 0xfc00fc01,
> +       0xff03fc01, 0x00fbfc01, 0x0706fc01, 0xf8f8fc01, 0xffffff04,
> 0x0302ff04, 0xfcfcff04, 0x03feff04,
> +       0xfc00ff04, 0xff03ff04, 0x00fbff04, 0x0706ff04, 0xf8f8ff04,
> 0x000000fc, 0x030300fc, 0xfcfd00fc,
> +       0x03ff00fc, 0xfc0100fc, 0xff0400fc, 0x00fc00fc, 0x070700fc,
> 0xf8f900fc, 0x00000707, 0x03030707,
> +       0xfcfd0707, 0x03ff0707, 0xfc010707, 0xff040707, 0x00fc0707,
> 0x07070707, 0xf8f90707, 0xfffff8f9,
> +       0x0302f8f9, 0xfcfcf8f9, 0x03fef8f9, 0xfc00f8f9, 0xff03f8f9,
> 0x00fbf8f9, 0x0706f8f9, 0xf8f8f8f9,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000404, 0xfffffbfc, 0x000004ff, 0xfffffb01,
> 0xffffff05, 0x000000fb, 0x00000a03,
> +       0xfffff5fd, 0x0000030a, 0xfffffcf6, 0x00000909, 0xfffff6f7,
> 0x000006f9, 0xfffff907, 0x00000bfd,
> +       0xfffff403, 0xfffffd0c, 0x000002f4, 0x00001108, 0xffffeef8,
> 0x00000811, 0xfffff7ef, 0x00001111,
> +       0xffffeeef, 0x00001301, 0xffffecff, 0x00000113, 0xfffffeed,
> 0x00000ff5, 0xfffff00b, 0xfffff510,
> +       0x00000af0, 0x000016fa, 0xffffe906, 0xfffffa17, 0x000005e9,
> 0x00001f12, 0xffffe0ee, 0x0000121f,
> +       0xffffede1, 0x00002008, 0xffffdff8, 0x00000820, 0xfffff7e0,
> 0x00002121, 0xffffdedf, 0x000023ff,
> +       0xffffdc01, 0xffffff24, 0x000000dc, 0x000016e9, 0xffffe917,
> 0x00001eef, 0xffffe111, 0xffffef1f,
> +       0x000010e1, 0x00003615, 0xffffc9eb, 0x00001536, 0xffffeaca,
> 0x00003725, 0xffffc8db, 0x00002537,
> +       0xffffdac9, 0x00002bf4, 0xffffd40c, 0xfffff42c, 0x00000bd4,
> 0x00003908, 0xffffc6f8, 0x00000839,
> +       0xfffff7c7, 0x00003d3d, 0xffffc2c3, 0x000041fb, 0xffffbe05,
> 0xfffffb42, 0x000004be, 0x00002cdc,
> +       0xffffd324, 0xffffdc2d, 0x000023d3, 0x00003be3, 0xffffc41d,
> 0xffffe33c, 0x00001cc4, 0x00005c2d,
> +       0xffffa3d3, 0x00002d5c, 0xffffd2a4, 0x00005d19, 0xffffa2e7,
> 0x0000195d, 0xffffe6a3, 0x00006147,
> +       0xffff9eb9, 0x00004761, 0xffffb89f, 0x000052ea, 0xffffad16,
> 0xffffea53, 0x000015ad, 0x00006607,
> +       0xffff99f9, 0x00000766, 0xfffff89a, 0x00006d6d, 0xffff9293,
> 0x000043bc, 0xffffbc44, 0x000054c7,
> +       0xffffab39, 0xffffc755, 0x000038ab, 0x000077f3, 0xffff880d,
> 0xfffff378, 0x00000c88, 0x00006dcf,
> +       0xffff9231, 0xffffcf6e, 0x00003092, 0x00007a98, 0xffff8568,
> 0xffff987b, 0x00006785, 0x00001818,
> +       0xffffe7e8, 0x00002e2e, 0xffffd1d2, 0x00005454, 0xffffabac,
> 0x00000000, 0x04040000, 0xfbfc0000,
> +       0x04ff0000, 0xfb010000, 0xff050000, 0x00fb0000, 0x0a030000,
> 0xf5fd0000, 0x030a0000, 0x00000404,
> +       0x04040404, 0xfbfc0404, 0x04ff0404, 0xfb010404, 0xff050404,
> 0x00fb0404, 0x0a030404, 0xf5fd0404,
> +       0x030a0404, 0xfffffbfc, 0x0403fbfc, 0xfbfbfbfc, 0x04fefbfc,
> 0xfb00fbfc, 0xff04fbfc, 0x00fafbfc,
> +       0x0a02fbfc, 0xf5fcfbfc, 0x0309fbfc, 0x000004ff, 0x040404ff,
> 0xfbfc04ff, 0x04ff04ff, 0xfb0104ff,
> +       0xff0504ff, 0x00fb04ff, 0x0a0304ff, 0xf5fd04ff, 0x030a04ff,
> 0xfffffb01, 0x0403fb01, 0xfbfbfb01,
> +       0x04fefb01, 0xfb00fb01, 0xff04fb01, 0x00fafb01, 0x0a02fb01,
> 0xf5fcfb01, 0x0309fb01, 0xffffff05,
> +       0x0403ff05, 0xfbfbff05, 0x04feff05, 0xfb00ff05, 0xff04ff05,
> 0x00faff05, 0x0a02ff05, 0xf5fcff05,
> +       0x0309ff05, 0x000000fb, 0x040400fb, 0xfbfc00fb, 0x04ff00fb,
> 0xfb0100fb, 0xff0500fb, 0x00fb00fb,
> +       0x0a0300fb, 0xf5fd00fb, 0x030a00fb, 0x00000a03, 0x04040a03,
> 0xfbfc0a03, 0x04ff0a03, 0xfb010a03,
> +       0xff050a03, 0x00fb0a03, 0x0a030a03, 0xf5fd0a03, 0x030a0a03,
> 0xfffff5fd, 0x0403f5fd, 0xfbfbf5fd,
> +       0x04fef5fd, 0xfb00f5fd, 0xff04f5fd, 0x00faf5fd, 0x0a02f5fd,
> 0xf5fcf5fd, 0x0309f5fd, 0x0000030a,
> +       0x0404030a, 0xfbfc030a, 0x04ff030a, 0xfb01030a, 0xff05030a,
> 0x00fb030a, 0x0a03030a, 0xf5fd030a,
> +       0x030a030a, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000505, 0xfffffafb, 0x000006fe, 0xfffff902,
> 0xfffffe07, 0x000001f9, 0x00000b0b,
> +       0xfffff4f5, 0x00000d03, 0xfffff2fd, 0x0000030d, 0xfffffcf3,
> 0x000008f7, 0xfffff709, 0x00000efc,
> +       0xfffff104, 0xfffffc0f, 0x000003f1, 0x0000160b, 0xffffe9f5,
> 0x00000b16, 0xfffff4ea, 0x00001515,
> +       0xffffeaeb, 0x00001802, 0xffffe7fe, 0x00000218, 0xfffffde8,
> 0x000013f2, 0xffffec0e, 0xfffff214,
> +       0x00000dec, 0x00002617, 0xffffd9e9, 0x00001726, 0xffffe8da,
> 0x00001cf8, 0xffffe308, 0xfffff81d,
> +       0x000007e3, 0x0000270b, 0xffffd8f5, 0x00000b27, 0xfffff4d9,
> 0x00002929, 0xffffd6d7, 0x00002cff,
> +       0xffffd301, 0xffffff2d, 0x000000d3, 0x00001ce3, 0xffffe31d,
> 0x000026ea, 0xffffd916, 0xffffea27,
> +       0x000015d9, 0x0000431b, 0xffffbce5, 0x00001b43, 0xffffe4bd,
> 0x0000452f, 0xffffbad1, 0x00002f45,
> +       0xffffd0bb, 0x000037f1, 0xffffc80f, 0xfffff138, 0x00000ec8,
> 0x0000470b, 0xffffb8f5, 0x00000b47,
> +       0xfffff4b9, 0x00004c4c, 0xffffb3b4, 0x000052fa, 0xffffad06,
> 0xfffffa53, 0x000005ad, 0x000038d3,
> +       0xffffc72d, 0xffffd339, 0x00002cc7, 0x00004adc, 0xffffb524,
> 0xffffdc4b, 0x000023b5, 0x00007338,
> +       0xffff8cc8, 0x00003873, 0xffffc78d, 0x0000751f, 0xffff8ae1,
> 0x00001f75, 0xffffe08b, 0x00007a58,
> +       0xffff85a8, 0x0000587a, 0xffffa786, 0x000067e4, 0xffff981c,
> 0xffffe468, 0x00001b98, 0x000054ab,
> +       0xffffab55, 0x000069b8, 0xffff9648, 0xffffb86a, 0x00004796,
> 0x00001e1e, 0xffffe1e2, 0x00003a3a,
> +       0xffffc5c6, 0x00006969, 0xffff9697, 0x00000000, 0x05050000,
> 0xfafb0000, 0x06fe0000, 0xf9020000,
> +       0xfe070000, 0x01f90000, 0x0b0b0000, 0xf4f50000, 0x0d030000,
> 0xf2fd0000, 0x00000505, 0x05050505,
> +       0xfafb0505, 0x06fe0505, 0xf9020505, 0xfe070505, 0x01f90505,
> 0x0b0b0505, 0xf4f50505, 0x0d030505,
> +       0xf2fd0505, 0xfffffafb, 0x0504fafb, 0xfafafafb, 0x06fdfafb,
> 0xf901fafb, 0xfe06fafb, 0x01f8fafb,
> +       0x0b0afafb, 0xf4f4fafb, 0x0d02fafb, 0xf2fcfafb, 0x000006fe,
> 0x050506fe, 0xfafb06fe, 0x06fe06fe,
> +       0xf90206fe, 0xfe0706fe, 0x01f906fe, 0x0b0b06fe, 0xf4f506fe,
> 0x0d0306fe, 0xf2fd06fe, 0xfffff902,
> +       0x0504f902, 0xfafaf902, 0x06fdf902, 0xf901f902, 0xfe06f902,
> 0x01f8f902, 0x0b0af902, 0xf4f4f902,
> +       0x0d02f902, 0xf2fcf902, 0xfffffe07, 0x0504fe07, 0xfafafe07,
> 0x06fdfe07, 0xf901fe07, 0xfe06fe07,
> +       0x01f8fe07, 0x0b0afe07, 0xf4f4fe07, 0x0d02fe07, 0xf2fcfe07,
> 0x000001f9, 0x050501f9, 0xfafb01f9,
> +       0x06fe01f9, 0xf90201f9, 0xfe0701f9, 0x01f901f9, 0x0b0b01f9,
> 0xf4f501f9, 0x0d0301f9, 0xf2fd01f9,
> +       0x00000b0b, 0x05050b0b, 0xfafb0b0b, 0x06fe0b0b, 0xf9020b0b,
> 0xfe070b0b, 0x01f90b0b, 0x0b0b0b0b,
> +       0xf4f50b0b, 0x0d030b0b, 0xf2fd0b0b, 0xfffff4f5, 0x0504f4f5,
> 0xfafaf4f5, 0x06fdf4f5, 0xf901f4f5,
> +       0xfe06f4f5, 0x01f8f4f5, 0x0b0af4f5, 0xf4f4f4f5, 0x0d02f4f5,
> 0xf2fcf4f5, 0x00000d03, 0x05050d03,
> +       0xfafb0d03, 0x06fe0d03, 0xf9020d03, 0xfe070d03, 0x01f90d03,
> 0x0b0b0d03, 0xf4f50d03, 0x0d030d03,
> +       0xf2fd0d03, 0xfffff2fd, 0x0504f2fd, 0xfafaf2fd, 0x06fdf2fd,
> 0xf901f2fd, 0xfe06f2fd, 0x01f8f2fd,
> +       0x0b0af2fd, 0xf4f4f2fd, 0x0d02f2fd, 0xf2fcf2fd, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000606, 0xfffff9fa, 0x000007fe, 0xfffff802,
> 0xfffffe08, 0x000001f8, 0x00000d0d,
> +       0xfffff2f3, 0x00000f04, 0xfffff0fc, 0x0000040f, 0xfffffbf1,
> 0x00000af5, 0xfffff50b, 0x000011fb,
> +       0xffffee05, 0xfffffb12, 0x000004ee, 0x00001a0d, 0xffffe5f3,
> 0x00000d1a, 0xfffff2e6, 0x00001a1a,
> +       0xffffe5e6, 0x00001d02, 0xffffe2fe, 0x0000021d, 0xfffffde3,
> 0x000017f0, 0xffffe810, 0xfffff018,
> +       0x00000fe8, 0x00002e1c, 0xffffd1e4, 0x00001c2e, 0xffffe3d2,
> 0x000022f7, 0xffffdd09, 0xfffff723,
> +       0x000008dd, 0x00002f0d, 0xffffd0f3, 0x00000d2f, 0xfffff2d1,
> 0x00003131, 0xffffcecf, 0x000035ff,
> +       0xffffca01, 0xffffff36, 0x000000ca, 0x000022dd, 0xffffdd23,
> 0x00002ee6, 0xffffd11a, 0xffffe62f,
> +       0x000019d1, 0x00005120, 0xffffaee0, 0x00002051, 0xffffdfaf,
> 0x00005338, 0xffffacc8, 0x00003853,
> +       0xffffc7ad, 0x000042ee, 0xffffbd12, 0xffffee43, 0x000011bd,
> 0x0000560d, 0xffffa9f3, 0x00000d56,
> +       0xfffff2aa, 0x00005b5b, 0xffffa4a5, 0x000062f9, 0xffff9d07,
> 0xfffff963, 0x0000069d, 0x000043ca,
> +       0xffffbc36, 0xffffca44, 0x000035bc, 0x000059d4, 0xffffa62c,
> 0xffffd45a, 0x00002ba6, 0x00007bdf,
> +       0xffff8421, 0xffffdf7c, 0x00002084, 0x00006699, 0xffff9967,
> 0x00007eaa, 0xffff8156, 0xffffaa7f,
> +       0x00005581, 0x00002525, 0xffffdadb, 0x00004545, 0xffffbabb,
> 0x00000000, 0x06060000, 0xf9fa0000,
> +       0x07fe0000, 0xf8020000, 0xfe080000, 0x01f80000, 0x0d0d0000,
> 0xf2f30000, 0x0f040000, 0xf0fc0000,
> +       0x040f0000, 0x00000606, 0x06060606, 0xf9fa0606, 0x07fe0606,
> 0xf8020606, 0xfe080606, 0x01f80606,
> +       0x0d0d0606, 0xf2f30606, 0x0f040606, 0xf0fc0606, 0x040f0606,
> 0xfffff9fa, 0x0605f9fa, 0xf9f9f9fa,
> +       0x07fdf9fa, 0xf801f9fa, 0xfe07f9fa, 0x01f7f9fa, 0x0d0cf9fa,
> 0xf2f2f9fa, 0x0f03f9fa, 0xf0fbf9fa,
> +       0x040ef9fa, 0x000007fe, 0x060607fe, 0xf9fa07fe, 0x07fe07fe,
> 0xf80207fe, 0xfe0807fe, 0x01f807fe,
> +       0x0d0d07fe, 0xf2f307fe, 0x0f0407fe, 0xf0fc07fe, 0x040f07fe,
> 0xfffff802, 0x0605f802, 0xf9f9f802,
> +       0x07fdf802, 0xf801f802, 0xfe07f802, 0x01f7f802, 0x0d0cf802,
> 0xf2f2f802, 0x0f03f802, 0xf0fbf802,
> +       0x040ef802, 0xfffffe08, 0x0605fe08, 0xf9f9fe08, 0x07fdfe08,
> 0xf801fe08, 0xfe07fe08, 0x01f7fe08,
> +       0x0d0cfe08, 0xf2f2fe08, 0x0f03fe08, 0xf0fbfe08, 0x040efe08,
> 0x000001f8, 0x060601f8, 0xf9fa01f8,
> +       0x07fe01f8, 0xf80201f8, 0xfe0801f8, 0x01f801f8, 0x0d0d01f8,
> 0xf2f301f8, 0x0f0401f8, 0xf0fc01f8,
> +       0x040f01f8, 0x00000d0d, 0x06060d0d, 0xf9fa0d0d, 0x07fe0d0d,
> 0xf8020d0d, 0xfe080d0d, 0x01f80d0d,
> +       0x0d0d0d0d, 0xf2f30d0d, 0x0f040d0d, 0xf0fc0d0d, 0x040f0d0d,
> 0xfffff2f3, 0x0605f2f3, 0xf9f9f2f3,
> +       0x07fdf2f3, 0xf801f2f3, 0xfe07f2f3, 0x01f7f2f3, 0x0d0cf2f3,
> 0xf2f2f2f3, 0x0f03f2f3, 0xf0fbf2f3,
> +       0x040ef2f3, 0x00000f04, 0x06060f04, 0xf9fa0f04, 0x07fe0f04,
> 0xf8020f04, 0xfe080f04, 0x01f80f04,
> +       0x0d0d0f04, 0xf2f30f04, 0x0f040f04, 0xf0fc0f04, 0x040f0f04,
> 0xfffff0fc, 0x0605f0fc, 0xf9f9f0fc,
> +       0x07fdf0fc, 0xf801f0fc, 0xfe07f0fc, 0x01f7f0fc, 0x0d0cf0fc,
> 0xf2f2f0fc, 0x0f03f0fc, 0xf0fbf0fc,
> +       0x040ef0fc, 0x0000040f, 0x0606040f, 0xf9fa040f, 0x07fe040f,
> 0xf802040f, 0xfe08040f, 0x01f8040f,
> +       0x0d0d040f, 0xf2f3040f, 0x0f04040f, 0xf0fc040f, 0x040f040f,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000707, 0xfffff8f9, 0x000009fd, 0xfffff603,
> 0xfffffd0a, 0x000002f6, 0x00001010,
> +       0xffffeff0, 0x00001205, 0xffffedfb, 0x00000512, 0xfffffaee,
> 0x00000cf3, 0xfffff30d, 0x000014fa,
> +       0xffffeb06, 0xfffffa15, 0x000005eb, 0x00001e0f, 0xffffe1f1,
> 0x00000f1e, 0xfffff0e2, 0x00001e1e,
> +       0xffffe1e2, 0x00002202, 0xffffddfe, 0x00000222, 0xfffffdde,
> 0x00001bed, 0xffffe413, 0xffffed1c,
> +       0x000012e4, 0x00003620, 0xffffc9e0, 0x00002036, 0xffffdfca,
> 0x000028f5, 0xffffd70b, 0xfffff529,
> +       0x00000ad7, 0x0000370f, 0xffffc8f1, 0x00000f37, 0xfffff0c9,
> 0x00003939, 0xffffc6c7, 0x00003eff,
> +       0xffffc101, 0xffffff3f, 0x000000c1, 0x000027d8, 0xffffd828,
> 0x000036e2, 0xffffc91e, 0xffffe237,
> +       0x00001dc9, 0x00005e25, 0xffffa1db, 0x0000255e, 0xffffdaa2,
> 0x00006041, 0xffff9fbf, 0x00004160,
> +       0xffffbea0, 0x00004deb, 0xffffb215, 0xffffeb4e, 0x000014b2,
> 0x0000640f, 0xffff9bf1, 0x00000f64,
> +       0xfffff09c, 0x00006a6a, 0xffff9596, 0x000073f8, 0xffff8c08,
> 0xfffff874, 0x0000078c, 0x00004ec1,
> +       0xffffb13f, 0xffffc14f, 0x00003eb1, 0x000068cd, 0xffff9733,
> 0xffffcd69, 0x00003297, 0x00007788,
> +       0xffff8878, 0x00002b2b, 0xffffd4d5, 0x00005050, 0xffffafb0,
> 0x00000000, 0x07070000, 0xf8f90000,
> +       0x09fd0000, 0xf6030000, 0xfd0a0000, 0x02f60000, 0x10100000,
> 0xeff00000, 0x12050000, 0xedfb0000,
> +       0x05120000, 0x00000707, 0x07070707, 0xf8f90707, 0x09fd0707,
> 0xf6030707, 0xfd0a0707, 0x02f60707,
> +       0x10100707, 0xeff00707, 0x12050707, 0xedfb0707, 0x05120707,
> 0xfffff8f9, 0x0706f8f9, 0xf8f8f8f9,
> +       0x09fcf8f9, 0xf602f8f9, 0xfd09f8f9, 0x02f5f8f9, 0x100ff8f9,
> 0xefeff8f9, 0x1204f8f9, 0xedfaf8f9,
> +       0x0511f8f9, 0x000009fd, 0x070709fd, 0xf8f909fd, 0x09fd09fd,
> 0xf60309fd, 0xfd0a09fd, 0x02f609fd,
> +       0x101009fd, 0xeff009fd, 0x120509fd, 0xedfb09fd, 0x051209fd,
> 0xfffff603, 0x0706f603, 0xf8f8f603,
> +       0x09fcf603, 0xf602f603, 0xfd09f603, 0x02f5f603, 0x100ff603,
> 0xefeff603, 0x1204f603, 0xedfaf603,
> +       0x0511f603, 0xfffffd0a, 0x0706fd0a, 0xf8f8fd0a, 0x09fcfd0a,
> 0xf602fd0a, 0xfd09fd0a, 0x02f5fd0a,
> +       0x100ffd0a, 0xefeffd0a, 0x1204fd0a, 0xedfafd0a, 0x0511fd0a,
> 0x000002f6, 0x070702f6, 0xf8f902f6,
> +       0x09fd02f6, 0xf60302f6, 0xfd0a02f6, 0x02f602f6, 0x101002f6,
> 0xeff002f6, 0x120502f6, 0xedfb02f6,
> +       0x051202f6, 0x00001010, 0x07071010, 0xf8f91010, 0x09fd1010,
> 0xf6031010, 0xfd0a1010, 0x02f61010,
> +       0x10101010, 0xeff01010, 0x12051010, 0xedfb1010, 0x05121010,
> 0xffffeff0, 0x0706eff0, 0xf8f8eff0,
> +       0x09fceff0, 0xf602eff0, 0xfd09eff0, 0x02f5eff0, 0x100feff0,
> 0xefefeff0, 0x1204eff0, 0xedfaeff0,
> +       0x0511eff0, 0x00001205, 0x07071205, 0xf8f91205, 0x09fd1205,
> 0xf6031205, 0xfd0a1205, 0x02f61205,
> +       0x10101205, 0xeff01205, 0x12051205, 0xedfb1205, 0x05121205,
> 0xffffedfb, 0x0706edfb, 0xf8f8edfb,
> +       0x09fcedfb, 0xf602edfb, 0xfd09edfb, 0x02f5edfb, 0x100fedfb,
> 0xefefedfb, 0x1204edfb, 0xedfaedfb,
> +       0x0511edfb, 0x00000512, 0x07070512, 0xf8f90512, 0x09fd0512,
> 0xf6030512, 0xfd0a0512, 0x02f60512,
> +       0x10100512, 0xeff00512, 0x12050512, 0xedfb0512, 0x05120512,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000808, 0xfffff7f8, 0x00000afd, 0xfffff503,
> 0xfffffd0b, 0x000002f5, 0x00001212,
> +       0xffffedee, 0x00001405, 0xffffebfb, 0x00000514, 0xfffffaec,
> 0x00000ef1, 0xfffff10f, 0x000017f9,
> +       0xffffe807, 0xfffff918, 0x000006e8, 0x00002311, 0xffffdcef,
> 0x00001123, 0xffffeedd, 0x00002222,
> +       0xffffddde, 0x00002603, 0xffffd9fd, 0x00000326, 0xfffffcda,
> 0x00001fea, 0xffffe016, 0xffffea20,
> +       0x000015e0, 0x00003d25, 0xffffc2db, 0x0000253d, 0xffffdac3,
> 0x00002ef3, 0xffffd10d, 0xfffff32f,
> +       0x00000cd1, 0x00003f11, 0xffffc0ef, 0x0000113f, 0xffffeec1,
> 0x00004141, 0xffffbebf, 0x000047ff,
> +       0xffffb801, 0xffffff48, 0x000000b8, 0x00002dd2, 0xffffd22e,
> 0x00003edd, 0xffffc123, 0xffffdd3f,
> +       0x000022c1, 0x00006b2b, 0xffff94d5, 0x00002b6b, 0xffffd495,
> 0x00006e4b, 0xffff91b5, 0x00004b6e,
> +       0xffffb492, 0x000058e8, 0xffffa718, 0xffffe859, 0x000017a7,
> 0x00007211, 0xffff8def, 0x00001172,
> +       0xffffee8e, 0x00007979, 0xffff8687, 0x00005ab8, 0xffffa548,
> 0xffffb85b, 0x000047a5, 0x000077c6,
> +       0xffff883a, 0xffffc678, 0x00003988, 0x00003131, 0xffffcecf,
> 0x00005c5c, 0xffffa3a4, 0x00000000,
> +       0x08080000, 0xf7f80000, 0x0afd0000, 0xf5030000, 0xfd0b0000,
> 0x02f50000, 0x12120000, 0xedee0000,
> +       0x14050000, 0xebfb0000, 0x05140000, 0x00000808, 0x08080808,
> 0xf7f80808, 0x0afd0808, 0xf5030808,
> +       0xfd0b0808, 0x02f50808, 0x12120808, 0xedee0808, 0x14050808,
> 0xebfb0808, 0x05140808, 0xfffff7f8,
> +       0x0807f7f8, 0xf7f7f7f8, 0x0afcf7f8, 0xf502f7f8, 0xfd0af7f8,
> 0x02f4f7f8, 0x1211f7f8, 0xededf7f8,
> +       0x1404f7f8, 0xebfaf7f8, 0x0513f7f8, 0x00000afd, 0x08080afd,
> 0xf7f80afd, 0x0afd0afd, 0xf5030afd,
> +       0xfd0b0afd, 0x02f50afd, 0x12120afd, 0xedee0afd, 0x14050afd,
> 0xebfb0afd, 0x05140afd, 0xfffff503,
> +       0x0807f503, 0xf7f7f503, 0x0afcf503, 0xf502f503, 0xfd0af503,
> 0x02f4f503, 0x1211f503, 0xededf503,
> +       0x1404f503, 0xebfaf503, 0x0513f503, 0xfffffd0b, 0x0807fd0b,
> 0xf7f7fd0b, 0x0afcfd0b, 0xf502fd0b,
> +       0xfd0afd0b, 0x02f4fd0b, 0x1211fd0b, 0xededfd0b, 0x1404fd0b,
> 0xebfafd0b, 0x0513fd0b, 0x000002f5,
> +       0x080802f5, 0xf7f802f5, 0x0afd02f5, 0xf50302f5, 0xfd0b02f5,
> 0x02f502f5, 0x121202f5, 0xedee02f5,
> +       0x140502f5, 0xebfb02f5, 0x051402f5, 0x00001212, 0x08081212,
> 0xf7f81212, 0x0afd1212, 0xf5031212,
> +       0xfd0b1212, 0x02f51212, 0x12121212, 0xedee1212, 0x14051212,
> 0xebfb1212, 0x05141212, 0xffffedee,
> +       0x0807edee, 0xf7f7edee, 0x0afcedee, 0xf502edee, 0xfd0aedee,
> 0x02f4edee, 0x1211edee, 0xedededee,
> +       0x1404edee, 0xebfaedee, 0x0513edee, 0x00001405, 0x08081405,
> 0xf7f81405, 0x0afd1405, 0xf5031405,
> +       0xfd0b1405, 0x02f51405, 0x12121405, 0xedee1405, 0x14051405,
> 0xebfb1405, 0x05141405, 0xffffebfb,
> +       0x0807ebfb, 0xf7f7ebfb, 0x0afcebfb, 0xf502ebfb, 0xfd0aebfb,
> 0x02f4ebfb, 0x1211ebfb, 0xededebfb,
> +       0x1404ebfb, 0xebfaebfb, 0x0513ebfb, 0x00000514, 0x08080514,
> 0xf7f80514, 0x0afd0514, 0xf5030514,
> +       0xfd0b0514, 0x02f50514, 0x12120514, 0xedee0514, 0x14050514,
> 0xebfb0514, 0x05140514, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000909, 0xfffff6f7, 0x00000bfd, 0xfffff403,
> 0xfffffd0c, 0x000002f4, 0x00001414,
> +       0xffffebec, 0x00001706, 0xffffe8fa, 0x00000617, 0xfffff9e9,
> 0x000010ef, 0xffffef11, 0x00001af9,
> +       0xffffe507, 0xfffff91b, 0x000006e5, 0x00002713, 0xffffd8ed,
> 0x00001327, 0xffffecd9, 0x00002727,
> +       0xffffd8d9, 0x00002b03, 0xffffd4fd, 0x0000032b, 0xfffffcd5,
> 0x000023e8, 0xffffdc18, 0xffffe824,
> +       0x000017dc, 0x0000452a, 0xffffbad6, 0x00002a45, 0xffffd5bb,
> 0x000034f2, 0xffffcb0e, 0xfffff235,
> +       0x00000dcb, 0x00004713, 0xffffb8ed, 0x00001347, 0xffffecb9,
> 0x00004949, 0xffffb6b7, 0x00004ffe,
> +       0xffffb002, 0xfffffe50, 0x000001b0, 0x000033cc, 0xffffcc34,
> 0x000045d9, 0xffffba27, 0xffffd946,
> +       0x000026ba, 0x00007930, 0xffff86d0, 0x00003079, 0xffffcf87,
> 0x00007c54, 0xffff83ac, 0x0000547c,
> +       0xffffab84, 0x000063e5, 0xffff9c1b, 0xffffe564, 0x00001a9c,
> 0x000065af, 0xffff9a51, 0xffffaf66,
> +       0x0000509a, 0x00003737, 0xffffc8c9, 0x00006868, 0xffff9798,
> 0x00000000, 0x09090000, 0xf6f70000,
> +       0x0bfd0000, 0xf4030000, 0xfd0c0000, 0x02f40000, 0x14140000,
> 0xebec0000, 0x17060000, 0xe8fa0000,
> +       0x06170000, 0xf9e90000, 0x00000909, 0x09090909, 0xf6f70909,
> 0x0bfd0909, 0xf4030909, 0xfd0c0909,
> +       0x02f40909, 0x14140909, 0xebec0909, 0x17060909, 0xe8fa0909,
> 0x06170909, 0xf9e90909, 0xfffff6f7,
> +       0x0908f6f7, 0xf6f6f6f7, 0x0bfcf6f7, 0xf402f6f7, 0xfd0bf6f7,
> 0x02f3f6f7, 0x1413f6f7, 0xebebf6f7,
> +       0x1705f6f7, 0xe8f9f6f7, 0x0616f6f7, 0xf9e8f6f7, 0x00000bfd,
> 0x09090bfd, 0xf6f70bfd, 0x0bfd0bfd,
> +       0xf4030bfd, 0xfd0c0bfd, 0x02f40bfd, 0x14140bfd, 0xebec0bfd,
> 0x17060bfd, 0xe8fa0bfd, 0x06170bfd,
> +       0xf9e90bfd, 0xfffff403, 0x0908f403, 0xf6f6f403, 0x0bfcf403,
> 0xf402f403, 0xfd0bf403, 0x02f3f403,
> +       0x1413f403, 0xebebf403, 0x1705f403, 0xe8f9f403, 0x0616f403,
> 0xf9e8f403, 0xfffffd0c, 0x0908fd0c,
> +       0xf6f6fd0c, 0x0bfcfd0c, 0xf402fd0c, 0xfd0bfd0c, 0x02f3fd0c,
> 0x1413fd0c, 0xebebfd0c, 0x1705fd0c,
> +       0xe8f9fd0c, 0x0616fd0c, 0xf9e8fd0c, 0x000002f4, 0x090902f4,
> 0xf6f702f4, 0x0bfd02f4, 0xf40302f4,
> +       0xfd0c02f4, 0x02f402f4, 0x141402f4, 0xebec02f4, 0x170602f4,
> 0xe8fa02f4, 0x061702f4, 0xf9e902f4,
> +       0x00001414, 0x09091414, 0xf6f71414, 0x0bfd1414, 0xf4031414,
> 0xfd0c1414, 0x02f41414, 0x14141414,
> +       0xebec1414, 0x17061414, 0xe8fa1414, 0x06171414, 0xf9e91414,
> 0xffffebec, 0x0908ebec, 0xf6f6ebec,
> +       0x0bfcebec, 0xf402ebec, 0xfd0bebec, 0x02f3ebec, 0x1413ebec,
> 0xebebebec, 0x1705ebec, 0xe8f9ebec,
> +       0x0616ebec, 0xf9e8ebec, 0x00001706, 0x09091706, 0xf6f71706,
> 0x0bfd1706, 0xf4031706, 0xfd0c1706,
> +       0x02f41706, 0x14141706, 0xebec1706, 0x17061706, 0xe8fa1706,
> 0x06171706, 0xf9e91706, 0xffffe8fa,
> +       0x0908e8fa, 0xf6f6e8fa, 0x0bfce8fa, 0xf402e8fa, 0xfd0be8fa,
> 0x02f3e8fa, 0x1413e8fa, 0xebebe8fa,
> +       0x1705e8fa, 0xe8f9e8fa, 0x0616e8fa, 0xf9e8e8fa, 0x00000617,
> 0x09090617, 0xf6f70617, 0x0bfd0617,
> +       0xf4030617, 0xfd0c0617, 0x02f40617, 0x14140617, 0xebec0617,
> 0x17060617, 0xe8fa0617, 0x06170617,
> +       0xf9e90617, 0xfffff9e9, 0x0908f9e9, 0xf6f6f9e9, 0x0bfcf9e9,
> 0xf402f9e9, 0xfd0bf9e9, 0x02f3f9e9,
> +       0x1413f9e9, 0xebebf9e9, 0x1705f9e9, 0xe8f9f9e9, 0x0616f9e9,
> 0xf9e8f9e9, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000202, 0xfffffdfe, 0x00000200, 0xfffffe00,
> 0x00000002, 0xfffffffe, 0x00000404,
> +       0xfffffbfc, 0x00000400, 0xfffffc00, 0x00000004, 0xfffffffc,
> 0x000003fc, 0xfffffc04, 0x000005fe,
> +       0xfffffa02, 0xfffffe06, 0x000001fa, 0x00000804, 0xfffff7fc,
> 0x00000408, 0xfffffbf8, 0x00000808,
> +       0xfffff7f8, 0x00000a00, 0xfffff600, 0x0000000a, 0xfffffff6,
> 0x000007fc, 0xfffff804, 0xfffffc08,
> +       0x000003f8, 0x00000e08, 0xfffff1f8, 0x0000080e, 0xfffff7f2,
> 0x00000bfe, 0xfffff402, 0xfffffe0c,
> +       0x000001f4, 0x00001004, 0xffffeffc, 0x00000410, 0xfffffbf0,
> 0x00001010, 0xffffeff0, 0x00001200,
> +       0xffffee00, 0x00000012, 0xffffffee, 0x00000bf4, 0xfffff40c,
> 0x00000ff8, 0xfffff008, 0xfffff810,
> +       0x000007f0, 0x00001a0a, 0xffffe5f6, 0x00000a1a, 0xfffff5e6,
> 0x00001c12, 0xffffe3ee, 0x0000121c,
> +       0xffffede4, 0x000015fa, 0xffffea06, 0xfffffa16, 0x000005ea,
> 0x00001c04, 0xffffe3fc, 0x0000041c,
> +       0xfffffbe4, 0x00001e1e, 0xffffe1e2, 0x00001ffe, 0xffffe002,
> 0xfffffe20, 0x000001e0, 0x000015ee,
> +       0xffffea12, 0xffffee16, 0x000011ea, 0x00001df2, 0xffffe20e,
> 0xfffff21e, 0x00000de2, 0x00002e16,
> +       0xffffd1ea, 0x0000162e, 0xffffe9d2, 0x00002e0c, 0xffffd1f4,
> 0x00000c2e, 0xfffff3d2, 0x00003022,
> +       0xffffcfde, 0x00002230, 0xffffddd0, 0x000027f6, 0xffffd80a,
> 0xfffff628, 0x000009d8, 0x00003204,
> +       0xffffcdfc, 0x00000432, 0xfffffbce, 0x00003636, 0xffffc9ca,
> 0x000021de, 0xffffde22, 0x000029e4,
> +       0xffffd61c, 0xffffe42a, 0x00001bd6, 0x00003bfa, 0xffffc406,
> 0xfffffa3c, 0x000005c4, 0x00004c1a,
> +       0xffffb3e6, 0x00001a4c, 0xffffe5b4, 0x00004c2a, 0xffffb3d6,
> 0x00002a4c, 0xffffd5b4, 0x000035e8,
> +       0xffffca18, 0xffffe836, 0x000017ca, 0x00004e0e, 0xffffb1f2,
> 0x00000e4e, 0xfffff1b2, 0x0000523e,
> +       0xffffadc2, 0x00003e52, 0xffffc1ae, 0x000049ec, 0xffffb614,
> 0xffffec4a, 0x000013b6, 0x00005802,
> +       0xffffa7fe, 0x00000258, 0xfffffda8, 0x00005c5c, 0xffffa3a4,
> 0x00003bcc, 0xffffc434, 0xffffcc3c,
> +       0x000033c4, 0x00007634, 0xffff89cc, 0x00003476, 0xffffcb8a,
> 0x000049d4, 0xffffb62c, 0xffffd44a,
> +       0x00002bb6, 0x0000764a, 0xffff89b6, 0x00004a76, 0xffffb58a,
> 0x00007620, 0xffff89e0, 0x00002076,
> +       0xffffdf8a, 0x000065f4, 0xffff9a0c, 0xfffff466, 0x00000b9a,
> 0x00005fd8, 0xffffa028, 0xffffd860,
> +       0x000027a0, 0x000075de, 0xffff8a22, 0xffffde76, 0x0000218a,
> 0x000057a8, 0xffffa858, 0x000067b2,
> +       0xffff984e, 0xffffb268, 0x00004d98, 0x00000c0c, 0xfffff3f4,
> 0x00001616, 0xffffe9ea, 0x00002a2a,
> +       0xffffd5d6, 0x00004848, 0xffffb7b8, 0x00000000, 0x02020000,
> 0xfdfe0000, 0x02000000, 0xfe000000,
> +       0x00020000, 0xfffe0000, 0x00000202, 0x02020202, 0xfdfe0202,
> 0x02000202, 0xfe000202, 0x00020202,
> +       0xfffe0202, 0xfffffdfe, 0x0201fdfe, 0xfdfdfdfe, 0x01fffdfe,
> 0xfdfffdfe, 0x0001fdfe, 0xfffdfdfe,
> +       0x00000200, 0x02020200, 0xfdfe0200, 0x02000200, 0xfe000200,
> 0x00020200, 0xfffe0200, 0xfffffe00,
> +       0x0201fe00, 0xfdfdfe00, 0x01fffe00, 0xfdfffe00, 0x0001fe00,
> 0xfffdfe00, 0x00000002, 0x02020002,
> +       0xfdfe0002, 0x02000002, 0xfe000002, 0x00020002, 0xfffe0002,
> 0xfffffffe, 0x0201fffe, 0xfdfdfffe,
> +       0x01fffffe, 0xfdfffffe, 0x0001fffe, 0xfffdfffe, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000303, 0xfffffcfd, 0x00000300, 0xfffffd00,
> 0x00000003, 0xfffffffd, 0x00000606,
> +       0xfffff9fa, 0x00000903, 0xfffff6fd, 0x00000309, 0xfffffcf7,
> 0x000008fd, 0xfffff703, 0xfffffd09,
> +       0x000002f7, 0x000005fa, 0xfffffa06, 0x00000c06, 0xfffff3fa,
> 0x0000060c, 0xfffff9f4, 0x00000c0c,
> +       0xfffff3f4, 0x00000f00, 0xfffff100, 0x0000000f, 0xfffffff1,
> 0x00000bf7, 0xfffff409, 0xfffff70c,
> +       0x000008f4, 0x0000180f, 0xffffe7f1, 0x00000f18, 0xfffff0e8,
> 0x000011fa, 0xffffee06, 0xfffffa12,
> +       0x000005ee, 0x00001806, 0xffffe7fa, 0x00000618, 0xfffff9e8,
> 0x00001818, 0xffffe7e8, 0x00001b00,
> +       0xffffe500, 0x0000001b, 0xffffffe5, 0x000011ee, 0xffffee12,
> 0x000017f4, 0xffffe80c, 0xfffff418,
> +       0x00000be8, 0x0000270f, 0xffffd8f1, 0x00000f27, 0xfffff0d9,
> 0x00002a1b, 0xffffd5e5, 0x00001b2a,
> +       0xffffe4d6, 0x000020f7, 0xffffdf09, 0xfffff721, 0x000008df,
> 0x00002a06, 0xffffd5fa, 0x0000062a,
> +       0xfffff9d6, 0x00002d2d, 0xffffd2d3, 0x000032fd, 0xffffcd03,
> 0xfffffd33, 0x000002cd, 0x000020e5,
> +       0xffffdf1b, 0xffffe521, 0x00001adf, 0x00002ceb, 0xffffd315,
> 0xffffeb2d, 0x000014d3, 0x00004521,
> +       0xffffbadf, 0x00002145, 0xffffdebb, 0x00004512, 0xffffbaee,
> 0x00001245, 0xffffedbb, 0x00004836,
> +       0xffffb7ca, 0x00003648, 0xffffc9b8, 0x00003eee, 0xffffc112,
> 0xffffee3f, 0x000011c1, 0x00004e06,
> +       0xffffb1fa, 0x0000064e, 0xfffff9b2, 0x00005151, 0xffffaeaf,
> 0x000032cd, 0xffffcd33, 0x00003ed6,
> +       0xffffc12a, 0xffffd63f, 0x000029c1, 0x000059f7, 0xffffa609,
> 0xfffff75a, 0x000008a6, 0x0000722a,
> +       0xffff8dd6, 0x00002a72, 0xffffd58e, 0x0000753f, 0xffff8ac1,
> 0x00003f75, 0xffffc08b, 0x000050dc,
> +       0xffffaf24, 0xffffdc51, 0x000023af, 0x00007815, 0xffff87eb,
> 0x00001578, 0xffffea88, 0x00007b60,
> +       0xffff84a0, 0x0000607b, 0xffff9f85, 0x00006ee2, 0xffff911e,
> 0xffffe26f, 0x00001d91, 0x00005cb2,
> +       0xffffa34e, 0xffffb25d, 0x00004da3, 0x000071bb, 0xffff8e45,
> 0xffffbb72, 0x0000448e, 0x00001212,
> +       0xffffedee, 0x00002121, 0xffffdedf, 0x00003f3f, 0xffffc0c1,
> 0x00006c6c, 0xffff9394, 0x00000000,
> +       0x03030000, 0xfcfd0000, 0x03000000, 0xfd000000, 0x00030000,
> 0xfffd0000, 0x06060000, 0xf9fa0000,
> +       0x00000303, 0x03030303, 0xfcfd0303, 0x03000303, 0xfd000303,
> 0x00030303, 0xfffd0303, 0x06060303,
> +       0xf9fa0303, 0xfffffcfd, 0x0302fcfd, 0xfcfcfcfd, 0x02fffcfd,
> 0xfcfffcfd, 0x0002fcfd, 0xfffcfcfd,
> +       0x0605fcfd, 0xf9f9fcfd, 0x00000300, 0x03030300, 0xfcfd0300,
> 0x03000300, 0xfd000300, 0x00030300,
> +       0xfffd0300, 0x06060300, 0xf9fa0300, 0xfffffd00, 0x0302fd00,
> 0xfcfcfd00, 0x02fffd00, 0xfcfffd00,
> +       0x0002fd00, 0xfffcfd00, 0x0605fd00, 0xf9f9fd00, 0x00000003,
> 0x03030003, 0xfcfd0003, 0x03000003,
> +       0xfd000003, 0x00030003, 0xfffd0003, 0x06060003, 0xf9fa0003,
> 0xfffffffd, 0x0302fffd, 0xfcfcfffd,
> +       0x02fffffd, 0xfcfffffd, 0x0002fffd, 0xfffcfffd, 0x0605fffd,
> 0xf9f9fffd, 0x00000606, 0x03030606,
> +       0xfcfd0606, 0x03000606, 0xfd000606, 0x00030606, 0xfffd0606,
> 0x06060606, 0xf9fa0606, 0xfffff9fa,
> +       0x0302f9fa, 0xfcfcf9fa, 0x02fff9fa, 0xfcfff9fa, 0x0002f9fa,
> 0xfffcf9fa, 0x0605f9fa, 0xf9f9f9fa,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000404, 0xfffffbfc, 0x00000400, 0xfffffc00,
> 0x00000004, 0xfffffffc, 0x00000804,
> +       0xfffff7fc, 0x00000408, 0xfffffbf8, 0x00000808, 0xfffff7f8,
> 0x000007f8, 0xfffff808, 0x00000bfc,
> +       0xfffff404, 0xfffffc0c, 0x000003f4, 0x00001008, 0xffffeff8,
> 0x00000810, 0xfffff7f0, 0x00001010,
> +       0xffffeff0, 0x00001400, 0xffffec00, 0x00000014, 0xffffffec,
> 0x00000ff4, 0xfffff00c, 0xfffff410,
> +       0x00000bf0, 0x000017fc, 0xffffe804, 0xfffffc18, 0x000003e8,
> 0x00002010, 0xffffdff0, 0x00001020,
> +       0xffffefe0, 0x00002008, 0xffffdff8, 0x00000820, 0xfffff7e0,
> 0x00002020, 0xffffdfe0, 0x00002400,
> +       0xffffdc00, 0x00000024, 0xffffffdc, 0x000017e8, 0xffffe818,
> 0x00001ff0, 0xffffe010, 0xfffff020,
> +       0x00000fe0, 0x00003414, 0xffffcbec, 0x00001434, 0xffffebcc,
> 0x00003824, 0xffffc7dc, 0x00002438,
> +       0xffffdbc8, 0x00002bf4, 0xffffd40c, 0xfffff42c, 0x00000bd4,
> 0x00003808, 0xffffc7f8, 0x00000838,
> +       0xfffff7c8, 0x00003c3c, 0xffffc3c4, 0x00003ffc, 0xffffc004,
> 0xfffffc40, 0x000003c0, 0x00002bdc,
> +       0xffffd424, 0xffffdc2c, 0x000023d4, 0x00003be4, 0xffffc41c,
> 0xffffe43c, 0x00001bc4, 0x00005c2c,
> +       0xffffa3d4, 0x00002c5c, 0xffffd3a4, 0x00005c18, 0xffffa3e8,
> 0x0000185c, 0xffffe7a4, 0x00006048,
> +       0xffff9fb8, 0x00004860, 0xffffb7a0, 0x000053ec, 0xffffac14,
> 0xffffec54, 0x000013ac, 0x00006408,
> +       0xffff9bf8, 0x00000864, 0xfffff79c, 0x00006c6c, 0xffff9394,
> 0x000043bc, 0xffffbc44, 0x000053c8,
> +       0xffffac38, 0xffffc854, 0x000037ac, 0x000077f4, 0xffff880c,
> 0xfffff478, 0x00000b88, 0x00006bd0,
> +       0xffff9430, 0xffffd06c, 0x00002f94, 0x00007b98, 0xffff8468,
> 0xffff987c, 0x00006784, 0x00001818,
> +       0xffffe7e8, 0x00002c2c, 0xffffd3d4, 0x00005454, 0xffffabac,
> 0x00000000, 0x04040000, 0xfbfc0000,
> +       0x04000000, 0xfc000000, 0x00040000, 0xfffc0000, 0x08040000,
> 0xf7fc0000, 0x04080000, 0x00000404,
> +       0x04040404, 0xfbfc0404, 0x04000404, 0xfc000404, 0x00040404,
> 0xfffc0404, 0x08040404, 0xf7fc0404,
> +       0x04080404, 0xfffffbfc, 0x0403fbfc, 0xfbfbfbfc, 0x03fffbfc,
> 0xfbfffbfc, 0x0003fbfc, 0xfffbfbfc,
> +       0x0803fbfc, 0xf7fbfbfc, 0x0407fbfc, 0x00000400, 0x04040400,
> 0xfbfc0400, 0x04000400, 0xfc000400,
> +       0x00040400, 0xfffc0400, 0x08040400, 0xf7fc0400, 0x04080400,
> 0xfffffc00, 0x0403fc00, 0xfbfbfc00,
> +       0x03fffc00, 0xfbfffc00, 0x0003fc00, 0xfffbfc00, 0x0803fc00,
> 0xf7fbfc00, 0x0407fc00, 0x00000004,
> +       0x04040004, 0xfbfc0004, 0x04000004, 0xfc000004, 0x00040004,
> 0xfffc0004, 0x08040004, 0xf7fc0004,
> +       0x04080004, 0xfffffffc, 0x0403fffc, 0xfbfbfffc, 0x03fffffc,
> 0xfbfffffc, 0x0003fffc, 0xfffbfffc,
> +       0x0803fffc, 0xf7fbfffc, 0x0407fffc, 0x00000804, 0x04040804,
> 0xfbfc0804, 0x04000804, 0xfc000804,
> +       0x00040804, 0xfffc0804, 0x08040804, 0xf7fc0804, 0x04080804,
> 0xfffff7fc, 0x0403f7fc, 0xfbfbf7fc,
> +       0x03fff7fc, 0xfbfff7fc, 0x0003f7fc, 0xfffbf7fc, 0x0803f7fc,
> 0xf7fbf7fc, 0x0407f7fc, 0x00000408,
> +       0x04040408, 0xfbfc0408, 0x04000408, 0xfc000408, 0x00040408,
> 0xfffc0408, 0x08040408, 0xf7fc0408,
> +       0x04080408, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000505, 0xfffffafb, 0x00000500, 0xfffffb00,
> 0x00000005, 0xfffffffb, 0x00000a0a,
> +       0xfffff5f6, 0x00000f05, 0xfffff0fb, 0x0000050f, 0xfffffaf1,
> 0x000009f6, 0xfffff60a, 0x00000efb,
> +       0xfffff105, 0xfffffb0f, 0x000004f1, 0x0000140a, 0xffffebf6,
> 0x00000a14, 0xfffff5ec, 0x00001414,
> +       0xffffebec, 0x00001900, 0xffffe700, 0x00000019, 0xffffffe7,
> 0x000013f1, 0xffffec0f, 0xfffff114,
> +       0x00000eec, 0x00002819, 0xffffd7e7, 0x00001928, 0xffffe6d8,
> 0x00001df6, 0xffffe20a, 0xfffff61e,
> +       0x000009e2, 0x0000280a, 0xffffd7f6, 0x00000a28, 0xfffff5d8,
> 0x00002828, 0xffffd7d8, 0x00002d00,
> +       0xffffd300, 0x0000002d, 0xffffffd3, 0x00001de2, 0xffffe21e,
> 0x000027ec, 0xffffd814, 0xffffec28,
> +       0x000013d8, 0x00004119, 0xffffbee7, 0x00001941, 0xffffe6bf,
> 0x0000462d, 0xffffb9d3, 0x00002d46,
> +       0xffffd2ba, 0x000036f1, 0xffffc90f, 0xfffff137, 0x00000ec9,
> 0x0000460a, 0xffffb9f6, 0x00000a46,
> +       0xfffff5ba, 0x00004b4b, 0xffffb4b5, 0x000054fb, 0xffffab05,
> 0xfffffb55, 0x000004ab, 0x000036d3,
> +       0xffffc92d, 0xffffd337, 0x00002cc9, 0x00004add, 0xffffb523,
> 0xffffdd4b, 0x000022b5, 0x00007337,
> +       0xffff8cc9, 0x00003773, 0xffffc88d, 0x0000731e, 0xffff8ce2,
> 0x00001e73, 0xffffe18d, 0x0000785a,
> +       0xffff87a6, 0x00005a78, 0xffffa588, 0x000068e2, 0xffff971e,
> 0xffffe269, 0x00001d97, 0x000054ab,
> +       0xffffab55, 0x000068ba, 0xffff9746, 0xffffba69, 0x00004597,
> 0x00001e1e, 0xffffe1e2, 0x00003c3c,
> +       0xffffc3c4, 0x00006969, 0xffff9697, 0x00000000, 0x05050000,
> 0xfafb0000, 0x05000000, 0xfb000000,
> +       0x00050000, 0xfffb0000, 0x0a0a0000, 0xf5f60000, 0x0f050000,
> 0xf0fb0000, 0x00000505, 0x05050505,
> +       0xfafb0505, 0x05000505, 0xfb000505, 0x00050505, 0xfffb0505,
> 0x0a0a0505, 0xf5f60505, 0x0f050505,
> +       0xf0fb0505, 0xfffffafb, 0x0504fafb, 0xfafafafb, 0x04fffafb,
> 0xfafffafb, 0x0004fafb, 0xfffafafb,
> +       0x0a09fafb, 0xf5f5fafb, 0x0f04fafb, 0xf0fafafb, 0x00000500,
> 0x05050500, 0xfafb0500, 0x05000500,
> +       0xfb000500, 0x00050500, 0xfffb0500, 0x0a0a0500, 0xf5f60500,
> 0x0f050500, 0xf0fb0500, 0xfffffb00,
> +       0x0504fb00, 0xfafafb00, 0x04fffb00, 0xfafffb00, 0x0004fb00,
> 0xfffafb00, 0x0a09fb00, 0xf5f5fb00,
> +       0x0f04fb00, 0xf0fafb00, 0x00000005, 0x05050005, 0xfafb0005,
> 0x05000005, 0xfb000005, 0x00050005,
> +       0xfffb0005, 0x0a0a0005, 0xf5f60005, 0x0f050005, 0xf0fb0005,
> 0xfffffffb, 0x0504fffb, 0xfafafffb,
> +       0x04fffffb, 0xfafffffb, 0x0004fffb, 0xfffafffb, 0x0a09fffb,
> 0xf5f5fffb, 0x0f04fffb, 0xf0fafffb,
> +       0x00000a0a, 0x05050a0a, 0xfafb0a0a, 0x05000a0a, 0xfb000a0a,
> 0x00050a0a, 0xfffb0a0a, 0x0a0a0a0a,
> +       0xf5f60a0a, 0x0f050a0a, 0xf0fb0a0a, 0xfffff5f6, 0x0504f5f6,
> 0xfafaf5f6, 0x04fff5f6, 0xfafff5f6,
> +       0x0004f5f6, 0xfffaf5f6, 0x0a09f5f6, 0xf5f5f5f6, 0x0f04f5f6,
> 0xf0faf5f6, 0x00000f05, 0x05050f05,
> +       0xfafb0f05, 0x05000f05, 0xfb000f05, 0x00050f05, 0xfffb0f05,
> 0x0a0a0f05, 0xf5f60f05, 0x0f050f05,
> +       0xf0fb0f05, 0xfffff0fb, 0x0504f0fb, 0xfafaf0fb, 0x04fff0fb,
> 0xfafff0fb, 0x0004f0fb, 0xfffaf0fb,
> +       0x0a09f0fb, 0xf5f5f0fb, 0x0f04f0fb, 0xf0faf0fb, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000606, 0xfffff9fa, 0x00000600, 0xfffffa00,
> 0x00000006, 0xfffffffa, 0x00000c0c,
> +       0xfffff3f4, 0x00000c06, 0xfffff3fa, 0x0000060c, 0xfffff9f4,
> 0x00000bf4, 0xfffff40c, 0x000011fa,
> +       0xffffee06, 0xfffffa12, 0x000005ee, 0x0000180c, 0xffffe7f4,
> 0x00000c18, 0xfffff3e8, 0x00001818,
> +       0xffffe7e8, 0x00001e00, 0xffffe200, 0x0000001e, 0xffffffe2,
> 0x000017ee, 0xffffe812, 0xffffee18,
> +       0x000011e8, 0x0000301e, 0xffffcfe2, 0x00001e30, 0xffffe1d0,
> 0x000023fa, 0xffffdc06, 0xfffffa24,
> +       0x000005dc, 0x0000300c, 0xffffcff4, 0x00000c30, 0xfffff3d0,
> 0x00003030, 0xffffcfd0, 0x00003600,
> +       0xffffca00, 0x00000036, 0xffffffca, 0x000023dc, 0xffffdc24,
> 0x00002fe8, 0xffffd018, 0xffffe830,
> +       0x000017d0, 0x00004e1e, 0xffffb1e2, 0x00001e4e, 0xffffe1b2,
> 0x00005436, 0xffffabca, 0x00003654,
> +       0xffffc9ac, 0x000041ee, 0xffffbe12, 0xffffee42, 0x000011be,
> 0x0000540c, 0xffffabf4, 0x00000c54,
> +       0xfffff3ac, 0x00005a5a, 0xffffa5a6, 0x00005ffa, 0xffffa006,
> 0xfffffa60, 0x000005a0, 0x000041ca,
> +       0xffffbe36, 0xffffca42, 0x000035be, 0x000059d6, 0xffffa62a,
> 0xffffd65a, 0x000029a6, 0x00007de2,
> +       0xffff821e, 0xffffe27e, 0x00001d82, 0x0000659a, 0xffff9a66,
> 0x00007dac, 0xffff8254, 0xffffac7e,
> +       0x00005382, 0x00002424, 0xffffdbdc, 0x00004242, 0xffffbdbe,
> 0x00000000, 0x06060000, 0xf9fa0000,
> +       0x06000000, 0xfa000000, 0x00060000, 0xfffa0000, 0x0c0c0000,
> 0xf3f40000, 0x0c060000, 0xf3fa0000,
> +       0x060c0000, 0x00000606, 0x06060606, 0xf9fa0606, 0x06000606,
> 0xfa000606, 0x00060606, 0xfffa0606,
> +       0x0c0c0606, 0xf3f40606, 0x0c060606, 0xf3fa0606, 0x060c0606,
> 0xfffff9fa, 0x0605f9fa, 0xf9f9f9fa,
> +       0x05fff9fa, 0xf9fff9fa, 0x0005f9fa, 0xfff9f9fa, 0x0c0bf9fa,
> 0xf3f3f9fa, 0x0c05f9fa, 0xf3f9f9fa,
> +       0x060bf9fa, 0x00000600, 0x06060600, 0xf9fa0600, 0x06000600,
> 0xfa000600, 0x00060600, 0xfffa0600,
> +       0x0c0c0600, 0xf3f40600, 0x0c060600, 0xf3fa0600, 0x060c0600,
> 0xfffffa00, 0x0605fa00, 0xf9f9fa00,
> +       0x05fffa00, 0xf9fffa00, 0x0005fa00, 0xfff9fa00, 0x0c0bfa00,
> 0xf3f3fa00, 0x0c05fa00, 0xf3f9fa00,
> +       0x060bfa00, 0x00000006, 0x06060006, 0xf9fa0006, 0x06000006,
> 0xfa000006, 0x00060006, 0xfffa0006,
> +       0x0c0c0006, 0xf3f40006, 0x0c060006, 0xf3fa0006, 0x060c0006,
> 0xfffffffa, 0x0605fffa, 0xf9f9fffa,
> +       0x05fffffa, 0xf9fffffa, 0x0005fffa, 0xfff9fffa, 0x0c0bfffa,
> 0xf3f3fffa, 0x0c05fffa, 0xf3f9fffa,
> +       0x060bfffa, 0x00000c0c, 0x06060c0c, 0xf9fa0c0c, 0x06000c0c,
> 0xfa000c0c, 0x00060c0c, 0xfffa0c0c,
> +       0x0c0c0c0c, 0xf3f40c0c, 0x0c060c0c, 0xf3fa0c0c, 0x060c0c0c,
> 0xfffff3f4, 0x0605f3f4, 0xf9f9f3f4,
> +       0x05fff3f4, 0xf9fff3f4, 0x0005f3f4, 0xfff9f3f4, 0x0c0bf3f4,
> 0xf3f3f3f4, 0x0c05f3f4, 0xf3f9f3f4,
> +       0x060bf3f4, 0x00000c06, 0x06060c06, 0xf9fa0c06, 0x06000c06,
> 0xfa000c06, 0x00060c06, 0xfffa0c06,
> +       0x0c0c0c06, 0xf3f40c06, 0x0c060c06, 0xf3fa0c06, 0x060c0c06,
> 0xfffff3fa, 0x0605f3fa, 0xf9f9f3fa,
> +       0x05fff3fa, 0xf9fff3fa, 0x0005f3fa, 0xfff9f3fa, 0x0c0bf3fa,
> 0xf3f3f3fa, 0x0c05f3fa, 0xf3f9f3fa,
> +       0x060bf3fa, 0x0000060c, 0x0606060c, 0xf9fa060c, 0x0600060c,
> 0xfa00060c, 0x0006060c, 0xfffa060c,
> +       0x0c0c060c, 0xf3f4060c, 0x0c06060c, 0xf3fa060c, 0x060c060c,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000707, 0xfffff8f9, 0x00000700, 0xfffff900,
> 0x00000007, 0xfffffff9, 0x00000e0e,
> +       0xfffff1f2, 0x00001507, 0xffffeaf9, 0x00000715, 0xfffff8eb,
> 0x00000df2, 0xfffff20e, 0x000014f9,
> +       0xffffeb07, 0xfffff915, 0x000006eb, 0x00001c0e, 0xffffe3f2,
> 0x00000e1c, 0xfffff1e4, 0x00001c1c,
> +       0xffffe3e4, 0x00002300, 0xffffdd00, 0x00000023, 0xffffffdd,
> 0x00001beb, 0xffffe415, 0xffffeb1c,
> +       0x000014e4, 0x00003823, 0xffffc7dd, 0x00002338, 0xffffdcc8,
> 0x000029f2, 0xffffd60e, 0xfffff22a,
> +       0x00000dd6, 0x0000380e, 0xffffc7f2, 0x00000e38, 0xfffff1c8,
> 0x00003838, 0xffffc7c8, 0x00003f00,
> +       0xffffc100, 0x0000003f, 0xffffffc1, 0x000029d6, 0xffffd62a,
> 0x000037e4, 0xffffc81c, 0xffffe438,
> +       0x00001bc8, 0x00005b23, 0xffffa4dd, 0x0000235b, 0xffffdca5,
> 0x0000623f, 0xffff9dc1, 0x00003f62,
> +       0xffffc09e, 0x00004ceb, 0xffffb315, 0xffffeb4d, 0x000014b3,
> 0x0000620e, 0xffff9df2, 0x00000e62,
> +       0xfffff19e, 0x00006969, 0xffff9697, 0x000076f9, 0xffff8907,
> 0xfffff977, 0x00000689, 0x00004cc1,
> +       0xffffb33f, 0xffffc14d, 0x00003eb3, 0x000068cf, 0xffff9731,
> 0xffffcf69, 0x00003097, 0x00007689,
> +       0xffff8977, 0x00002a2a, 0xffffd5d6, 0x00004d4d, 0xffffb2b3,
> 0x00000000, 0x07070000, 0xf8f90000,
> +       0x07000000, 0xf9000000, 0x00070000, 0xfff90000, 0x0e0e0000,
> 0xf1f20000, 0x15070000, 0xeaf90000,
> +       0x07150000, 0x00000707, 0x07070707, 0xf8f90707, 0x07000707,
> 0xf9000707, 0x00070707, 0xfff90707,
> +       0x0e0e0707, 0xf1f20707, 0x15070707, 0xeaf90707, 0x07150707,
> 0xfffff8f9, 0x0706f8f9, 0xf8f8f8f9,
> +       0x06fff8f9, 0xf8fff8f9, 0x0006f8f9, 0xfff8f8f9, 0x0e0df8f9,
> 0xf1f1f8f9, 0x1506f8f9, 0xeaf8f8f9,
> +       0x0714f8f9, 0x00000700, 0x07070700, 0xf8f90700, 0x07000700,
> 0xf9000700, 0x00070700, 0xfff90700,
> +       0x0e0e0700, 0xf1f20700, 0x15070700, 0xeaf90700, 0x07150700,
> 0xfffff900, 0x0706f900, 0xf8f8f900,
> +       0x06fff900, 0xf8fff900, 0x0006f900, 0xfff8f900, 0x0e0df900,
> 0xf1f1f900, 0x1506f900, 0xeaf8f900,
> +       0x0714f900, 0x00000007, 0x07070007, 0xf8f90007, 0x07000007,
> 0xf9000007, 0x00070007, 0xfff90007,
> +       0x0e0e0007, 0xf1f20007, 0x15070007, 0xeaf90007, 0x07150007,
> 0xfffffff9, 0x0706fff9, 0xf8f8fff9,
> +       0x06fffff9, 0xf8fffff9, 0x0006fff9, 0xfff8fff9, 0x0e0dfff9,
> 0xf1f1fff9, 0x1506fff9, 0xeaf8fff9,
> +       0x0714fff9, 0x00000e0e, 0x07070e0e, 0xf8f90e0e, 0x07000e0e,
> 0xf9000e0e, 0x00070e0e, 0xfff90e0e,
> +       0x0e0e0e0e, 0xf1f20e0e, 0x15070e0e, 0xeaf90e0e, 0x07150e0e,
> 0xfffff1f2, 0x0706f1f2, 0xf8f8f1f2,
> +       0x06fff1f2, 0xf8fff1f2, 0x0006f1f2, 0xfff8f1f2, 0x0e0df1f2,
> 0xf1f1f1f2, 0x1506f1f2, 0xeaf8f1f2,
> +       0x0714f1f2, 0x00001507, 0x07071507, 0xf8f91507, 0x07001507,
> 0xf9001507, 0x00071507, 0xfff91507,
> +       0x0e0e1507, 0xf1f21507, 0x15071507, 0xeaf91507, 0x07151507,
> 0xffffeaf9, 0x0706eaf9, 0xf8f8eaf9,
> +       0x06ffeaf9, 0xf8ffeaf9, 0x0006eaf9, 0xfff8eaf9, 0x0e0deaf9,
> 0xf1f1eaf9, 0x1506eaf9, 0xeaf8eaf9,
> +       0x0714eaf9, 0x00000715, 0x07070715, 0xf8f90715, 0x07000715,
> 0xf9000715, 0x00070715, 0xfff90715,
> +       0x0e0e0715, 0xf1f20715, 0x15070715, 0xeaf90715, 0x07150715,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000808, 0xfffff7f8, 0x00000800, 0xfffff800,
> 0x00000008, 0xfffffff8, 0x00001010,
> +       0xffffeff0, 0x00001008, 0xffffeff8, 0x00000810, 0xfffff7f0,
> 0x00000ff0, 0xfffff010, 0x000017f8,
> +       0xffffe808, 0xfffff818, 0x000007e8, 0x00002010, 0xffffdff0,
> 0x00001020, 0xffffefe0, 0x00002020,
> +       0xffffdfe0, 0x00002800, 0xffffd800, 0x00000028, 0xffffffd8,
> 0x00001fe8, 0xffffe018, 0xffffe820,
> +       0x000017e0, 0x00004028, 0xffffbfd8, 0x00002840, 0xffffd7c0,
> 0x00002ff0, 0xffffd010, 0xfffff030,
> +       0x00000fd0, 0x00004010, 0xffffbff0, 0x00001040, 0xffffefc0,
> 0x00004040, 0xffffbfc0, 0x00004800,
> +       0xffffb800, 0x00000048, 0xffffffb8, 0x00002fd0, 0xffffd030,
> 0x00003fe0, 0xffffc020, 0xffffe040,
> +       0x00001fc0, 0x00006828, 0xffff97d8, 0x00002868, 0xffffd798,
> 0x00007048, 0xffff8fb8, 0x00004870,
> +       0xffffb790, 0x000057e8, 0xffffa818, 0xffffe858, 0x000017a8,
> 0x00007010, 0xffff8ff0, 0x00001070,
> +       0xffffef90, 0x00007878, 0xffff8788, 0x000057b8, 0xffffa848,
> 0xffffb858, 0x000047a8, 0x000077c8,
> +       0xffff8838, 0xffffc878, 0x00003788, 0x00003030, 0xffffcfd0,
> 0x00005858, 0xffffa7a8, 0x00000000,
> +       0x08080000, 0xf7f80000, 0x08000000, 0xf8000000, 0x00080000,
> 0xfff80000, 0x10100000, 0xeff00000,
> +       0x10080000, 0xeff80000, 0x08100000, 0x00000808, 0x08080808,
> 0xf7f80808, 0x08000808, 0xf8000808,
> +       0x00080808, 0xfff80808, 0x10100808, 0xeff00808, 0x10080808,
> 0xeff80808, 0x08100808, 0xfffff7f8,
> +       0x0807f7f8, 0xf7f7f7f8, 0x07fff7f8, 0xf7fff7f8, 0x0007f7f8,
> 0xfff7f7f8, 0x100ff7f8, 0xefeff7f8,
> +       0x1007f7f8, 0xeff7f7f8, 0x080ff7f8, 0x00000800, 0x08080800,
> 0xf7f80800, 0x08000800, 0xf8000800,
> +       0x00080800, 0xfff80800, 0x10100800, 0xeff00800, 0x10080800,
> 0xeff80800, 0x08100800, 0xfffff800,
> +       0x0807f800, 0xf7f7f800, 0x07fff800, 0xf7fff800, 0x0007f800,
> 0xfff7f800, 0x100ff800, 0xefeff800,
> +       0x1007f800, 0xeff7f800, 0x080ff800, 0x00000008, 0x08080008,
> 0xf7f80008, 0x08000008, 0xf8000008,
> +       0x00080008, 0xfff80008, 0x10100008, 0xeff00008, 0x10080008,
> 0xeff80008, 0x08100008, 0xfffffff8,
> +       0x0807fff8, 0xf7f7fff8, 0x07fffff8, 0xf7fffff8, 0x0007fff8,
> 0xfff7fff8, 0x100ffff8, 0xefeffff8,
> +       0x1007fff8, 0xeff7fff8, 0x080ffff8, 0x00001010, 0x08081010,
> 0xf7f81010, 0x08001010, 0xf8001010,
> +       0x00081010, 0xfff81010, 0x10101010, 0xeff01010, 0x10081010,
> 0xeff81010, 0x08101010, 0xffffeff0,
> +       0x0807eff0, 0xf7f7eff0, 0x07ffeff0, 0xf7ffeff0, 0x0007eff0,
> 0xfff7eff0, 0x100feff0, 0xefefeff0,
> +       0x1007eff0, 0xeff7eff0, 0x080feff0, 0x00001008, 0x08081008,
> 0xf7f81008, 0x08001008, 0xf8001008,
> +       0x00081008, 0xfff81008, 0x10101008, 0xeff01008, 0x10081008,
> 0xeff81008, 0x08101008, 0xffffeff8,
> +       0x0807eff8, 0xf7f7eff8, 0x07ffeff8, 0xf7ffeff8, 0x0007eff8,
> 0xfff7eff8, 0x100feff8, 0xefefeff8,
> +       0x1007eff8, 0xeff7eff8, 0x080feff8, 0x00000810, 0x08080810,
> 0xf7f80810, 0x08000810, 0xf8000810,
> +       0x00080810, 0xfff80810, 0x10100810, 0xeff00810, 0x10080810,
> 0xeff80810, 0x08100810, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000909, 0xfffff6f7, 0x00000900, 0xfffff700,
> 0x00000009, 0xfffffff7, 0x00001212,
> +       0xffffedee, 0x00001b09, 0xffffe4f7, 0x0000091b, 0xfffff6e5,
> 0x000011ee, 0xffffee12, 0x00001af7,
> +       0xffffe509, 0xfffff71b, 0x000008e5, 0x00002412, 0xffffdbee,
> 0x00001224, 0xffffeddc, 0x00002424,
> +       0xffffdbdc, 0x00002d00, 0xffffd300, 0x0000002d, 0xffffffd3,
> 0x000023e5, 0xffffdc1b, 0xffffe524,
> +       0x00001adc, 0x0000482d, 0xffffb7d3, 0x00002d48, 0xffffd2b8,
> 0x000035ee, 0xffffca12, 0xffffee36,
> +       0x000011ca, 0x00004812, 0xffffb7ee, 0x00001248, 0xffffedb8,
> 0x00004848, 0xffffb7b8, 0x00005100,
> +       0xffffaf00, 0x00000051, 0xffffffaf, 0x000035ca, 0xffffca36,
> 0x000047dc, 0xffffb824, 0xffffdc48,
> +       0x000023b8, 0x0000752d, 0xffff8ad3, 0x00002d75, 0xffffd28b,
> 0x00007e51, 0xffff81af, 0x0000517e,
> +       0xffffae82, 0x000062e5, 0xffff9d1b, 0xffffe563, 0x00001a9d,
> 0x000062af, 0xffff9d51, 0xffffaf63,
> +       0x0000509d, 0x00003636, 0xffffc9ca, 0x00006c6c, 0xffff9394,
> 0x00000000, 0x09090000, 0xf6f70000,
> +       0x09000000, 0xf7000000, 0x00090000, 0xfff70000, 0x12120000,
> 0xedee0000, 0x1b090000, 0xe4f70000,
> +       0x091b0000, 0xf6e50000, 0x00000909, 0x09090909, 0xf6f70909,
> 0x09000909, 0xf7000909, 0x00090909,
> +       0xfff70909, 0x12120909, 0xedee0909, 0x1b090909, 0xe4f70909,
> 0x091b0909, 0xf6e50909, 0xfffff6f7,
> +       0x0908f6f7, 0xf6f6f6f7, 0x08fff6f7, 0xf6fff6f7, 0x0008f6f7,
> 0xfff6f6f7, 0x1211f6f7, 0xededf6f7,
> +       0x1b08f6f7, 0xe4f6f6f7, 0x091af6f7, 0xf6e4f6f7, 0x00000900,
> 0x09090900, 0xf6f70900, 0x09000900,
> +       0xf7000900, 0x00090900, 0xfff70900, 0x12120900, 0xedee0900,
> 0x1b090900, 0xe4f70900, 0x091b0900,
> +       0xf6e50900, 0xfffff700, 0x0908f700, 0xf6f6f700, 0x08fff700,
> 0xf6fff700, 0x0008f700, 0xfff6f700,
> +       0x1211f700, 0xededf700, 0x1b08f700, 0xe4f6f700, 0x091af700,
> 0xf6e4f700, 0x00000009, 0x09090009,
> +       0xf6f70009, 0x09000009, 0xf7000009, 0x00090009, 0xfff70009,
> 0x12120009, 0xedee0009, 0x1b090009,
> +       0xe4f70009, 0x091b0009, 0xf6e50009, 0xfffffff7, 0x0908fff7,
> 0xf6f6fff7, 0x08fffff7, 0xf6fffff7,
> +       0x0008fff7, 0xfff6fff7, 0x1211fff7, 0xededfff7, 0x1b08fff7,
> 0xe4f6fff7, 0x091afff7, 0xf6e4fff7,
> +       0x00001212, 0x09091212, 0xf6f71212, 0x09001212, 0xf7001212,
> 0x00091212, 0xfff71212, 0x12121212,
> +       0xedee1212, 0x1b091212, 0xe4f71212, 0x091b1212, 0xf6e51212,
> 0xffffedee, 0x0908edee, 0xf6f6edee,
> +       0x08ffedee, 0xf6ffedee, 0x0008edee, 0xfff6edee, 0x1211edee,
> 0xedededee, 0x1b08edee, 0xe4f6edee,
> +       0x091aedee, 0xf6e4edee, 0x00001b09, 0x09091b09, 0xf6f71b09,
> 0x09001b09, 0xf7001b09, 0x00091b09,
> +       0xfff71b09, 0x12121b09, 0xedee1b09, 0x1b091b09, 0xe4f71b09,
> 0x091b1b09, 0xf6e51b09, 0xffffe4f7,
> +       0x0908e4f7, 0xf6f6e4f7, 0x08ffe4f7, 0xf6ffe4f7, 0x0008e4f7,
> 0xfff6e4f7, 0x1211e4f7, 0xedede4f7,
> +       0x1b08e4f7, 0xe4f6e4f7, 0x091ae4f7, 0xf6e4e4f7, 0x0000091b,
> 0x0909091b, 0xf6f7091b, 0x0900091b,
> +       0xf700091b, 0x0009091b, 0xfff7091b, 0x1212091b, 0xedee091b,
> 0x1b09091b, 0xe4f7091b, 0x091b091b,
> +       0xf6e5091b, 0xfffff6e5, 0x0908f6e5, 0xf6f6f6e5, 0x08fff6e5,
> 0xf6fff6e5, 0x0008f6e5, 0xfff6f6e5,
> +       0x1211f6e5, 0xededf6e5, 0x1b08f6e5, 0xe4f6f6e5, 0x091af6e5,
> 0xf6e4f6e5, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000202, 0xfffffdfe, 0x00000300, 0xfffffd00,
> 0x00000003, 0xfffffffd, 0x00000606,
> +       0xfffff9fa, 0x00000700, 0xfffff900, 0x00000007, 0xfffffff9,
> 0x000004fb, 0xfffffb05, 0xfffffb05,
> +       0x000004fb, 0x00000b06, 0xfffff4fa, 0x0000060b, 0xfffff9f5,
> 0x00000800, 0xfffff800, 0x00000008,
> +       0xfffffff8, 0x00000b0b, 0xfffff4f5, 0x00000c00, 0xfffff400,
> 0x0000000c, 0xfffffff4, 0x0000110c,
> +       0xffffeef4, 0x00000c11, 0xfffff3ef, 0x00001111, 0xffffeeef,
> 0x00001206, 0xffffedfa, 0x00000612,
> +       0xfffff9ee, 0x00000af8, 0xfffff508, 0xfffff80b, 0x000007f5,
> 0x00000f00, 0xfffff100, 0x0000000f,
> +       0xfffffff1, 0x00001400, 0xffffec00, 0x00000014, 0xffffffec,
> 0x00001912, 0xffffe6ee, 0x00001219,
> +       0xffffede7, 0x0000190b, 0xffffe6f5, 0x00000b19, 0xfffff4e7,
> 0x00001919, 0xffffe6e7, 0x00000df2,
> +       0xfffff20e, 0xfffff20e, 0x00000df2, 0x00001a00, 0xffffe600,
> 0x0000001a, 0xffffffe6, 0x000011f5,
> +       0xffffee0b, 0xfffff512, 0x00000aee, 0x000015f9, 0xffffea07,
> 0xfffff916, 0x000006ea, 0x0000221a,
> +       0xffffdde6, 0x00001a22, 0xffffe5de, 0x00002212, 0xffffddee,
> 0x00001222, 0xffffedde, 0x00002222,
> +       0xffffddde, 0x0000230b, 0xffffdcf5, 0x00000b23, 0xfffff4dd,
> 0x00001d00, 0xffffe300, 0x0000001d,
> +       0xffffffe3, 0x000015ed, 0xffffea13, 0xffffed16, 0x000012ea,
> 0x000019f1, 0xffffe60f, 0xfffff11a,
> +       0x00000ee6, 0x00002500, 0xffffdb00, 0x00000025, 0xffffffdb,
> 0x00002c1b, 0xffffd3e5, 0x00001b2c,
> +       0xffffe4d4, 0x00002c24, 0xffffd3dc, 0x0000242c, 0xffffdbd4,
> 0x00002c12, 0xffffd3ee, 0x0000122c,
> +       0xffffedd4, 0x000020f6, 0xffffdf0a, 0xfffff621, 0x000009df,
> 0x00002d2d, 0xffffd2d3, 0x00000000,
> +       0x00000000, 0x00000202, 0xfffffdfe, 0x00000300, 0xfffffd00,
> 0x00000003, 0xfffffffd, 0x00000606,
> +       0xfffff9fa, 0x00000700, 0xfffff900, 0x02020000, 0x02020202,
> 0x0201fdfe, 0x02020300, 0x0201fd00,
> +       0x02020003, 0x0201fffd, 0x02020606, 0x0201f9fa, 0x02020700,
> 0x0201f900, 0xfdfe0000, 0xfdfe0202,
> +       0xfdfdfdfe, 0xfdfe0300, 0xfdfdfd00, 0xfdfe0003, 0xfdfdfffd,
> 0xfdfe0606, 0xfdfdf9fa, 0xfdfe0700,
> +       0xfdfdf900, 0x03000000, 0x03000202, 0x02fffdfe, 0x03000300,
> 0x02fffd00, 0x03000003, 0x02fffffd,
> +       0x03000606, 0x02fff9fa, 0x03000700, 0x02fff900, 0xfd000000,
> 0xfd000202, 0xfcfffdfe, 0xfd000300,
> +       0xfcfffd00, 0xfd000003, 0xfcfffffd, 0xfd000606, 0xfcfff9fa,
> 0xfd000700, 0xfcfff900, 0x00030000,
> +       0x00030202, 0x0002fdfe, 0x00030300, 0x0002fd00, 0x00030003,
> 0x0002fffd, 0x00030606, 0x0002f9fa,
> +       0x00030700, 0x0002f900, 0xfffd0000, 0xfffd0202, 0xfffcfdfe,
> 0xfffd0300, 0xfffcfd00, 0xfffd0003,
> +       0xfffcfffd, 0xfffd0606, 0xfffcf9fa, 0xfffd0700, 0xfffcf900,
> 0x06060000, 0x06060202, 0x0605fdfe,
> +       0x06060300, 0x0605fd00, 0x06060003, 0x0605fffd, 0x06060606,
> 0x0605f9fa, 0x06060700, 0x0605f900,
> +       0xf9fa0000, 0xf9fa0202, 0xf9f9fdfe, 0xf9fa0300, 0xf9f9fd00,
> 0xf9fa0003, 0xf9f9fffd, 0xf9fa0606,
> +       0xf9f9f9fa, 0xf9fa0700, 0xf9f9f900, 0x07000000, 0x07000202,
> 0x06fffdfe, 0x07000300, 0x06fffd00,
> +       0x07000003, 0x06fffffd, 0x07000606, 0x06fff9fa, 0x07000700,
> 0x06fff900, 0xf9000000, 0xf9000202,
> +       0xf8fffdfe, 0xf9000300, 0xf8fffd00, 0xf9000003, 0xf8fffffd,
> 0xf9000606, 0xf8fff9fa, 0xf9000700,
> +       0xf8fff900, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe,
> 0x00000202, 0xfffffdfe, 0x00000606,
> +       0xfffff9fa, 0x00000600, 0xfffffa00, 0x00000006, 0xfffffffa,
> 0x000003fc, 0xfffffc04, 0xfffffa0a,
> +       0x000005f6, 0xfffff400, 0x00000c00, 0xfffff3fa, 0xfffff406,
> 0x00000bfa, 0x00000c06, 0xfffffff2,
> +       0x0000000e, 0x00000c0c, 0xfffff3f4, 0xffffee00, 0x00001200,
> 0xfffff40e, 0x00000bf2, 0xfffff9ee,
> +       0xfffffa12, 0x000005ee, 0x00000612, 0xffffedf6, 0xffffee0a,
> 0x000011f6, 0x0000120a, 0xffffffea,
> +       0x00000016, 0xffffe800, 0x00001800, 0xfffff3ea, 0xfffff416,
> 0x00000bea, 0x00000c16, 0xffffe7f8,
> +       0xffffe808, 0x000017f8, 0x00001808, 0xfffff9e6, 0xfffffa1a,
> 0x000005e6, 0x0000061a, 0xffffffe4,
> +       0x0000001c, 0x00001414, 0xffffebec, 0xffffe5f2, 0x00001a0e,
> 0xfffff3e2, 0x00000c1e, 0xffffdff6,
> +       0x0000200a, 0xffffdfee, 0x00002012, 0xffffe5e6, 0x00001a1a,
> 0xffffebde, 0x00001422, 0xfffff3da,
> +       0x00000c26, 0xffffdfe0, 0x00002020, 0x00002020, 0xffffd7ea,
> 0xffffddde, 0x00002222, 0x00000000,
> +       0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe, 0x00000202,
> 0xfffffdfe, 0x00000606, 0xfffff9fa,
> +       0x00000600, 0xfffffa00, 0x00000006, 0xfffffffa, 0x02000000,
> 0x02000200, 0x01fffe00, 0x02000002,
> +       0x01fffffe, 0x02000202, 0x01fffdfe, 0x02000606, 0x01fff9fa,
> 0x02000600, 0x01fffa00, 0x02000006,
> +       0x01fffffa, 0xfe000000, 0xfe000200, 0xfdfffe00, 0xfe000002,
> 0xfdfffffe, 0xfe000202, 0xfdfffdfe,
> +       0xfe000606, 0xfdfff9fa, 0xfe000600, 0xfdfffa00, 0xfe000006,
> 0xfdfffffa, 0x00020000, 0x00020200,
> +       0x0001fe00, 0x00020002, 0x0001fffe, 0x00020202, 0x0001fdfe,
> 0x00020606, 0x0001f9fa, 0x00020600,
> +       0x0001fa00, 0x00020006, 0x0001fffa, 0xfffe0000, 0xfffe0200,
> 0xfffdfe00, 0xfffe0002, 0xfffdfffe,
> +       0xfffe0202, 0xfffdfdfe, 0xfffe0606, 0xfffdf9fa, 0xfffe0600,
> 0xfffdfa00, 0xfffe0006, 0xfffdfffa,
> +       0x02020000, 0x02020200, 0x0201fe00, 0x02020002, 0x0201fffe,
> 0x02020202, 0x0201fdfe, 0x02020606,
> +       0x0201f9fa, 0x02020600, 0x0201fa00, 0x02020006, 0x0201fffa,
> 0xfdfe0000, 0xfdfe0200, 0xfdfdfe00,
> +       0xfdfe0002, 0xfdfdfffe, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606,
> 0xfdfdf9fa, 0xfdfe0600, 0xfdfdfa00,
> +       0xfdfe0006, 0xfdfdfffa, 0x06060000, 0x06060200, 0x0605fe00,
> 0x06060002, 0x0605fffe, 0x06060202,
> +       0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060600, 0x0605fa00,
> 0x06060006, 0x0605fffa, 0xf9fa0000,
> +       0xf9fa0200, 0xf9f9fe00, 0xf9fa0002, 0xf9f9fffe, 0xf9fa0202,
> 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
> +       0xf9fa0600, 0xf9f9fa00, 0xf9fa0006, 0xf9f9fffa, 0x06000000,
> 0x06000200, 0x05fffe00, 0x06000002,
> +       0x05fffffe, 0x06000202, 0x05fffdfe, 0x06000606, 0x05fff9fa,
> 0x06000600, 0x05fffa00, 0x06000006,
> +       0x05fffffa, 0xfa000000, 0xfa000200, 0xf9fffe00, 0xfa000002,
> 0xf9fffffe, 0xfa000202, 0xf9fffdfe,
> +       0xfa000606, 0xf9fff9fa, 0xfa000600, 0xf9fffa00, 0xfa000006,
> 0xf9fffffa, 0x00060000, 0x00060200,
> +       0x0005fe00, 0x00060002, 0x0005fffe, 0x00060202, 0x0005fdfe,
> 0x00060606, 0x0005f9fa, 0x00060600,
> +       0x0005fa00, 0x00060006, 0x0005fffa, 0xfffa0000, 0xfffa0200,
> 0xfff9fe00, 0xfffa0002, 0xfff9fffe,
> +       0xfffa0202, 0xfff9fdfe, 0xfffa0606, 0xfff9f9fa, 0xfffa0600,
> 0xfff9fa00, 0xfffa0006, 0xfff9fffa,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe,
> 0x00000404, 0xfffffbfc, 0x00000a0a,
> +       0xfffff5f6, 0x00000a00, 0xfffff600, 0x0000000a, 0xfffffff6,
> 0x000005fa, 0xfffffa06, 0xfffff80e,
> +       0x000007f2, 0xffffffee, 0x00000012, 0xfffff00a, 0x00000ff6,
> 0xffffe800, 0x00001800, 0xfffff7e8,
> +       0xfffff818, 0x000007e8, 0x00000818, 0x00001212, 0xffffedee,
> 0xfffff014, 0x00000fec, 0xffffe5f2,
> +       0xffffe60e, 0x000019f2, 0x00001a0e, 0xffffffe2, 0x0000001e,
> 0xffffde00, 0x00002200, 0xfffff7de,
> +       0xfffff822, 0x000007de, 0x00000822, 0xffffede2, 0xffffee1e,
> 0x000011e2, 0x0000121e, 0xffffddf6,
> +       0xffffde0a, 0x000021f6, 0x0000220a, 0xffffddec, 0x00002214,
> 0xffffffd8, 0x00000028, 0x00001e1e,
> +       0xffffe1e2, 0xffffedd8, 0x00001228, 0xffffd400, 0x00002c00,
> 0xffffd3f0, 0x00002c10, 0xffffdbdc,
> +       0xffffdbdc, 0x00002424, 0xffffd3e6, 0x00002c1a, 0xffffe5d2,
> 0x00001a2e, 0xffffedcc, 0x00001234,
> +       0xffffc9ec, 0xffffd3d4, 0x00002c2c, 0xffffc9e0, 0xffffd1d2,
> 0xffffd1d2, 0x00002e2e, 0x00000000,
> +       0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe, 0x00000404,
> 0xfffffbfc, 0x00000a0a, 0xfffff5f6,
> +       0x00000a00, 0xfffff600, 0x0000000a, 0xfffffff6, 0x02000000,
> 0x02000200, 0x01fffe00, 0x02000002,
> +       0x01fffffe, 0x02000404, 0x01fffbfc, 0x02000a0a, 0x01fff5f6,
> 0x02000a00, 0x01fff600, 0x0200000a,
> +       0x01fffff6, 0xfe000000, 0xfe000200, 0xfdfffe00, 0xfe000002,
> 0xfdfffffe, 0xfe000404, 0xfdfffbfc,
> +       0xfe000a0a, 0xfdfff5f6, 0xfe000a00, 0xfdfff600, 0xfe00000a,
> 0xfdfffff6, 0x00020000, 0x00020200,
> +       0x0001fe00, 0x00020002, 0x0001fffe, 0x00020404, 0x0001fbfc,
> 0x00020a0a, 0x0001f5f6, 0x00020a00,
> +       0x0001f600, 0x0002000a, 0x0001fff6, 0xfffe0000, 0xfffe0200,
> 0xfffdfe00, 0xfffe0002, 0xfffdfffe,
> +       0xfffe0404, 0xfffdfbfc, 0xfffe0a0a, 0xfffdf5f6, 0xfffe0a00,
> 0xfffdf600, 0xfffe000a, 0xfffdfff6,
> +       0x04040000, 0x04040200, 0x0403fe00, 0x04040002, 0x0403fffe,
> 0x04040404, 0x0403fbfc, 0x04040a0a,
> +       0x0403f5f6, 0x04040a00, 0x0403f600, 0x0404000a, 0x0403fff6,
> 0xfbfc0000, 0xfbfc0200, 0xfbfbfe00,
> +       0xfbfc0002, 0xfbfbfffe, 0xfbfc0404, 0xfbfbfbfc, 0xfbfc0a0a,
> 0xfbfbf5f6, 0xfbfc0a00, 0xfbfbf600,
> +       0xfbfc000a, 0xfbfbfff6, 0x0a0a0000, 0x0a0a0200, 0x0a09fe00,
> 0x0a0a0002, 0x0a09fffe, 0x0a0a0404,
> +       0x0a09fbfc, 0x0a0a0a0a, 0x0a09f5f6, 0x0a0a0a00, 0x0a09f600,
> 0x0a0a000a, 0x0a09fff6, 0xf5f60000,
> +       0xf5f60200, 0xf5f5fe00, 0xf5f60002, 0xf5f5fffe, 0xf5f60404,
> 0xf5f5fbfc, 0xf5f60a0a, 0xf5f5f5f6,
> +       0xf5f60a00, 0xf5f5f600, 0xf5f6000a, 0xf5f5fff6, 0x0a000000,
> 0x0a000200, 0x09fffe00, 0x0a000002,
> +       0x09fffffe, 0x0a000404, 0x09fffbfc, 0x0a000a0a, 0x09fff5f6,
> 0x0a000a00, 0x09fff600, 0x0a00000a,
> +       0x09fffff6, 0xf6000000, 0xf6000200, 0xf5fffe00, 0xf6000002,
> 0xf5fffffe, 0xf6000404, 0xf5fffbfc,
> +       0xf6000a0a, 0xf5fff5f6, 0xf6000a00, 0xf5fff600, 0xf600000a,
> 0xf5fffff6, 0x000a0000, 0x000a0200,
> +       0x0009fe00, 0x000a0002, 0x0009fffe, 0x000a0404, 0x0009fbfc,
> 0x000a0a0a, 0x0009f5f6, 0x000a0a00,
> +       0x0009f600, 0x000a000a, 0x0009fff6, 0xfff60000, 0xfff60200,
> 0xfff5fe00, 0xfff60002, 0xfff5fffe,
> +       0xfff60404, 0xfff5fbfc, 0xfff60a0a, 0xfff5f5f6, 0xfff60a00,
> 0xfff5f600, 0xfff6000a, 0xfff5fff6,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000400, 0xfffffc00, 0x00000004, 0xfffffffc,
> 0x00000404, 0xfffffbfc, 0x00000c0c,
> +       0xfffff3f4, 0x00000c00, 0xfffff400, 0x0000000c, 0xfffffff4,
> 0x000007f8, 0xfffff808, 0xfffff008,
> +       0x00000ff8, 0xffffe800, 0x00001800, 0xfffff7e8, 0xfffff818,
> 0x000007e8, 0x00000818, 0xfffff014,
> +       0x00000fec, 0xffffffe4, 0x0000001c, 0xffffe7f0, 0xffffe810,
> 0x000017f0, 0x00001810, 0xffffe000,
> +       0x00002000, 0xffffefe4, 0xfffff01c, 0x00000fe4, 0x0000101c,
> 0xffffdff8, 0xffffe008, 0xfffff7e0,
> +       0xfffff820, 0x000007e0, 0x00000820, 0x00001ff8, 0x00002008,
> 0x00001818, 0xffffe7e8, 0xffffe818,
> +       0x000017e8, 0xffffdfec, 0x00002014, 0xffffffd8, 0x00000028,
> 0xffffefd8, 0x00001028, 0xffffd400,
> +       0xffffd400, 0xffffffd4, 0x0000002c, 0x00002c00, 0x00002c00,
> 0xffffdfe0, 0x00002020, 0xffffd3f0,
> +       0x00002c10, 0xffffd3e8, 0xffffe7d4, 0x0000182c, 0x00002c18,
> 0xffffefd0, 0x00001030, 0xffffdbdc,
> +       0xffffdbdc, 0x00002424, 0x00002424, 0xffffcbec, 0x00002828,
> 0xffffd7d8, 0xffffcbe0, 0x00000000,
> +       0x00000400, 0xfffffc00, 0x00000004, 0xfffffffc, 0x00000404,
> 0xfffffbfc, 0x00000c0c, 0xfffff3f4,
> +       0x00000c00, 0xfffff400, 0x0000000c, 0xfffffff4, 0x04000000,
> 0x04000400, 0x03fffc00, 0x04000004,
> +       0x03fffffc, 0x04000404, 0x03fffbfc, 0x04000c0c, 0x03fff3f4,
> 0x04000c00, 0x03fff400, 0x0400000c,
> +       0x03fffff4, 0xfc000000, 0xfc000400, 0xfbfffc00, 0xfc000004,
> 0xfbfffffc, 0xfc000404, 0xfbfffbfc,
> +       0xfc000c0c, 0xfbfff3f4, 0xfc000c00, 0xfbfff400, 0xfc00000c,
> 0xfbfffff4, 0x00040000, 0x00040400,
> +       0x0003fc00, 0x00040004, 0x0003fffc, 0x00040404, 0x0003fbfc,
> 0x00040c0c, 0x0003f3f4, 0x00040c00,
> +       0x0003f400, 0x0004000c, 0x0003fff4, 0xfffc0000, 0xfffc0400,
> 0xfffbfc00, 0xfffc0004, 0xfffbfffc,
> +       0xfffc0404, 0xfffbfbfc, 0xfffc0c0c, 0xfffbf3f4, 0xfffc0c00,
> 0xfffbf400, 0xfffc000c, 0xfffbfff4,
> +       0x04040000, 0x04040400, 0x0403fc00, 0x04040004, 0x0403fffc,
> 0x04040404, 0x0403fbfc, 0x04040c0c,
> +       0x0403f3f4, 0x04040c00, 0x0403f400, 0x0404000c, 0x0403fff4,
> 0xfbfc0000, 0xfbfc0400, 0xfbfbfc00,
> +       0xfbfc0004, 0xfbfbfffc, 0xfbfc0404, 0xfbfbfbfc, 0xfbfc0c0c,
> 0xfbfbf3f4, 0xfbfc0c00, 0xfbfbf400,
> +       0xfbfc000c, 0xfbfbfff4, 0x0c0c0000, 0x0c0c0400, 0x0c0bfc00,
> 0x0c0c0004, 0x0c0bfffc, 0x0c0c0404,
> +       0x0c0bfbfc, 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c0c00, 0x0c0bf400,
> 0x0c0c000c, 0x0c0bfff4, 0xf3f40000,
> +       0xf3f40400, 0xf3f3fc00, 0xf3f40004, 0xf3f3fffc, 0xf3f40404,
> 0xf3f3fbfc, 0xf3f40c0c, 0xf3f3f3f4,
> +       0xf3f40c00, 0xf3f3f400, 0xf3f4000c, 0xf3f3fff4, 0x0c000000,
> 0x0c000400, 0x0bfffc00, 0x0c000004,
> +       0x0bfffffc, 0x0c000404, 0x0bfffbfc, 0x0c000c0c, 0x0bfff3f4,
> 0x0c000c00, 0x0bfff400, 0x0c00000c,
> +       0x0bfffff4, 0xf4000000, 0xf4000400, 0xf3fffc00, 0xf4000004,
> 0xf3fffffc, 0xf4000404, 0xf3fffbfc,
> +       0xf4000c0c, 0xf3fff3f4, 0xf4000c00, 0xf3fff400, 0xf400000c,
> 0xf3fffff4, 0x000c0000, 0x000c0400,
> +       0x000bfc00, 0x000c0004, 0x000bfffc, 0x000c0404, 0x000bfbfc,
> 0x000c0c0c, 0x000bf3f4, 0x000c0c00,
> +       0x000bf400, 0x000c000c, 0x000bfff4, 0xfff40000, 0xfff40400,
> 0xfff3fc00, 0xfff40004, 0xfff3fffc,
> +       0xfff40404, 0xfff3fbfc, 0xfff40c0c, 0xfff3f3f4, 0xfff40c00,
> 0xfff3f400, 0xfff4000c, 0xfff3fff4,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa,
> 0x00000c0c, 0xfffff3f4, 0x00001414,
> +       0xffffebec, 0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c,
> 0xfffff3f4, 0x00001414, 0xffffebec,
> +       0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x02020000,
> 0x02020202, 0x0201fdfe, 0x02020606,
> +       0x0201f9fa, 0x02020c0c, 0x0201f3f4, 0x02021414, 0x0201ebec,
> 0x02022020, 0x0201dfe0, 0x02022e2e,
> +       0x0201d1d2, 0xfdfe0000, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606,
> 0xfdfdf9fa, 0xfdfe0c0c, 0xfdfdf3f4,
> +       0xfdfe1414, 0xfdfdebec, 0xfdfe2020, 0xfdfddfe0, 0xfdfe2e2e,
> 0xfdfdd1d2, 0x06060000, 0x06060202,
> +       0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060c0c, 0x0605f3f4,
> 0x06061414, 0x0605ebec, 0x06062020,
> +       0x0605dfe0, 0x06062e2e, 0x0605d1d2, 0xf9fa0000, 0xf9fa0202,
> 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
> +       0xf9fa0c0c, 0xf9f9f3f4, 0xf9fa1414, 0xf9f9ebec, 0xf9fa2020,
> 0xf9f9dfe0, 0xf9fa2e2e, 0xf9f9d1d2,
> +       0x0c0c0000, 0x0c0c0202, 0x0c0bfdfe, 0x0c0c0606, 0x0c0bf9fa,
> 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c1414,
> +       0x0c0bebec, 0x0c0c2020, 0x0c0bdfe0, 0x0c0c2e2e, 0x0c0bd1d2,
> 0xf3f40000, 0xf3f40202, 0xf3f3fdfe,
> +       0xf3f40606, 0xf3f3f9fa, 0xf3f40c0c, 0xf3f3f3f4, 0xf3f41414,
> 0xf3f3ebec, 0xf3f42020, 0xf3f3dfe0,
> +       0xf3f42e2e, 0xf3f3d1d2, 0x14140000, 0x14140202, 0x1413fdfe,
> 0x14140606, 0x1413f9fa, 0x14140c0c,
> +       0x1413f3f4, 0x14141414, 0x1413ebec, 0x14142020, 0x1413dfe0,
> 0x14142e2e, 0x1413d1d2, 0xebec0000,
> +       0xebec0202, 0xebebfdfe, 0xebec0606, 0xebebf9fa, 0xebec0c0c,
> 0xebebf3f4, 0xebec1414, 0xebebebec,
> +       0xebec2020, 0xebebdfe0, 0xebec2e2e, 0xebebd1d2, 0x20200000,
> 0x20200202, 0x201ffdfe, 0x20200606,
> +       0x201ff9fa, 0x20200c0c, 0x201ff3f4, 0x20201414, 0x201febec,
> 0x20202020, 0x201fdfe0, 0x20202e2e,
> +       0x201fd1d2, 0xdfe00000, 0xdfe00202, 0xdfdffdfe, 0xdfe00606,
> 0xdfdff9fa, 0xdfe00c0c, 0xdfdff3f4,
> +       0xdfe01414, 0xdfdfebec, 0xdfe02020, 0xdfdfdfe0, 0xdfe02e2e,
> 0xdfdfd1d2, 0x2e2e0000, 0x2e2e0202,
> +       0x2e2dfdfe, 0x2e2e0606, 0x2e2df9fa, 0x2e2e0c0c, 0x2e2df3f4,
> 0x2e2e1414, 0x2e2debec, 0x2e2e2020,
> +       0x2e2ddfe0, 0x2e2e2e2e, 0x2e2dd1d2, 0xd1d20000, 0xd1d20202,
> 0xd1d1fdfe, 0xd1d20606, 0xd1d1f9fa,
> +       0xd1d20c0c, 0xd1d1f3f4, 0xd1d21414, 0xd1d1ebec, 0xd1d22020,
> 0xd1d1dfe0, 0xd1d22e2e, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa,
> 0x00000c0c, 0xfffff3f4, 0x00001414,
> +       0xffffebec, 0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c,
> 0xfffff3f4, 0x00001414, 0xffffebec,
> +       0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x02020000,
> 0x02020202, 0x0201fdfe, 0x02020606,
> +       0x0201f9fa, 0x02020c0c, 0x0201f3f4, 0x02021414, 0x0201ebec,
> 0x02022020, 0x0201dfe0, 0x02022e2e,
> +       0x0201d1d2, 0xfdfe0000, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606,
> 0xfdfdf9fa, 0xfdfe0c0c, 0xfdfdf3f4,
> +       0xfdfe1414, 0xfdfdebec, 0xfdfe2020, 0xfdfddfe0, 0xfdfe2e2e,
> 0xfdfdd1d2, 0x06060000, 0x06060202,
> +       0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060c0c, 0x0605f3f4,
> 0x06061414, 0x0605ebec, 0x06062020,
> +       0x0605dfe0, 0x06062e2e, 0x0605d1d2, 0xf9fa0000, 0xf9fa0202,
> 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
> +       0xf9fa0c0c, 0xf9f9f3f4, 0xf9fa1414, 0xf9f9ebec, 0xf9fa2020,
> 0xf9f9dfe0, 0xf9fa2e2e, 0xf9f9d1d2,
> +       0x0c0c0000, 0x0c0c0202, 0x0c0bfdfe, 0x0c0c0606, 0x0c0bf9fa,
> 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c1414,
> +       0x0c0bebec, 0x0c0c2020, 0x0c0bdfe0, 0x0c0c2e2e, 0x0c0bd1d2,
> 0xf3f40000, 0xf3f40202, 0xf3f3fdfe,
> +       0xf3f40606, 0xf3f3f9fa, 0xf3f40c0c, 0xf3f3f3f4, 0xf3f41414,
> 0xf3f3ebec, 0xf3f42020, 0xf3f3dfe0,
> +       0xf3f42e2e, 0xf3f3d1d2, 0x14140000, 0x14140202, 0x1413fdfe,
> 0x14140606, 0x1413f9fa, 0x14140c0c,
> +       0x1413f3f4, 0x14141414, 0x1413ebec, 0x14142020, 0x1413dfe0,
> 0x14142e2e, 0x1413d1d2, 0xebec0000,
> +       0xebec0202, 0xebebfdfe, 0xebec0606, 0xebebf9fa, 0xebec0c0c,
> 0xebebf3f4, 0xebec1414, 0xebebebec,
> +       0xebec2020, 0xebebdfe0, 0xebec2e2e, 0xebebd1d2, 0x20200000,
> 0x20200202, 0x201ffdfe, 0x20200606,
> +       0x201ff9fa, 0x20200c0c, 0x201ff3f4, 0x20201414, 0x201febec,
> 0x20202020, 0x201fdfe0, 0x20202e2e,
> +       0x201fd1d2, 0xdfe00000, 0xdfe00202, 0xdfdffdfe, 0xdfe00606,
> 0xdfdff9fa, 0xdfe00c0c, 0xdfdff3f4,
> +       0xdfe01414, 0xdfdfebec, 0xdfe02020, 0xdfdfdfe0, 0xdfe02e2e,
> 0xdfdfd1d2, 0x2e2e0000, 0x2e2e0202,
> +       0x2e2dfdfe, 0x2e2e0606, 0x2e2df9fa, 0x2e2e0c0c, 0x2e2df3f4,
> 0x2e2e1414, 0x2e2debec, 0x2e2e2020,
> +       0x2e2ddfe0, 0x2e2e2e2e, 0x2e2dd1d2, 0xd1d20000, 0xd1d20202,
> 0xd1d1fdfe, 0xd1d20606, 0xd1d1f9fa,
> +       0xd1d20c0c, 0xd1d1f3f4, 0xd1d21414, 0xd1d1ebec, 0xd1d22020,
> 0xd1d1dfe0, 0xd1d22e2e, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa,
> 0x00000c0c, 0xfffff3f4, 0x00001414,
> +       0xffffebec, 0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c,
> 0xfffff3f4, 0x00001414, 0xffffebec,
> +       0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x02020000,
> 0x02020202, 0x0201fdfe, 0x02020606,
> +       0x0201f9fa, 0x02020c0c, 0x0201f3f4, 0x02021414, 0x0201ebec,
> 0x02022020, 0x0201dfe0, 0x02022e2e,
> +       0x0201d1d2, 0xfdfe0000, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606,
> 0xfdfdf9fa, 0xfdfe0c0c, 0xfdfdf3f4,
> +       0xfdfe1414, 0xfdfdebec, 0xfdfe2020, 0xfdfddfe0, 0xfdfe2e2e,
> 0xfdfdd1d2, 0x06060000, 0x06060202,
> +       0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060c0c, 0x0605f3f4,
> 0x06061414, 0x0605ebec, 0x06062020,
> +       0x0605dfe0, 0x06062e2e, 0x0605d1d2, 0xf9fa0000, 0xf9fa0202,
> 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
> +       0xf9fa0c0c, 0xf9f9f3f4, 0xf9fa1414, 0xf9f9ebec, 0xf9fa2020,
> 0xf9f9dfe0, 0xf9fa2e2e, 0xf9f9d1d2,
> +       0x0c0c0000, 0x0c0c0202, 0x0c0bfdfe, 0x0c0c0606, 0x0c0bf9fa,
> 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c1414,
> +       0x0c0bebec, 0x0c0c2020, 0x0c0bdfe0, 0x0c0c2e2e, 0x0c0bd1d2,
> 0xf3f40000, 0xf3f40202, 0xf3f3fdfe,
> +       0xf3f40606, 0xf3f3f9fa, 0xf3f40c0c, 0xf3f3f3f4, 0xf3f41414,
> 0xf3f3ebec, 0xf3f42020, 0xf3f3dfe0,
> +       0xf3f42e2e, 0xf3f3d1d2, 0x14140000, 0x14140202, 0x1413fdfe,
> 0x14140606, 0x1413f9fa, 0x14140c0c,
> +       0x1413f3f4, 0x14141414, 0x1413ebec, 0x14142020, 0x1413dfe0,
> 0x14142e2e, 0x1413d1d2, 0xebec0000,
> +       0xebec0202, 0xebebfdfe, 0xebec0606, 0xebebf9fa, 0xebec0c0c,
> 0xebebf3f4, 0xebec1414, 0xebebebec,
> +       0xebec2020, 0xebebdfe0, 0xebec2e2e, 0xebebd1d2, 0x20200000,
> 0x20200202, 0x201ffdfe, 0x20200606,
> +       0x201ff9fa, 0x20200c0c, 0x201ff3f4, 0x20201414, 0x201febec,
> 0x20202020, 0x201fdfe0, 0x20202e2e,
> +       0x201fd1d2, 0xdfe00000, 0xdfe00202, 0xdfdffdfe, 0xdfe00606,
> 0xdfdff9fa, 0xdfe00c0c, 0xdfdff3f4,
> +       0xdfe01414, 0xdfdfebec, 0xdfe02020, 0xdfdfdfe0, 0xdfe02e2e,
> 0xdfdfd1d2, 0x2e2e0000, 0x2e2e0202,
> +       0x2e2dfdfe, 0x2e2e0606, 0x2e2df9fa, 0x2e2e0c0c, 0x2e2df3f4,
> 0x2e2e1414, 0x2e2debec, 0x2e2e2020,
> +       0x2e2ddfe0, 0x2e2e2e2e, 0x2e2dd1d2, 0xd1d20000, 0xd1d20202,
> 0xd1d1fdfe, 0xd1d20606, 0xd1d1f9fa,
> +       0xd1d20c0c, 0xd1d1f3f4, 0xd1d21414, 0xd1d1ebec, 0xd1d22020,
> 0xd1d1dfe0, 0xd1d22e2e, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa,
> 0x00000c0c, 0xfffff3f4, 0x00001414,
> +       0xffffebec, 0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c,
> 0xfffff3f4, 0x00001414, 0xffffebec,
> +       0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x02020000,
> 0x02020202, 0x0201fdfe, 0x02020606,
> +       0x0201f9fa, 0x02020c0c, 0x0201f3f4, 0x02021414, 0x0201ebec,
> 0x02022020, 0x0201dfe0, 0x02022e2e,
> +       0x0201d1d2, 0xfdfe0000, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606,
> 0xfdfdf9fa, 0xfdfe0c0c, 0xfdfdf3f4,
> +       0xfdfe1414, 0xfdfdebec, 0xfdfe2020, 0xfdfddfe0, 0xfdfe2e2e,
> 0xfdfdd1d2, 0x06060000, 0x06060202,
> +       0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060c0c, 0x0605f3f4,
> 0x06061414, 0x0605ebec, 0x06062020,
> +       0x0605dfe0, 0x06062e2e, 0x0605d1d2, 0xf9fa0000, 0xf9fa0202,
> 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
> +       0xf9fa0c0c, 0xf9f9f3f4, 0xf9fa1414, 0xf9f9ebec, 0xf9fa2020,
> 0xf9f9dfe0, 0xf9fa2e2e, 0xf9f9d1d2,
> +       0x0c0c0000, 0x0c0c0202, 0x0c0bfdfe, 0x0c0c0606, 0x0c0bf9fa,
> 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c1414,
> +       0x0c0bebec, 0x0c0c2020, 0x0c0bdfe0, 0x0c0c2e2e, 0x0c0bd1d2,
> 0xf3f40000, 0xf3f40202, 0xf3f3fdfe,
> +       0xf3f40606, 0xf3f3f9fa, 0xf3f40c0c, 0xf3f3f3f4, 0xf3f41414,
> 0xf3f3ebec, 0xf3f42020, 0xf3f3dfe0,
> +       0xf3f42e2e, 0xf3f3d1d2, 0x14140000, 0x14140202, 0x1413fdfe,
> 0x14140606, 0x1413f9fa, 0x14140c0c,
> +       0x1413f3f4, 0x14141414, 0x1413ebec, 0x14142020, 0x1413dfe0,
> 0x14142e2e, 0x1413d1d2, 0xebec0000,
> +       0xebec0202, 0xebebfdfe, 0xebec0606, 0xebebf9fa, 0xebec0c0c,
> 0xebebf3f4, 0xebec1414, 0xebebebec,
> +       0xebec2020, 0xebebdfe0, 0xebec2e2e, 0xebebd1d2, 0x20200000,
> 0x20200202, 0x201ffdfe, 0x20200606,
> +       0x201ff9fa, 0x20200c0c, 0x201ff3f4, 0x20201414, 0x201febec,
> 0x20202020, 0x201fdfe0, 0x20202e2e,
> +       0x201fd1d2, 0xdfe00000, 0xdfe00202, 0xdfdffdfe, 0xdfe00606,
> 0xdfdff9fa, 0xdfe00c0c, 0xdfdff3f4,
> +       0xdfe01414, 0xdfdfebec, 0xdfe02020, 0xdfdfdfe0, 0xdfe02e2e,
> 0xdfdfd1d2, 0x2e2e0000, 0x2e2e0202,
> +       0x2e2dfdfe, 0x2e2e0606, 0x2e2df9fa, 0x2e2e0c0c, 0x2e2df3f4,
> 0x2e2e1414, 0x2e2debec, 0x2e2e2020,
> +       0x2e2ddfe0, 0x2e2e2e2e, 0x2e2dd1d2, 0xd1d20000, 0xd1d20202,
> 0xd1d1fdfe, 0xd1d20606, 0xd1d1f9fa,
> +       0xd1d20c0c, 0xd1d1f3f4, 0xd1d21414, 0xd1d1ebec, 0xd1d22020,
> 0xd1d1dfe0, 0xd1d22e2e, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000
> +};
> +
> +
> +const uint32 Indeo3Decoder::correctionloworder[] = {
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101,
> 0xfeff0303, 0x0100fcfd, 0x04040404,
> +       0xfbfbfbfc, 0x05050101, 0xfafafeff, 0x01010505, 0xfefefafb,
> 0x0403fbfc, 0xfbfc0404, 0x0605fdfe,
> +       0xf9fa0202, 0xfdfe0606, 0x0201f9fa, 0x09090404, 0xf6f6fbfc,
> 0x04040909, 0xfbfbf6f7, 0x09090909,
> +       0xf6f6f6f7, 0x0a0a0101, 0xf5f5feff, 0x01010a0a, 0xfefef5f6,
> 0x0807fafb, 0xf7f80505, 0xfafb0808,
> +       0x0504f7f8, 0x0f0f0909, 0xf0f0f6f7, 0x09090f0f, 0xf6f6f0f1,
> 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c,
> +       0x0302f3f4, 0x10100404, 0xefeffbfc, 0x04041010, 0xfbfbeff0,
> 0x10101010, 0xefefeff0, 0x12120000,
> +       0xedee0000, 0x00001212, 0xffffedee, 0x0c0bf3f4, 0xf3f40c0c,
> 0x100ff6f7, 0xeff00909, 0xf6f71010,
> +       0x0908eff0, 0x1b1b0b0b, 0xe4e4f4f5, 0x0b0b1b1b, 0xf4f4e4e5,
> 0x1c1c1313, 0xe3e3eced, 0x13131c1c,
> +       0xecece3e4, 0x1615f9fa, 0xe9ea0606, 0xf9fa1616, 0x0605e9ea,
> 0x1d1d0404, 0xe2e2fbfc, 0x04041d1d,
> +       0xfbfbe2e3, 0x1e1e1e1e, 0xe1e1e1e2, 0x2120fdfe, 0xdedf0202,
> 0xfdfe2121, 0x0201dedf, 0x1716edee,
> +       0xe8e91212, 0xedee1717, 0x1211e8e9, 0x1e1df0f1, 0xe1e20f0f,
> 0xf0f11e1e, 0x0f0ee1e2, 0x2e2e1616,
> +       0xd1d1e9ea, 0x16162e2e, 0xe9e9d1d2, 0x2f2f0d0d, 0xd0d0f2f3,
> 0x0d0d2f2f, 0xf2f2d0d1, 0x31312323,
> +       0xcecedcdd, 0x23233131, 0xdcdccecf, 0x2928f4f5, 0xd6d70b0b,
> 0xf4f52929, 0x0b0ad6d7, 0x33330404,
> +       0xccccfbfc, 0x04043333, 0xfbfbcccd, 0x36363636, 0xc9c9c9ca,
> 0x2221ddde, 0xddde2222, 0x2a29e2e3,
> +       0xd5d61d1d, 0xe2e32a2a, 0x1d1cd5d6, 0x3c3bf9fa, 0xc3c40606,
> 0xf9fa3c3c, 0x0605c3c4, 0x4c4c1b1b,
> +       0xb3b3e4e5, 0x1b1b4c4c, 0xe4e4b3b4, 0x4d4d2b2b, 0xb2b2d4d5,
> 0x2b2b4d4d, 0xd4d4b2b3, 0x3736e7e8,
> +       0xc8c91818, 0xe7e83737, 0x1817c8c9, 0x4f4f0e0e, 0xb0b0f1f2,
> 0x0e0e4f4f, 0xf1f1b0b1, 0x53533f3f,
> +       0xacacc0c1, 0x3f3f5353, 0xc0c0acad, 0x4a49ebec, 0xb5b61414,
> 0xebec4a4a, 0x1413b5b6, 0x58580202,
> +       0xa7a7fdfe, 0x02025858, 0xfdfda7a8, 0x5d5d5d5d, 0xa2a2a2a3,
> 0x3d3ccbcc, 0xc2c33434, 0xcbcc3d3d,
> +       0x3433c2c3, 0x78783434, 0x8787cbcc, 0x34347878, 0xcbcb8788,
> 0x4b4ad2d3, 0xb4b52d2d, 0xd2d34b4b,
> +       0x2d2cb4b5, 0x7d7d4b4b, 0x8282b4b5, 0x4b4b7d7d, 0xb4b48283,
> 0x7a7a2121, 0x8585dedf, 0x21217a7a,
> +       0xdede8586, 0x6766f2f3, 0x98990d0d, 0xf2f36767, 0x0d0c9899,
> 0x605fd7d8, 0x9fa02828, 0xd7d86060,
> +       0x28279fa0, 0x7f7eddde, 0x80812222, 0xddde7f7f, 0x22218081,
> 0x5958a6a7, 0xa6a75959, 0x6968b1b2,
> +       0x96974e4e, 0xb1b26969, 0x4e4d9697, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x17171717, 0xe8e8e8e9, 0x2a2a2a2a,
> +       0xd5d5d5d6, 0x49494949, 0xb6b6b6b7, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0x0302feff, 0x0302feff, 0x0302feff, 0x0302feff, 0x0302feff,
> 0x0302feff, 0x0302feff, 0xfcfd0101,
> +       0xfcfd0101, 0xfcfd0101, 0xfcfd0101, 0xfcfd0101, 0xfcfd0101,
> 0xfcfd0101, 0xfeff0303, 0xfeff0303,
> +       0xfeff0303, 0xfeff0303, 0xfeff0303, 0xfeff0303, 0xfeff0303,
> 0x0100fcfd, 0x0100fcfd, 0x0100fcfd,
> +       0x0100fcfd, 0x0100fcfd, 0x0100fcfd, 0x0100fcfd, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101,
> 0xfeff0404, 0x0100fbfc, 0x07070707,
> +       0xf8f8f8f9, 0x08080202, 0xf7f7fdfe, 0x02020808, 0xfdfdf7f8,
> 0x0908fdfe, 0xf6f70202, 0xfdfe0909,
> +       0x0201f6f7, 0x0605f9fa, 0xf9fa0606, 0x0d0d0606, 0xf2f2f9fa,
> 0x06060d0d, 0xf9f9f2f3, 0x0d0d0d0d,
> +       0xf2f2f2f3, 0x0e0e0101, 0xf1f1feff, 0x01010e0e, 0xfefef1f2,
> 0x0c0bf7f8, 0xf3f40808, 0xf7f80c0c,
> +       0x0807f3f4, 0x17170e0e, 0xe8e8f1f2, 0x0e0e1717, 0xf1f1e8e9,
> 0x1211fafb, 0xedee0505, 0xfafb1212,
> +       0x0504edee, 0x18180606, 0xe7e7f9fa, 0x06061818, 0xf9f9e7e8,
> 0x18181818, 0xe7e7e7e8, 0x1b1afeff,
> +       0xe4e50101, 0xfeff1b1b, 0x0100e4e5, 0x1110eeef, 0xeeef1111,
> 0x1716f2f3, 0xe8e90d0d, 0xf2f31717,
> +       0x0d0ce8e9, 0x28281010, 0xd7d7eff0, 0x10102828, 0xefefd7d8,
> 0x29291c1c, 0xd6d6e3e4, 0x1c1c2929,
> +       0xe3e3d6d7, 0x2120f6f7, 0xdedf0909, 0xf6f72121, 0x0908dedf,
> 0x2b2b0606, 0xd4d4f9fa, 0x06062b2b,
> +       0xf9f9d4d5, 0x2e2e2e2e, 0xd1d1d1d2, 0x3231fbfc, 0xcdce0404,
> 0xfbfc3232, 0x0403cdce, 0x2221e4e5,
> +       0xddde1b1b, 0xe4e52222, 0x1b1addde, 0x2d2ce9ea, 0xd2d31616,
> 0xe9ea2d2d, 0x1615d2d3, 0x45452222,
> +       0xbabaddde, 0x22224545, 0xddddbabb, 0x46461313, 0xb9b9eced,
> 0x13134646, 0xececb9ba, 0x49493535,
> +       0xb6b6cacb, 0x35354949, 0xcacab6b7, 0x3e3deeef, 0xc1c21111,
> 0xeeef3e3e, 0x1110c1c2, 0x4d4d0505,
> +       0xb2b2fafb, 0x05054d4d, 0xfafab2b3, 0x52525252, 0xadadadae,
> 0x3332cccd, 0xcccd3333, 0x403fd4d5,
> +       0xbfc02b2b, 0xd4d54040, 0x2b2abfc0, 0x5a59f5f6, 0xa5a60a0a,
> 0xf5f65a5a, 0x0a09a5a6, 0x72722929,
> +       0x8d8dd6d7, 0x29297272, 0xd6d68d8e, 0x74744040, 0x8b8bbfc0,
> 0x40407474, 0xbfbf8b8c, 0x5251dadb,
> +       0xadae2525, 0xdadb5252, 0x2524adae, 0x77771616, 0x8888e9ea,
> 0x16167777, 0xe9e98889, 0x7c7c5f5f,
> +       0x8383a0a1, 0x5f5f7c7c, 0xa0a08384, 0x6f6ee1e2, 0x90911e1e,
> 0xe1e26f6f, 0x1e1d9091, 0x5c5bb1b2,
> +       0xa3a44e4e, 0xb1b25c5c, 0x4e4da3a4, 0x7170bbbc, 0x8e8f4444,
> 0xbbbc7171, 0x44438e8f, 0x12121212,
> +       0xedededee, 0x22222222, 0xddddddde, 0x3f3f3f3f, 0xc0c0c0c1,
> 0x6d6d6d6d, 0x92929293, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303,
> 0x03030303, 0x03030303, 0x03030303,
> +       0x03030303, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd,
> 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd,
> +       0xfcfcfcfd, 0xfcfcfcfd, 0x0403feff, 0x0403feff, 0x0403feff,
> 0x0403feff, 0x0403feff, 0x0403feff,
> +       0x0403feff, 0x0403feff, 0x0403feff, 0xfbfc0101, 0xfbfc0101,
> 0xfbfc0101, 0xfbfc0101, 0xfbfc0101,
> +       0xfbfc0101, 0xfbfc0101, 0xfbfc0101, 0xfbfc0101, 0xfeff0404,
> 0xfeff0404, 0xfeff0404, 0xfeff0404,
> +       0xfeff0404, 0xfeff0404, 0xfeff0404, 0xfeff0404, 0xfeff0404,
> 0x0100fbfc, 0x0100fbfc, 0x0100fbfc,
> +       0x0100fbfc, 0x0100fbfc, 0x0100fbfc, 0x0100fbfc, 0x0100fbfc,
> 0x0100fbfc, 0x07070707, 0x07070707,
> +       0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707,
> 0x07070707, 0x07070707, 0xf8f8f8f9,
> +       0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
> 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101,
> 0xfeff0505, 0x0100fafb, 0x0a0a0303,
> +       0xf5f5fcfd, 0x03030a0a, 0xfcfcf5f6, 0x09090909, 0xf6f6f6f7,
> 0x0706f8f9, 0xf8f90707, 0x0c0bfcfd,
> +       0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x11110808, 0xeeeef7f8,
> 0x08081111, 0xf7f7eeef, 0x11111111,
> +       0xeeeeeeef, 0x13130101, 0xececfeff, 0x01011313, 0xfefeeced,
> 0x100ff4f5, 0xeff00b0b, 0xf4f51010,
> +       0x0b0aeff0, 0x1716f9fa, 0xe8e90606, 0xf9fa1717, 0x0605e8e9,
> 0x1f1f1212, 0xe0e0edee, 0x12121f1f,
> +       0xedede0e1, 0x20200808, 0xdfdff7f8, 0x08082020, 0xf7f7dfe0,
> 0x21212121, 0xdedededf, 0x2423feff,
> +       0xdbdc0101, 0xfeff2424, 0x0100dbdc, 0x1716e8e9, 0xe8e91717,
> 0x1f1eeeef, 0xe0e11111, 0xeeef1f1f,
> +       0x1110e0e1, 0x36361515, 0xc9c9eaeb, 0x15153636, 0xeaeac9ca,
> 0x37372525, 0xc8c8dadb, 0x25253737,
> +       0xdadac8c9, 0x2c2bf3f4, 0xd3d40c0c, 0xf3f42c2c, 0x0c0bd3d4,
> 0x39390808, 0xc6c6f7f8, 0x08083939,
> +       0xf7f7c6c7, 0x3d3d3d3d, 0xc2c2c2c3, 0x4241fafb, 0xbdbe0505,
> 0xfafb4242, 0x0504bdbe, 0x2d2cdbdc,
> +       0xd2d32424, 0xdbdc2d2d, 0x2423d2d3, 0x3c3be2e3, 0xc3c41d1d,
> 0xe2e33c3c, 0x1d1cc3c4, 0x5c5c2d2d,
> +       0xa3a3d2d3, 0x2d2d5c5c, 0xd2d2a3a4, 0x5d5d1919, 0xa2a2e6e7,
> 0x19195d5d, 0xe6e6a2a3, 0x61614747,
> +       0x9e9eb8b9, 0x47476161, 0xb8b89e9f, 0x5352e9ea, 0xacad1616,
> 0xe9ea5353, 0x1615acad, 0x66660707,
> +       0x9999f8f9, 0x07076666, 0xf8f8999a, 0x6d6d6d6d, 0x92929293,
> 0x4443bbbc, 0xbbbc4444, 0x5554c6c7,
> +       0xaaab3939, 0xc6c75555, 0x3938aaab, 0x7877f2f3, 0x87880d0d,
> 0xf2f37878, 0x0d0c8788, 0x6e6dcecf,
> +       0x91923131, 0xcecf6e6e, 0x31309192, 0x7b7a9798, 0x84856868,
> 0x97987b7b, 0x68678485, 0x18181818,
> +       0xe7e7e7e8, 0x2e2e2e2e, 0xd1d1d1d2, 0x54545454, 0xabababac,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x04040404,
> +       0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
> 0x04040404, 0x04040404, 0x04040404,
> +       0x04040404, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> +       0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0x0504feff, 0x0504feff,
> 0x0504feff, 0x0504feff, 0x0504feff,
> +       0x0504feff, 0x0504feff, 0x0504feff, 0x0504feff, 0x0504feff,
> 0xfafb0101, 0xfafb0101, 0xfafb0101,
> +       0xfafb0101, 0xfafb0101, 0xfafb0101, 0xfafb0101, 0xfafb0101,
> 0xfafb0101, 0xfafb0101, 0xfeff0505,
> +       0xfeff0505, 0xfeff0505, 0xfeff0505, 0xfeff0505, 0xfeff0505,
> 0xfeff0505, 0xfeff0505, 0xfeff0505,
> +       0xfeff0505, 0x0100fafb, 0x0100fafb, 0x0100fafb, 0x0100fafb,
> 0x0100fafb, 0x0100fafb, 0x0100fafb,
> +       0x0100fafb, 0x0100fafb, 0x0100fafb, 0x0a0a0303, 0x0a0a0303,
> 0x0a0a0303, 0x0a0a0303, 0x0a0a0303,
> +       0x0a0a0303, 0x0a0a0303, 0x0a0a0303, 0x0a0a0303, 0x0a0a0303,
> 0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd,
> +       0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd,
> 0xf5f5fcfd, 0xf5f5fcfd, 0x03030a0a,
> +       0x03030a0a, 0x03030a0a, 0x03030a0a, 0x03030a0a, 0x03030a0a,
> 0x03030a0a, 0x03030a0a, 0x03030a0a,
> +       0x03030a0a, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202,
> 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b,
> +       0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x03030d0d, 0xfcfcf2f3,
> 0x0908f6f7, 0xf6f70909, 0x0f0efbfc,
> +       0xf0f10404, 0xfbfc0f0f, 0x0403f0f1, 0x16160b0b, 0xe9e9f4f5,
> 0x0b0b1616, 0xf4f4e9ea, 0x15151515,
> +       0xeaeaeaeb, 0x18180202, 0xe7e7fdfe, 0x02021818, 0xfdfde7e8,
> 0x1413f1f2, 0xebec0e0e, 0xf1f21414,
> +       0x0e0debec, 0x26261717, 0xd9d9e8e9, 0x17172626, 0xe8e8d9da,
> 0x1d1cf7f8, 0xe2e30808, 0xf7f81d1d,
> +       0x0807e2e3, 0x27270b0b, 0xd8d8f4f5, 0x0b0b2727, 0xf4f4d8d9,
> 0x29292929, 0xd6d6d6d7, 0x2d2cfeff,
> +       0xd2d30101, 0xfeff2d2d, 0x0100d2d3, 0x1d1ce2e3, 0xe2e31d1d,
> 0x2726e9ea, 0xd8d91616, 0xe9ea2727,
> +       0x1615d8d9, 0x43431b1b, 0xbcbce4e5, 0x1b1b4343, 0xe4e4bcbd,
> 0x45452f2f, 0xbabad0d1, 0x2f2f4545,
> +       0xd0d0babb, 0x3837f0f1, 0xc7c80f0f, 0xf0f13838, 0x0f0ec7c8,
> 0x47470b0b, 0xb8b8f4f5, 0x0b0b4747,
> +       0xf4f4b8b9, 0x4c4c4c4c, 0xb3b3b3b4, 0x5352f9fa, 0xacad0606,
> 0xf9fa5353, 0x0605acad, 0x3938d2d3,
> +       0xc6c72d2d, 0xd2d33939, 0x2d2cc6c7, 0x4b4adbdc, 0xb4b52424,
> 0xdbdc4b4b, 0x2423b4b5, 0x73733838,
> +       0x8c8cc7c8, 0x38387373, 0xc7c78c8d, 0x75751f1f, 0x8a8ae0e1,
> 0x1f1f7575, 0xe0e08a8b, 0x7a7a5858,
> +       0x8585a7a8, 0x58587a7a, 0xa7a78586, 0x6867e3e4, 0x97981c1c,
> 0xe3e46868, 0x1c1b9798, 0x5554aaab,
> +       0xaaab5555, 0x6a69b7b8, 0x95964848, 0xb7b86a6a, 0x48479596,
> 0x1e1e1e1e, 0xe1e1e1e2, 0x3a3a3a3a,
> +       0xc5c5c5c6, 0x69696969, 0x96969697, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x05050505, 0x05050505,
> +       0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505,
> 0x05050505, 0x05050505, 0x05050505,
> +       0x05050505, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb,
> 0xfafafafb, 0xfafafafb, 0xfafafafb,
> +       0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0x0706fdfe,
> 0x0706fdfe, 0x0706fdfe, 0x0706fdfe,
> +       0x0706fdfe, 0x0706fdfe, 0x0706fdfe, 0x0706fdfe, 0x0706fdfe,
> 0x0706fdfe, 0x0706fdfe, 0xf8f90202,
> +       0xf8f90202, 0xf8f90202, 0xf8f90202, 0xf8f90202, 0xf8f90202,
> 0xf8f90202, 0xf8f90202, 0xf8f90202,
> +       0xf8f90202, 0xf8f90202, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707,
> 0xfdfe0707, 0xfdfe0707, 0xfdfe0707,
> +       0xfdfe0707, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707,
> 0x0201f8f9, 0x0201f8f9, 0x0201f8f9,
> +       0x0201f8f9, 0x0201f8f9, 0x0201f8f9, 0x0201f8f9, 0x0201f8f9,
> 0x0201f8f9, 0x0201f8f9, 0x0201f8f9,
> +       0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b,
> 0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b,
> +       0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0xf4f4f4f5, 0xf4f4f4f5,
> 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5,
> +       0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5,
> 0xf4f4f4f5, 0x0d0d0303, 0x0d0d0303,
> +       0x0d0d0303, 0x0d0d0303, 0x0d0d0303, 0x0d0d0303, 0x0d0d0303,
> 0x0d0d0303, 0x0d0d0303, 0x0d0d0303,
> +       0x0d0d0303, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd,
> 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd,
> +       0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe, 0xf7f80202,
> 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d,
> +       0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f, 0xfbfbf0f1,
> 0x0b0af4f5, 0xf4f50b0b, 0x1211fafb,
> +       0xedee0505, 0xfafb1212, 0x0504edee, 0x1a1a0d0d, 0xe5e5f2f3,
> 0x0d0d1a1a, 0xf2f2e5e6, 0x1a1a1a1a,
> +       0xe5e5e5e6, 0x1d1d0202, 0xe2e2fdfe, 0x02021d1d, 0xfdfde2e3,
> 0x1817eff0, 0xe7e81010, 0xeff01818,
> +       0x100fe7e8, 0x2e2e1c1c, 0xd1d1e3e4, 0x1c1c2e2e, 0xe3e3d1d2,
> 0x2322f6f7, 0xdcdd0909, 0xf6f72323,
> +       0x0908dcdd, 0x2f2f0d0d, 0xd0d0f2f3, 0x0d0d2f2f, 0xf2f2d0d1,
> 0x31313131, 0xcecececf, 0x3635feff,
> +       0xc9ca0101, 0xfeff3636, 0x0100c9ca, 0x2322dcdd, 0xdcdd2323,
> 0x2f2ee5e6, 0xd0d11a1a, 0xe5e62f2f,
> +       0x1a19d0d1, 0x51512020, 0xaeaedfe0, 0x20205151, 0xdfdfaeaf,
> 0x53533838, 0xacacc7c8, 0x38385353,
> +       0xc7c7acad, 0x4342edee, 0xbcbd1212, 0xedee4343, 0x1211bcbd,
> 0x56560d0d, 0xa9a9f2f3, 0x0d0d5656,
> +       0xf2f2a9aa, 0x5b5b5b5b, 0xa4a4a4a5, 0x6362f8f9, 0x9c9d0707,
> 0xf8f96363, 0x07069c9d, 0x4443c9ca,
> +       0xbbbc3636, 0xc9ca4444, 0x3635bbbc, 0x5a59d3d4, 0xa5a62c2c,
> 0xd3d45a5a, 0x2c2ba5a6, 0x7c7bdedf,
> +       0x83842121, 0xdedf7c7c, 0x21208384, 0x67669899, 0x98996767,
> 0x7f7ea9aa, 0x80815656, 0xa9aa7f7f,
> +       0x56558081, 0x25252525, 0xdadadadb, 0x45454545, 0xbabababb,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe,
> 0x0807fdfe, 0x0807fdfe, 0x0807fdfe,
> +       0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe,
> 0xf7f80202, 0xf7f80202, 0xf7f80202,
> +       0xf7f80202, 0xf7f80202, 0xf7f80202, 0xf7f80202, 0xf7f80202,
> 0xf7f80202, 0xf7f80202, 0xf7f80202,
> +       0xf7f80202, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808,
> 0xfdfe0808, 0xfdfe0808, 0xfdfe0808,
> +       0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808,
> 0x0201f7f8, 0x0201f7f8, 0x0201f7f8,
> +       0x0201f7f8, 0x0201f7f8, 0x0201f7f8, 0x0201f7f8, 0x0201f7f8,
> 0x0201f7f8, 0x0201f7f8, 0x0201f7f8,
> +       0x0201f7f8, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d,
> 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d,
> +       0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d,
> 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3,
> +       0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3,
> 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3,
> +       0xf2f2f2f3, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404,
> 0x0f0f0404, 0x0f0f0404, 0x0f0f0404,
> +       0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404,
> 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc,
> +       0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc,
> 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc,
> +       0xf0f0fbfc, 0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f,
> 0x04040f0f, 0x04040f0f, 0x04040f0f,
> +       0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd, 0xf5f60303,
> 0xfcfd0a0a, 0x0302f5f6, 0x10101010,
> +       0xefefeff0, 0x12120505, 0xededfafb, 0x05051212, 0xfafaedee,
> 0x0d0cf2f3, 0xf2f30d0d, 0x1514f9fa,
> +       0xeaeb0606, 0xf9fa1515, 0x0605eaeb, 0x1e1e0f0f, 0xe1e1f0f1,
> 0x0f0f1e1e, 0xf0f0e1e2, 0x1e1e1e1e,
> +       0xe1e1e1e2, 0x22220202, 0xddddfdfe, 0x02022222, 0xfdfdddde,
> 0x1c1beced, 0xe3e41313, 0xeced1c1c,
> +       0x1312e3e4, 0x36362020, 0xc9c9dfe0, 0x20203636, 0xdfdfc9ca,
> 0x2928f4f5, 0xd6d70b0b, 0xf4f52929,
> +       0x0b0ad6d7, 0x37370f0f, 0xc8c8f0f1, 0x0f0f3737, 0xf0f0c8c9,
> 0x39393939, 0xc6c6c6c7, 0x3f3efeff,
> +       0xc0c10101, 0xfeff3f3f, 0x0100c0c1, 0x2827d7d8, 0xd7d82828,
> 0x3736e1e2, 0xc8c91e1e, 0xe1e23737,
> +       0x1e1dc8c9, 0x5e5e2525, 0xa1a1dadb, 0x25255e5e, 0xdadaa1a2,
> 0x60604141, 0x9f9fbebf, 0x41416060,
> +       0xbebe9fa0, 0x4e4deaeb, 0xb1b21515, 0xeaeb4e4e, 0x1514b1b2,
> 0x64640f0f, 0x9b9bf0f1, 0x0f0f6464,
> +       0xf0f09b9c, 0x6a6a6a6a, 0x95959596, 0x7473f7f8, 0x8b8c0808,
> 0xf7f87474, 0x08078b8c, 0x4f4ec0c1,
> +       0xb0b13f3f, 0xc0c14f4f, 0x3f3eb0b1, 0x6968cccd, 0x96973333,
> 0xcccd6969, 0x33329697, 0x78778788,
> +       0x87887878, 0x2b2b2b2b, 0xd4d4d4d5, 0x50505050, 0xafafafb0,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x07070707, 0x07070707, 0x07070707, 0x07070707,
> 0x07070707, 0x07070707, 0x07070707,
> +       0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707,
> 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
> +       0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
> 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
> +       0xf8f8f8f9, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd,
> 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd,
> +       0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd,
> 0xf5f60303, 0xf5f60303, 0xf5f60303,
> +       0xf5f60303, 0xf5f60303, 0xf5f60303, 0xf5f60303, 0xf5f60303,
> 0xf5f60303, 0xf5f60303, 0xf5f60303,
> +       0xf5f60303, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a,
> 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a,
> +       0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a,
> 0x0302f5f6, 0x0302f5f6, 0x0302f5f6,
> +       0x0302f5f6, 0x0302f5f6, 0x0302f5f6, 0x0302f5f6, 0x0302f5f6,
> 0x0302f5f6, 0x0302f5f6, 0x0302f5f6,
> +       0x0302f5f6, 0x10101010, 0x10101010, 0x10101010, 0x10101010,
> 0x10101010, 0x10101010, 0x10101010,
> +       0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010,
> 0xefefeff0, 0xefefeff0, 0xefefeff0,
> +       0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0,
> 0xefefeff0, 0xefefeff0, 0xefefeff0,
> +       0xefefeff0, 0x12120505, 0x12120505, 0x12120505, 0x12120505,
> 0x12120505, 0x12120505, 0x12120505,
> +       0x12120505, 0x12120505, 0x12120505, 0x12120505, 0x12120505,
> 0xededfafb, 0xededfafb, 0xededfafb,
> +       0xededfafb, 0xededfafb, 0xededfafb, 0xededfafb, 0xededfafb,
> 0xededfafb, 0xededfafb, 0xededfafb,
> +       0xededfafb, 0x05051212, 0x05051212, 0x05051212, 0x05051212,
> 0x05051212, 0x05051212, 0x05051212,
> +       0x05051212, 0x05051212, 0x05051212, 0x05051212, 0x05051212,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
> 0xfcfd0b0b, 0x0302f4f5, 0x12121212,
> +       0xedededee, 0x14140505, 0xebebfafb, 0x05051414, 0xfafaebec,
> 0x0f0ef0f1, 0xf0f10f0f, 0x1817f8f9,
> +       0xe7e80707, 0xf8f91818, 0x0706e7e8, 0x23231111, 0xdcdceeef,
> 0x11112323, 0xeeeedcdd, 0x22222222,
> +       0xddddddde, 0x26260303, 0xd9d9fcfd, 0x03032626, 0xfcfcd9da,
> 0x201fe9ea, 0xdfe01616, 0xe9ea2020,
> +       0x1615dfe0, 0x3d3d2525, 0xc2c2dadb, 0x25253d3d, 0xdadac2c3,
> 0x2f2ef2f3, 0xd0d10d0d, 0xf2f32f2f,
> +       0x0d0cd0d1, 0x3f3f1111, 0xc0c0eeef, 0x11113f3f, 0xeeeec0c1,
> 0x41414141, 0xbebebebf, 0x4847feff,
> +       0xb7b80101, 0xfeff4848, 0x0100b7b8, 0x2e2dd1d2, 0xd1d22e2e,
> 0x3f3edcdd, 0xc0c12323, 0xdcdd3f3f,
> +       0x2322c0c1, 0x6b6b2b2b, 0x9494d4d5, 0x2b2b6b6b, 0xd4d49495,
> 0x6e6e4b4b, 0x9191b4b5, 0x4b4b6e6e,
> +       0xb4b49192, 0x5958e7e8, 0xa6a71818, 0xe7e85959, 0x1817a6a7,
> 0x72721111, 0x8d8deeef, 0x11117272,
> +       0xeeee8d8e, 0x79797979, 0x86868687, 0x5b5ab7b8, 0xa4a54848,
> 0xb7b85b5b, 0x4847a4a5, 0x7877c5c6,
> +       0x87883a3a, 0xc5c67878, 0x3a398788, 0x31313131, 0xcecececf,
> 0x5c5c5c5c, 0xa3a3a3a4, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x08080808, 0x08080808,
> 0x08080808, 0x08080808, 0x08080808,
> +       0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808,
> 0x08080808, 0x08080808, 0xf7f7f7f8,
> +       0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8,
> 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8,
> +       0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0x0b0afcfd, 0x0b0afcfd,
> 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd,
> +       0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd,
> 0x0b0afcfd, 0x0b0afcfd, 0xf4f50303,
> +       0xf4f50303, 0xf4f50303, 0xf4f50303, 0xf4f50303, 0xf4f50303,
> 0xf4f50303, 0xf4f50303, 0xf4f50303,
> +       0xf4f50303, 0xf4f50303, 0xf4f50303, 0xfcfd0b0b, 0xfcfd0b0b,
> 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b,
> +       0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b,
> 0xfcfd0b0b, 0xfcfd0b0b, 0x0302f4f5,
> +       0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x0302f4f5,
> 0x0302f4f5, 0x0302f4f5, 0x0302f4f5,
> +       0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x12121212, 0x12121212,
> 0x12121212, 0x12121212, 0x12121212,
> +       0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
> 0x12121212, 0x12121212, 0xedededee,
> +       0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee,
> 0xedededee, 0xedededee, 0xedededee,
> +       0xedededee, 0xedededee, 0xedededee, 0x14140505, 0x14140505,
> 0x14140505, 0x14140505, 0x14140505,
> +       0x14140505, 0x14140505, 0x14140505, 0x14140505, 0x14140505,
> 0x14140505, 0x14140505, 0xebebfafb,
> +       0xebebfafb, 0xebebfafb, 0xebebfafb, 0xebebfafb, 0xebebfafb,
> 0xebebfafb, 0xebebfafb, 0xebebfafb,
> +       0xebebfafb, 0xebebfafb, 0xebebfafb, 0x05051414, 0x05051414,
> 0x05051414, 0x05051414, 0x05051414,
> +       0x05051414, 0x05051414, 0x05051414, 0x05051414, 0x05051414,
> 0x05051414, 0x05051414, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303,
> 0xfcfd0c0c, 0x0302f3f4, 0x14141414,
> +       0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9,
> 0x1110eeef, 0xeeef1111, 0x1b1af8f9,
> +       0xe4e50707, 0xf8f91b1b, 0x0706e4e5, 0x27271313, 0xd8d8eced,
> 0x13132727, 0xececd8d9, 0x27272727,
> +       0xd8d8d8d9, 0x2b2b0303, 0xd4d4fcfd, 0x03032b2b, 0xfcfcd4d5,
> 0x2423e7e8, 0xdbdc1818, 0xe7e82424,
> +       0x1817dbdc, 0x45452a2a, 0xbabad5d6, 0x2a2a4545, 0xd5d5babb,
> 0x3534f1f2, 0xcacb0e0e, 0xf1f23535,
> +       0x0e0dcacb, 0x47471313, 0xb8b8eced, 0x13134747, 0xececb8b9,
> 0x49494949, 0xb6b6b6b7, 0x504ffdfe,
> +       0xafb00202, 0xfdfe5050, 0x0201afb0, 0x3433cbcc, 0xcbcc3434,
> 0x4645d8d9, 0xb9ba2727, 0xd8d94646,
> +       0x2726b9ba, 0x79793030, 0x8686cfd0, 0x30307979, 0xcfcf8687,
> 0x7c7c5454, 0x8383abac, 0x54547c7c,
> +       0xabab8384, 0x6463e4e5, 0x9b9c1b1b, 0xe4e56464, 0x1b1a9b9c,
> 0x6665aeaf, 0x999a5151, 0xaeaf6666,
> +       0x5150999a, 0x37373737, 0xc8c8c8c9, 0x68686868, 0x97979798,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x09090909, 0x09090909, 0x09090909,
> 0x09090909, 0x09090909, 0x09090909,
> +       0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909,
> 0x09090909, 0x09090909, 0xf6f6f6f7,
> +       0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7,
> 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7,
> +       0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0x0c0bfcfd,
> 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd,
> +       0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd,
> 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd,
> +       0x0c0bfcfd, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303,
> 0xf3f40303, 0xf3f40303, 0xf3f40303,
> +       0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303,
> 0xf3f40303, 0xfcfd0c0c, 0xfcfd0c0c,
> +       0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c,
> 0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c,
> +       0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0x0302f3f4, 0x0302f3f4,
> 0x0302f3f4, 0x0302f3f4, 0x0302f3f4,
> +       0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4,
> 0x0302f3f4, 0x0302f3f4, 0x0302f3f4,
> +       0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0x14141414,
> +       0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
> 0xebebebec, 0xebebebec, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
> 0xebebebec, 0xebebebec, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0x17170606, 0x17170606, 0x17170606,
> 0x17170606, 0x17170606, 0x17170606,
> +       0x17170606, 0x17170606, 0x17170606, 0x17170606, 0x17170606,
> 0x17170606, 0x17170606, 0xe8e8f9fa,
> +       0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa,
> 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa,
> +       0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0x06061717,
> 0x06061717, 0x06061717, 0x06061717,
> +       0x06061717, 0x06061717, 0x06061717, 0x06061717, 0x06061717,
> 0x06061717, 0x06061717, 0x06061717,
> +       0x06061717, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9,
> 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9,
> +       0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9,
> 0xf9f9e8e9, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000,
> 0x00000202, 0xfffffdfe, 0x04040404,
> +       0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc,
> 0x0403fbfc, 0xfbfc0404, 0x0605fdfe,
> +       0xf9fa0202, 0xfdfe0606, 0x0201f9fa, 0x08080404, 0xf7f7fbfc,
> 0x04040808, 0xfbfbf7f8, 0x08080808,
> +       0xf7f7f7f8, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6,
> 0x0807fbfc, 0xf7f80404, 0xfbfc0808,
> +       0x0403f7f8, 0x0e0e0808, 0xf1f1f7f8, 0x08080e0e, 0xf7f7f1f2,
> 0x0c0bfdfe, 0xf3f40202, 0xfdfe0c0c,
> +       0x0201f3f4, 0x10100404, 0xefeffbfc, 0x04041010, 0xfbfbeff0,
> 0x10101010, 0xefefeff0, 0x12120000,
> +       0xedee0000, 0x00001212, 0xffffedee, 0x0c0bf3f4, 0xf3f40c0c,
> 0x100ff7f8, 0xeff00808, 0xf7f81010,
> +       0x0807eff0, 0x1a1a0a0a, 0xe5e5f5f6, 0x0a0a1a1a, 0xf5f5e5e6,
> 0x1c1c1212, 0xe3e3edee, 0x12121c1c,
> +       0xedede3e4, 0x1615f9fa, 0xe9ea0606, 0xf9fa1616, 0x0605e9ea,
> 0x1c1c0404, 0xe3e3fbfc, 0x04041c1c,
> +       0xfbfbe3e4, 0x1e1e1e1e, 0xe1e1e1e2, 0x201ffdfe, 0xdfe00202,
> 0xfdfe2020, 0x0201dfe0, 0x1615edee,
> +       0xe9ea1212, 0xedee1616, 0x1211e9ea, 0x1e1df1f2, 0xe1e20e0e,
> 0xf1f21e1e, 0x0e0de1e2, 0x2e2e1616,
> +       0xd1d1e9ea, 0x16162e2e, 0xe9e9d1d2, 0x2e2e0c0c, 0xd1d1f3f4,
> 0x0c0c2e2e, 0xf3f3d1d2, 0x30302222,
> +       0xcfcfddde, 0x22223030, 0xddddcfd0, 0x2827f5f6, 0xd7d80a0a,
> 0xf5f62828, 0x0a09d7d8, 0x32320404,
> +       0xcdcdfbfc, 0x04043232, 0xfbfbcdce, 0x36363636, 0xc9c9c9ca,
> 0x2221ddde, 0xddde2222, 0x2a29e3e4,
> +       0xd5d61c1c, 0xe3e42a2a, 0x1c1bd5d6, 0x3c3bf9fa, 0xc3c40606,
> 0xf9fa3c3c, 0x0605c3c4, 0x4c4c1a1a,
> +       0xb3b3e5e6, 0x1a1a4c4c, 0xe5e5b3b4, 0x4c4c2a2a, 0xb3b3d5d6,
> 0x2a2a4c4c, 0xd5d5b3b4, 0x3635e7e8,
> +       0xc9ca1818, 0xe7e83636, 0x1817c9ca, 0x4e4e0e0e, 0xb1b1f1f2,
> 0x0e0e4e4e, 0xf1f1b1b2, 0x52523e3e,
> +       0xadadc1c2, 0x3e3e5252, 0xc1c1adae, 0x4a49ebec, 0xb5b61414,
> 0xebec4a4a, 0x1413b5b6, 0x58580202,
> +       0xa7a7fdfe, 0x02025858, 0xfdfda7a8, 0x5c5c5c5c, 0xa3a3a3a4,
> 0x3c3bcbcc, 0xc3c43434, 0xcbcc3c3c,
> +       0x3433c3c4, 0x76763434, 0x8989cbcc, 0x34347676, 0xcbcb898a,
> 0x4a49d3d4, 0xb5b62c2c, 0xd3d44a4a,
> +       0x2c2bb5b6, 0x76764a4a, 0x8989b5b6, 0x4a4a7676, 0xb5b5898a,
> 0x76762020, 0x8989dfe0, 0x20207676,
> +       0xdfdf898a, 0x6665f3f4, 0x999a0c0c, 0xf3f46666, 0x0c0b999a,
> 0x605fd7d8, 0x9fa02828, 0xd7d86060,
> +       0x28279fa0, 0x7675ddde, 0x898a2222, 0xddde7676, 0x2221898a,
> 0x5857a7a8, 0xa7a85858, 0x6867b1b2,
> +       0x97984e4e, 0xb1b26868, 0x4e4d9798, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x16161616, 0xe9e9e9ea, 0x2a2a2a2a,
> +       0xd5d5d5d6, 0x48484848, 0xb7b7b7b8, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000,
> 0x02020000, 0x02020000, 0xfdfe0000,
> +       0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
> 0xfdfe0000, 0x00000202, 0x00000202,
> +       0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202,
> 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
> +       0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000,
> 0x00000303, 0xfffffcfd, 0x06060606,
> +       0xf9f9f9fa, 0x09090303, 0xf6f6fcfd, 0x03030909, 0xfcfcf6f7,
> 0x0908fcfd, 0xf6f70303, 0xfcfd0909,
> +       0x0302f6f7, 0x0605f9fa, 0xf9fa0606, 0x0c0c0606, 0xf3f3f9fa,
> 0x06060c0c, 0xf9f9f3f4, 0x0c0c0c0c,
> +       0xf3f3f3f4, 0x0f0f0000, 0xf0f10000, 0x00000f0f, 0xfffff0f1,
> 0x0c0bf6f7, 0xf3f40909, 0xf6f70c0c,
> +       0x0908f3f4, 0x18180f0f, 0xe7e7f0f1, 0x0f0f1818, 0xf0f0e7e8,
> 0x1211f9fa, 0xedee0606, 0xf9fa1212,
> +       0x0605edee, 0x18180606, 0xe7e7f9fa, 0x06061818, 0xf9f9e7e8,
> 0x18181818, 0xe7e7e7e8, 0x1b1b0000,
> +       0xe4e50000, 0x00001b1b, 0xffffe4e5, 0x1211edee, 0xedee1212,
> 0x1817f3f4, 0xe7e80c0c, 0xf3f41818,
> +       0x0c0be7e8, 0x27270f0f, 0xd8d8f0f1, 0x0f0f2727, 0xf0f0d8d9,
> 0x2a2a1b1b, 0xd5d5e4e5, 0x1b1b2a2a,
> +       0xe4e4d5d6, 0x2120f6f7, 0xdedf0909, 0xf6f72121, 0x0908dedf,
> 0x2a2a0606, 0xd5d5f9fa, 0x06062a2a,
> +       0xf9f9d5d6, 0x2d2d2d2d, 0xd2d2d2d3, 0x3332fcfd, 0xcccd0303,
> 0xfcfd3333, 0x0302cccd, 0x2120e4e5,
> +       0xdedf1b1b, 0xe4e52121, 0x1b1adedf, 0x2d2ceaeb, 0xd2d31515,
> 0xeaeb2d2d, 0x1514d2d3, 0x45452121,
> +       0xbabadedf, 0x21214545, 0xdedebabb, 0x45451212, 0xbabaedee,
> 0x12124545, 0xededbabb, 0x48483636,
> +       0xb7b7c9ca, 0x36364848, 0xc9c9b7b8, 0x3f3eedee, 0xc0c11212,
> 0xedee3f3f, 0x1211c0c1, 0x4e4e0606,
> +       0xb1b1f9fa, 0x06064e4e, 0xf9f9b1b2, 0x51515151, 0xaeaeaeaf,
> 0x3332cccd, 0xcccd3333, 0x3f3ed5d6,
> +       0xc0c12a2a, 0xd5d63f3f, 0x2a29c0c1, 0x5a59f6f7, 0xa5a60909,
> 0xf6f75a5a, 0x0908a5a6, 0x72722a2a,
> +       0x8d8dd5d6, 0x2a2a7272, 0xd5d58d8e, 0x75753f3f, 0x8a8ac0c1,
> 0x3f3f7575, 0xc0c08a8b, 0x5150dbdc,
> +       0xaeaf2424, 0xdbdc5151, 0x2423aeaf, 0x78781515, 0x8787eaeb,
> 0x15157878, 0xeaea8788, 0x7b7b6060,
> +       0x84849fa0, 0x60607b7b, 0x9f9f8485, 0x6f6ee1e2, 0x90911e1e,
> 0xe1e26f6f, 0x1e1d9091, 0x5d5cb1b2,
> +       0xa2a34e4e, 0xb1b25d5d, 0x4e4da2a3, 0x7271babb, 0x8d8e4545,
> 0xbabb7272, 0x45448d8e, 0x12121212,
> +       0xedededee, 0x21212121, 0xdedededf, 0x3f3f3f3f, 0xc0c0c0c1,
> 0x6c6c6c6c, 0x93939394, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303,
> 0x03030303, 0x03030303, 0x03030303,
> +       0x03030303, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd,
> 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd,
> +       0xfcfcfcfd, 0xfcfcfcfd, 0x03030000, 0x03030000, 0x03030000,
> 0x03030000, 0x03030000, 0x03030000,
> +       0x03030000, 0x03030000, 0x03030000, 0xfcfd0000, 0xfcfd0000,
> 0xfcfd0000, 0xfcfd0000, 0xfcfd0000,
> +       0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0x00000303,
> 0x00000303, 0x00000303, 0x00000303,
> +       0x00000303, 0x00000303, 0x00000303, 0x00000303, 0x00000303,
> 0xfffffcfd, 0xfffffcfd, 0xfffffcfd,
> +       0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd,
> 0xfffffcfd, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000,
> 0x00000404, 0xfffffbfc, 0x08080404,
> +       0xf7f7fbfc, 0x04040808, 0xfbfbf7f8, 0x08080808, 0xf7f7f7f8,
> 0x0807f7f8, 0xf7f80808, 0x0c0bfbfc,
> +       0xf3f40404, 0xfbfc0c0c, 0x0403f3f4, 0x10100808, 0xefeff7f8,
> 0x08081010, 0xf7f7eff0, 0x10101010,
> +       0xefefeff0, 0x14140000, 0xebec0000, 0x00001414, 0xffffebec,
> 0x100ff3f4, 0xeff00c0c, 0xf3f41010,
> +       0x0c0beff0, 0x1817fbfc, 0xe7e80404, 0xfbfc1818, 0x0403e7e8,
> 0x20201010, 0xdfdfeff0, 0x10102020,
> +       0xefefdfe0, 0x20200808, 0xdfdff7f8, 0x08082020, 0xf7f7dfe0,
> 0x20202020, 0xdfdfdfe0, 0x24240000,
> +       0xdbdc0000, 0x00002424, 0xffffdbdc, 0x1817e7e8, 0xe7e81818,
> 0x201feff0, 0xdfe01010, 0xeff02020,
> +       0x100fdfe0, 0x34341414, 0xcbcbebec, 0x14143434, 0xebebcbcc,
> 0x38382424, 0xc7c7dbdc, 0x24243838,
> +       0xdbdbc7c8, 0x2c2bf3f4, 0xd3d40c0c, 0xf3f42c2c, 0x0c0bd3d4,
> 0x38380808, 0xc7c7f7f8, 0x08083838,
> +       0xf7f7c7c8, 0x3c3c3c3c, 0xc3c3c3c4, 0x403ffbfc, 0xbfc00404,
> 0xfbfc4040, 0x0403bfc0, 0x2c2bdbdc,
> +       0xd3d42424, 0xdbdc2c2c, 0x2423d3d4, 0x3c3be3e4, 0xc3c41c1c,
> 0xe3e43c3c, 0x1c1bc3c4, 0x5c5c2c2c,
> +       0xa3a3d3d4, 0x2c2c5c5c, 0xd3d3a3a4, 0x5c5c1818, 0xa3a3e7e8,
> 0x18185c5c, 0xe7e7a3a4, 0x60604848,
> +       0x9f9fb7b8, 0x48486060, 0xb7b79fa0, 0x5453ebec, 0xabac1414,
> 0xebec5454, 0x1413abac, 0x64640808,
> +       0x9b9bf7f8, 0x08086464, 0xf7f79b9c, 0x6c6c6c6c, 0x93939394,
> 0x4443bbbc, 0xbbbc4444, 0x5453c7c8,
> +       0xabac3838, 0xc7c85454, 0x3837abac, 0x7877f3f4, 0x87880c0c,
> 0xf3f47878, 0x0c0b8788, 0x6c6bcfd0,
> +       0x93943030, 0xcfd06c6c, 0x302f9394, 0x7c7b9798, 0x83846868,
> 0x97987c7c, 0x68678384, 0x18181818,
> +       0xe7e7e7e8, 0x2c2c2c2c, 0xd3d3d3d4, 0x54545454, 0xabababac,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x04040404,
> +       0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
> 0x04040404, 0x04040404, 0x04040404,
> +       0x04040404, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> +       0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0x04040000, 0x04040000,
> 0x04040000, 0x04040000, 0x04040000,
> +       0x04040000, 0x04040000, 0x04040000, 0x04040000, 0x04040000,
> 0xfbfc0000, 0xfbfc0000, 0xfbfc0000,
> +       0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000,
> 0xfbfc0000, 0xfbfc0000, 0x00000404,
> +       0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404,
> 0x00000404, 0x00000404, 0x00000404,
> +       0x00000404, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc,
> 0xfffffbfc, 0xfffffbfc, 0xfffffbfc,
> +       0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0x08080404, 0x08080404,
> 0x08080404, 0x08080404, 0x08080404,
> +       0x08080404, 0x08080404, 0x08080404, 0x08080404, 0x08080404,
> 0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc,
> +       0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc,
> 0xf7f7fbfc, 0xf7f7fbfc, 0x04040808,
> +       0x04040808, 0x04040808, 0x04040808, 0x04040808, 0x04040808,
> 0x04040808, 0x04040808, 0x04040808,
> +       0x04040808, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000,
> 0x00000505, 0xfffffafb, 0x0a0a0a0a,
> +       0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x05050f0f, 0xfafaf0f1,
> 0x0a09f5f6, 0xf5f60a0a, 0x0f0efafb,
> +       0xf0f10505, 0xfafb0f0f, 0x0504f0f1, 0x14140a0a, 0xebebf5f6,
> 0x0a0a1414, 0xf5f5ebec, 0x14141414,
> +       0xebebebec, 0x19190000, 0xe6e70000, 0x00001919, 0xffffe6e7,
> 0x1413f0f1, 0xebec0f0f, 0xf0f11414,
> +       0x0f0eebec, 0x28281919, 0xd7d7e6e7, 0x19192828, 0xe6e6d7d8,
> 0x1e1df5f6, 0xe1e20a0a, 0xf5f61e1e,
> +       0x0a09e1e2, 0x28280a0a, 0xd7d7f5f6, 0x0a0a2828, 0xf5f5d7d8,
> 0x28282828, 0xd7d7d7d8, 0x2d2d0000,
> +       0xd2d30000, 0x00002d2d, 0xffffd2d3, 0x1e1de1e2, 0xe1e21e1e,
> 0x2827ebec, 0xd7d81414, 0xebec2828,
> +       0x1413d7d8, 0x41411919, 0xbebee6e7, 0x19194141, 0xe6e6bebf,
> 0x46462d2d, 0xb9b9d2d3, 0x2d2d4646,
> +       0xd2d2b9ba, 0x3736f0f1, 0xc8c90f0f, 0xf0f13737, 0x0f0ec8c9,
> 0x46460a0a, 0xb9b9f5f6, 0x0a0a4646,
> +       0xf5f5b9ba, 0x4b4b4b4b, 0xb4b4b4b5, 0x5554fafb, 0xaaab0505,
> 0xfafb5555, 0x0504aaab, 0x3736d2d3,
> +       0xc8c92d2d, 0xd2d33737, 0x2d2cc8c9, 0x4b4adcdd, 0xb4b52323,
> 0xdcdd4b4b, 0x2322b4b5, 0x73733737,
> +       0x8c8cc8c9, 0x37377373, 0xc8c88c8d, 0x73731e1e, 0x8c8ce1e2,
> 0x1e1e7373, 0xe1e18c8d, 0x78785a5a,
> +       0x8787a5a6, 0x5a5a7878, 0xa5a58788, 0x6968e1e2, 0x96971e1e,
> 0xe1e26969, 0x1e1d9697, 0x5554aaab,
> +       0xaaab5555, 0x6968b9ba, 0x96974646, 0xb9ba6969, 0x46459697,
> 0x1e1e1e1e, 0xe1e1e1e2, 0x3c3c3c3c,
> +       0xc3c3c3c4, 0x69696969, 0x96969697, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x05050505, 0x05050505,
> +       0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505,
> 0x05050505, 0x05050505, 0x05050505,
> +       0x05050505, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb,
> 0xfafafafb, 0xfafafafb, 0xfafafafb,
> +       0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0x05050000,
> 0x05050000, 0x05050000, 0x05050000,
> +       0x05050000, 0x05050000, 0x05050000, 0x05050000, 0x05050000,
> 0x05050000, 0x05050000, 0xfafb0000,
> +       0xfafb0000, 0xfafb0000, 0xfafb0000, 0xfafb0000, 0xfafb0000,
> 0xfafb0000, 0xfafb0000, 0xfafb0000,
> +       0xfafb0000, 0xfafb0000, 0x00000505, 0x00000505, 0x00000505,
> 0x00000505, 0x00000505, 0x00000505,
> +       0x00000505, 0x00000505, 0x00000505, 0x00000505, 0x00000505,
> 0xfffffafb, 0xfffffafb, 0xfffffafb,
> +       0xfffffafb, 0xfffffafb, 0xfffffafb, 0xfffffafb, 0xfffffafb,
> 0xfffffafb, 0xfffffafb, 0xfffffafb,
> +       0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a,
> 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a,
> +       0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0xf5f5f5f6, 0xf5f5f5f6,
> 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6,
> +       0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6,
> 0xf5f5f5f6, 0x0f0f0505, 0x0f0f0505,
> +       0x0f0f0505, 0x0f0f0505, 0x0f0f0505, 0x0f0f0505, 0x0f0f0505,
> 0x0f0f0505, 0x0f0f0505, 0x0f0f0505,
> +       0x0f0f0505, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb,
> 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb,
> +       0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000,
> 0x00000606, 0xfffff9fa, 0x0c0c0c0c,
> +       0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0xf9f9f3f4,
> 0x0c0bf3f4, 0xf3f40c0c, 0x1211f9fa,
> +       0xedee0606, 0xf9fa1212, 0x0605edee, 0x18180c0c, 0xe7e7f3f4,
> 0x0c0c1818, 0xf3f3e7e8, 0x18181818,
> +       0xe7e7e7e8, 0x1e1e0000, 0xe1e20000, 0x00001e1e, 0xffffe1e2,
> 0x1817edee, 0xe7e81212, 0xedee1818,
> +       0x1211e7e8, 0x30301e1e, 0xcfcfe1e2, 0x1e1e3030, 0xe1e1cfd0,
> 0x2423f9fa, 0xdbdc0606, 0xf9fa2424,
> +       0x0605dbdc, 0x30300c0c, 0xcfcff3f4, 0x0c0c3030, 0xf3f3cfd0,
> 0x30303030, 0xcfcfcfd0, 0x36360000,
> +       0xc9ca0000, 0x00003636, 0xffffc9ca, 0x2423dbdc, 0xdbdc2424,
> 0x302fe7e8, 0xcfd01818, 0xe7e83030,
> +       0x1817cfd0, 0x4e4e1e1e, 0xb1b1e1e2, 0x1e1e4e4e, 0xe1e1b1b2,
> 0x54543636, 0xababc9ca, 0x36365454,
> +       0xc9c9abac, 0x4241edee, 0xbdbe1212, 0xedee4242, 0x1211bdbe,
> 0x54540c0c, 0xababf3f4, 0x0c0c5454,
> +       0xf3f3abac, 0x5a5a5a5a, 0xa5a5a5a6, 0x605ff9fa, 0x9fa00606,
> 0xf9fa6060, 0x06059fa0, 0x4241c9ca,
> +       0xbdbe3636, 0xc9ca4242, 0x3635bdbe, 0x5a59d5d6, 0xa5a62a2a,
> 0xd5d65a5a, 0x2a29a5a6, 0x7e7de1e2,
> +       0x81821e1e, 0xe1e27e7e, 0x1e1d8182, 0x6665999a, 0x999a6666,
> 0x7e7dabac, 0x81825454, 0xabac7e7e,
> +       0x54538182, 0x24242424, 0xdbdbdbdc, 0x42424242, 0xbdbdbdbe,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0x06060000, 0x06060000, 0x06060000, 0x06060000,
> 0x06060000, 0x06060000, 0x06060000,
> +       0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000,
> 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
> +       0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
> 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
> +       0xf9fa0000, 0x00000606, 0x00000606, 0x00000606, 0x00000606,
> 0x00000606, 0x00000606, 0x00000606,
> +       0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606,
> 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
> +       0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
> 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
> +       0xfffff9fa, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606,
> 0x0c0c0606, 0x0c0c0606, 0x0c0c0606,
> +       0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606,
> 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa,
> +       0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa,
> 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa,
> +       0xf3f3f9fa, 0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c,
> 0x06060c0c, 0x06060c0c, 0x06060c0c,
> +       0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000, 0xf8f90000,
> 0x00000707, 0xfffff8f9, 0x0e0e0e0e,
> +       0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515, 0xf8f8eaeb,
> 0x0e0df1f2, 0xf1f20e0e, 0x1514f8f9,
> +       0xeaeb0707, 0xf8f91515, 0x0706eaeb, 0x1c1c0e0e, 0xe3e3f1f2,
> 0x0e0e1c1c, 0xf1f1e3e4, 0x1c1c1c1c,
> +       0xe3e3e3e4, 0x23230000, 0xdcdd0000, 0x00002323, 0xffffdcdd,
> 0x1c1beaeb, 0xe3e41515, 0xeaeb1c1c,
> +       0x1514e3e4, 0x38382323, 0xc7c7dcdd, 0x23233838, 0xdcdcc7c8,
> 0x2a29f1f2, 0xd5d60e0e, 0xf1f22a2a,
> +       0x0e0dd5d6, 0x38380e0e, 0xc7c7f1f2, 0x0e0e3838, 0xf1f1c7c8,
> 0x38383838, 0xc7c7c7c8, 0x3f3f0000,
> +       0xc0c10000, 0x00003f3f, 0xffffc0c1, 0x2a29d5d6, 0xd5d62a2a,
> 0x3837e3e4, 0xc7c81c1c, 0xe3e43838,
> +       0x1c1bc7c8, 0x5b5b2323, 0xa4a4dcdd, 0x23235b5b, 0xdcdca4a5,
> 0x62623f3f, 0x9d9dc0c1, 0x3f3f6262,
> +       0xc0c09d9e, 0x4d4ceaeb, 0xb2b31515, 0xeaeb4d4d, 0x1514b2b3,
> 0x62620e0e, 0x9d9df1f2, 0x0e0e6262,
> +       0xf1f19d9e, 0x69696969, 0x96969697, 0x7776f8f9, 0x88890707,
> 0xf8f97777, 0x07068889, 0x4d4cc0c1,
> +       0xb2b33f3f, 0xc0c14d4d, 0x3f3eb2b3, 0x6968cecf, 0x96973131,
> 0xcecf6969, 0x31309697, 0x77768889,
> +       0x88897777, 0x2a2a2a2a, 0xd5d5d5d6, 0x4d4d4d4d, 0xb2b2b2b3,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x07070707, 0x07070707, 0x07070707, 0x07070707,
> 0x07070707, 0x07070707, 0x07070707,
> +       0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707,
> 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
> +       0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
> 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
> +       0xf8f8f8f9, 0x07070000, 0x07070000, 0x07070000, 0x07070000,
> 0x07070000, 0x07070000, 0x07070000,
> +       0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000,
> 0xf8f90000, 0xf8f90000, 0xf8f90000,
> +       0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000,
> 0xf8f90000, 0xf8f90000, 0xf8f90000,
> +       0xf8f90000, 0x00000707, 0x00000707, 0x00000707, 0x00000707,
> 0x00000707, 0x00000707, 0x00000707,
> +       0x00000707, 0x00000707, 0x00000707, 0x00000707, 0x00000707,
> 0xfffff8f9, 0xfffff8f9, 0xfffff8f9,
> +       0xfffff8f9, 0xfffff8f9, 0xfffff8f9, 0xfffff8f9, 0xfffff8f9,
> 0xfffff8f9, 0xfffff8f9, 0xfffff8f9,
> +       0xfffff8f9, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e,
> 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e,
> +       0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e,
> 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2,
> +       0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2,
> 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2,
> +       0xf1f1f1f2, 0x15150707, 0x15150707, 0x15150707, 0x15150707,
> 0x15150707, 0x15150707, 0x15150707,
> +       0x15150707, 0x15150707, 0x15150707, 0x15150707, 0x15150707,
> 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9,
> +       0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9,
> 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9,
> +       0xeaeaf8f9, 0x07071515, 0x07071515, 0x07071515, 0x07071515,
> 0x07071515, 0x07071515, 0x07071515,
> +       0x07071515, 0x07071515, 0x07071515, 0x07071515, 0x07071515,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000,
> 0x00000808, 0xfffff7f8, 0x10101010,
> +       0xefefeff0, 0x10100808, 0xefeff7f8, 0x08081010, 0xf7f7eff0,
> 0x100feff0, 0xeff01010, 0x1817f7f8,
> +       0xe7e80808, 0xf7f81818, 0x0807e7e8, 0x20201010, 0xdfdfeff0,
> 0x10102020, 0xefefdfe0, 0x20202020,
> +       0xdfdfdfe0, 0x28280000, 0xd7d80000, 0x00002828, 0xffffd7d8,
> 0x201fe7e8, 0xdfe01818, 0xe7e82020,
> +       0x1817dfe0, 0x40402828, 0xbfbfd7d8, 0x28284040, 0xd7d7bfc0,
> 0x302feff0, 0xcfd01010, 0xeff03030,
> +       0x100fcfd0, 0x40401010, 0xbfbfeff0, 0x10104040, 0xefefbfc0,
> 0x40404040, 0xbfbfbfc0, 0x48480000,
> +       0xb7b80000, 0x00004848, 0xffffb7b8, 0x302fcfd0, 0xcfd03030,
> 0x403fdfe0, 0xbfc02020, 0xdfe04040,
> +       0x201fbfc0, 0x68682828, 0x9797d7d8, 0x28286868, 0xd7d79798,
> 0x70704848, 0x8f8fb7b8, 0x48487070,
> +       0xb7b78f90, 0x5857e7e8, 0xa7a81818, 0xe7e85858, 0x1817a7a8,
> 0x70701010, 0x8f8feff0, 0x10107070,
> +       0xefef8f90, 0x78787878, 0x87878788, 0x5857b7b8, 0xa7a84848,
> 0xb7b85858, 0x4847a7a8, 0x7877c7c8,
> +       0x87883838, 0xc7c87878, 0x38378788, 0x30303030, 0xcfcfcfd0,
> 0x58585858, 0xa7a7a7a8, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x08080808, 0x08080808,
> 0x08080808, 0x08080808, 0x08080808,
> +       0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808,
> 0x08080808, 0x08080808, 0xf7f7f7f8,
> +       0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8,
> 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8,
> +       0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0x08080000, 0x08080000,
> 0x08080000, 0x08080000, 0x08080000,
> +       0x08080000, 0x08080000, 0x08080000, 0x08080000, 0x08080000,
> 0x08080000, 0x08080000, 0xf7f80000,
> +       0xf7f80000, 0xf7f80000, 0xf7f80000, 0xf7f80000, 0xf7f80000,
> 0xf7f80000, 0xf7f80000, 0xf7f80000,
> +       0xf7f80000, 0xf7f80000, 0xf7f80000, 0x00000808, 0x00000808,
> 0x00000808, 0x00000808, 0x00000808,
> +       0x00000808, 0x00000808, 0x00000808, 0x00000808, 0x00000808,
> 0x00000808, 0x00000808, 0xfffff7f8,
> +       0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0xfffff7f8,
> 0xfffff7f8, 0xfffff7f8, 0xfffff7f8,
> +       0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0x10101010, 0x10101010,
> 0x10101010, 0x10101010, 0x10101010,
> +       0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010,
> 0x10101010, 0x10101010, 0xefefeff0,
> +       0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0,
> 0xefefeff0, 0xefefeff0, 0xefefeff0,
> +       0xefefeff0, 0xefefeff0, 0xefefeff0, 0x10100808, 0x10100808,
> 0x10100808, 0x10100808, 0x10100808,
> +       0x10100808, 0x10100808, 0x10100808, 0x10100808, 0x10100808,
> 0x10100808, 0x10100808, 0xefeff7f8,
> +       0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0xefeff7f8,
> 0xefeff7f8, 0xefeff7f8, 0xefeff7f8,
> +       0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0x08081010, 0x08081010,
> 0x08081010, 0x08081010, 0x08081010,
> +       0x08081010, 0x08081010, 0x08081010, 0x08081010, 0x08081010,
> 0x08081010, 0x08081010, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000,
> 0x00000909, 0xfffff6f7, 0x12121212,
> +       0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5,
> 0x1211edee, 0xedee1212, 0x1b1af6f7,
> +       0xe4e50909, 0xf6f71b1b, 0x0908e4e5, 0x24241212, 0xdbdbedee,
> 0x12122424, 0xededdbdc, 0x24242424,
> +       0xdbdbdbdc, 0x2d2d0000, 0xd2d30000, 0x00002d2d, 0xffffd2d3,
> 0x2423e4e5, 0xdbdc1b1b, 0xe4e52424,
> +       0x1b1adbdc, 0x48482d2d, 0xb7b7d2d3, 0x2d2d4848, 0xd2d2b7b8,
> 0x3635edee, 0xc9ca1212, 0xedee3636,
> +       0x1211c9ca, 0x48481212, 0xb7b7edee, 0x12124848, 0xededb7b8,
> 0x48484848, 0xb7b7b7b8, 0x51510000,
> +       0xaeaf0000, 0x00005151, 0xffffaeaf, 0x3635c9ca, 0xc9ca3636,
> 0x4847dbdc, 0xb7b82424, 0xdbdc4848,
> +       0x2423b7b8, 0x75752d2d, 0x8a8ad2d3, 0x2d2d7575, 0xd2d28a8b,
> 0x7e7e5151, 0x8181aeaf, 0x51517e7e,
> +       0xaeae8182, 0x6362e4e5, 0x9c9d1b1b, 0xe4e56363, 0x1b1a9c9d,
> 0x6362aeaf, 0x9c9d5151, 0xaeaf6363,
> +       0x51509c9d, 0x36363636, 0xc9c9c9ca, 0x6c6c6c6c, 0x93939394,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x09090909, 0x09090909, 0x09090909,
> 0x09090909, 0x09090909, 0x09090909,
> +       0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909,
> 0x09090909, 0x09090909, 0xf6f6f6f7,
> +       0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7,
> 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7,
> +       0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0x09090000,
> 0x09090000, 0x09090000, 0x09090000,
> +       0x09090000, 0x09090000, 0x09090000, 0x09090000, 0x09090000,
> 0x09090000, 0x09090000, 0x09090000,
> +       0x09090000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000,
> 0xf6f70000, 0xf6f70000, 0xf6f70000,
> +       0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000,
> 0xf6f70000, 0x00000909, 0x00000909,
> +       0x00000909, 0x00000909, 0x00000909, 0x00000909, 0x00000909,
> 0x00000909, 0x00000909, 0x00000909,
> +       0x00000909, 0x00000909, 0x00000909, 0xfffff6f7, 0xfffff6f7,
> 0xfffff6f7, 0xfffff6f7, 0xfffff6f7,
> +       0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7,
> 0xfffff6f7, 0xfffff6f7, 0xfffff6f7,
> +       0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
> 0x12121212, 0x12121212, 0x12121212,
> +       0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
> 0xedededee, 0xedededee, 0xedededee,
> +       0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee,
> 0xedededee, 0xedededee, 0xedededee,
> +       0xedededee, 0xedededee, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909,
> 0x1b1b0909, 0x1b1b0909, 0x1b1b0909,
> +       0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909,
> 0x1b1b0909, 0x1b1b0909, 0xe4e4f6f7,
> +       0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7,
> 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7,
> +       0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0x09091b1b,
> 0x09091b1b, 0x09091b1b, 0x09091b1b,
> +       0x09091b1b, 0x09091b1b, 0x09091b1b, 0x09091b1b, 0x09091b1b,
> 0x09091b1b, 0x09091b1b, 0x09091b1b,
> +       0x09091b1b, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5,
> 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5,
> +       0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5,
> 0xf6f6e4e5, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000,
> 0x00000303, 0xfffffcfd, 0x06060606,
> +       0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9,
> 0x0504fafb, 0xfafb0505, 0xfafb0505,
> +       0x0504fafb, 0x0b0b0606, 0xf4f4f9fa, 0x06060b0b, 0xf9f9f4f5,
> 0x08080000, 0xf7f80000, 0x00000808,
> +       0xfffff7f8, 0x0b0b0b0b, 0xf4f4f4f5, 0x0c0c0000, 0xf3f40000,
> 0x00000c0c, 0xfffff3f4, 0x11110c0c,
> +       0xeeeef3f4, 0x0c0c1111, 0xf3f3eeef, 0x11111111, 0xeeeeeeef,
> 0x12120606, 0xededf9fa, 0x06061212,
> +       0xf9f9edee, 0x0b0af7f8, 0xf4f50808, 0xf7f80b0b, 0x0807f4f5,
> 0x0f0f0000, 0xf0f10000, 0x00000f0f,
> +       0xfffff0f1, 0x14140000, 0xebec0000, 0x00001414, 0xffffebec,
> 0x19191212, 0xe6e6edee, 0x12121919,
> +       0xedede6e7, 0x19190b0b, 0xe6e6f4f5, 0x0b0b1919, 0xf4f4e6e7,
> 0x19191919, 0xe6e6e6e7, 0x0e0df1f2,
> +       0xf1f20e0e, 0xf1f20e0e, 0x0e0df1f2, 0x1a1a0000, 0xe5e60000,
> 0x00001a1a, 0xffffe5e6, 0x1211f4f5,
> +       0xedee0b0b, 0xf4f51212, 0x0b0aedee, 0x1615f8f9, 0xe9ea0707,
> 0xf8f91616, 0x0706e9ea, 0x22221a1a,
> +       0xdddde5e6, 0x1a1a2222, 0xe5e5ddde, 0x22221212, 0xddddedee,
> 0x12122222, 0xededddde, 0x22222222,
> +       0xddddddde, 0x23230b0b, 0xdcdcf4f5, 0x0b0b2323, 0xf4f4dcdd,
> 0x1d1d0000, 0xe2e30000, 0x00001d1d,
> +       0xffffe2e3, 0x1615eced, 0xe9ea1313, 0xeced1616, 0x1312e9ea,
> 0x1a19f0f1, 0xe5e60f0f, 0xf0f11a1a,
> +       0x0f0ee5e6, 0x25250000, 0xdadb0000, 0x00002525, 0xffffdadb,
> 0x2c2c1b1b, 0xd3d3e4e5, 0x1b1b2c2c,
> +       0xe4e4d3d4, 0x2c2c2424, 0xd3d3dbdc, 0x24242c2c, 0xdbdbd3d4,
> 0x2c2c1212, 0xd3d3edee, 0x12122c2c,
> +       0xededd3d4, 0x2120f5f6, 0xdedf0a0a, 0xf5f62121, 0x0a09dedf,
> 0x2d2d2d2d, 0xd2d2d2d3, 0x00000000,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000,
> 0x00000303, 0xfffffcfd, 0x06060606,
> +       0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x03030000, 0xfcfd0000,
> +       0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000,
> 0xf8f90000, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd,
> 0x06060606, 0xf9f9f9fa, 0x07070000,
> +       0xf8f90000, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000,
> 0xfcfd0000, 0x00000303, 0xfffffcfd,
> +       0x06060606, 0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x03030000,
> +       0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa,
> 0x07070000, 0xf8f90000, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303,
> 0xfffffcfd, 0x06060606, 0xf9f9f9fa,
> +       0x07070000, 0xf8f90000, 0x00000000, 0x02020202, 0xfdfdfdfe,
> 0x03030000, 0xfcfd0000, 0x00000303,
> +       0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000, 0xf8f90000,
> 0x00000000, 0x02020202, 0xfdfdfdfe,
> +       0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606,
> 0xf9f9f9fa, 0x07070000, 0xf8f90000,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000,
> 0x00000303, 0xfffffcfd, 0x06060606,
> +       0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x03030000, 0xfcfd0000,
> +       0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000,
> 0xf8f90000, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd,
> 0x06060606, 0xf9f9f9fa, 0x07070000,
> +       0xf8f90000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
> 0x0403fbfc, 0xfbfc0404, 0xf9fa0a0a,
> +       0x0605f5f6, 0xf3f40000, 0x0c0c0000, 0xf3f3f9fa, 0xf3f40606,
> 0x0c0bf9fa, 0x0c0c0606, 0xfffff1f2,
> +       0x00000e0e, 0x0c0c0c0c, 0xf3f3f3f4, 0xedee0000, 0x12120000,
> 0xf3f40e0e, 0x0c0bf1f2, 0xf9f9edee,
> +       0xf9fa1212, 0x0605edee, 0x06061212, 0xededf5f6, 0xedee0a0a,
> 0x1211f5f6, 0x12120a0a, 0xffffe9ea,
> +       0x00001616, 0xe7e80000, 0x18180000, 0xf3f3e9ea, 0xf3f41616,
> 0x0c0be9ea, 0x0c0c1616, 0xe7e7f7f8,
> +       0xe7e80808, 0x1817f7f8, 0x18180808, 0xf9f9e5e6, 0xf9fa1a1a,
> 0x0605e5e6, 0x06061a1a, 0xffffe3e4,
> +       0x00001c1c, 0x14141414, 0xebebebec, 0xe5e5f1f2, 0x1a1a0e0e,
> 0xf3f3e1e2, 0x0c0c1e1e, 0xdfdff5f6,
> +       0x20200a0a, 0xdfdfedee, 0x20201212, 0xe5e5e5e6, 0x1a1a1a1a,
> 0xebebddde, 0x14142222, 0xf3f3d9da,
> +       0x0c0c2626, 0xdfdfdfe0, 0x20202020, 0x20202020, 0xd7d7e9ea,
> 0xddddddde, 0x22222222, 0x00000000,
> +       0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000,
> 0x02020000, 0xfdfe0000, 0x00000202,
> +       0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x06060000, 0xf9fa0000, 0x00000606,
> +       0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202,
> 0xfffffdfe, 0x02020202, 0xfdfdfdfe,
> +       0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606,
> 0xfffff9fa, 0x00000000, 0x02020000,
> +       0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe,
> 0x06060606, 0xf9f9f9fa, 0x06060000,
> +       0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000,
> 0xfdfe0000, 0x00000202, 0xfffffdfe,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000,
> 0xf9fa0000, 0x00000606, 0xfffff9fa,
> +       0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
> 0x00000000, 0x02020000, 0xfdfe0000,
> +       0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x06060000, 0xf9fa0000,
> +       0x00000606, 0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000,
> 0x00000202, 0xfffffdfe, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000,
> 0x00000606, 0xfffff9fa, 0x00000000,
> +       0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000,
> 0x02020000, 0xfdfe0000, 0x00000202,
> +       0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x06060000, 0xf9fa0000, 0x00000606,
> +       0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202,
> 0xfffffdfe, 0x02020202, 0xfdfdfdfe,
> +       0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606,
> 0xfffff9fa, 0x00000000, 0x02020000,
> +       0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe,
> 0x06060606, 0xf9f9f9fa, 0x06060000,
> +       0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000,
> 0xfdfe0000, 0x00000202, 0xfffffdfe,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000,
> 0xf9fa0000, 0x00000606, 0xfffff9fa,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
> 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a,
> +       0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6,
> 0x0605f9fa, 0xf9fa0606, 0xf7f80e0e,
> +       0x0807f1f2, 0xffffedee, 0x00001212, 0xeff00a0a, 0x100ff5f6,
> 0xe7e80000, 0x18180000, 0xf7f7e7e8,
> +       0xf7f81818, 0x0807e7e8, 0x08081818, 0x12121212, 0xedededee,
> 0xeff01414, 0x100febec, 0xe5e5f1f2,
> +       0xe5e60e0e, 0x1a19f1f2, 0x1a1a0e0e, 0xffffe1e2, 0x00001e1e,
> 0xddde0000, 0x22220000, 0xf7f7ddde,
> +       0xf7f82222, 0x0807ddde, 0x08082222, 0xedede1e2, 0xedee1e1e,
> 0x1211e1e2, 0x12121e1e, 0xddddf5f6,
> +       0xddde0a0a, 0x2221f5f6, 0x22220a0a, 0xddddebec, 0x22221414,
> 0xffffd7d8, 0x00002828, 0x1e1e1e1e,
> +       0xe1e1e1e2, 0xededd7d8, 0x12122828, 0xd3d40000, 0x2c2c0000,
> 0xd3d3eff0, 0x2c2c1010, 0xdbdbdbdc,
> +       0xdbdbdbdc, 0x24242424, 0xd3d3e5e6, 0x2c2c1a1a, 0xe5e5d1d2,
> 0x1a1a2e2e, 0xededcbcc, 0x12123434,
> +       0xc9c9ebec, 0xd3d3d3d4, 0x2c2c2c2c, 0xc9c9dfe0, 0xd1d1d1d2,
> 0xd1d1d1d2, 0x2e2e2e2e, 0x00000000,
> +       0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404,
> 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6,
> +       0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000,
> 0x02020000, 0xfdfe0000, 0x00000202,
> +       0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6,
> 0x0a0a0000, 0xf5f60000, 0x00000a0a,
> +       0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202,
> 0xfffffdfe, 0x04040404, 0xfbfbfbfc,
> +       0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a,
> 0xfffff5f6, 0x00000000, 0x02020000,
> +       0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc,
> 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000,
> +       0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000,
> 0xfdfe0000, 0x00000202, 0xfffffdfe,
> +       0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000,
> 0xf5f60000, 0x00000a0a, 0xfffff5f6,
> +       0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
> 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a,
> +       0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6,
> 0x00000000, 0x02020000, 0xfdfe0000,
> +       0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a,
> 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000,
> +       0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000,
> 0x00000202, 0xfffffdfe, 0x04040404,
> +       0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000,
> 0x00000a0a, 0xfffff5f6, 0x00000000,
> +       0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404,
> 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6,
> +       0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000,
> 0x02020000, 0xfdfe0000, 0x00000202,
> +       0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6,
> 0x0a0a0000, 0xf5f60000, 0x00000a0a,
> +       0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202,
> 0xfffffdfe, 0x04040404, 0xfbfbfbfc,
> +       0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a,
> 0xfffff5f6, 0x00000000, 0x02020000,
> +       0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc,
> 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000,
> +       0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000,
> 0xfdfe0000, 0x00000202, 0xfffffdfe,
> +       0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000,
> 0xf5f60000, 0x00000a0a, 0xfffff5f6,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc,
> 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c,
> +       0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4,
> 0x0807f7f8, 0xf7f80808, 0xeff00808,
> +       0x100ff7f8, 0xe7e80000, 0x18180000, 0xf7f7e7e8, 0xf7f81818,
> 0x0807e7e8, 0x08081818, 0xeff01414,
> +       0x100febec, 0xffffe3e4, 0x00001c1c, 0xe7e7eff0, 0xe7e81010,
> 0x1817eff0, 0x18181010, 0xdfe00000,
> +       0x20200000, 0xefefe3e4, 0xeff01c1c, 0x100fe3e4, 0x10101c1c,
> 0xdfdff7f8, 0xdfe00808, 0xf7f7dfe0,
> +       0xf7f82020, 0x0807dfe0, 0x08082020, 0x201ff7f8, 0x20200808,
> 0x18181818, 0xe7e7e7e8, 0xe7e81818,
> +       0x1817e7e8, 0xdfdfebec, 0x20201414, 0xffffd7d8, 0x00002828,
> 0xefefd7d8, 0x10102828, 0xd3d40000,
> +       0xd3d40000, 0xffffd3d4, 0x00002c2c, 0x2c2c0000, 0x2c2c0000,
> 0xdfdfdfe0, 0x20202020, 0xd3d3eff0,
> +       0x2c2c1010, 0xd3d3e7e8, 0xe7e7d3d4, 0x18182c2c, 0x2c2c1818,
> 0xefefcfd0, 0x10103030, 0xdbdbdbdc,
> +       0xdbdbdbdc, 0x24242424, 0x24242424, 0xcbcbebec, 0x28282828,
> 0xd7d7d7d8, 0xcbcbdfe0, 0x00000000,
> +       0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404,
> 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000,
> 0x04040000, 0xfbfc0000, 0x00000404,
> +       0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x0c0c0000, 0xf3f40000, 0x00000c0c,
> +       0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404,
> 0xfffffbfc, 0x04040404, 0xfbfbfbfc,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c,
> 0xfffff3f4, 0x00000000, 0x04040000,
> +       0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000,
> +       0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000,
> 0xfbfc0000, 0x00000404, 0xfffffbfc,
> +       0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000,
> 0xf3f40000, 0x00000c0c, 0xfffff3f4,
> +       0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc,
> 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c,
> +       0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4,
> 0x00000000, 0x04040000, 0xfbfc0000,
> +       0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000,
> +       0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000,
> 0x00000404, 0xfffffbfc, 0x04040404,
> +       0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000,
> 0x00000c0c, 0xfffff3f4, 0x00000000,
> +       0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404,
> 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000,
> 0x04040000, 0xfbfc0000, 0x00000404,
> +       0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x0c0c0000, 0xf3f40000, 0x00000c0c,
> +       0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404,
> 0xfffffbfc, 0x04040404, 0xfbfbfbfc,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c,
> 0xfffff3f4, 0x00000000, 0x04040000,
> +       0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000,
> +       0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000,
> 0xfbfc0000, 0x00000404, 0xfffffbfc,
> +       0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000,
> 0xf3f40000, 0x00000c0c, 0xfffff3f4,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> +       0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x14141414, 0xebebebec,
> +       0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
> 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> +       0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> 0xd1d1d1d2, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x14141414, 0xebebebec, 0x20202020,
> +       0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
> 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> +       0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> 0x00000000, 0x02020202, 0xfdfdfdfe,
> +       0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> 0xebebebec, 0x20202020, 0xdfdfdfe0,
> +       0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe,
> 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> +       0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0,
> 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x14141414, 0xebebebec,
> +       0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
> 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> +       0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> 0xd1d1d1d2, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x14141414, 0xebebebec, 0x20202020,
> +       0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
> 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> +       0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x14141414, 0xebebebec,
> +       0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
> 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> +       0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> 0xd1d1d1d2, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x14141414, 0xebebebec, 0x20202020,
> +       0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
> 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> +       0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> 0x00000000, 0x02020202, 0xfdfdfdfe,
> +       0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> 0xebebebec, 0x20202020, 0xdfdfdfe0,
> +       0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe,
> 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> +       0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0,
> 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x14141414, 0xebebebec,
> +       0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
> 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> +       0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> 0xd1d1d1d2, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x14141414, 0xebebebec, 0x20202020,
> +       0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
> 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> +       0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x14141414, 0xebebebec,
> +       0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
> 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> +       0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> 0xd1d1d1d2, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x14141414, 0xebebebec, 0x20202020,
> +       0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
> 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> +       0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> 0x00000000, 0x02020202, 0xfdfdfdfe,
> +       0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> 0xebebebec, 0x20202020, 0xdfdfdfe0,
> +       0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe,
> 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> +       0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0,
> 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x14141414, 0xebebebec,
> +       0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
> 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> +       0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> 0xd1d1d1d2, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x14141414, 0xebebebec, 0x20202020,
> +       0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
> 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> +       0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x14141414, 0xebebebec,
> +       0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
> 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> +       0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> 0xd1d1d1d2, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x14141414, 0xebebebec, 0x20202020,
> +       0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
> 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> +       0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> 0x00000000, 0x02020202, 0xfdfdfdfe,
> +       0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
> 0xebebebec, 0x20202020, 0xdfdfdfe0,
> +       0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe,
> 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> +       0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0,
> 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x14141414, 0xebebebec,
> +       0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
> 0x02020202, 0xfdfdfdfe, 0x06060606,
> +       0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
> 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> +       0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
> 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
> 0xd1d1d1d2, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
> 0x14141414, 0xebebebec, 0x20202020,
> +       0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
> 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000
> +};
> +
> +
> +const uint32 Indeo3Decoder::correctionhighorder[] = {
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x0302feff, 0xfcfd0101,
> +       0xfeff0303, 0x0100fcfd, 0x00000000, 0x02020202, 0xfdfdfdfe,
> 0x0302feff, 0xfcfd0101, 0xfeff0303,
> +       0x0100fcfd, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff,
> 0xfcfd0101, 0xfeff0303, 0x0100fcfd,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101,
> 0xfeff0303, 0x0100fcfd, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303,
> 0x0100fcfd, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd,
> 0x00000000, 0x02020202, 0xfdfdfdfe,
> +       0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404,
> 0x0100fbfc, 0x07070707, 0xf8f8f8f9,
> +       0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101,
> 0xfeff0404, 0x0100fbfc, 0x07070707,
> +       0xf8f8f8f9, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff,
> 0xfbfc0101, 0xfeff0404, 0x0100fbfc,
> +       0x07070707, 0xf8f8f8f9, 0x00000000, 0x03030303, 0xfcfcfcfd,
> 0x0403feff, 0xfbfc0101, 0xfeff0404,
> +       0x0100fbfc, 0x07070707, 0xf8f8f8f9, 0x00000000, 0x03030303,
> 0xfcfcfcfd, 0x0403feff, 0xfbfc0101,
> +       0xfeff0404, 0x0100fbfc, 0x07070707, 0xf8f8f8f9, 0x00000000,
> 0x03030303, 0xfcfcfcfd, 0x0403feff,
> +       0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707, 0xf8f8f8f9,
> 0x00000000, 0x03030303, 0xfcfcfcfd,
> +       0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707,
> 0xf8f8f8f9, 0x00000000, 0x03030303,
> +       0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc,
> 0x07070707, 0xf8f8f8f9, 0x00000000,
> +       0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404,
> 0x0100fbfc, 0x07070707, 0xf8f8f8f9,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0x00000000, 0x04040404, 0xfbfbfbfc,
> +       0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303,
> 0xf5f5fcfd, 0x03030a0a, 0x00000000,
> +       0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505,
> 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd,
> +       0x03030a0a, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x0504feff,
> 0xfafb0101, 0xfeff0505, 0x0100fafb,
> +       0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000, 0x04040404,
> 0xfbfbfbfc, 0x0504feff, 0xfafb0101,
> +       0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd, 0x03030a0a,
> 0x00000000, 0x04040404, 0xfbfbfbfc,
> +       0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303,
> 0xf5f5fcfd, 0x03030a0a, 0x00000000,
> +       0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505,
> 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd,
> +       0x03030a0a, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x0504feff,
> 0xfafb0101, 0xfeff0505, 0x0100fafb,
> +       0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000, 0x04040404,
> 0xfbfbfbfc, 0x0504feff, 0xfafb0101,
> +       0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd, 0x03030a0a,
> 0x00000000, 0x04040404, 0xfbfbfbfc,
> +       0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303,
> 0xf5f5fcfd, 0x03030a0a, 0x00000000,
> +       0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505,
> 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd,
> +       0x03030a0a, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x05050505,
> 0xfafafafb, 0x0706fdfe, 0xf8f90202,
> +       0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303,
> 0xf2f2fcfd, 0x00000000, 0x05050505,
> +       0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9,
> 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303,
> +       0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe,
> 0xf8f90202, 0xfdfe0707, 0x0201f8f9,
> +       0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000,
> 0x05050505, 0xfafafafb, 0x0706fdfe,
> +       0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5,
> 0x0d0d0303, 0xf2f2fcfd, 0x00000000,
> +       0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707,
> 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5,
> +       0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb,
> 0x0706fdfe, 0xf8f90202, 0xfdfe0707,
> +       0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd,
> 0x00000000, 0x05050505, 0xfafafafb,
> +       0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b,
> 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd,
> +       0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202,
> 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b,
> +       0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x05050505,
> 0xfafafafb, 0x0706fdfe, 0xf8f90202,
> +       0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303,
> 0xf2f2fcfd, 0x00000000, 0x05050505,
> +       0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9,
> 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303,
> +       0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe,
> 0xf8f90202, 0xfdfe0707, 0x0201f8f9,
> +       0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d,
> 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
> +       0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe,
> 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
> +       0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d,
> 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
> +       0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe,
> 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
> +       0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d,
> 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
> +       0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe,
> 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
> +       0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d,
> 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
> +       0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe,
> 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
> +       0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d,
> 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
> +       0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe,
> 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
> +       0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d,
> 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
> +       0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe,
> 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
> +       0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010,
> 0xefefeff0, 0x12120505, 0xededfafb,
> +       0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd,
> 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
> +       0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010,
> 0xefefeff0, 0x12120505, 0xededfafb,
> +       0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd,
> 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
> +       0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010,
> 0xefefeff0, 0x12120505, 0xededfafb,
> +       0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd,
> 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
> +       0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010,
> 0xefefeff0, 0x12120505, 0xededfafb,
> +       0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd,
> 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
> +       0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010,
> 0xefefeff0, 0x12120505, 0xededfafb,
> +       0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd,
> 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
> +       0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010,
> 0xefefeff0, 0x12120505, 0xededfafb,
> +       0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd,
> 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
> +       0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b,
> 0x0302f4f5, 0x12121212, 0xedededee,
> +       0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
> +       0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505,
> 0xebebfafb, 0x05051414, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b,
> 0x0302f4f5, 0x12121212, 0xedededee,
> +       0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
> +       0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505,
> 0xebebfafb, 0x05051414, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b,
> 0x0302f4f5, 0x12121212, 0xedededee,
> +       0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
> +       0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505,
> 0xebebfafb, 0x05051414, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b,
> 0x0302f4f5, 0x12121212, 0xedededee,
> +       0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
> +       0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505,
> 0xebebfafb, 0x05051414, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b,
> 0x0302f4f5, 0x12121212, 0xedededee,
> +       0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
> +       0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505,
> 0xebebfafb, 0x05051414, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b,
> 0x0302f4f5, 0x12121212, 0xedededee,
> +       0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
> +       0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505,
> 0xebebfafb, 0x05051414, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0x00000000, 0x09090909, 0xf6f6f6f7,
> +       0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414,
> 0xebebebec, 0x17170606, 0xe8e8f9fa,
> +       0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7,
> 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c,
> +       0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa,
> 0x06061717, 0xf9f9e8e9, 0x00000000,
> +       0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c,
> 0x0302f3f4, 0x14141414, 0xebebebec,
> +       0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000,
> 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd,
> +       0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec,
> 0x17170606, 0xe8e8f9fa, 0x06061717,
> +       0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd,
> 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4,
> +       0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717,
> 0xf9f9e8e9, 0x00000000, 0x09090909,
> +       0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4,
> 0x14141414, 0xebebebec, 0x17170606,
> +       0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909,
> 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303,
> +       0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606,
> 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9,
> +       0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303,
> 0xfcfd0c0c, 0x0302f3f4, 0x14141414,
> +       0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9,
> 0x00000000, 0x09090909, 0xf6f6f6f7,
> +       0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414,
> 0xebebebec, 0x17170606, 0xe8e8f9fa,
> +       0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7,
> 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c,
> +       0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa,
> 0x06061717, 0xf9f9e8e9, 0x00000000,
> +       0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c,
> 0x0302f3f4, 0x14141414, 0xebebebec,
> +       0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000,
> 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd,
> +       0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec,
> 0x17170606, 0xe8e8f9fa, 0x06061717,
> +       0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd,
> 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4,
> +       0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717,
> 0xf9f9e8e9, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x02020202,
> 0xfdfdfdfe, 0x02020000, 0xfdfe0000,
> +       0x00000202, 0xfffffdfe, 0x00000000, 0x02020202, 0xfdfdfdfe,
> 0x02020000, 0xfdfe0000, 0x00000202,
> +       0xfffffdfe, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x02020000,
> 0xfdfe0000, 0x00000202, 0xfffffdfe,
> +       0x00000000, 0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000,
> 0x00000202, 0xfffffdfe, 0x00000000,
> +       0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000, 0x00000202,
> 0xfffffdfe, 0x00000000, 0x02020202,
> +       0xfdfdfdfe, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
> 0x00000000, 0x02020202, 0xfdfdfdfe,
> +       0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303,
> 0xfffffcfd, 0x06060606, 0xf9f9f9fa,
> +       0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000,
> 0x00000303, 0xfffffcfd, 0x06060606,
> +       0xf9f9f9fa, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000,
> 0xfcfd0000, 0x00000303, 0xfffffcfd,
> +       0x06060606, 0xf9f9f9fa, 0x00000000, 0x03030303, 0xfcfcfcfd,
> 0x03030000, 0xfcfd0000, 0x00000303,
> +       0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x00000000, 0x03030303,
> 0xfcfcfcfd, 0x03030000, 0xfcfd0000,
> +       0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x00000000,
> 0x03030303, 0xfcfcfcfd, 0x03030000,
> +       0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa,
> 0x00000000, 0x03030303, 0xfcfcfcfd,
> +       0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606,
> 0xf9f9f9fa, 0x00000000, 0x03030303,
> +       0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd,
> 0x06060606, 0xf9f9f9fa, 0x00000000,
> +       0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303,
> 0xfffffcfd, 0x06060606, 0xf9f9f9fa,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0x00000000, 0x04040404, 0xfbfbfbfc,
> +       0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404,
> 0xf7f7fbfc, 0x04040808, 0x00000000,
> +       0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404,
> 0xfffffbfc, 0x08080404, 0xf7f7fbfc,
> +       0x04040808, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x04040000,
> 0xfbfc0000, 0x00000404, 0xfffffbfc,
> +       0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000, 0x04040404,
> 0xfbfbfbfc, 0x04040000, 0xfbfc0000,
> +       0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc, 0x04040808,
> 0x00000000, 0x04040404, 0xfbfbfbfc,
> +       0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404,
> 0xf7f7fbfc, 0x04040808, 0x00000000,
> +       0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404,
> 0xfffffbfc, 0x08080404, 0xf7f7fbfc,
> +       0x04040808, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x04040000,
> 0xfbfc0000, 0x00000404, 0xfffffbfc,
> +       0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000, 0x04040404,
> 0xfbfbfbfc, 0x04040000, 0xfbfc0000,
> +       0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc, 0x04040808,
> 0x00000000, 0x04040404, 0xfbfbfbfc,
> +       0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404,
> 0xf7f7fbfc, 0x04040808, 0x00000000,
> +       0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404,
> 0xfffffbfc, 0x08080404, 0xf7f7fbfc,
> +       0x04040808, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x05050505,
> 0xfafafafb, 0x05050000, 0xfafb0000,
> +       0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505,
> 0xf0f0fafb, 0x00000000, 0x05050505,
> +       0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb,
> 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505,
> +       0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb, 0x05050000,
> 0xfafb0000, 0x00000505, 0xfffffafb,
> +       0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000,
> 0x05050505, 0xfafafafb, 0x05050000,
> +       0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6,
> 0x0f0f0505, 0xf0f0fafb, 0x00000000,
> +       0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505,
> 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6,
> +       0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb,
> 0x05050000, 0xfafb0000, 0x00000505,
> +       0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb,
> 0x00000000, 0x05050505, 0xfafafafb,
> +       0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a,
> 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb,
> +       0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000,
> 0x00000505, 0xfffffafb, 0x0a0a0a0a,
> +       0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x05050505,
> 0xfafafafb, 0x05050000, 0xfafb0000,
> +       0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505,
> 0xf0f0fafb, 0x00000000, 0x05050505,
> +       0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb,
> 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505,
> +       0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb, 0x05050000,
> 0xfafb0000, 0x00000505, 0xfffffafb,
> +       0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
> +       0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000,
> 0xf9fa0000, 0x00000606, 0xfffff9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
> +       0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000,
> 0xf9fa0000, 0x00000606, 0xfffff9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
> +       0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000,
> 0xf9fa0000, 0x00000606, 0xfffff9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
> +       0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000,
> 0xf9fa0000, 0x00000606, 0xfffff9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
> +       0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000,
> 0xf9fa0000, 0x00000606, 0xfffff9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c,
> 0x00000000, 0x06060606, 0xf9f9f9fa,
> +       0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c,
> 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
> +       0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000,
> 0xf9fa0000, 0x00000606, 0xfffff9fa,
> +       0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e,
> 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
> +       0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000,
> 0xf8f90000, 0x00000707, 0xfffff8f9,
> +       0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e,
> 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
> +       0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000,
> 0xf8f90000, 0x00000707, 0xfffff8f9,
> +       0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e,
> 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
> +       0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000,
> 0xf8f90000, 0x00000707, 0xfffff8f9,
> +       0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e,
> 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
> +       0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000,
> 0xf8f90000, 0x00000707, 0xfffff8f9,
> +       0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e,
> 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
> +       0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000,
> 0xf8f90000, 0x00000707, 0xfffff8f9,
> +       0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515,
> 0x00000000, 0x07070707, 0xf8f8f8f9,
> +       0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e,
> 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
> +       0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000,
> 0xf8f90000, 0x00000707, 0xfffff8f9,
> +       0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808,
> 0xfffff7f8, 0x10101010, 0xefefeff0,
> +       0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x08080000, 0xf7f80000,
> +       0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808,
> 0xefeff7f8, 0x08081010, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808,
> 0xfffff7f8, 0x10101010, 0xefefeff0,
> +       0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x08080000, 0xf7f80000,
> +       0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808,
> 0xefeff7f8, 0x08081010, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808,
> 0xfffff7f8, 0x10101010, 0xefefeff0,
> +       0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x08080000, 0xf7f80000,
> +       0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808,
> 0xefeff7f8, 0x08081010, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808,
> 0xfffff7f8, 0x10101010, 0xefefeff0,
> +       0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x08080000, 0xf7f80000,
> +       0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808,
> 0xefeff7f8, 0x08081010, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808,
> 0xfffff7f8, 0x10101010, 0xefefeff0,
> +       0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x08080000, 0xf7f80000,
> +       0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808,
> 0xefeff7f8, 0x08081010, 0x00000000,
> +       0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808,
> 0xfffff7f8, 0x10101010, 0xefefeff0,
> +       0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808,
> 0xf7f7f7f8, 0x08080000, 0xf7f80000,
> +       0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808,
> 0xefeff7f8, 0x08081010, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0x00000000, 0x09090909, 0xf6f6f6f7,
> +       0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212,
> 0xedededee, 0x1b1b0909, 0xe4e4f6f7,
> +       0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7,
> 0x09090000, 0xf6f70000, 0x00000909,
> +       0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7,
> 0x09091b1b, 0xf6f6e4e5, 0x00000000,
> +       0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909,
> 0xfffff6f7, 0x12121212, 0xedededee,
> +       0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000,
> 0x09090909, 0xf6f6f6f7, 0x09090000,
> +       0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee,
> 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b,
> +       0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000,
> 0xf6f70000, 0x00000909, 0xfffff6f7,
> +       0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b,
> 0xf6f6e4e5, 0x00000000, 0x09090909,
> +       0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7,
> 0x12121212, 0xedededee, 0x1b1b0909,
> +       0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909,
> 0xf6f6f6f7, 0x09090000, 0xf6f70000,
> +       0x00000909, 0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909,
> 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5,
> +       0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000,
> 0x00000909, 0xfffff6f7, 0x12121212,
> +       0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5,
> 0x00000000, 0x09090909, 0xf6f6f6f7,
> +       0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212,
> 0xedededee, 0x1b1b0909, 0xe4e4f6f7,
> +       0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7,
> 0x09090000, 0xf6f70000, 0x00000909,
> +       0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7,
> 0x09091b1b, 0xf6f6e4e5, 0x00000000,
> +       0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909,
> 0xfffff6f7, 0x12121212, 0xedededee,
> +       0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000,
> 0x09090909, 0xf6f6f6f7, 0x09090000,
> +       0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee,
> 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b,
> +       0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000,
> 0xf6f70000, 0x00000909, 0xfffff6f7,
> +       0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b,
> 0xf6f6e4e5, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x02020202, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
> 0x02020202, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0xfdfdfdfe, 0x03030000, 0x03030000, 0x03030000, 0x03030000,
> 0x03030000, 0x03030000, 0x03030000,
> +       0x03030000, 0x03030000, 0x03030000, 0x03030000, 0xfcfd0000,
> 0xfcfd0000, 0xfcfd0000, 0xfcfd0000,
> +       0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000,
> 0xfcfd0000, 0xfcfd0000, 0x00000303,
> +       0x00000303, 0x00000303, 0x00000303, 0x00000303, 0x00000303,
> 0x00000303, 0x00000303, 0x00000303,
> +       0x00000303, 0x00000303, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd,
> 0xfffffcfd, 0xfffffcfd, 0xfffffcfd,
> +       0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd,
> 0x06060606, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0x06060606,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0x07070000, 0x07070000,
> 0x07070000, 0x07070000, 0x07070000,
> +       0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000,
> 0x07070000, 0xf8f90000, 0xf8f90000,
> +       0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000,
> 0xf8f90000, 0xf8f90000, 0xf8f90000,
> +       0xf8f90000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020000,
> 0x02020000, 0x02020000, 0x02020000,
> +       0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000,
> 0x02020000, 0x02020000, 0x02020000,
> +       0x02020000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
> 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
> +       0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
> 0xfdfe0000, 0x00000202, 0x00000202,
> +       0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202,
> 0x00000202, 0x00000202, 0x00000202,
> +       0x00000202, 0x00000202, 0x00000202, 0xfffffdfe, 0xfffffdfe,
> 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
> +       0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
> 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
> +       0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0xfdfdfdfe, 0xfdfdfdfe, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0x06060000,
> 0x06060000, 0x06060000, 0x06060000,
> +       0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000,
> 0x06060000, 0x06060000, 0x06060000,
> +       0x06060000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
> 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
> +       0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
> 0xf9fa0000, 0x00000606, 0x00000606,
> +       0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606,
> 0x00000606, 0x00000606, 0x00000606,
> +       0x00000606, 0x00000606, 0x00000606, 0xfffff9fa, 0xfffff9fa,
> 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
> +       0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
> 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020000,
> 0x02020000, 0x02020000, 0x02020000,
> +       0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000,
> 0x02020000, 0x02020000, 0x02020000,
> +       0x02020000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
> 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
> +       0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
> 0xfdfe0000, 0x00000202, 0x00000202,
> +       0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202,
> 0x00000202, 0x00000202, 0x00000202,
> +       0x00000202, 0x00000202, 0x00000202, 0xfffffdfe, 0xfffffdfe,
> 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
> +       0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
> 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
> +       0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
> 0x04040404, 0x04040404, 0x04040404,
> +       0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
> 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> +       0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> +       0xfbfbfbfc, 0xfbfbfbfc, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a,
> 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a,
> +       0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a,
> 0x0a0a0a0a, 0x0a0a0a0a, 0xf5f5f5f6,
> +       0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6,
> 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6,
> +       0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0x0a0a0000,
> 0x0a0a0000, 0x0a0a0000, 0x0a0a0000,
> +       0x0a0a0000, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000,
> 0x0a0a0000, 0x0a0a0000, 0x0a0a0000,
> +       0x0a0a0000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000,
> 0xf5f60000, 0xf5f60000, 0xf5f60000,
> +       0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000,
> 0xf5f60000, 0x00000a0a, 0x00000a0a,
> +       0x00000a0a, 0x00000a0a, 0x00000a0a, 0x00000a0a, 0x00000a0a,
> 0x00000a0a, 0x00000a0a, 0x00000a0a,
> +       0x00000a0a, 0x00000a0a, 0x00000a0a, 0xfffff5f6, 0xfffff5f6,
> 0xfffff5f6, 0xfffff5f6, 0xfffff5f6,
> +       0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6,
> 0xfffff5f6, 0xfffff5f6, 0xfffff5f6,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04040000,
> 0x04040000, 0x04040000, 0x04040000,
> +       0x04040000, 0x04040000, 0x04040000, 0x04040000, 0x04040000,
> 0x04040000, 0x04040000, 0x04040000,
> +       0x04040000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000,
> 0xfbfc0000, 0xfbfc0000, 0xfbfc0000,
> +       0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000,
> 0xfbfc0000, 0x00000404, 0x00000404,
> +       0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404,
> 0x00000404, 0x00000404, 0x00000404,
> +       0x00000404, 0x00000404, 0x00000404, 0xfffffbfc, 0xfffffbfc,
> 0xfffffbfc, 0xfffffbfc, 0xfffffbfc,
> +       0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc,
> 0xfffffbfc, 0xfffffbfc, 0xfffffbfc,
> +       0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
> 0x04040404, 0x04040404, 0x04040404,
> +       0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
> 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> +       0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
> +       0xfbfbfbfc, 0xfbfbfbfc, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0x0c0c0c0c, 0x0c0c0c0c, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0x0c0c0000,
> 0x0c0c0000, 0x0c0c0000, 0x0c0c0000,
> +       0x0c0c0000, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000,
> 0x0c0c0000, 0x0c0c0000, 0x0c0c0000,
> +       0x0c0c0000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000,
> 0xf3f40000, 0xf3f40000, 0xf3f40000,
> +       0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000,
> 0xf3f40000, 0x00000c0c, 0x00000c0c,
> +       0x00000c0c, 0x00000c0c, 0x00000c0c, 0x00000c0c, 0x00000c0c,
> 0x00000c0c, 0x00000c0c, 0x00000c0c,
> +       0x00000c0c, 0x00000c0c, 0x00000c0c, 0xfffff3f4, 0xfffff3f4,
> 0xfffff3f4, 0xfffff3f4, 0xfffff3f4,
> +       0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4,
> 0xfffff3f4, 0xfffff3f4, 0xfffff3f4,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0x14141414,
> +       0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
> 0xebebebec, 0xebebebec, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0x20202020,
> 0x20202020, 0x20202020, 0x20202020,
> +       0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
> 0x20202020, 0x20202020, 0x20202020,
> +       0x20202020, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> +       0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> 0xdfdfdfe0, 0x2e2e2e2e, 0x2e2e2e2e,
> +       0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
> 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
> +       0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0xd1d1d1d2, 0xd1d1d1d2,
> 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> +       0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0x14141414,
> +       0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
> 0xebebebec, 0xebebebec, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0x20202020,
> 0x20202020, 0x20202020, 0x20202020,
> +       0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
> 0x20202020, 0x20202020, 0x20202020,
> +       0x20202020, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> +       0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> 0xdfdfdfe0, 0x2e2e2e2e, 0x2e2e2e2e,
> +       0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
> 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
> +       0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0xd1d1d1d2, 0xd1d1d1d2,
> 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> +       0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0x14141414,
> +       0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
> 0xebebebec, 0xebebebec, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0x20202020,
> 0x20202020, 0x20202020, 0x20202020,
> +       0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
> 0x20202020, 0x20202020, 0x20202020,
> +       0x20202020, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> +       0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> 0xdfdfdfe0, 0x2e2e2e2e, 0x2e2e2e2e,
> +       0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
> 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
> +       0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0xd1d1d1d2, 0xd1d1d1d2,
> 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> +       0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> +       0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
> 0xdeadbeef, 0xdeadbeef, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
> 0x02020202, 0x02020202, 0x02020202,
> +       0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> +       0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
> 0xfdfdfdfe, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
> 0x06060606, 0x06060606, 0x06060606,
> +       0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> +       0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
> +       0xf3f3f3f4, 0xf3f3f3f4, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0x14141414,
> +       0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
> 0x14141414, 0x14141414, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
> 0xebebebec, 0xebebebec, 0xebebebec,
> +       0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0x20202020,
> 0x20202020, 0x20202020, 0x20202020,
> +       0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
> 0x20202020, 0x20202020, 0x20202020,
> +       0x20202020, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> +       0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
> 0xdfdfdfe0, 0x2e2e2e2e, 0x2e2e2e2e,
> +       0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
> 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
> +       0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0xd1d1d1d2, 0xd1d1d1d2,
> 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> +       0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
> +       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000
> +};
> +
> +} // End of namespace Image
> diff --git a/image/codecs/indeo3.h b/image/codecs/indeo3.h
> new file mode 100644
> index 0000000..275cbc1
> --- /dev/null
> +++ b/image/codecs/indeo3.h
> @@ -0,0 +1,94 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "common/scummsys.h"
> +
> +/* Intel Indeo 3 decompressor, derived from ffmpeg.
> + *
> + * Original copyright note:
> + * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
> + * written, produced, and directed by Alan Smithee
> + */
> +
> +#ifndef IMAGE_CODECS_INDEO3_H
> +#define IMAGE_CODECS_INDEO3_H
> +
> +#include "image/codecs/codec.h"
> +
> +namespace Image {
> +
> +/**
> + * Intel Indeo 3 decoder.
> + *
> + * Used in video:
> + *  - AVIDecoder
> + *  - VMDDecoder
> + */
> +class Indeo3Decoder : public Codec {
> +public:
> +       Indeo3Decoder(uint16 width, uint16 height);
> +       ~Indeo3Decoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const;
> +
> +       static bool isIndeo3(Common::SeekableReadStream &stream);
> +
> +private:
> +       Graphics::Surface *_surface;
> +
> +       Graphics::PixelFormat _pixelFormat;
> +
> +       static const int _corrector_type_0[24];
> +       static const int _corrector_type_2[8];
> +       static const uint32 correction[];
> +       static const uint32 correctionloworder[];
> +       static const uint32 correctionhighorder[];
> +
> +       struct YUVBufs {
> +               byte *Ybuf;
> +               byte *Ubuf;
> +               byte *Vbuf;
> +               byte *the_buf;
> +               uint32 the_buf_size;
> +               uint16 y_w, y_h;
> +               uint16 uv_w, uv_h;
> +       };
> +
> +       YUVBufs _iv_frame[2];
> +       YUVBufs *_cur_frame;
> +       YUVBufs *_ref_frame;
> +
> +       byte *_ModPred;
> +       uint16 *_corrector_type;
> +
> +       void buildModPred();
> +       void allocFrames();
> +
> +       void decodeChunk(byte *cur, byte *ref, int width, int height,
> +                       const byte *buf1, uint32 fflags2, const byte *hdr,
> +                       const byte *buf2, int min_width_160);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/jpeg.cpp b/image/codecs/jpeg.cpp
> new file mode 100644
> index 0000000..9e8ba5a
> --- /dev/null
> +++ b/image/codecs/jpeg.cpp
> @@ -0,0 +1,66 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "common/system.h"
> +#include "common/textconsole.h"
> +#include "graphics/surface.h"
> +#include "image/jpeg.h"
> +
> +#include "image/codecs/jpeg.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Image {
> +
> +JPEGCodec::JPEGCodec() : Codec() {
> +       _pixelFormat = g_system->getScreenFormat();
> +       _surface = NULL;
> +}
> +
> +JPEGCodec::~JPEGCodec() {
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +       }
> +}
> +
> +const Graphics::Surface
> *JPEGCodec::decodeImage(Common::SeekableReadStream *stream) {
> +       JPEGDecoder jpeg;
> +
> +       if (!jpeg.loadStream(*stream)) {
> +               warning("Failed to decode JPEG frame");
> +               return 0;
> +       }
> +
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +       }
> +
> +       _surface = jpeg.getSurface()->convertTo(_pixelFormat);
> +
> +       return _surface;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/jpeg.h b/image/codecs/jpeg.h
> new file mode 100644
> index 0000000..d48604b
> --- /dev/null
> +++ b/image/codecs/jpeg.h
> @@ -0,0 +1,60 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_JPEG_H
> +#define IMAGE_CODECS_JPEG_H
> +
> +#include "image/codecs/codec.h"
> +#include "graphics/pixelformat.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Graphics {
> +struct Surface;
> +}
> +
> +namespace Image {
> +
> +/**
> + * JPEG decoder.
> + *
> + * Used in video:
> + *  - QuickTimeDecoder
> + */
> +class JPEGCodec : public Codec {
> +public:
> +       JPEGCodec();
> +       ~JPEGCodec();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> _pixelFormat; }
> +
> +private:
> +       Graphics::PixelFormat _pixelFormat;
> +       Graphics::Surface *_surface;
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/mjpeg.cpp b/image/codecs/mjpeg.cpp
> new file mode 100644
> index 0000000..aa7e1d0
> --- /dev/null
> +++ b/image/codecs/mjpeg.cpp
> @@ -0,0 +1,217 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// Based on LGPL MJPEG/AVI to JPEG/JFIF conversion code from libav
> +// Copyright (c) 2010 Adrian Daerr and Nicolas George
> +// That in turn was adapted from mjpeg2jpeg.c, with original copyright:
> +// Paris 2010 Adrian Daerr, public domain
> +
> +#include "common/memstream.h"
> +#include "common/system.h"
> +#include "common/textconsole.h"
> +#include "graphics/surface.h"
> +#include "image/jpeg.h"
> +
> +#include "image/codecs/mjpeg.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Image {
> +
> +MJPEGDecoder::MJPEGDecoder() : Codec() {
> +       _pixelFormat = g_system->getScreenFormat();
> +       _surface = 0;
> +}
> +
> +MJPEGDecoder::~MJPEGDecoder() {
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +       }
> +}
> +
> +// Header to be inserted
> +static const byte s_jpegHeader[] = {
> +       0xff, 0xd8,                     // SOI
> +       0xff, 0xe0,                     // APP0
> +       0x00, 0x10,                     // APP0 header size (including
> +                                       // this field, but excluding
> preceding)
> +       'J', 'F', 'I', 'F', 0x00,       // ID string 'JFIF\0'
> +       0x01, 0x01,                     // version
> +       0x00,                           // bits per type
> +       0x00, 0x00,                     // X density
> +       0x00, 0x00,                     // Y density
> +       0x00,                           // X thumbnail size
> +       0x00
> +};
> +
> +enum {
> +       DHT_SEGMENT_SIZE = 420
> +};
> +
> +static const byte s_dhtSegmentHead[] = { 0xFF, 0xC4, 0x01, 0xA2, 0x00 };
> +static const byte s_dhtSegmentFrag[] = {
> +       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
> +       0x0a, 0x0b, 0x01, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01,
> +       0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
> +};
> +
> +// Set up the standard Huffman tables (cf. JPEG standard section K.3)
> +// IMPORTANT: these are only valid for 8-bit data precision!
> +static const byte s_mjpegBitsDCLuminance[17] = {
> +       /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
> +};
> +
> +static const byte s_mjpegValDC[12] = {
> +       0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
> +};
> +
> +static const byte s_mjpegBitsDCChrominance[17] = {
> +       /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
> +};
> +
> +static const byte s_mjpegBitsACLuminance[17] = {
> +       /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
> +};
> +
> +static const byte s_mjpegValACLuminance[] = {
> +       0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
> +       0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
> +       0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
> +       0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
> +       0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
> +       0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
> +       0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
> +       0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
> +       0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
> +       0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
> +       0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
> +       0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
> +       0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
> +       0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
> +       0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
> +       0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
> +       0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
> +       0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
> +       0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
> +       0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
> +       0xf9, 0xfa
> +};
> +
> +static const byte s_mjpegBitsACChrominance[17] = {
> +       /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
> +};
> +
> +static const byte s_mjpegValACChrominance[] = {
> +       0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
> +       0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
> +       0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
> +       0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
> +       0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
> +       0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
> +       0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
> +       0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
> +       0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
> +       0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
> +       0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
> +       0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
> +       0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
> +       0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
> +       0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
> +       0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
> +       0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
> +       0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
> +       0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
> +       0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
> +       0xf9, 0xfa
> +};
> +
> +const Graphics::Surface
> *MJPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +       // We need to reconstruct an actual JPEG stream here, then feed it
> to the JPEG decoder
> +       // Yes, this is a pain.
> +
> +       stream->readUint32BE(); // Skip nonsense JPEG header
> +       uint16 inputSkip = stream->readUint16BE() + 4;
> +       uint32 tag = stream->readUint32BE();
> +
> +       if (tag != MKTAG('A', 'V', 'I', '1')) {
> +               warning("Invalid MJPEG tag found");
> +               return 0;
> +       }
> +
> +       uint32 outputSize = stream->size() - inputSkip +
> sizeof(s_jpegHeader) + DHT_SEGMENT_SIZE;
> +       byte *data = (byte *)malloc(outputSize);
> +
> +       if (!data) {
> +               warning("Failed to allocate data for MJPEG conversion");
> +               return 0;
> +       }
> +
> +       // Copy the header
> +       memcpy(data, s_jpegHeader, sizeof(s_jpegHeader));
> +       uint32 dataOffset = sizeof(s_jpegHeader);
> +
> +       // Write the fake DHT segment
> +       memcpy(data + dataOffset, s_dhtSegmentHead,
> sizeof(s_dhtSegmentHead));
> +       dataOffset += sizeof(s_dhtSegmentHead);
> +       memcpy(data + dataOffset, s_mjpegBitsDCLuminance + 1, 16);
> +       dataOffset += 16;
> +       memcpy(data + dataOffset, s_dhtSegmentFrag,
> sizeof(s_dhtSegmentFrag));
> +       dataOffset += sizeof(s_dhtSegmentFrag);
> +       memcpy(data + dataOffset, s_mjpegValDC, 12);
> +       dataOffset += 12;
> +       data[dataOffset++] = 0x10;
> +       memcpy(data + dataOffset, s_mjpegBitsACLuminance + 1, 16);
> +       dataOffset += 16;
> +       memcpy(data + dataOffset, s_mjpegValACLuminance, 162);
> +       dataOffset += 162;
> +       data[dataOffset++] = 0x11;
> +       memcpy(data + dataOffset, s_mjpegBitsACChrominance + 1, 16);
> +       dataOffset += 16;
> +       memcpy(data + dataOffset, s_mjpegValACChrominance, 162);
> +       dataOffset += 162;
> +
> +       // Write the actual data
> +       stream->seek(inputSkip);
> +       stream->read(data + dataOffset, stream->size() - inputSkip);
> +
> +       Common::MemoryReadStream convertedStream(data, outputSize,
> DisposeAfterUse::YES);
> +       JPEGDecoder jpeg;
> +
> +       if (!jpeg.loadStream(convertedStream)) {
> +               warning("Failed to decode MJPEG frame");
> +               return 0;
> +       }
> +
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +       }
> +
> +       _surface = jpeg.getSurface()->convertTo(_pixelFormat);
> +
> +       return _surface;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/mjpeg.h b/image/codecs/mjpeg.h
> new file mode 100644
> index 0000000..b34b84b
> --- /dev/null
> +++ b/image/codecs/mjpeg.h
> @@ -0,0 +1,60 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_MJPEG_H
> +#define IMAGE_CODECS_MJPEG_H
> +
> +#include "image/codecs/codec.h"
> +#include "graphics/pixelformat.h"
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Graphics {
> +struct Surface;
> +}
> +
> +namespace Image {
> +
> +/**
> + * Motion JPEG decoder.
> + *
> + * Used in video:
> + *  - AVIDecoder
> + */
> +class MJPEGDecoder : public Codec {
> +public:
> +       MJPEGDecoder();
> +       ~MJPEGDecoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> _pixelFormat; }
> +
> +private:
> +       Graphics::PixelFormat _pixelFormat;
> +       Graphics::Surface *_surface;
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/mpeg.cpp b/image/codecs/mpeg.cpp
> new file mode 100644
> index 0000000..d81123f
> --- /dev/null
> +++ b/image/codecs/mpeg.cpp
> @@ -0,0 +1,107 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "common/debug.h"
> +#include "common/stream.h"
> +#include "common/system.h"
> +#include "common/textconsole.h"
> +#include "graphics/surface.h"
> +#include "graphics/yuv_to_rgb.h"
> +
> +#include "image/codecs/mpeg.h"
> +
> +namespace Image {
> +
> +MPEGDecoder::MPEGDecoder() : Codec() {
> +       _pixelFormat = g_system->getScreenFormat();
> +       _surface = 0;
> +
> +       _mpegDecoder = mpeg2_init();
> +
> +       if (!_mpegDecoder)
> +               error("Could not initialize libmpeg2");
> +
> +       _mpegInfo = mpeg2_info(_mpegDecoder);
> +}
> +
> +MPEGDecoder::~MPEGDecoder() {
> +       mpeg2_close(_mpegDecoder);
> +
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +       }
> +}
> +
> +const Graphics::Surface
> *MPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +       uint32 framePeriod;
> +       decodePacket(stream, framePeriod);
> +       return _surface;
> +}
> +
> +bool MPEGDecoder::decodePacket(Common::SeekableReadStream *packet, uint32
> &framePeriod, Graphics::Surface *dst) {
> +       // Decode as much as we can out of this packet
> +       uint32 size = 0xFFFFFFFF;
> +       mpeg2_state_t state;
> +       bool foundFrame = false;
> +       framePeriod = 0;
> +
> +       do {
> +               state = mpeg2_parse(_mpegDecoder);
> +
> +               switch (state) {
> +               case STATE_BUFFER:
> +                       size = packet->read(_buffer, BUFFER_SIZE);
> +                       mpeg2_buffer(_mpegDecoder, _buffer, _buffer +
> size);
> +                       break;
> +               case STATE_SLICE:
> +               case STATE_END:
> +                       if (_mpegInfo->display_fbuf) {
> +                               foundFrame = true;
> +                               const mpeg2_sequence_t *sequence =
> _mpegInfo->sequence;
> +
> +                               framePeriod += sequence->frame_period;
> +
> +                               if (!dst) {
> +                                       // If no destination is specified,
> use our internal storage
> +                                       if (!_surface) {
> +                                               _surface = new
> Graphics::Surface();
> +
> _surface->create(sequence->picture_width, sequence->picture_height,
> _pixelFormat);
> +                                       }
> +
> +                                       dst = _surface;
> +                               }
> +
> +                               YUVToRGBMan.convert420(dst,
> Graphics::YUVToRGBManager::kScaleITU, _mpegInfo->display_fbuf->buf[0],
> +
> _mpegInfo->display_fbuf->buf[1], _mpegInfo->display_fbuf->buf[2],
> sequence->picture_width,
> +                                               sequence->picture_height,
> sequence->width, sequence->chroma_width);
> +                       }
> +                       break;
> +               default:
> +                       break;
> +               }
> +       } while (size != 0);
> +
> +       return foundFrame;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/mpeg.h b/image/codecs/mpeg.h
> new file mode 100644
> index 0000000..b9e961c
> --- /dev/null
> +++ b/image/codecs/mpeg.h
> @@ -0,0 +1,98 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifdef USE_MPEG2
> +
> +#ifndef IMAGE_CODECS_MPEG_H
> +#define IMAGE_CODECS_MPEG_H
> +
> +#include "image/codecs/codec.h"
> +#include "graphics/pixelformat.h"
> +
> +#if defined(__PLAYSTATION2__)
> +       typedef uint8 uint8_t;
> +       typedef uint16 uint16_t;
> +       typedef uint32 uint32_t;
> +#elif defined(_WIN32_WCE)
> +       typedef signed char int8_t;
> +       typedef signed short int16_t;
> +       typedef unsigned char uint8_t;
> +       typedef unsigned short uint16_t;
> +#elif defined(_MSC_VER) || defined (__SYMBIAN32__)
> +       typedef signed char int8_t;
> +       typedef signed short int16_t;
> +       typedef unsigned char uint8_t;
> +       typedef unsigned short uint16_t;
> +       #if !defined(SDL_COMPILEDVERSION) || (SDL_COMPILEDVERSION < 1210)
> +       typedef signed long int32_t;
> +       typedef unsigned long uint32_t;
> +       #endif
> +#else
> +#      include <inttypes.h>
> +#endif
> +
> +extern "C" {
> +       #include <mpeg2dec/mpeg2.h>
> +}
> +
> +namespace Common {
> +class SeekableReadStream;
> +}
> +
> +namespace Graphics {
> +struct Surface;
> +}
> +
> +namespace Image {
> +
> +// MPEG 1/2 video decoder
> +
> +class MPEGDecoder : public Codec {
> +public:
> +       MPEGDecoder();
> +       ~MPEGDecoder();
> +
> +       // Codec interface
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> _pixelFormat; }
> +
> +       // MPEGPSDecoder call
> +       bool decodePacket(Common::SeekableReadStream *packet, uint32
> &framePeriod, Graphics::Surface *dst = 0);
> +
> +private:
> +       Graphics::PixelFormat _pixelFormat;
> +       Graphics::Surface *_surface;
> +
> +       enum {
> +               BUFFER_SIZE = 4096
> +       };
> +
> +       byte _buffer[BUFFER_SIZE];
> +       mpeg2dec_t *_mpegDecoder;
> +       const mpeg2_info_t *_mpegInfo;
> +};
> +
> +} // End of namespace Image
> +
> +#endif // IMAGE_CODECS_MPEG_H
> +
> +#endif // USE_MPEG2
> diff --git a/image/codecs/msrle.cpp b/image/codecs/msrle.cpp
> new file mode 100644
> index 0000000..951de83
> --- /dev/null
> +++ b/image/codecs/msrle.cpp
> @@ -0,0 +1,132 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// Based off ffmpeg's msrledec.c
> +
> +#include "image/codecs/msrle.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +
> +namespace Image {
> +
> +MSRLEDecoder::MSRLEDecoder(uint16 width, uint16 height, byte
> bitsPerPixel) {
> +       _surface = new Graphics::Surface();
> +       _surface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> +       _bitsPerPixel = bitsPerPixel;
> +}
> +
> +MSRLEDecoder::~MSRLEDecoder() {
> +       _surface->free();
> +       delete _surface;
> +}
> +
> +const Graphics::Surface
> *MSRLEDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +       if (_bitsPerPixel == 8) {
> +               decode8(stream);
> +       } else
> +               error("Unhandled %d bit Microsoft RLE encoding",
> _bitsPerPixel);
> +
> +       return _surface;
> +}
> +
> +void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) {
> +
> +       int x = 0;
> +       int y = _surface->h - 1;
> +
> +       byte *data = (byte *) _surface->getPixels();
> +       uint16 width  = _surface->w;
> +       uint16 height = _surface->h;
> +
> +       byte *output     = data + ((height - 1) * width);
> +       byte *output_end = data + ((height)     * width);
> +
> +       while (!stream->eos()) {
> +               byte count = stream->readByte();
> +               byte value = stream->readByte();
> +
> +               if (count == 0) {
> +                       if (value == 0) {
> +                               // End of line
> +
> +                               x = 0;
> +                               y--;
> +                               output = data + (y * width);
> +
> +                               if (y < 0) {
> +                                       warning("MS RLE Codec: Next line
> is beyond picture bounds");
> +                                       return;
> +                               }
> +
> +                       } else if (value == 1) {
> +                               // End of image
> +
> +                               return;
> +                       } else if (value == 2) {
> +                               // Skip
> +
> +                               count = stream->readByte();
> +                               value = stream->readByte();
> +
> +                               y -= value;
> +                               x += count;
> +
> +                               if (y < 0) {
> +                                       warning("MS RLE Codec: Skip beyond
> picture bounds");
> +                                       return;
> +                               }
> +
> +                               output = data + ((y * width) + x);
> +
> +                       } else {
> +                               // Copy data
> +
> +                               if (output + value > output_end) {
> +                                       stream->skip(value);
> +                                       continue;
> +                               }
> +
> +                               for (int i = 0; i < value; i++)
> +                                       *output++ = stream->readByte();
> +
> +                               if (value & 1)
> +                                       stream->skip(1);
> +
> +                               x += value;
> +                       }
> +
> +               } else {
> +                       // Run data
> +
> +                       if (output + count > output_end)
> +                               continue;
> +
> +                       for (int i = 0; i < count; i++, x++)
> +                               *output++ = value;
> +               }
> +
> +       }
> +
> +       warning("MS RLE Codec: No end-of-picture code");
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/msrle.h b/image/codecs/msrle.h
> new file mode 100644
> index 0000000..10e3531
> --- /dev/null
> +++ b/image/codecs/msrle.h
> @@ -0,0 +1,54 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_MSRLE_H
> +#define IMAGE_CODECS_MSRLE_H
> +
> +#include "image/codecs/codec.h"
> +
> +namespace Image {
> +
> +/**
> + * Microsoft Run-Length Encoding decoder.
> + *
> + * Used in video:
> + *  - AVIDecoder
> + */
> +class MSRLEDecoder : public Codec {
> +public:
> +       MSRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel);
> +       ~MSRLEDecoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat::createFormatCLUT8(); }
> +
> +private:
> +       byte _bitsPerPixel;
> +
> +       Graphics::Surface *_surface;
> +
> +       void decode8(Common::SeekableReadStream *stream);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/msvideo1.cpp b/image/codecs/msvideo1.cpp
> new file mode 100644
> index 0000000..e94afed
> --- /dev/null
> +++ b/image/codecs/msvideo1.cpp
> @@ -0,0 +1,139 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> + // Based off ffmpeg's msvideo.cpp
> +
> +#include "image/codecs/msvideo1.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +
> +namespace Image {
> +
> +#define CHECK_STREAM_PTR(n) \
> +  if ((stream->pos() + n) > stream->size() ) { \
> +       warning ("MS Video-1: Stream out of bounds (%d >= %d)",
> stream->pos() + n, stream->size()); \
> +    return; \
> +  }
> +
> +MSVideo1Decoder::MSVideo1Decoder(uint16 width, uint16 height, byte
> bitsPerPixel) : Codec() {
> +       _surface = new Graphics::Surface();
> +       // TODO: Specify the correct pixel format for 2Bpp mode.
> +       _surface->create(width, height, (bitsPerPixel == 8) ?
> Graphics::PixelFormat::createFormatCLUT8() : Graphics::PixelFormat(2, 0, 0,
> 0, 0, 0, 0, 0, 0));
> +       _bitsPerPixel = bitsPerPixel;
> +}
> +
> +MSVideo1Decoder::~MSVideo1Decoder() {
> +       _surface->free();
> +       delete _surface;
> +}
> +
> +void MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) {
> +    byte colors[8];
> +    byte *pixels = (byte *)_surface->getPixels();
> +    uint16 stride = _surface->w;
> +
> +    int skipBlocks = 0;
> +    uint16 blocks_wide = _surface->w / 4;
> +    uint16 blocks_high = _surface->h / 4;
> +    uint32 totalBlocks = blocks_wide * blocks_high;
> +    uint32 blockInc = 4;
> +    uint16 rowDec = stride + 4;
> +
> +    for (uint16 block_y = blocks_high; block_y > 0; block_y--) {
> +        uint32 blockPtr = (block_y * 4 - 1) * stride;
> +        for (uint16 block_x = blocks_wide; block_x > 0; block_x--) {
> +            // check if this block should be skipped
> +            if (skipBlocks > 0) {
> +                blockPtr += blockInc;
> +                skipBlocks--;
> +                totalBlocks--;
> +                continue;
> +            }
> +
> +            uint32 pixelPtr = blockPtr;
> +
> +            /* get the next two bytes in the encoded data stream */
> +            CHECK_STREAM_PTR(2);
> +            byte byte_a = stream->readByte();
> +            byte byte_b = stream->readByte();
> +
> +            /* check if the decode is finished */
> +            if (byte_a == 0 && byte_b == 0 && totalBlocks == 0) {
> +                return;
> +            } else if ((byte_b & 0xFC) == 0x84) {
> +                // skip code, but don't count the current block
> +                skipBlocks = ((byte_b - 0x84) << 8) + byte_a - 1;
> +            } else if (byte_b < 0x80) {
> +                // 2-color encoding
> +                uint16 flags = (byte_b << 8) | byte_a;
> +
> +                CHECK_STREAM_PTR(2);
> +                colors[0] = stream->readByte();
> +                colors[1] = stream->readByte();
> +
> +                for (byte pixel_y = 0; pixel_y < 4; pixel_y++) {
> +                    for (byte pixel_x = 0; pixel_x < 4; pixel_x++, flags
> >>= 1)
> +                        pixels[pixelPtr++] = colors[(flags & 0x1) ^ 1];
> +                    pixelPtr -= rowDec;
> +                }
> +            } else if (byte_b >= 0x90) {
> +                // 8-color encoding
> +                uint16 flags = (byte_b << 8) | byte_a;
> +
> +                CHECK_STREAM_PTR(8);
> +                               for (byte i = 0; i < 8; i++)
> +                                       colors[i] = stream->readByte();
> +
> +                for (byte pixel_y = 0; pixel_y < 4; pixel_y++) {
> +                    for (byte pixel_x = 0; pixel_x < 4; pixel_x++, flags
> >>= 1)
> +                        pixels[pixelPtr++] = colors[((pixel_y & 0x2) <<
> 1) + (pixel_x & 0x2) + ((flags & 0x1) ^ 1)];
> +                    pixelPtr -= rowDec;
> +                }
> +            } else {
> +                // 1-color encoding
> +                colors[0] = byte_a;
> +
> +                for (byte pixel_y = 0; pixel_y < 4; pixel_y++) {
> +                    for (byte pixel_x = 0; pixel_x < 4; pixel_x++)
> +                        pixels[pixelPtr++] = colors[0];
> +                    pixelPtr -= rowDec;
> +                }
> +            }
> +
> +            blockPtr += blockInc;
> +            totalBlocks--;
> +        }
> +    }
> +}
> +
> +const Graphics::Surface
> *MSVideo1Decoder::decodeImage(Common::SeekableReadStream *stream) {
> +       if (_bitsPerPixel == 8)
> +               decode8(stream);
> +       else {
> +    // decode16(stream);
> +               error ("Unhandled MS Video-1 16bpp encoding");
> +       }
> +
> +    return _surface;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/msvideo1.h b/image/codecs/msvideo1.h
> new file mode 100644
> index 0000000..517936d
> --- /dev/null
> +++ b/image/codecs/msvideo1.h
> @@ -0,0 +1,55 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_MSVIDEO1_H
> +#define IMAGE_CODECS_MSVIDEO1_H
> +
> +#include "image/codecs/codec.h"
> +
> +namespace Image {
> +
> +/**
> + * Microsoft Video 1 decoder.
> + *
> + * Used in video:
> + *  - AVIDecoder
> + */
> +class MSVideo1Decoder : public Codec {
> +public:
> +       MSVideo1Decoder(uint16 width, uint16 height, byte bitsPerPixel);
> +       ~MSVideo1Decoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat::createFormatCLUT8(); }
> +
> +private:
> +       byte _bitsPerPixel;
> +
> +       Graphics::Surface *_surface;
> +
> +       void decode8(Common::SeekableReadStream *stream);
> +       //void decode16(Common::SeekableReadStream *stream);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/qtrle.cpp b/image/codecs/qtrle.cpp
> new file mode 100644
> index 0000000..a609e9b
> --- /dev/null
> +++ b/image/codecs/qtrle.cpp
> @@ -0,0 +1,431 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// QuickTime RLE Decoder
> +// Based off ffmpeg's QuickTime RLE decoder (written by Mike Melanson)
> +
> +#include "image/codecs/qtrle.h"
> +
> +#include "common/debug.h"
> +#include "common/scummsys.h"
> +#include "common/stream.h"
> +#include "common/system.h"
> +#include "common/textconsole.h"
> +#include "graphics/colormasks.h"
> +#include "graphics/surface.h"
> +
> +namespace Image {
> +
> +QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte
> bitsPerPixel) : Codec() {
> +       _bitsPerPixel = bitsPerPixel;
> +
> +       // We need to ensure the width is a multiple of 4
> +       uint16 wMod = width % 4;
> +       if (wMod != 0)
> +               width += 4 - wMod;
> +
> +       _surface = new Graphics::Surface();
> +       _surface->create(width, height, getPixelFormat());
> +}
> +
> +#define CHECK_STREAM_PTR(n) \
> +  if ((stream->pos() + n) > stream->size()) { \
> +    warning("QTRLE Problem: stream out of bounds (%d > %d)",
> stream->pos() + n, stream->size()); \
> +    return; \
> +  }
> +
> +#define CHECK_PIXEL_PTR(n) \
> +  if ((int32)pixelPtr + n > _surface->w * _surface->h) { \
> +    warning("QTRLE Problem: pixel ptr = %d, pixel limit = %d", pixelPtr +
> n, _surface->w * _surface->h); \
> +    return; \
> +  } \
> +
> +void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +       uint32 pixelPtr = 0;
> +       byte *rgb = (byte *)_surface->getPixels();
> +
> +       while (linesToChange) {
> +               CHECK_STREAM_PTR(2);
> +               byte skip = stream->readByte();
> +               int8 rleCode = stream->readSByte();
> +
> +               if (rleCode == 0)
> +                       break;
> +
> +               if (skip & 0x80) {
> +                       linesToChange--;
> +                       rowPtr += _surface->w;
> +                       pixelPtr = rowPtr + 2 * (skip & 0x7f);
> +               } else
> +                       pixelPtr += 2 * skip;
> +
> +               if (rleCode < 0) {
> +                       // decode the run length code
> +                       rleCode = -rleCode;
> +                       // get the next 2 bytes from the stream, treat
> them as groups of 8 pixels, and output them rleCode times */
> +                       CHECK_STREAM_PTR(2);
> +                       byte pi0 = stream->readByte();
> +                       byte pi1 = stream->readByte();
> +                       CHECK_PIXEL_PTR(rleCode * 2);
> +
> +                       while (rleCode--) {
> +                               rgb[pixelPtr++] = pi0;
> +                               rgb[pixelPtr++] = pi1;
> +                       }
> +               } else {
> +                       // copy the same pixel directly to output 2 times
> +                       rleCode *= 2;
> +                       CHECK_STREAM_PTR(rleCode);
> +                       CHECK_PIXEL_PTR(rleCode);
> +
> +                       while (rleCode--)
> +                               rgb[pixelPtr++] = stream->readByte();
> +               }
> +       }
> +}
> +
> +void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange, byte bpp) {
> +       uint32 pixelPtr = 0;
> +       byte *rgb = (byte *)_surface->getPixels();
> +       byte numPixels = (bpp == 4) ? 8 : 16;
> +
> +       while (linesToChange--) {
> +               CHECK_STREAM_PTR(2);
> +               pixelPtr = rowPtr + (numPixels * (stream->readByte() - 1));
> +
> +               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +                       if (rleCode == 0) {
> +                               // there's another skip code in the stream
> +                               CHECK_STREAM_PTR(1);
> +                               pixelPtr += (numPixels *
> (stream->readByte() - 1));
> +                       } else if (rleCode < 0) {
> +                               // decode the run length code
> +                               rleCode = -rleCode;
> +
> +                               // get the next 4 bytes from the stream,
> treat them as palette indices, and output them rleCode times */
> +                               CHECK_STREAM_PTR(4);
> +
> +                               byte pi[16]; // 16 palette indices
> +
> +                               for (int8 i = numPixels - 1; i >= 0; i--) {
> +                                       pi[numPixels - 1 - i] =
> (stream->readByte() >> ((i * bpp) & 0x07)) & ((1 << bpp) - 1);
> +
> +                                       if ((i & ((numPixels >> 2) - 1))
> == 0)
> +                                               stream->readByte();
> +                               }
> +
> +                               CHECK_PIXEL_PTR(rleCode * numPixels);
> +
> +                               while (rleCode--)
> +                                       for (byte i = 0; i < numPixels;
> i++)
> +                                               rgb[pixelPtr++] = pi[i];
> +                       } else {
> +                               // copy the same pixel directly to output
> 4 times
> +                               rleCode *= 4;
> +                               CHECK_STREAM_PTR(rleCode);
> +                               CHECK_PIXEL_PTR(rleCode * (numPixels >>
> 2));
> +
> +                               while (rleCode--) {
> +                                       byte temp = stream->readByte();
> +                                       if (bpp == 4) {
> +                                               rgb[pixelPtr++] = (temp >>
> 4) & 0x0f;
> +                                               rgb[pixelPtr++] = temp &
> 0x0f;
> +                                       } else {
> +                                               rgb[pixelPtr++] = (temp >>
> 6) & 0x03;
> +                                               rgb[pixelPtr++] = (temp >>
> 4) & 0x03;
> +                                               rgb[pixelPtr++] = (temp >>
> 2) & 0x03;
> +                                               rgb[pixelPtr++] = temp &
> 0x03;
> +                                       }
> +                               }
> +                       }
> +               }
> +
> +               rowPtr += _surface->w;
> +       }
> +}
> +
> +void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +       uint32 pixelPtr = 0;
> +       byte *rgb = (byte *)_surface->getPixels();
> +
> +       while (linesToChange--) {
> +               CHECK_STREAM_PTR(2);
> +               pixelPtr = rowPtr + 4 * (stream->readByte() - 1);
> +
> +               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +                       if (rleCode == 0) {
> +                               // there's another skip code in the stream
> +                               CHECK_STREAM_PTR(1);
> +                               pixelPtr += 4 * (stream->readByte() - 1);
> +                       } else if (rleCode < 0) {
> +                               // decode the run length code
> +                               rleCode = -rleCode;
> +
> +                               // get the next 4 bytes from the stream,
> treat them as palette indices, and output them rleCode times
> +                               CHECK_STREAM_PTR(4);
> +
> +                               byte pi[4];  // 4 palette indexes
> +
> +                               for (byte i = 0; i < 4; i++)
> +                                       pi[i] = stream->readByte();
> +
> +                               CHECK_PIXEL_PTR(rleCode * 4);
> +
> +                               while (rleCode--)
> +                                       for (byte i = 0; i < 4; i++)
> +                                               rgb[pixelPtr++] = pi[i];
> +                       } else {
> +                               // copy the same pixel directly to output
> 4 times
> +                               rleCode *= 4;
> +                               CHECK_STREAM_PTR(rleCode);
> +                               CHECK_PIXEL_PTR(rleCode);
> +
> +                               while (rleCode--)
> +                                       rgb[pixelPtr++] =
> stream->readByte();
> +                       }
> +               }
> +
> +               rowPtr += _surface->w;
> +       }
> +}
> +
> +void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +       uint32 pixelPtr = 0;
> +       uint16 *rgb = (uint16 *)_surface->getPixels();
> +
> +       while (linesToChange--) {
> +               CHECK_STREAM_PTR(2);
> +               pixelPtr = rowPtr + stream->readByte() - 1;
> +
> +               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +                       if (rleCode == 0) {
> +                               // there's another skip code in the stream
> +                               CHECK_STREAM_PTR(1);
> +                               pixelPtr += stream->readByte() - 1;
> +                       } else if (rleCode < 0) {
> +                               // decode the run length code
> +                               rleCode = -rleCode;
> +                               CHECK_STREAM_PTR(2);
> +
> +                               uint16 rgb16 = stream->readUint16BE();
> +
> +                               CHECK_PIXEL_PTR(rleCode);
> +
> +                               while (rleCode--)
> +                                       rgb[pixelPtr++] = rgb16;
> +                       } else {
> +                               CHECK_STREAM_PTR(rleCode * 2);
> +                               CHECK_PIXEL_PTR(rleCode);
> +
> +                               // copy pixels directly to output
> +                               while (rleCode--)
> +                                       rgb[pixelPtr++] =
> stream->readUint16BE();
> +                       }
> +               }
> +
> +               rowPtr += _surface->w;
> +       }
> +}
> +
> +void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +       uint32 pixelPtr = 0;
> +       uint32 *rgb = (uint32 *)_surface->getPixels();
> +
> +       while (linesToChange--) {
> +               CHECK_STREAM_PTR(2);
> +               pixelPtr = rowPtr + stream->readByte() - 1;
> +
> +               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +                       if (rleCode == 0) {
> +                               // there's another skip code in the stream
> +                               CHECK_STREAM_PTR(1);
> +                               pixelPtr += stream->readByte() - 1;
> +                       } else if (rleCode < 0) {
> +                               // decode the run length code
> +                               rleCode = -rleCode;
> +
> +                               CHECK_STREAM_PTR(3);
> +
> +                               byte r = stream->readByte();
> +                               byte g = stream->readByte();
> +                               byte b = stream->readByte();
> +                               uint32 color =
> _surface->format.RGBToColor(r, g, b);
> +
> +                               CHECK_PIXEL_PTR(rleCode);
> +
> +                               while (rleCode--)
> +                                       rgb[pixelPtr++] = color;
> +                       } else {
> +                               CHECK_STREAM_PTR(rleCode * 3);
> +                               CHECK_PIXEL_PTR(rleCode);
> +
> +                               // copy pixels directly to output
> +                               while (rleCode--) {
> +                                       byte r = stream->readByte();
> +                                       byte g = stream->readByte();
> +                                       byte b = stream->readByte();
> +                                       rgb[pixelPtr++] =
> _surface->format.RGBToColor(r, g, b);
> +                               }
> +                       }
> +               }
> +
> +               rowPtr += _surface->w;
> +       }
> +}
> +
> +void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +       uint32 pixelPtr = 0;
> +       uint32 *rgb = (uint32 *)_surface->getPixels();
> +
> +       while (linesToChange--) {
> +               CHECK_STREAM_PTR(2);
> +               pixelPtr = rowPtr + stream->readByte() - 1;
> +
> +               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +                       if (rleCode == 0) {
> +                               // there's another skip code in the stream
> +                               CHECK_STREAM_PTR(1);
> +                               pixelPtr += stream->readByte() - 1;
> +                       } else if (rleCode < 0) {
> +                               // decode the run length code
> +                               rleCode = -rleCode;
> +
> +                               CHECK_STREAM_PTR(4);
> +
> +                               byte a = stream->readByte();
> +                               byte r = stream->readByte();
> +                               byte g = stream->readByte();
> +                               byte b = stream->readByte();
> +                               uint32 color =
> _surface->format.ARGBToColor(a, r, g, b);
> +
> +                               CHECK_PIXEL_PTR(rleCode);
> +
> +                               while (rleCode--)
> +                                       rgb[pixelPtr++] = color;
> +                       } else {
> +                               CHECK_STREAM_PTR(rleCode * 4);
> +                               CHECK_PIXEL_PTR(rleCode);
> +
> +                               // copy pixels directly to output
> +                               while (rleCode--) {
> +                                       byte a = stream->readByte();
> +                                       byte r = stream->readByte();
> +                                       byte g = stream->readByte();
> +                                       byte b = stream->readByte();
> +                                       rgb[pixelPtr++] =
> _surface->format.ARGBToColor(a, r, g, b);
> +                               }
> +                       }
> +               }
> +
> +               rowPtr += _surface->w;
> +       }
> +}
> +
> +const Graphics::Surface
> *QTRLEDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +       uint16 startLine = 0;
> +       uint16 height = _surface->h;
> +
> +       // check if this frame is even supposed to change
> +       if (stream->size() < 8)
> +               return _surface;
> +
> +       // start after the chunk size
> +       stream->readUint32BE();
> +
> +       // fetch the header
> +       uint16 header = stream->readUint16BE();
> +
> +       // if a header is present, fetch additional decoding parameters
> +       if (header & 8) {
> +               if (stream->size() < 14)
> +                       return _surface;
> +
> +               startLine = stream->readUint16BE();
> +               stream->readUint16BE(); // Unknown
> +               height = stream->readUint16BE();
> +               stream->readUint16BE(); // Unknown
> +       }
> +
> +       uint32 rowPtr = _surface->w * startLine;
> +
> +       switch (_bitsPerPixel) {
> +       case 1:
> +       case 33:
> +               decode1(stream, rowPtr, height);
> +               break;
> +       case 2:
> +       case 34:
> +               decode2_4(stream, rowPtr, height, 2);
> +               break;
> +       case 4:
> +       case 36:
> +               decode2_4(stream, rowPtr, height, 4);
> +               break;
> +       case 8:
> +       case 40:
> +               decode8(stream, rowPtr, height);
> +               break;
> +       case 16:
> +               decode16(stream, rowPtr, height);
> +               break;
> +       case 24:
> +               decode24(stream, rowPtr, height);
> +               break;
> +       case 32:
> +               decode32(stream, rowPtr, height);
> +               break;
> +       default:
> +               error("Unsupported QTRLE bits per pixel %d",
> _bitsPerPixel);
> +       }
> +
> +       return _surface;
> +}
> +
> +QTRLEDecoder::~QTRLEDecoder() {
> +       _surface->free();
> +       delete _surface;
> +}
> +
> +Graphics::PixelFormat QTRLEDecoder::getPixelFormat() const {
> +       switch (_bitsPerPixel) {
> +       case 1:
> +       case 33:
> +       case 2:
> +       case 34:
> +       case 4:
> +       case 36:
> +       case 8:
> +       case 40:
> +               return Graphics::PixelFormat::createFormatCLUT8();
> +       case 16:
> +               return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
> +       case 24:
> +       case 32:
> +               return Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24);
> +       default:
> +               error("Unsupported QTRLE bits per pixel %d",
> _bitsPerPixel);
> +       }
> +
> +       return Graphics::PixelFormat();
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/qtrle.h b/image/codecs/qtrle.h
> new file mode 100644
> index 0000000..c16daa0
> --- /dev/null
> +++ b/image/codecs/qtrle.h
> @@ -0,0 +1,60 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_QTRLE_H
> +#define IMAGE_CODECS_QTRLE_H
> +
> +#include "graphics/pixelformat.h"
> +#include "image/codecs/codec.h"
> +
> +namespace Image {
> +
> +/**
> + * QuickTime Run-Length Encoding decoder.
> + *
> + * Used in video:
> + *  - QuickTimeDecoder
> + */
> +class QTRLEDecoder : public Codec {
> +public:
> +       QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel);
> +       ~QTRLEDecoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const;
> +
> +private:
> +       byte _bitsPerPixel;
> +
> +       Graphics::Surface *_surface;
> +
> +       void decode1(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange, byte bpp);
> +       void decode8(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode16(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode24(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode32(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/rpza.cpp b/image/codecs/rpza.cpp
> new file mode 100644
> index 0000000..ecd930f
> --- /dev/null
> +++ b/image/codecs/rpza.cpp
> @@ -0,0 +1,201 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> + // Based off ffmpeg's RPZA decoder
> +
> +#include "image/codecs/rpza.h"
> +
> +#include "common/debug.h"
> +#include "common/system.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +
> +namespace Image {
> +
> +RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Codec() {
> +       // We need to increase the surface size to a multiple of 4
> +       uint16 wMod = width % 4;
> +       if (wMod != 0)
> +               width += 4 - wMod;
> +
> +       _surface = new Graphics::Surface();
> +       _surface->create(width, height, getPixelFormat());
> +}
> +
> +RPZADecoder::~RPZADecoder() {
> +       _surface->free();
> +       delete _surface;
> +}
> +
> +#define ADVANCE_BLOCK() \
> +       pixelPtr += 4; \
> +       if (pixelPtr >= _surface->w) { \
> +               pixelPtr = 0; \
> +               rowPtr += _surface->w * 4; \
> +       } \
> +       totalBlocks--; \
> +       if (totalBlocks < 0) \
> +               error("rpza block counter just went negative (this should
> not happen)") \
> +
> +#define PUT_PIXEL(color) \
> +       if ((int32)blockPtr < _surface->w * _surface->h) \
> +               WRITE_UINT16((uint16 *)_surface->getPixels() + blockPtr,
> color); \
> +       blockPtr++
> +
> +const Graphics::Surface
> *RPZADecoder::decodeImage(Common::SeekableReadStream *stream) {
> +       uint16 colorA = 0, colorB = 0;
> +       uint16 color4[4];
> +
> +       uint32 rowPtr = 0;
> +       uint32 pixelPtr = 0;
> +       uint32 blockPtr = 0;
> +       uint32 rowInc = _surface->w - 4;
> +       uint16 ta;
> +       uint16 tb;
> +
> +       // First byte is always 0xe1. Warn if it's different
> +       byte firstByte = stream->readByte();
> +       if (firstByte != 0xe1)
> +               warning("First RPZA chunk byte is 0x%02x instead of 0xe1",
> firstByte);
> +
> +       // Get chunk size, ingnoring first byte
> +       uint32 chunkSize = stream->readUint16BE() << 8;
> +       chunkSize += stream->readByte();
> +
> +       // If length mismatch use size from MOV file and try to decode
> anyway
> +       if (chunkSize != (uint32)stream->size()) {
> +               warning("MOV chunk size != encoded chunk size; using MOV
> chunk size");
> +               chunkSize = stream->size();
> +       }
> +
> +       // Number of 4x4 blocks in frame
> +       int32 totalBlocks = ((_surface->w + 3) / 4) * ((_surface->h + 3) /
> 4);
> +
> +       // Process chunk data
> +       while ((uint32)stream->pos() < chunkSize) {
> +               byte opcode = stream->readByte(); // Get opcode
> +               byte numBlocks = (opcode & 0x1f) + 1; // Extract block
> counter from opcode
> +
> +               // If opcode MSbit is 0, we need more data to decide what
> to do
> +               if ((opcode & 0x80) == 0) {
> +                       colorA = (opcode << 8) | stream->readByte();
> +                       opcode = 0;
> +                       if (stream->readByte() & 0x80) {
> +                               // Must behave as opcode 110xxxxx, using
> colorA computed
> +                               // above. Use fake opcode 0x20 to enter
> switch block at
> +                               // the right place
> +                               opcode = 0x20;
> +                               numBlocks = 1;
> +                       }
> +                       stream->seek(-1, SEEK_CUR);
> +               }
> +
> +               switch (opcode & 0xe0) {
> +               case 0x80: // Skip blocks
> +                       while (numBlocks--) {
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +               case 0xa0: // Fill blocks with one color
> +                       colorA = stream->readUint16BE();
> +                       while (numBlocks--) {
> +                               blockPtr = rowPtr + pixelPtr;
> +                               for (byte pixel_y = 0; pixel_y < 4;
> pixel_y++) {
> +                                       for (byte pixel_x = 0; pixel_x <
> 4; pixel_x++) {
> +                                               PUT_PIXEL(colorA);
> +                                       }
> +                                       blockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // Fill blocks with 4 colors
> +               case 0xc0:
> +                       colorA = stream->readUint16BE();
> +               case 0x20:
> +                       colorB = stream->readUint16BE();
> +
> +                       // Sort out the colors
> +                       color4[0] = colorB;
> +                       color4[1] = 0;
> +                       color4[2] = 0;
> +                       color4[3] = colorA;
> +
> +                       // Red components
> +                       ta = (colorA >> 10) & 0x1F;
> +                       tb = (colorB >> 10) & 0x1F;
> +                       color4[1] |= ((11 * ta + 21 * tb) >> 5) << 10;
> +                       color4[2] |= ((21 * ta + 11 * tb) >> 5) << 10;
> +
> +                       // Green components
> +                       ta = (colorA >> 5) & 0x1F;
> +                       tb = (colorB >> 5) & 0x1F;
> +                       color4[1] |= ((11 * ta + 21 * tb) >> 5) << 5;
> +                       color4[2] |= ((21 * ta + 11 * tb) >> 5) << 5;
> +
> +                       // Blue components
> +                       ta = colorA & 0x1F;
> +                       tb = colorB & 0x1F;
> +                       color4[1] |= ((11 * ta + 21 * tb) >> 5);
> +                       color4[2] |= ((21 * ta + 11 * tb) >> 5);
> +
> +                       while (numBlocks--) {
> +                               blockPtr = rowPtr + pixelPtr;
> +                               for (byte pixel_y = 0; pixel_y < 4;
> pixel_y++) {
> +                                       byte index = stream->readByte();
> +                                       for (byte pixel_x = 0; pixel_x <
> 4; pixel_x++) {
> +                                               byte idx = (index >> (2 *
> (3 - pixel_x))) & 0x03;
> +                                               PUT_PIXEL(color4[idx]);
> +                                       }
> +                                       blockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // Fill block with 16 colors
> +               case 0x00:
> +                       blockPtr = rowPtr + pixelPtr;
> +                       for (byte pixel_y = 0; pixel_y < 4; pixel_y++) {
> +                               for (byte pixel_x = 0; pixel_x < 4;
> pixel_x++) {
> +                                       // We already have color of upper
> left pixel
> +                                       if (pixel_y != 0 || pixel_x != 0)
> +                                               colorA =
> stream->readUint16BE();
> +
> +                                       PUT_PIXEL(colorA);
> +                               }
> +                               blockPtr += rowInc;
> +                       }
> +                       ADVANCE_BLOCK();
> +                       break;
> +
> +               // Unknown opcode
> +               default:
> +                       error("Unknown opcode %02x in rpza chunk", opcode);
> +               }
> +       }
> +
> +       return _surface;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/rpza.h b/image/codecs/rpza.h
> new file mode 100644
> index 0000000..f87ee11
> --- /dev/null
> +++ b/image/codecs/rpza.h
> @@ -0,0 +1,51 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_RPZA_H
> +#define IMAGE_CODECS_RPZA_H
> +
> +#include "graphics/pixelformat.h"
> +#include "image/codecs/codec.h"
> +
> +namespace Image {
> +
> +/**
> + * Apple RPZA decoder.
> + *
> + * Used in video:
> + *  - QuickTimeDecoder
> + */
> +class RPZADecoder : public Codec {
> +public:
> +       RPZADecoder(uint16 width, uint16 height);
> +       ~RPZADecoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); }
> +
> +private:
> +       Graphics::Surface *_surface;
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/smc.cpp b/image/codecs/smc.cpp
> new file mode 100644
> index 0000000..434a105
> --- /dev/null
> +++ b/image/codecs/smc.cpp
> @@ -0,0 +1,389 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// Based off ffmpeg's SMC decoder
> +
> +#include "image/codecs/smc.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +
> +namespace Image {
> +
> +#define GET_BLOCK_COUNT() \
> +  (opcode & 0x10) ? (1 + stream->readByte()) : 1 + (opcode & 0x0F);
> +
> +#define ADVANCE_BLOCK() \
> +{ \
> +       pixelPtr += 4; \
> +       if (pixelPtr >= _surface->w) { \
> +               pixelPtr = 0; \
> +               rowPtr += _surface->w * 4; \
> +       } \
> +       totalBlocks--; \
> +       if (totalBlocks < 0) { \
> +               warning("block counter just went negative (this should not
> happen)"); \
> +               return _surface; \
> +       } \
> +}
> +
> +SMCDecoder::SMCDecoder(uint16 width, uint16 height) {
> +       _surface = new Graphics::Surface();
> +       _surface->create(width, height,
> Graphics::PixelFormat::createFormatCLUT8());
> +}
> +
> +SMCDecoder::~SMCDecoder() {
> +       _surface->free();
> +       delete _surface;
> +}
> +
> +const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +       byte *pixels = (byte *)_surface->getPixels();
> +
> +       uint32 numBlocks = 0;
> +       uint32 colorFlags = 0;
> +       uint32 colorFlagsA = 0;
> +       uint32 colorFlagsB = 0;
> +
> +       const uint16 rowInc = _surface->w - 4;
> +       int32 rowPtr = 0;
> +       int32 pixelPtr = 0;
> +       uint32 blockPtr = 0;
> +       uint32 prevBlockPtr = 0;
> +       uint32 prevBlockPtr1 = 0, prevBlockPtr2 = 0;
> +       byte prevBlockFlag = false;
> +       uint32 pixel = 0;
> +
> +       uint32 colorPairIndex = 0;
> +       uint32 colorQuadIndex = 0;
> +       uint32 colorOctetIndex = 0;
> +       uint32 colorTableIndex = 0;  // indices to color pair, quad, or
> octet tables
> +
> +       int32 chunkSize = stream->readUint32BE() & 0x00FFFFFF;
> +       if (chunkSize != stream->size())
> +               warning("MOV chunk size != SMC chunk size (%d != %d);
> ignoring SMC chunk size", chunkSize, stream->size());
> +
> +       int32 totalBlocks = ((_surface->w + 3) / 4) * ((_surface->h + 3) /
> 4);
> +
> +       // traverse through the blocks
> +       while (totalBlocks != 0) {
> +               // sanity checks
> +
> +               // make sure stream ptr hasn't gone out of bounds
> +               if (stream->pos() > stream->size()) {
> +                       warning("SMC decoder just went out of bounds
> (stream ptr = %d, chunk size = %d)", stream->pos(), stream->size());
> +                       return _surface;
> +               }
> +
> +               // make sure the row pointer hasn't gone wild
> +               if (rowPtr >= _surface->w * _surface->h) {
> +                       warning("SMC decoder just went out of bounds (row
> ptr = %d, size = %d)", rowPtr, _surface->w * _surface->h);
> +                       return _surface;
> +               }
> +
> +               byte opcode = stream->readByte();
> +
> +               switch (opcode & 0xF0) {
> +               // skip n blocks
> +               case 0x00:
> +               case 0x10:
> +                       numBlocks = GET_BLOCK_COUNT();
> +                       while (numBlocks--) {
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // repeat last block n times
> +               case 0x20:
> +               case 0x30:
> +                       numBlocks = GET_BLOCK_COUNT();
> +
> +                       // sanity check
> +                       if (rowPtr == 0 && pixelPtr == 0) {
> +                               warning("encountered repeat block opcode
> (%02X) but no blocks rendered yet", opcode & 0xF0);
> +                               break;
> +                       }
> +
> +                       // figure out where the previous block started
> +                       if (pixelPtr == 0)
> +                               prevBlockPtr1 = (rowPtr - _surface->w * 4)
> + _surface->w - 4;
> +                       else
> +                               prevBlockPtr1 = rowPtr + pixelPtr - 4;
> +
> +                       while (numBlocks--) {
> +                               blockPtr = rowPtr + pixelPtr;
> +                               prevBlockPtr = prevBlockPtr1;
> +                               for (byte y = 0; y < 4; y++) {
> +                                       for (byte x = 0; x < 4; x++)
> +                                               pixels[blockPtr++] =
> pixels[prevBlockPtr++];
> +                                       blockPtr += rowInc;
> +                                       prevBlockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // repeat previous pair of blocks n times
> +               case 0x40:
> +               case 0x50:
> +                       numBlocks = GET_BLOCK_COUNT();
> +                       numBlocks *= 2;
> +
> +                       // sanity check
> +                       if (rowPtr == 0 && pixelPtr < 2 * 4) {
> +                               warning("encountered repeat block opcode
> (%02X) but not enough blocks rendered yet", opcode & 0xF0);
> +                               break;
> +                       }
> +
> +                       // figure out where the previous 2 blocks started
> +                       if (pixelPtr == 0)
> +                               prevBlockPtr1 = (rowPtr - _surface->w * 4)
> + _surface->w - 4 * 2;
> +                       else if (pixelPtr == 4)
> +                               prevBlockPtr1 = (rowPtr - _surface->w * 4)
> + rowInc;
> +                       else
> +                               prevBlockPtr1 = rowPtr + pixelPtr - 4 * 2;
> +
> +                       if (pixelPtr == 0)
> +                               prevBlockPtr2 = (rowPtr - _surface->w * 4)
> + rowInc;
> +                       else
> +                               prevBlockPtr2 = rowPtr + pixelPtr - 4;
> +
> +                       prevBlockFlag = 0;
> +                       while (numBlocks--) {
> +                               blockPtr = rowPtr + pixelPtr;
> +
> +                               if (prevBlockFlag)
> +                                       prevBlockPtr = prevBlockPtr2;
> +                               else
> +                                       prevBlockPtr = prevBlockPtr1;
> +
> +                               prevBlockFlag = !prevBlockFlag;
> +
> +                               for (byte y = 0; y < 4; y++) {
> +                                       for (byte x = 0; x < 4; x++)
> +                                               pixels[blockPtr++] =
> pixels[prevBlockPtr++];
> +
> +                                       blockPtr += rowInc;
> +                                       prevBlockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // 1-color block encoding
> +               case 0x60:
> +               case 0x70:
> +                       numBlocks = GET_BLOCK_COUNT();
> +                       pixel = stream->readByte();
> +
> +                       while (numBlocks--) {
> +                               blockPtr = rowPtr + pixelPtr;
> +                               for (byte y = 0; y < 4; y++) {
> +                                       for (byte x = 0; x < 4; x++)
> +                                               pixels[blockPtr++] = pixel;
> +
> +                                       blockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // 2-color block encoding
> +               case 0x80:
> +               case 0x90:
> +                       numBlocks = (opcode & 0x0F) + 1;
> +
> +                       // figure out which color pair to use to paint the
> 2-color block
> +                       if ((opcode & 0xF0) == 0x80) {
> +                               // fetch the next 2 colors from bytestream
> and store in next
> +                               // available entry in the color pair table
> +                               for (byte i = 0; i < CPAIR; i++) {
> +                                       pixel = stream->readByte();
> +                                       colorTableIndex = CPAIR *
> colorPairIndex + i;
> +                                       _colorPairs[colorTableIndex] =
> pixel;
> +                               }
> +
> +                               // this is the base index to use for this
> block
> +                               colorTableIndex = CPAIR * colorPairIndex;
> +                               colorPairIndex++;
> +
> +                               // wraparound
> +                               if (colorPairIndex == COLORS_PER_TABLE)
> +                                       colorPairIndex = 0;
> +                       } else
> +                               colorTableIndex = CPAIR *
> stream->readByte();
> +
> +                       while (numBlocks--) {
> +                               colorFlags = stream->readUint16BE();
> +                               uint16 flagMask = 0x8000;
> +                               blockPtr = rowPtr + pixelPtr;
> +                               for (byte y = 0; y < 4; y++) {
> +                                       for (byte x = 0; x < 4; x++) {
> +                                               if (colorFlags & flagMask)
> +                                                       pixel =
> colorTableIndex + 1;
> +                                               else
> +                                                       pixel =
> colorTableIndex;
> +
> +                                               flagMask >>= 1;
> +                                               pixels[blockPtr++] =
> _colorPairs[pixel];
> +                                       }
> +
> +                                       blockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // 4-color block encoding
> +               case 0xA0:
> +               case 0xB0:
> +                       numBlocks = (opcode & 0x0F) + 1;
> +
> +                       // figure out which color quad to use to paint the
> 4-color block
> +                       if ((opcode & 0xF0) == 0xA0) {
> +                               // fetch the next 4 colors from bytestream
> and store in next
> +                               // available entry in the color quad table
> +                               for (byte i = 0; i < CQUAD; i++) {
> +                                       pixel = stream->readByte();
> +                                       colorTableIndex = CQUAD *
> colorQuadIndex + i;
> +                                       _colorQuads[colorTableIndex] =
> pixel;
> +                               }
> +
> +                               // this is the base index to use for this
> block
> +                               colorTableIndex = CQUAD * colorQuadIndex;
> +                               colorQuadIndex++;
> +
> +                               // wraparound
> +                               if (colorQuadIndex == COLORS_PER_TABLE)
> +                                       colorQuadIndex = 0;
> +                       } else
> +                               colorTableIndex = CQUAD *
> stream->readByte();
> +
> +                       while (numBlocks--) {
> +                               colorFlags = stream->readUint32BE();
> +
> +                               // flag mask actually acts as a bit shift
> count here
> +                               byte flagMask = 30;
> +                               blockPtr = rowPtr + pixelPtr;
> +
> +                               for (byte y = 0; y < 4; y++) {
> +                                       for (byte x = 0; x < 4; x++) {
> +                                               pixel = colorTableIndex +
> ((colorFlags >> flagMask) & 0x03);
> +                                               flagMask -= 2;
> +                                               pixels[blockPtr++] =
> _colorQuads[pixel];
> +                                       }
> +                                       blockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // 8-color block encoding
> +               case 0xC0:
> +               case 0xD0:
> +                       numBlocks = (opcode & 0x0F) + 1;
> +
> +                       // figure out which color octet to use to paint
> the 8-color block
> +                       if ((opcode & 0xF0) == 0xC0) {
> +                               // fetch the next 8 colors from bytestream
> and store in next
> +                               // available entry in the color octet table
> +                               for (byte i = 0; i < COCTET; i++) {
> +                                       pixel = stream->readByte();
> +                                       colorTableIndex = COCTET *
> colorOctetIndex + i;
> +                                       _colorOctets[colorTableIndex] =
> pixel;
> +                               }
> +
> +                               // this is the base index to use for this
> block
> +                               colorTableIndex = COCTET * colorOctetIndex;
> +                               colorOctetIndex++;
> +
> +                               // wraparound
> +                               if (colorOctetIndex == COLORS_PER_TABLE)
> +                                       colorOctetIndex = 0;
> +                       } else
> +                               colorTableIndex = COCTET *
> stream->readByte();
> +
> +                       while (numBlocks--) {
> +                               /*
> +                                 For this input of 6 hex bytes:
> +                                   01 23 45 67 89 AB
> +                                 Mangle it to this output:
> +                                   flags_a = xx012456, flags_b = xx89A37B
> +                               */
> +
> +                               // build the color flags
> +                               byte flagData[6];
> +                               stream->read(flagData, 6);
> +
> +                               colorFlagsA = ((READ_BE_UINT16(flagData) &
> 0xFFF0) << 8) | (READ_BE_UINT16(flagData + 2) >> 4);
> +                               colorFlagsB = ((READ_BE_UINT16(flagData +
> 4) & 0xFFF0) << 8) | ((flagData[1] & 0xF) << 8) |
> +
> ((flagData[3] & 0xF) << 4) | (flagData[5] & 0xf);
> +
> +                               colorFlags = colorFlagsA;
> +
> +                               // flag mask actually acts as a bit shift
> count here
> +                               byte flagMask = 21;
> +                               blockPtr = rowPtr + pixelPtr;
> +                               for (byte y = 0; y < 4; y++) {
> +                                       // reload flags at third row
> (iteration y == 2)
> +                                       if (y == 2) {
> +                                               colorFlags = colorFlagsB;
> +                                               flagMask = 21;
> +                                       }
> +
> +                                       for (byte x = 0; x < 4; x++) {
> +                                               pixel = colorTableIndex +
> ((colorFlags >> flagMask) & 0x07);
> +                                               flagMask -= 3;
> +                                               pixels[blockPtr++] =
> _colorOctets[pixel];
> +                                       }
> +
> +                                       blockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               // 16-color block encoding (every pixel is a different
> color)
> +               case 0xE0:
> +                       numBlocks = (opcode & 0x0F) + 1;
> +
> +                       while (numBlocks--) {
> +                               blockPtr = rowPtr + pixelPtr;
> +                               for (byte y = 0; y < 4; y++) {
> +                                       for (byte x = 0; x < 4; x++)
> +                                               pixels[blockPtr++] =
> stream->readByte();
> +
> +                                       blockPtr += rowInc;
> +                               }
> +                               ADVANCE_BLOCK();
> +                       }
> +                       break;
> +
> +               case 0xF0:
> +                       warning("0xF0 opcode seen in SMC chunk (contact
> the developers)");
> +                       break;
> +               }
> +       }
> +
> +       return _surface;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/smc.h b/image/codecs/smc.h
> new file mode 100644
> index 0000000..2de1f69
> --- /dev/null
> +++ b/image/codecs/smc.h
> @@ -0,0 +1,62 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_SMC_H
> +#define IMAGE_CODECS_SMC_H
> +
> +#include "image/codecs/codec.h"
> +
> +namespace Image {
> +
> +enum {
> +       CPAIR = 2,
> +       CQUAD = 4,
> +       COCTET = 8,
> +       COLORS_PER_TABLE = 256
> +};
> +
> +/**
> + * Apple SMC decoder.
> + *
> + * Used in video:
> + *  - QuickTimeDecoder
> + */
> +class SMCDecoder : public Codec {
> +public:
> +       SMCDecoder(uint16 width, uint16 height);
> +       ~SMCDecoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat::createFormatCLUT8(); }
> +
> +private:
> +       Graphics::Surface *_surface;
> +
> +       // SMC color tables
> +       byte _colorPairs[COLORS_PER_TABLE * CPAIR];
> +       byte _colorQuads[COLORS_PER_TABLE * CQUAD];
> +       byte _colorOctets[COLORS_PER_TABLE * COCTET];
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/svq1.cpp b/image/codecs/svq1.cpp
> new file mode 100644
> index 0000000..550445b
> --- /dev/null
> +++ b/image/codecs/svq1.cpp
> @@ -0,0 +1,797 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// Sorenson Video 1 Codec
> +// Based off FFmpeg's SVQ1 decoder (written by Arpi and Nick Kurshev)
> +
> +#include "image/codecs/svq1.h"
> +#include "image/codecs/svq1_cb.h"
> +#include "image/codecs/svq1_vlc.h"
> +
> +#include "common/stream.h"
> +#include "common/bitstream.h"
> +#include "common/rect.h"
> +#include "common/system.h"
> +#include "common/debug.h"
> +#include "common/textconsole.h"
> +#include "common/huffman.h"
> +
> +#include "graphics/yuv_to_rgb.h"
> +
> +namespace Image {
> +
> +#define SVQ1_BLOCK_SKIP     0
> +#define SVQ1_BLOCK_INTER    1
> +#define SVQ1_BLOCK_INTER_4V 2
> +#define SVQ1_BLOCK_INTRA    3
> +
> +SVQ1Decoder::SVQ1Decoder(uint16 width, uint16 height) {
> +       debug(1, "SVQ1Decoder::SVQ1Decoder(width:%d, height:%d)", width,
> height);
> +       _width = width;
> +       _height = height;
> +       _frameWidth = _frameHeight = 0;
> +       _surface = 0;
> +
> +       _last[0] = 0;
> +       _last[1] = 0;
> +       _last[2] = 0;
> +
> +       // Setup Variable Length Code Tables
> +       _blockType = new Common::Huffman(0, 4, s_svq1BlockTypeCodes,
> s_svq1BlockTypeLengths);
> +
> +       for (int i = 0; i < 6; i++) {
> +               _intraMultistage[i] = new Common::Huffman(0, 8,
> s_svq1IntraMultistageCodes[i], s_svq1IntraMultistageLengths[i]);
> +               _interMultistage[i] = new Common::Huffman(0, 8,
> s_svq1InterMultistageCodes[i], s_svq1InterMultistageLengths[i]);
> +       }
> +
> +       _intraMean = new Common::Huffman(0, 256, s_svq1IntraMeanCodes,
> s_svq1IntraMeanLengths);
> +       _interMean = new Common::Huffman(0, 512, s_svq1InterMeanCodes,
> s_svq1InterMeanLengths);
> +       _motionComponent = new Common::Huffman(0, 33,
> s_svq1MotionComponentCodes, s_svq1MotionComponentLengths);
> +}
> +
> +SVQ1Decoder::~SVQ1Decoder() {
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +       }
> +
> +       delete[] _last[0];
> +       delete[] _last[1];
> +       delete[] _last[2];
> +
> +       delete _blockType;
> +       delete _intraMean;
> +       delete _interMean;
> +       delete _motionComponent;
> +
> +       for (int i = 0; i < 6; i++) {
> +               delete _intraMultistage[i];
> +               delete _interMultistage[i];
> +       }
> +}
> +
> +#define ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
> +
> +const Graphics::Surface
> *SVQ1Decoder::decodeImage(Common::SeekableReadStream *stream) {
> +       debug(1, "SVQ1Decoder::decodeImage()");
> +
> +       Common::BitStream32BEMSB frameData(*stream);
> +
> +       uint32 frameCode = frameData.getBits(22);
> +       debug(1, " frameCode: %d", frameCode);
> +
> +       if ((frameCode & ~0x70) || !(frameCode & 0x60)) { // Invalid
> +               warning("Invalid Image at frameCode");
> +               return _surface;
> +       }
> +
> +       byte temporalReference = frameData.getBits(8);
> +       debug(1, " temporalReference: %d", temporalReference);
> +       static const char *const types[4] = { "I (Key)", "P (Delta from
> Previous)", "B (Delta from Next)", "Invalid" };
> +       byte frameType = frameData.getBits(2);
> +       debug(1, " frameType: %d = %s Frame", frameType, types[frameType]);
> +
> +       if (frameType == 0) { // I Frame
> +               // TODO: Validate checksum if present
> +               if (frameCode == 0x50 || frameCode == 0x60) {
> +                       uint32 checksum = frameData.getBits(16);
> +                       debug(1, " checksum:0x%02x", checksum);
> +                       // We're currently just ignoring the checksum
> +               }
> +
> +               if ((frameCode ^ 0x10) >= 0x50) {
> +                       // Skip embedded string
> +                       byte stringLen = frameData.getBits(8);
> +                       for (uint16 i = 0; i < stringLen-1; i++)
> +                               frameData.skip(8);
> +               }
> +
> +               frameData.skip(5); // Unknown
> +
> +               static const struct { uint w, h; } standardFrameSizes[7] =
> {
> +                       { 160, 120 }, // 0
> +                       { 128,  96 }, // 1
> +                       { 176, 144 }, // 2
> +                       { 352, 288 }, // 3
> +                       { 704, 576 }, // 4
> +                       { 240, 180 }, // 5
> +                       { 320, 240 }  // 6
> +               };
> +
> +               byte frameSizeCode = frameData.getBits(3);
> +               debug(1, " frameSizeCode: %d", frameSizeCode);
> +
> +               if (frameSizeCode == 7) {
> +                       _frameWidth = frameData.getBits(12);
> +                       _frameHeight = frameData.getBits(12);
> +               } else {
> +                       _frameWidth = standardFrameSizes[frameSizeCode].w;
> +                       _frameHeight = standardFrameSizes[frameSizeCode].h;
> +               }
> +
> +               debug(1, " frameWidth: %d", _frameWidth);
> +               debug(1, " frameHeight: %d", _frameHeight);
> +       } else if (frameType == 2) { // B Frame
> +               warning("B Frames not supported by SVQ1 decoder (yet)");
> +               return _surface;
> +       } else if (frameType == 3) { // Invalid
> +               warning("Invalid Frame Type");
> +               return _surface;
> +       }
> +
> +       bool checksumPresent = frameData.getBit() != 0;
> +       debug(1, " checksumPresent: %d", checksumPresent);
> +       if (checksumPresent) {
> +               bool usePacketChecksum = frameData.getBit() != 0;
> +               debug(1, " usePacketChecksum: %d", usePacketChecksum);
> +               bool componentChecksumsAfterImageData = frameData.getBit()
> != 0;
> +               debug(1, " componentChecksumsAfterImageData: %d",
> componentChecksumsAfterImageData);
> +               byte unk4 = frameData.getBits(2);
> +               debug(1, " unk4: %d", unk4);
> +               if (unk4 != 0)
> +                       warning("Invalid Frame Header in SVQ1 Frame
> Decode");
> +       }
> +
> +       // Some more unknown data
> +       bool unk5 = frameData.getBit() != 0;
> +       if (unk5) {
> +               frameData.skip(8);
> +
> +               while (frameData.getBit() != 0)
> +                       frameData.skip(8);
> +       }
> +
> +       uint yWidth = ALIGN(_frameWidth, 16);
> +       uint yHeight = ALIGN(_frameHeight, 16);
> +       uint uvWidth = ALIGN(yWidth / 4, 16);
> +       uint uvHeight = ALIGN(yHeight / 4, 16);
> +       uint uvPitch = uvWidth + 4; // we need at least one extra column
> and pitch must be divisible by 4
> +
> +       byte *current[3];
> +
> +       // Decode Y, U and V component planes
> +       for (int i = 0; i < 3; i++) {
> +               uint width, height, pitch;
> +               if (i == 0) {
> +                       width = yWidth;
> +                       height = yHeight;
> +                       pitch = width;
> +                       current[i] = new byte[width * height];
> +               } else {
> +                       width = uvWidth;
> +                       height = uvHeight;
> +                       pitch = uvPitch;
> +
> +                       // Add an extra row here. See below for more
> information.
> +                       current[i] = new byte[pitch * (height + 1)];
> +               }
> +
> +               if (frameType == 0) { // I Frame
> +                       // Keyframe (I)
> +                       byte *currentP = current[i];
> +                       for (uint16 y = 0; y < height; y += 16) {
> +                               for (uint16 x = 0; x < width; x += 16) {
> +                                       if
> (!svq1DecodeBlockIntra(&frameData, &currentP[x], pitch)) {
> +
> warning("svq1DecodeBlockIntra decode failure");
> +                                               return _surface;
> +                                       }
> +                               }
> +                               currentP += 16 * pitch;
> +                       }
> +               } else {
> +                       // Delta frame (P or B)
> +
> +                       // Prediction Motion Vector
> +                       Common::Point *pmv = new Common::Point[(width / 8)
> + 3];
> +
> +                       byte *previous = 0;
> +                       if (frameType == 2) { // B Frame
> +                               error("SVQ1 Video: B Frames not
> supported");
> +                               //previous = _next[i];
> +                       } else {
> +                               previous = _last[i];
> +                       }
> +
> +                       byte *currentP = current[i];
> +                       for (uint16 y = 0; y < height; y += 16) {
> +                               for (uint16 x = 0; x < width; x += 16) {
> +                                       if
> (!svq1DecodeDeltaBlock(&frameData, &currentP[x], previous, pitch, pmv, x,
> y)) {
> +
> warning("svq1DecodeDeltaBlock decode failure");
> +                                               return _surface;
> +                                       }
> +                               }
> +
> +                               pmv[0].x = pmv[0].y = 0;
> +
> +                               currentP += 16 * pitch;
> +                       }
> +
> +                       delete[] pmv;
> +               }
> +       }
> +
> +       // Now we'll create the surface
> +       if (!_surface) {
> +               _surface = new Graphics::Surface();
> +               _surface->create(yWidth, yHeight,
> g_system->getScreenFormat());
> +               _surface->w = _width;
> +               _surface->h = _height;
> +       }
> +
> +       // We need to massage the chrominance data a bit to be able to be
> used by the converter
> +       // Since the thing peeks at values one column and one row beyond
> the data, we need to fill it in
> +
> +       // First, fill in the column-after-last with the last column's
> value
> +       for (uint i = 0; i < uvHeight; i++) {
> +               current[1][i * uvPitch + uvWidth] = current[1][i * uvPitch
> + uvWidth - 1];
> +               current[2][i * uvPitch + uvWidth] = current[2][i * uvPitch
> + uvWidth - 1];
> +       }
> +
> +       // Then, copy the last row to the one after the last row
> +       memcpy(current[1] + uvHeight * uvPitch, current[1] + (uvHeight -
> 1) * uvPitch, uvWidth + 1);
> +       memcpy(current[2] + uvHeight * uvPitch, current[2] + (uvHeight -
> 1) * uvPitch, uvWidth + 1);
> +
> +       // Finally, actually do the conversion ;)
> +       YUVToRGBMan.convert410(_surface,
> Graphics::YUVToRGBManager::kScaleFull, current[0], current[1], current[2],
> yWidth, yHeight, yWidth, uvPitch);
> +
> +       // Store the current surfaces for later and free the old ones
> +       for (int i = 0; i < 3; i++) {
> +               delete[] _last[i];
> +               _last[i] = current[i];
> +       }
> +
> +       return _surface;
> +}
> +
> +bool SVQ1Decoder::svq1DecodeBlockIntra(Common::BitStream *s, byte
> *pixels, int pitch) {
> +       // initialize list for breadth first processing of vectors
> +       byte *list[63];
> +       list[0] = pixels;
> +
> +       // recursively process vector
> +       for (int i = 0, m = 1, n = 1, level = 5; i < n; i++) {
> +               for (; level > 0; i++) {
> +                       // process next depth
> +                       if (i == m) {
> +                               m = n;
> +                               if (--level == 0)
> +                                       break;
> +                       }
> +
> +                       // divide block if next bit set
> +                       if (s->getBit() == 0)
> +                               break;
> +
> +                       // add child nodes
> +                       list[n++] = list[i];
> +                       list[n++] = list[i] + (((level & 1) ? pitch : 1)
> << ((level / 2) + 1));
> +               }
> +
> +               // destination address and vector size
> +               uint32 *dst = (uint32 *)list[i];
> +               uint width = 1 << ((level + 4) / 2);
> +               uint height = 1 << ((level + 3) / 2);
> +
> +               // get number of stages (-1 skips vector, 0 for mean only)
> +               int stages = _intraMultistage[level]->getSymbol(*s) - 1;
> +
> +               if (stages == -1) {
> +                       for (uint y = 0; y < height; y++)
> +                               memset(&dst[y * (pitch / 4)], 0, width);
> +
> +                       continue; // skip vector
> +               }
> +
> +               if (stages > 0 && level >= 4) {
> +                       warning("Error (svq1_decode_block_intra): invalid
> vector: stages = %d, level = %d", stages, level);
> +                       return false; // error - invalid vector
> +               }
> +
> +               int mean = _intraMean->getSymbol(*s);
> +
> +               if (stages == 0) {
> +                       for (uint y = 0; y < height; y++)
> +                               memset(&dst[y * (pitch / 4)], mean, width);
> +               } else {
> +                       const uint32 *codebook = (const uint32
> *)s_svq1IntraCodebooks[level];
> +                       uint32 bitCache = s->getBits(stages * 4);
> +
> +                       // calculate codebook entries for this vector
> +                       int entries[6];
> +                       for (int j = 0; j < stages; j++)
> +                               entries[j] = (((bitCache >> ((stages - j -
> 1) * 4)) & 0xF) + j * 16) << (level + 1);
> +
> +                       mean -= stages * 128;
> +                       uint32 n4 = ((mean + (mean >> 31)) << 16) | (mean
> & 0xFFFF);
> +
> +                       for (uint y = 0; y < height; y++) {
> +                               for (uint x = 0; x < (width / 4); x++,
> codebook++) {
> +                                       uint32 n1 = n4;
> +                                       uint32 n2 = n4;
> +                                       uint32 n3;
> +
> +                                       // add codebook entries to vector
> +                                       for (int j = 0; j < stages; j++) {
> +                                               n3 =
> READ_UINT32(&codebook[entries[j]]) ^ 0x80808080;
> +                                               n1 += (n3 & 0xFF00FF00) >>
> 8;
> +                                               n2 += n3 & 0x00FF00FF;
> +                                       }
> +
> +                                       // clip to [0..255]
> +                                       if (n1 & 0xFF00FF00) {
> +                                               n3 = (((n1 >> 15) &
> 0x00010001) | 0x01000100) - 0x00010001;
> +                                               n1 += 0x7F007F00;
> +                                               n1 |= (((~n1 >> 15) &
> 0x00010001) | 0x01000100) - 0x00010001;
> +                                               n1 &= n3 & 0x00FF00FF;
> +                                       }
> +
> +                                       if (n2 & 0xFF00FF00) {
> +                                               n3 = (((n2 >> 15) &
> 0x00010001) | 0x01000100) - 0x00010001;
> +                                               n2 += 0x7F007F00;
> +                                               n2 |= (((~n2 >> 15) &
> 0x00010001) | 0x01000100) - 0x00010001;
> +                                               n2 &= n3 & 0x00FF00FF;
> +                                       }
> +
> +                                       // store result
> +                                       dst[x] = (n1 << 8) | n2;
> +                               }
> +
> +                               dst += pitch / 4;
> +                       }
> +               }
> +       }
> +
> +       return true;
> +}
> +
> +bool SVQ1Decoder::svq1DecodeBlockNonIntra(Common::BitStream *s, byte
> *pixels, int pitch) {
> +       // initialize list for breadth first processing of vectors
> +       byte *list[63];
> +       list[0] = pixels;
> +
> +       // recursively process vector
> +       for (int i = 0, m = 1, n = 1, level = 5; i < n; i++) {
> +               for (; level > 0; i++) {
> +                       // process next depth
> +                       if (i == m) {
> +                               m = n;
> +                               if (--level == 0)
> +                                       break;
> +                       }
> +
> +                       // divide block if next bit set
> +                       if (s->getBit() == 0)
> +                               break;
> +
> +                       // add child nodes
> +                       list[n++] = list[i];
> +                       list[n++] = list[i] + (((level & 1) ? pitch : 1)
> << ((level / 2) + 1));
> +               }
> +
> +               // destination address and vector size
> +               uint32 *dst = (uint32 *)list[i];
> +               int width = 1 << ((level + 4) / 2);
> +               int height = 1 << ((level + 3) /  2);
> +
> +               // get number of stages (-1 skips vector, 0 for mean only)
> +               int stages = _interMultistage[level]->getSymbol(*s) - 1;
> +
> +               if (stages == -1)
> +                       continue; // skip vector
> +
> +               if (stages > 0 && level >= 4) {
> +                       warning("Error (svq1_decode_block_non_intra):
> invalid vector: stages = %d, level = %d", stages, level);
> +                       return false; // error - invalid vector
> +               }
> +
> +               int mean = _interMean->getSymbol(*s) - 256;
> +               const uint32 *codebook = (const uint32
> *)s_svq1InterCodebooks[level];
> +               uint32 bitCache = s->getBits(stages * 4);
> +
> +               // calculate codebook entries for this vector
> +               int entries[6];
> +               for (int j = 0; j < stages; j++)
> +                       entries[j] = (((bitCache >> ((stages - j - 1) *
> 4)) & 0xF) + j * 16) << (level + 1);
> +
> +               mean -= stages * 128;
> +               uint32 n4 = ((mean + (mean >> 31)) << 16) | (mean &
> 0xFFFF);
> +
> +               for (int y = 0; y < height; y++) {
> +                       for (int x = 0; x < (width / 4); x++, codebook++) {
> +                               uint32 n3 = dst[x];
> +
> +                               // add mean value to vector
> +                               uint32 n1 = ((n3 & 0xFF00FF00) >> 8) + n4;
> +                               uint32 n2 = (n3 & 0x00FF00FF) + n4;
> +
> +                               // add codebook entries to vector
> +                               for (int j = 0; j < stages; j++) {
> +                                       n3 =
> READ_UINT32(&codebook[entries[j]]) ^ 0x80808080;
> +                                       n1 += (n3 & 0xFF00FF00) >> 8;
> +                                       n2 += n3 & 0x00FF00FF;
> +                               }
> +
> +                               // clip to [0..255]
> +                               if (n1 & 0xFF00FF00) {
> +                                       n3 = ((( n1 >> 15) & 0x00010001) |
> 0x01000100) - 0x00010001;
> +                                       n1 += 0x7F007F00;
> +                                       n1 |= (((~n1 >> 15) & 0x00010001)
> | 0x01000100) - 0x00010001;
> +                                       n1 &= n3 & 0x00FF00FF;
> +                               }
> +
> +                               if (n2 & 0xFF00FF00) {
> +                                       n3  = ((( n2 >> 15) & 0x00010001)
> | 0x01000100) - 0x00010001;
> +                                       n2 += 0x7F007F00;
> +                                       n2 |= (((~n2 >> 15) & 0x00010001)
> | 0x01000100) - 0x00010001;
> +                                       n2 &= n3 & 0x00FF00FF;
> +                               }
> +
> +                               // store result
> +                               dst[x] = (n1 << 8) | n2;
> +                       }
> +
> +                       dst += pitch / 4;
> +               }
> +       }
> +
> +       return true;
> +}
> +
> +// median of 3
> +static inline int midPred(int a, int b, int c) {
> +       if (a > b) {
> +               if (c > b) {
> +                       if (c > a)
> +                               b = a;
> +                       else
> +                               b = c;
> +               }
> +       } else {
> +               if (b > c) {
> +                       if (c > a)
> +                               b = c;
> +                       else
> +                               b = a;
> +               }
> +       }
> +
> +       return b;
> +}
> +
> +bool SVQ1Decoder::svq1DecodeMotionVector(Common::BitStream *s,
> Common::Point *mv, Common::Point **pmv) {
> +       for (int i = 0; i < 2; i++) {
> +               // get motion code
> +               int diff = _motionComponent->getSymbol(*s);
> +               if (diff < 0)
> +                       return false; // error - invalid motion code
> +               else if (diff && s->getBit() != 0)
> +                       diff = -diff;
> +
> +               // add median of motion vector predictors and clip result
> +               if (i == 1)
> +                       mv->y = ((diff + midPred(pmv[0]->y, pmv[1]->y,
> pmv[2]->y)) << 26) >> 26;
> +               else
> +                       mv->x = ((diff + midPred(pmv[0]->x, pmv[1]->x,
> pmv[2]->x)) << 26) >> 26;
> +       }
> +
> +       return true;
> +}
> +
> +void SVQ1Decoder::svq1SkipBlock(byte *current, byte *previous, int pitch,
> int x, int y) {
> +       const byte *src = &previous[x + y * pitch];
> +       byte *dst = current;
> +
> +       for (int i = 0; i < 16; i++) {
> +               memcpy(dst, src, 16);
> +               src += pitch;
> +               dst += pitch;
> +       }
> +}
> +
> +void SVQ1Decoder::putPixels8C(byte *block, const byte *pixels, int
> lineSize, int h) {
> +       for (int i = 0; i < h; i++) {
> +               *((uint32 *)block) = READ_UINT32(pixels);
> +               *((uint32 *)(block + 4)) = READ_UINT32(pixels + 4);
> +               pixels += lineSize;
> +               block += lineSize;
> +       }
> +}
> +
> +static inline uint32 rndAvg32(uint32 a, uint32 b) {
> +       return (a | b) - (((a ^ b) & ~0x01010101) >> 1);
> +}
> +
> +void SVQ1Decoder::putPixels8L2(byte *dst, const byte *src1, const byte
> *src2,
> +               int dstStride, int srcStride1, int srcStride2, int h) {
> +       for (int i = 0; i < h; i++) {
> +               uint32 a = READ_UINT32(&src1[srcStride1 * i]);
> +               uint32 b = READ_UINT32(&src2[srcStride2 * i]);
> +               *((uint32 *)&dst[dstStride * i]) = rndAvg32(a, b);
> +               a = READ_UINT32(&src1[srcStride1 * i + 4]);
> +               b = READ_UINT32(&src2[srcStride2 * i + 4]);
> +               *((uint32 *)&dst[dstStride * i + 4]) = rndAvg32(a, b);
> +       }
> +}
> +
> +void SVQ1Decoder::putPixels8X2C(byte *block, const byte *pixels, int
> lineSize, int h) {
> +       putPixels8L2(block, pixels, pixels + 1, lineSize, lineSize,
> lineSize, h);
> +}
> +
> +void SVQ1Decoder::putPixels8Y2C(byte *block, const byte *pixels, int
> lineSize, int h) {
> +       putPixels8L2(block, pixels, pixels + lineSize, lineSize, lineSize,
> lineSize, h);
> +}
> +
> +void SVQ1Decoder::putPixels8XY2C(byte *block, const byte *pixels, int
> lineSize, int h) {
> +       for (int j = 0; j < 2; j++) {
> +               uint32 a = READ_UINT32(pixels);
> +               uint32 b = READ_UINT32(pixels + 1);
> +               uint32 l0 = (a & 0x03030303UL) + (b & 0x03030303UL) +
> 0x02020202UL;
> +               uint32 h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b &
> 0xFCFCFCFCUL) >> 2);
> +
> +               pixels += lineSize;
> +
> +               for (int i = 0; i < h; i += 2) {
> +                       a = READ_UINT32(pixels);
> +                       b = READ_UINT32(pixels + 1);
> +                       uint32 l1 = (a & 0x03030303UL) + (b &
> 0x03030303UL);
> +                       uint32 h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b &
> 0xFCFCFCFCUL) >> 2);
> +                       *((uint32 *)block) = h0 + h1 + (((l0 + l1) >> 2) &
> 0x0F0F0F0FUL);
> +                       pixels += lineSize;
> +                       block += lineSize;
> +                       a = READ_UINT32(pixels);
> +                       b = READ_UINT32(pixels + 1);
> +                       l0 = (a & 0x03030303UL) + (b & 0x03030303UL) +
> 0x02020202UL;
> +                       h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b &
> 0xFCFCFCFCUL) >> 2);
> +                       *((uint32 *)block) = h0 + h1 + (((l0 + l1) >> 2) &
> 0x0F0F0F0FUL);
> +                       pixels += lineSize;
> +                       block += lineSize;
> +               }
> +
> +               pixels += 4 - lineSize * (h + 1);
> +               block += 4 - lineSize * h;
> +       }
> +}
> +
> +void SVQ1Decoder::putPixels16C(byte *block, const byte *pixels, int
> lineSize, int h) {
> +       putPixels8C(block, pixels, lineSize, h);
> +       putPixels8C(block + 8, pixels + 8, lineSize, h);
> +}
> +
> +void SVQ1Decoder::putPixels16X2C(byte *block, const byte *pixels, int
> lineSize, int h) {
> +       putPixels8X2C(block, pixels, lineSize, h);
> +       putPixels8X2C(block + 8, pixels + 8, lineSize, h);
> +}
> +
> +void SVQ1Decoder::putPixels16Y2C(byte *block, const byte *pixels, int
> lineSize, int h) {
> +       putPixels8Y2C(block, pixels, lineSize, h);
> +       putPixels8Y2C(block + 8, pixels + 8, lineSize, h);
> +}
> +
> +void SVQ1Decoder::putPixels16XY2C(byte *block, const byte *pixels, int
> lineSize, int h) {
> +       putPixels8XY2C(block, pixels, lineSize, h);
> +       putPixels8XY2C(block + 8, pixels + 8, lineSize, h);
> +}
> +
> +bool SVQ1Decoder::svq1MotionInterBlock(Common::BitStream *ss, byte
> *current, byte *previous, int pitch,
> +               Common::Point *motion, int x, int y) {
> +
> +       // predict and decode motion vector
> +       Common::Point *pmv[3];
> +       pmv[0] = &motion[0];
> +       if (y == 0) {
> +               pmv[1] = pmv[2] = pmv[0];
> +       } else {
> +               pmv[1] = &motion[(x / 8) + 2];
> +               pmv[2] = &motion[(x / 8) + 4];
> +       }
> +
> +       Common::Point mv;
> +       bool resultValid = svq1DecodeMotionVector(ss, &mv, pmv);
> +       if (!resultValid)
> +               return false;
> +
> +       motion[0].x = motion[(x / 8) + 2].x = motion[(x / 8) + 3].x = mv.x;
> +       motion[0].y = motion[(x / 8) + 2].y = motion[(x / 8) + 3].y = mv.y;
> +
> +       if (y + (mv.y >> 1) < 0)
> +               mv.y = 0;
> +
> +       if (x + (mv.x >> 1) < 0)
> +               mv.x = 0;
> +
> +       const byte *src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))
> * pitch];
> +       byte *dst = current;
> +
> +       // Halfpel motion compensation with rounding (a + b + 1) >> 1.
> +       // 4 motion compensation functions for the 4 halfpel positions
> +       // for 16x16 blocks
> +       switch(((mv.y & 1) << 1) + (mv.x & 1)) {
> +       case 0:
> +               putPixels16C(dst, src, pitch, 16);
> +               break;
> +       case 1:
> +               putPixels16X2C(dst, src, pitch, 16);
> +               break;
> +       case 2:
> +               putPixels16Y2C(dst, src, pitch, 16);
> +               break;
> +       case 3:
> +               putPixels16XY2C(dst, src, pitch, 16);
> +               break;
> +       }
> +
> +       return true;
> +}
> +
> +bool SVQ1Decoder::svq1MotionInter4vBlock(Common::BitStream *ss, byte
> *current, byte *previous, int pitch,
> +               Common::Point *motion, int x, int y) {
> +       // predict and decode motion vector (0)
> +       Common::Point *pmv[4];
> +       pmv[0] = &motion[0];
> +       if (y == 0) {
> +               pmv[1] = pmv[2] = pmv[0];
> +       } else {
> +               pmv[1] = &motion[(x / 8) + 2];
> +               pmv[2] = &motion[(x / 8) + 4];
> +       }
> +
> +       Common::Point mv;
> +       bool resultValid = svq1DecodeMotionVector(ss, &mv, pmv);
> +       if (!resultValid)
> +               return false;
> +
> +       // predict and decode motion vector (1)
> +       pmv[0] = &mv;
> +       if (y == 0)
> +               pmv[1] = pmv[2] = pmv[0];
> +       else
> +               pmv[1] = &motion[(x / 8) + 3];
> +
> +       resultValid = svq1DecodeMotionVector(ss, &motion[0], pmv);
> +       if (!resultValid)
> +               return false;
> +
> +       // predict and decode motion vector (2)
> +       pmv[1] = &motion[0];
> +       pmv[2] = &motion[(x / 8) + 1];
> +
> +       resultValid = svq1DecodeMotionVector(ss, &motion[(x / 8) + 2],
> pmv);
> +       if (!resultValid)
> +               return false;
> +
> +       // predict and decode motion vector (3)
> +       pmv[2] = &motion[(x / 8) + 2];
> +       pmv[3] = &motion[(x / 8) + 3];
> +
> +       resultValid = svq1DecodeMotionVector(ss, pmv[3], pmv);
> +       if (!resultValid)
> +               return false;
> +
> +       // form predictions
> +       for (int i = 0; i < 4; i++) {
> +               int mvx = pmv[i]->x + (i & 1) * 16;
> +               int mvy = pmv[i]->y + (i >> 1) * 16;
> +
> +               // FIXME: clipping or padding?
> +               if (y + (mvy >> 1) < 0)
> +                       mvy = 0;
> +
> +               if (x + (mvx >> 1) < 0)
> +                       mvx = 0;
> +
> +               const byte *src = &previous[(x + (mvx >> 1)) + (y + (mvy
> >> 1)) * pitch];
> +               byte *dst = current;
> +
> +               // Halfpel motion compensation with rounding (a + b + 1)
> >> 1.
> +               // 4 motion compensation functions for the 4 halfpel
> positions
> +               // for 8x8 blocks
> +               switch(((mvy & 1) << 1) + (mvx & 1)) {
> +               case 0:
> +                       putPixels8C(dst, src, pitch, 8);
> +                       break;
> +               case 1:
> +                       putPixels8X2C(dst, src, pitch, 8);
> +                       break;
> +               case 2:
> +                       putPixels8Y2C(dst, src, pitch, 8);
> +                       break;
> +               case 3:
> +                       putPixels8XY2C(dst, src, pitch, 8);
> +                       break;
> +               }
> +
> +               // select next block
> +               if (i & 1)
> +                       current += (pitch - 1) * 8;
> +               else
> +                       current += 8;
> +       }
> +
> +       return true;
> +}
> +
> +bool SVQ1Decoder::svq1DecodeDeltaBlock(Common::BitStream *ss, byte
> *current, byte *previous, int pitch,
> +               Common::Point *motion, int x, int y) {
> +       // get block type
> +       uint32 blockType = _blockType->getSymbol(*ss);
> +
> +       // reset motion vectors
> +       if (blockType == SVQ1_BLOCK_SKIP || blockType == SVQ1_BLOCK_INTRA)
> {
> +               motion[0].x =
> +               motion[0].y =
> +               motion[(x / 8) + 2].x =
> +               motion[(x / 8) + 2].y =
> +               motion[(x / 8) + 3].x =
> +               motion[(x / 8) + 3].y = 0;
> +       }
> +
> +       bool resultValid = true;
> +
> +       switch (blockType) {
> +       case SVQ1_BLOCK_SKIP:
> +               svq1SkipBlock(current, previous, pitch, x, y);
> +               break;
> +       case SVQ1_BLOCK_INTER:
> +               resultValid = svq1MotionInterBlock(ss, current, previous,
> pitch, motion, x, y);
> +               if (!resultValid) {
> +                       warning("svq1MotionInterBlock decode failure");
> +                       break;
> +               }
> +               resultValid = svq1DecodeBlockNonIntra(ss, current, pitch);
> +               break;
> +       case SVQ1_BLOCK_INTER_4V:
> +               resultValid = svq1MotionInter4vBlock(ss, current,
> previous, pitch, motion, x, y);
> +               if (!resultValid) {
> +                       warning("svq1MotionInter4vBlock decode failure");
> +                       break;
> +               }
> +               resultValid = svq1DecodeBlockNonIntra(ss, current, pitch);
> +               break;
> +       case SVQ1_BLOCK_INTRA:
> +               resultValid = svq1DecodeBlockIntra(ss, current, pitch);
> +               break;
> +       }
> +
> +       return resultValid;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/svq1.h b/image/codecs/svq1.h
> new file mode 100644
> index 0000000..56310a1
> --- /dev/null
> +++ b/image/codecs/svq1.h
> @@ -0,0 +1,88 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_SVQ1_H
> +#define IMAGE_CODECS_SVQ1_H
> +
> +#include "image/codecs/codec.h"
> +
> +namespace Common {
> +class BitStream;
> +class Huffman;
> +struct Point;
> +}
> +
> +namespace Image {
> +
> +/**
> + * Sorenson Vector Quantizer 1 decoder.
> + *
> + * Used in video:
> + *  - QuickTimeDecoder
> + */
> +class SVQ1Decoder : public Codec {
> +public:
> +       SVQ1Decoder(uint16 width, uint16 height);
> +       ~SVQ1Decoder();
> +
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const { return
> _surface->format; }
> +
> +private:
> +       Graphics::Surface *_surface;
> +       uint16 _width, _height;
> +       uint16 _frameWidth, _frameHeight;
> +
> +       byte *_last[3];
> +
> +       Common::Huffman *_blockType;
> +       Common::Huffman *_intraMultistage[6];
> +       Common::Huffman *_interMultistage[6];
> +       Common::Huffman *_intraMean;
> +       Common::Huffman *_interMean;
> +       Common::Huffman *_motionComponent;
> +
> +       bool svq1DecodeBlockIntra(Common::BitStream *s, byte *pixels, int
> pitch);
> +       bool svq1DecodeBlockNonIntra(Common::BitStream *s, byte *pixels,
> int pitch);
> +       bool svq1DecodeMotionVector(Common::BitStream *s, Common::Point
> *mv, Common::Point **pmv);
> +       void svq1SkipBlock(byte *current, byte *previous, int pitch, int
> x, int y);
> +       bool svq1MotionInterBlock(Common::BitStream *ss, byte *current,
> byte *previous, int pitch,
> +                       Common::Point *motion, int x, int y);
> +       bool svq1MotionInter4vBlock(Common::BitStream *ss, byte *current,
> byte *previous, int pitch,
> +                       Common::Point *motion, int x, int y);
> +       bool svq1DecodeDeltaBlock(Common::BitStream *ss, byte *current,
> byte *previous, int pitch,
> +                       Common::Point *motion, int x, int y);
> +
> +       void putPixels8C(byte *block, const byte *pixels, int lineSize,
> int h);
> +       void putPixels8L2(byte *dst, const byte *src1, const byte *src2,
> int dstStride, int srcStride1, int srcStride2, int h);
> +       void putPixels8X2C(byte *block, const byte *pixels, int lineSize,
> int h);
> +       void putPixels8Y2C(byte *block, const byte *pixels, int lineSize,
> int h);
> +       void putPixels8XY2C(byte *block, const byte *pixels, int lineSize,
> int h);
> +       void putPixels16C(byte *block, const byte *pixels, int lineSize,
> int h);
> +       void putPixels16X2C(byte *block, const byte *pixels, int lineSize,
> int h);
> +       void putPixels16Y2C(byte *block, const byte *pixels, int lineSize,
> int h);
> +       void putPixels16XY2C(byte *block, const byte *pixels, int
> lineSize, int h);
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/svq1_cb.h b/image/codecs/svq1_cb.h
> new file mode 100644
> index 0000000..27408a7
> --- /dev/null
> +++ b/image/codecs/svq1_cb.h
> @@ -0,0 +1,1511 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// These tables are modified from their FFmpeg counterparts so that
> +// they work on both little and big endian systems.
> +
> +#ifndef IMAGE_CODECS_SVQ1_CB_H
> +#define IMAGE_CODECS_SVQ1_CB_H
> +
> +#include "common/scummsys.h"
> +
> +namespace Image {
> +
> +static const int8 s_svq1InterCodebook4x2[768] = {
> +    7,  2, -6, -7,  7,  3, -3, -4, -7, -2,  7,  8, -8, -4,  3,  4,
> +   19, 17,  9,  3,-14,-16,-12, -8,-18,-16, -8, -3, 11, 14, 12,  8,
> +    7,-16,-10, 20,  7,-17,-10, 20, -6, 18,  8,-21, -7, 18,  9,-20,
> +   25,  3,-20,-14, 29,  7,-18,-13,-29, -4, 21, 14,-31, -6, 20, 14,
> +  -19,-26,-28,-24, 31, 32, 22, 10, 15, 24, 31, 28,-32,-32,-22,-13,
> +    2, -8,-23,-26, -9,  3, 27, 35,  3, 11, 21, 21,  8, -4,-27,-34,
> +  -30,-31, 12, 47,-29,-30, 13, 47, 38, 30,-17,-46, 34, 26,-19,-46,
> +  -42,-50,-51,-43, 34, 48, 55, 48, 48, 54, 51, 42,-44,-52,-53,-47,
> +    4,  5,  0, -6, -2, -2,  0,  1,-11, -6, -1, -2,  1,  8,  9,  1,
> +    0,  1, -6,  5,  8,  1,-12,  2,  7,-14, -7,  8,  5, -8,  0,  8,
> +    1,  4, 11,  8,-12, -8,  0, -5, -1,  1,  0,  4,-15, -8,  3, 16,
> +   17,  8, -4, -6,  9, -4,-13, -8,  2,  6,  1,-18, -1, 11, 11,-12,
> +    6,  0,  2,  0, 14,  6, -7,-21,  1, -1,-13,-20,  1,  1, 10, 21,
> +  -22, -5,  7, 13,-11, -1,  4, 12, -7,  0, 14, 19, -4,  3, -5,-19,
> +  -26,-14, 10, 15, 18,  4, -6, -2, 25, 19, -5,-18,-20, -7,  4,  2,
> +  -13, -6, -1, -4, 25, 37, -2,-35,  5,  4,  1,  1,-21,-36,  2, 43,
> +    2, -2, -1,  3,  8, -2, -6, -1, -2, -3,  2, 12, -5, -2, -2, -1,
> +   -3, -1, -1, -5, -1,  7,  8, -2,  2,  7,  5, -3,  1,  1, -3, -8,
> +   -3, -1, -3, -2, -2, -3,  2, 13, 15,  0,-11, -6,  3,  0,  0,  0,
> +   -6, -9, -5, -4, 18,  4,  1,  3, 12,  3,  0,  4,-16, -3,  3, -3,
> +  -17,  3, 18,  2, -1, -3, -1, -1, -6, 16, -8,  0, -9, 14, -7,  0,
> +    3,-13, 14, -5,  3,-13, 14, -4, -7, 20, 14,-23,  8, -7, -8,  4,
> +    8,-15,-19, 16,-10, 13, 11, -3,  9, -1,  1, 26,  5,-15,-27,  2,
> +  -20,  7, 16, -4,-40,  9, 31,  1, 26,-12,-30, -7, 40, -2,-19,  4,
> +    6,  0,  0,  0, -6, -2,  1,  2,  0, -1,  0, -6,  9,  0, -2, -1,
> +   -7,  8,  2, -3, -1,  2, -3,  2,  7, -4, -2,  4,  2,  0,  0, -6,
> +   -3, -2,  9,  2, -2, -1,  0, -4, -3, -3,  0, -3, -6,  2, 10,  4,
> +    3,  0,-10,  8,  0,  0, -4,  4, -1,  1,  4,  2,  3, -7, -9,  7,
> +    2,  1, -9, -4, -1, 12,  0,  0,  3, -1,  7, -4,  3,-14,  4,  2,
> +  -12, -9,  1, 11,  2,  5,  1,  0,  3,  1,  0,  2,  0,  8,  6,-19,
> +   -6,-10, -7, -4,  9,  7,  5,  7,  6, 21,  3, -3,-11, -9, -5, -2,
> +   -4, -9,-16, -1, -2, -5,  1, 36,  8, 11, 19,  0,  2,  5, -4,-41,
> +   -1, -1, -2, -1, -2, -2,  1,  6,  0,  4,  1, -8,  1,  1,  1,  0,
> +   -2, -3,  4,  0,  2, -1,  3, -3,  1,  3, -4,  1, -1,  3,  0, -5,
> +    3,  4,  2,  3, -2, -3, -6, -1, -2, -3, -2,  2, -4,  8,  1,  0,
> +   -7,  4,  2,  6, -7, -1,  1,  0, -2,  2, -4,  1,  8, -6,  2, -1,
> +   -6,  2,  0,  2,  5,  4, -8, -1, -1,-11,  0,  9,  0, -2,  2,  2,
> +   17, -5, -4, -1, -1, -4, -2, -2,  0,-13,  9, -3, -1, 12, -7,  2,
> +    0, -2, -5,  2, -7, -5, 20, -3,  7,  7, -1,-30,  3,  5,  8,  1,
> +   -6,  3, -1, -4,  2, -2,-11, 18,  0, -7,  3, 14, 20, -3,-18, -9,
> +    7, -2,  0, -1, -2,  0,  0, -1, -4, -1,  1,  0, -2,  2,  0,  4,
> +    1, -3,  2,  1,  3,  1, -5,  1, -3,  0, -1, -2,  7,  1,  0, -3,
> +    2,  5,  0, -2,  2, -5, -1,  1, -1, -2,  4, -1,  0, -3,  5,  0,
> +    0,  3, -1, -2, -4,  1,  5, -1, -1,  0, -1,  9, -1, -2, -1, -1,
> +   -2,  5,  5, -1, -2,  2, -3, -2,  1,  2,-11,  1,  2,  1,  3,  2,
> +    2,-10, -1, -2,  4,  2,  4,  1,  4,  5, -5,  1,  0,  6,-11,  1,
> +    1,  0,  6,  6,  0,  2,  1,-15,  7,  3,  5,  9,-30,  2,  2,  2,
> +  -34,  1,  9,  2,  5,  8,  8,  2,  7,  2,  6,  6,  2,-27,  1,  4
> +};
> +
> +static const int8 s_svq1InterCodebook4x4[1536] = {
> +    4,  0, -6, -7, -4, -8,-13, -9, -8, -8, -1,  6, -2,  5, 22, 27,
> +  -16, -7, 11, 10,-18, -7, 13, 10,-15, -4, 12,  8, -9, -1,  9,  5,
> +   -2,  2, 15,-16, -3,  2, 19,-19, -3,  2, 19,-19, -2,  3, 15,-14,
> +   17, 22, 22, 16, -6, -7, -5, -2,-12,-16,-16,-12,  1,  1, -1, -3,
> +   11,-17,  0,  8, 14,-21, -1,  9, 14,-21, -2,  8, 11,-16, -2,  6,
> +    7, -2,-16, 11,  9, -2,-21, 14, 10, -1,-22, 14,  8, -1,-18, 10,
> +  -10, 16,  3, -9,-13, 20,  4,-11,-14, 21,  4,-10,-11, 16,  3, -8,
> +   11,  4, -9, -9, 15,  6,-12,-14, 17,  8,-12,-14, 16, 10, -7,-11,
> +    4, 10, 14, 13, -1,  7, 15, 16,-12, -7,  3,  8,-20,-23,-18,-10,
> +  -10,-18,-26,-25,  4,  1, -6,-11, 13, 15, 11,  3, 12, 15, 13,  8,
> +  -16,-19,-16,-11,  7, 12, 15, 11, 11, 16, 16, 11, -6, -9,-11,-10,
> +   18, 19, 12,  5, 18, 16,  5, -4,  6,  0,-10,-15, -9,-17,-23,-22,
> +  -10,-14, -1, 21,-11,-17,  0, 29,-11,-16,  1, 30,-10,-14,  0, 23,
> +  -16,-17,-12, -6,-19,-19,-14, -7, -3, -1,  1,  2, 27, 35, 29, 19,
> +  -37, -8, 23, 23,-42, -9, 28, 29,-43,-10, 26, 28,-38,-11, 19, 22,
> +   32, 16,-16,-33, 39, 20,-18,-37, 38, 19,-19,-38, 32, 15,-17,-34,
> +   24,  9, -6, -4, -1,-10, -6,  3, -8, -9, -1,  3,  3,  7,  2, -6,
> +   -1, -3, -1,  0, -1,  4,  2, -7, -3, 11,  3,-16,  1, 20,  9,-18,
> +   -3, -8,  6, 12, -5,-10,  7, 13, -6, -9,  5,  7, -5, -5,  2, -1,
> +   -8, 12, -3, -1,-10, 15, -3,  1,-11, 13, -4,  1,-11,  8, -3,  2,
> +    9,  6, -5,-12,  3,  0, -8,-13, -4, -4, -1, -1, -4,  1, 15, 18,
> +    9, 13, 14, 12,  4,  3, -1, -2, -2, -5, -8, -5, -7,-11, -9, -4,
> +    7, -5, -7, -4, 14, -2, -7, -4, 17,  0, -8, -5, 15,  1, -7, -5,
> +  -10, -1,  6,  4,-15, -9,  2,  4,  2, -1, -3,  0, 25, 13, -8,-10,
> +    7, 11, -3,-16,  7, 11, -3,-15,  6,  7, -2, -9,  4,  2, -3, -5,
> +   -7, -1, -1,  0, -9, -2,  2,  6,-12, -4,  6, 14,-13, -6,  8, 19,
> +  -18,-18,-11, -5, -3,  0,  3,  4,  6,  8,  6,  6,  6,  6,  6,  6,
> +   -5,  3, 13,-10, -6,  1, 15, -9, -6, -3, 15, -6, -6, -6, 10, -3,
> +    9,  1, -9, -9, 11,  9,  6,  5,  0,  3,  8,  7,-15,-14, -6, -5,
> +  -11, -6, 11, 19, -2, -5, -9, -8,  6,  2, -9,-10,  6,  5,  4,  5,
> +   -7, -3,  8, 15, -1,  3, 10, 15,  5,  5, -1, -2,  4, -2,-21,-25,
> +    6, -6, -6,  5,  8, -9, -7,  9,  8,-12, -7, 13,  4,-14, -7, 14,
> +   -4, -3,  1,  1, -3, -5, -2, -3,  7,  0, -2, -4, 20,  7, -4, -4,
> +   -3,-20, -6, 10,  6,  0,  0,  1,  5,  8,  5, -1, -3,  0,  0, -2,
> +   13,  6, -1,  2,  5,  3,  2,  3, -3,  0,  3,  0,-16, -8, -2, -5,
> +   -2, -7, -6,  0, -3, -6, -3,  1, -5, -1,  2, -1, -1, 12, 16,  5,
> +   -7,  1,  9,  8,-10, -2,  5,  3, -6,  2,  7,  3, -4,  0, -1, -7,
> +    3,  4, -9,-24,  0,  2,  6,  3, -1, -1,  4,  7,  5,  3, -1, -2,
> +    3,  6, -9,  2,  1,  6,-13,  1,  1,  8,-10,  2,  1,  8, -7,  1,
> +   -3, -3,  2, 22, -2, -3, -5, 12, -2, -3,-10,  2, -3, -1, -4,  2,
> +   11, 12,  8,  2, -5, -5, -5, -8, -6, -4,  0, -3, -2, -1,  3,  3,
> +   12, -6, -2, -1, 12, -8, -2, -2,  9, -7,  0, -3,  4, -6,  2, -2,
> +  -19,  1, 12, -3, -4,  4,  5, -4,  6,  1, -2, -1,  4, -4, -2,  7,
> +   -3, -4, -7, -8, -4, -4, -2,  0, -1,  2, 14, 16, -4, -2,  4,  4,
> +   -1,  7,  2, -5, -2,  0, -1,  1,  4, -3, -1, 13,  6,-12,-14,  8,
> +   -1,  5,  4, -5, -2,  5,  3, -9, -2,  7,  4,-12, -1,  7,  4, -9,
> +   -6, -3,  1,  1, 11, 11,  0, -6,  6,  4, -2, -7,-12,-10,  3, 10,
> +   -2, -3, -3, -2,  6, 11, 14, 10, -9,-11,-10,-10,  2,  2,  3,  2,
> +   -7, -5, -7, -1, -1,  2,  0,  7, -1,  1,  0,  9,  3,  4, -5, -1,
> +   10, -1,-15, -1,  4,  1, -5,  2, -3,  1, -1,  1, -3,  1,  4,  4,
> +    2, -1,  4, 10,  6,  2, -1,  0,  2,  2, -7,-12, -4,  2,  0, -3,
> +   -1, -4, -1, -8,  3, -1,  2, -9,  4,  0,  5, -5,  2,  0,  8,  3,
> +    3,  2,  1,  1,  4, -2,  0,  3,  2, -1,  4,  1,  0,  6, -1,-25,
> +   -1, -2, -2, -4, -3,  0, -1, -4, -1, -1, -4,  2,  0, -6,  2, 25,
> +  -11, -1,  5,  0,  7,  0, -2,  2, 10, -1, -3,  4, -5, -5, -2, -1,
> +    0,  6,  3, -1, -2, -1, -1,  1, -1, -7,-12, -5,  8,  6,  2,  4,
> +    2,  6, -1, -6,  9, 10, -1, -4,  1,  0, -4,  0,  3, -2, -9, -5,
> +   -4,  3,  4,  0, -4,  3,  3,  0,-11,  0,  3,  2,-11,  3,  7,  2,
> +    2, -4,  7,  3,  1, -8,  7,  1, -1,-12,  4,  1,  3, -9,  2,  2,
> +    2, -2, -2,  9,-17, -3,  3,  1, -4,  7,  1, -6,  5,  4, -1,  3,
> +   -1,  2,  0, -4, -7,  8, 12, -1, -2,  5,  4, -5,  3, -5, -8, -2,
> +    0,  0, -5, -2, -2, -8,  3, 27, -1, -4, -3,  6, -3,  1, -2, -7,
> +    4,  4,  1, -1, -7,-10, -7, -3, 10, 10,  5,  3, -2, -2, -4, -3,
> +    0,  1,  5,  7,  4, -2,-16,-20,  0,  4,  7,  8,  2,  0, -2, -1,
> +   -2,  1,  3, 17, -3,  1, -2, -1, -1, -2, -1, -2, -1, -5, -1,  0,
> +    5, -3,  1,  0,  6, -2,  0,  0, -1, -2,  0, -3,-11,  1,  8, -1,
> +    3,  0,  0,  0,  0,  2,  4,  1,  2,  0,  6,  1, -2,-18, -3,  2,
> +  -14,  0,  6,  1, -5, -2, -1,  1, -1,  1,  0,  1,  1,  7,  4,  0,
> +   -1,  0,  1, -4,  1,  8,  3, -4, -3,  4,  1,  3, -6,  1, -4,  1,
> +    1,-12,  3,  3, -1,-10,  0, -1,  2,  0,  2,  1,  3,  2,  2,  4,
> +    3,  0,  0,  3,  2,  0, -2,  1,  5,  2, -5,  0,  6, -1,-14, -1,
> +   -2, -6, -3, -3,  2, -1,  4,  5,  6, -1, -2,  0,  4,  4, -1, -5,
> +   -4,  1,-11,  0, -1,  2, -4,  1,  2, -3,  3, -1,  1, -2, 15,  0,
> +    1, -1,  0, -2,  1, -4, -7,  1, -2, -6, -1, 21, -2,  2, -1,  1,
> +   21, -1, -2,  0, -1, -3,  1, -2, -9, -2,  2, -1,  2,  1, -4, -1,
> +    1,  8,  2, -6,-10, -1,  4,  0, -4, -3,  3,  3,  5,  0, -1, -1,
> +    3,  2,  1, -2, -2, -2,  4,  3,  5,  2, -4,-17,  0, -2,  4,  3,
> +   -7, -4,  0,  3,  9,  9,  2, -1,-11, -6,  0, -1,  5,  1,  0,  1,
> +    0, 17,  5,-11,  3, -2, -6,  0,  2, -2, -4,  1, -4,  1,  2, -1,
> +   -5, -1, -5, -3, -3,  5, -3, -2,  4, 16,  2, -5, -2,  5, -1, -1,
> +    0,  0, -4,  1, -1,  2,  5, 11, -1, -1, -2,  1, -4, -2, -3, -1,
> +   -5, -1, 10,  0,  6,  1,  0, -3,  0, -4,  1,  0, -2, -4,  3, -1,
> +    6,  9,  3,  0, -2,  1, -2,  0, -2, -3, -2, -2,  1,  0,  1, -6,
> +    1,  0,  2,  1, -1,  3, -2,  1,  0, -1,-15,  0, -1,  5,  2,  6,
> +    2,  0,  2,  2,  0,-12, -4,  6,  0,  1,  4, -1,  1,  2,  1, -4,
> +    1, -2, -7,  0,  0,  0,  0, -1, -5,  2, 11,  3,  1,  3,  0, -6,
> +    0, -3, -9, -4,  1,  3, -1,  0,  4,  1, -2,  0,  7, -3, -1,  6,
> +    1, -2,  6,  2,  0, -1,  3, -2, -2,  4,  0,  2, -1,  2,-14,  2,
> +    2,  2,  0, -1, -2,  3, -3,-14,  0,  2,  3, -3,  5,  1,  3,  2,
> +    1, -3,  4,-14,  1, -2, 11, -1,  0, -1,  3,  0, -1,  1,  0,  2,
> +   -2,  3, -3,  2, -4, -1, -4,  3, -1,  2,  1,  3, -6, -2,  2,  7,
> +   -2,  1,  2,  0, -2,  0,  0, -1, 12,  5, -1,  2, -8, -1,  1, -7,
> +    2, -2, -4,  2, 11,  0,-11, -2,  3,  1, -3, -1,  0,  3,  1, -1,
> +    0,  3,  0, -2,  0, -6, -1, -3, 12, -7, -2,  0,  7, -2,  1,  1,
> +    1,  2,  2,  2, -1,  2,  0,  2,-23,  0,  4,  0,  3,  2,  1,  3,
> +   -4, -5, -1,  5, -3,  5, 10, -1,  0,  0,  3, -4,  1, -1,  2, -5
> +};
> +
> +static const int8 s_svq1InterCodebook8x4[3072] = {
> +    9,  8,  4,  0, -3, -4, -4, -3,  9,  8,  4, -1, -4, -5, -5, -3,
> +    8,  7,  3, -2, -5, -5, -5, -4,  6,  4,  1, -2, -4, -5, -4, -3,
> +  -12,-14,-11, -4,  1,  5,  6,  6, -8,-10, -7, -5, -2,  1,  1,  1,
> +    5,  4,  3,  1,  0,  0, -1, -1, 13, 13,  9,  6,  3,  0, -1, -2,
> +   -4, -4, -3, -1,  1,  4,  8, 11, -5, -6, -4, -2,  0,  3,  8, 12,
> +   -7, -7, -6, -4, -2,  2,  7, 10, -7, -7, -5, -4, -2,  1,  5,  8,
> +   -3, -2, -1,  1,  3,  6,  7,  6,  2,  3,  5,  7,  8,  8,  6,  4,
> +    4,  5,  4,  3,  1, -2, -6, -7,  1,  0, -2, -7,-10,-14,-17,-16,
> +   -5, -4,  1,  8,  9,  3, -3, -7, -7, -6,  1, 11, 12,  5, -3, -8,
> +   -8, -7,  0,  9, 11,  5, -3, -7, -8, -6, -1,  5,  8,  4, -2, -6,
> +   -4, -5, -7, -8, -9, -9, -8, -6, -4, -5, -6, -7, -7, -6, -4, -2,
> +    0,  1,  2,  3,  5,  8, 10,  9,  1,  2,  3,  6,  9, 12, 14, 13,
> +    5,  6,  6,  5,  4,  3,  2,  1,  5,  6,  7,  7,  6,  6,  6,  4,
> +   -1,  0,  1,  1,  3,  5,  5,  5,-13,-16,-17,-17,-14,-10, -6, -4,
> +    9, 11, 13, 16, 15, 13, 12, 10, -4, -5, -6, -7, -7, -7, -6, -5,
> +   -6, -6, -7, -7, -7, -7, -6, -5, -2, -1,  0,  0,  0,  0,  0, -1,
> +  -11,-13,-15,-16,-16,-14,-12,-10,  2,  3,  4,  5,  4,  3,  3,  3,
> +    6,  7,  8,  8,  8,  7,  6,  5,  3,  4,  3,  3,  3,  3,  3,  3,
> +    3,  4,  4,  1, -2, -7,-13,-17,  5,  7,  7,  5,  1, -5,-13,-19,
> +    6,  8,  9,  8,  5, -1, -9,-16,  6,  8, 10, 10,  7,  2, -4,-11,
> +   18,  9, -1,-10,-13, -9, -4,  0, 22, 12, -1,-12,-15,-10, -4,  2,
> +   23, 13,  0,-10,-13, -9, -3,  2, 20, 12,  2, -6, -9, -6, -2,  2,
> +   -6, -6, -6, -7, -7, -7, -7, -6, -6, -7, -8, -8, -9, -9, -9, -8,
> +   -3, -3, -3, -3, -3, -3, -3, -3, 12, 15, 18, 21, 21, 19, 17, 14,
> +   14, 16, 18, 18, 18, 16, 15, 13,  5,  6,  6,  5,  5,  4,  4,  3,
> +   -6, -7, -9,-10,-10,-10, -9, -7,-10,-11,-13,-14,-14,-13,-12,-10,
> +  -27,-17, -4,  5,  9, 10, 10,  7,-32,-19, -3,  7, 11, 12, 11,  8,
> +  -30,-16, -2,  8, 12, 12, 10,  7,-23,-12,  0,  7, 10, 11,  9,  6,
> +   16, 17, 16, 12,  6, -1, -8,-12, 17, 18, 15, 10,  1, -8,-15,-18,
> +   15, 14, 10,  4, -5,-14,-20,-23, 10,  8,  4, -1, -9,-16,-21,-22,
> +  -10,-12,-12,-11, -5,  4, 14, 20,-11,-13,-15,-12, -4,  7, 19, 27,
> +  -11,-13,-14,-11, -3,  8, 21, 28,-10,-11,-12, -9, -2,  8, 18, 25,
> +   -1, -1, -1,  1,  4,  6,  6,  5,  0,  0,  0,  2,  4,  3,  1, -2,
> +    0,  0,  2,  4,  4, -1, -7,-10,  0,  0,  3,  5,  3, -3,-11,-15,
> +  -14,-13, -8, -1,  3,  3, -1, -4, -5, -4, -1,  4,  8,  8,  3,  0,
> +    3,  2,  2,  3,  4,  5,  3,  1,  5,  3,  0, -2, -2, -1, -1, -1,
> +    9,  1, -6, -6, -5, -3, -2, -1, 12,  1, -6, -6, -4, -2, -1,  0,
> +   14,  4, -4, -4, -2, -2, -1, -1, 14,  6, -1, -1, -1, -1, -1, -1,
> +    4,  6,  8, 10, 11,  9,  7,  5, -1, -1, -1,  0,  0, -1, -1, -2,
> +   -2, -4, -4, -5, -5, -5, -5, -4, -2, -3, -3, -4, -4, -3, -2, -1,
> +    2,  3,  4,  4,  3,  1,  0,  0, -1,  1,  4,  5,  6,  5,  4,  3,
> +   -8, -6, -2,  2,  3,  4,  4,  3,-14,-13, -9, -5, -2, -1,  0,  0,
> +   -3, -4, -5, -4,  0,  7, 12, 13, -3, -4, -5, -5, -2,  4,  9, 10,
> +   -2, -3, -4, -5, -4, -1,  3,  4, -1, -1, -2, -3, -3, -2,  0,  1,
> +    9,  5, -2, -8,-11,-10, -7, -4, 12, 10,  6,  2,  0, -1,  0,  0,
> +    2,  2,  3,  4,  3,  1,  1,  1, -9, -8, -4,  0,  1,  2,  1,  0,
> +    6,  8,  8,  5,  1, -5,-11,-13,  0,  1,  2,  2, -1, -4, -8,-11,
> +   -3, -2,  1,  3,  3,  1, -1, -4, -2, -1,  2,  5,  6,  6,  4,  1,
> +    3,  4,  5,  5,  4,  1, -3, -6,  5,  6,  4,  2,  2,  2,  0, -3,
> +    6,  5,  0, -5, -5, -2, -1, -2,  7,  4, -3,-11,-12, -7, -3, -2,
> +    1,  0, -1, -1, -1,  0,  0,  0,  2,  3,  4,  4,  5,  5,  4,  3,
> +   -7, -9, -9,-10,-10, -9, -7, -6,  3,  4,  5,  6,  5,  5,  5,  5,
> +   -7, -7, -7, -7, -6, -6, -5, -4, -5, -4, -3, -1, -1, -1,  0,  0,
> +   -3, -2,  1,  4,  5,  5,  5,  5, -2, -1,  3,  6,  9, 10, 10,  9,
> +  -14,  1, 10,  3, -2,  0,  1,  1,-16,  2, 13,  3, -3, -1,  1,  0,
> +  -15,  2, 12,  3, -4, -2,  1,  1,-10,  3, 10,  2, -3, -1,  1,  1,
> +    0,  1,  4,  2, -5,-10, -3, 11, -1,  1,  4,  2, -6,-13, -2, 15,
> +   -1,  0,  3,  1, -6,-12, -1, 15, -1,  1,  2,  1, -4, -8,  0, 11,
> +   10,  5, -2, -2,  2,  5,  1, -4,  7,  0, -8, -6,  1,  5,  2, -4,
> +    2, -5,-12, -7,  2,  7,  4, -1, -1, -7,-10, -4,  4,  9,  7,  2,
> +   -5, -5, -4, -6, -6, -5, -5, -3, -1, -2, -2, -4, -5, -6, -5, -4,
> +    6,  7,  7,  4,  0, -2, -3, -3, 13, 14, 13, 10,  5,  1, -1, -2,
> +    1,  1,  2,  2,  2,  2,  2,  2, -5, -6, -8, -9, -9, -8, -7, -6,
> +    7,  9, 10, 11, 11,  9,  7,  5, -1, -2, -3, -3, -4, -4, -4, -3,
> +   -1, -1,  0,  0,  0,  0, -1, -1, -3, -3, -4, -5, -4, -3, -3, -2,
> +    2,  1, -1, -3, -3, -2, -1,  0, 12, 12,  8,  3,  1,  0,  0,  1,
> +   -6, -8, -8, -6, -2,  2,  6,  8,  1,  1, -1, -2,  0,  3,  5,  7,
> +    3,  3,  1, -1, -1,  0,  0,  2,  0,  1,  0, -1, -1, -1, -2, -1,
> +    1,  0,  0,  0,  0,  0,  2,  4,  2,  1,  3,  4,  3,  1,  0,  2,
> +    2,  1,  0,  0, -1, -1,  0,  3,  5,  1, -6,-12,-13, -8, -1,  4,
> +   -2,  0, -1, -2, -1,  0,  2,  3, -6, -3, -2,  0,  1,  1,  1,  1,
> +   -9, -5,  0,  4,  5,  3,  1,  0, -8, -3,  3,  7,  8,  4,  1,  0,
> +    1,  2,  2,  3,  3,  1, -1, -3,  4,  5,  5,  6,  6,  5,  2,  0,
> +    0,  0,  0,  0,  1,  0, -2, -4, -3, -3, -4, -3, -3, -4, -7, -8,
> +   14, 12,  6, -1, -3, -3,  0,  0,  7,  5,  1, -3, -5, -4, -2, -1,
> +   -2, -2, -2, -2, -2, -2, -1, -1, -6, -4, -1,  1,  1,  1,  0, -1,
> +    2,  2,  1, -3, -6, -7, -6, -3,  1,  0, -1, -3, -2,  1,  4,  6,
> +    0,  0,  1,  2,  4,  7,  8,  7,  0,  0,  0,  0, -1, -4, -7, -8,
> +    0,  2,  1, -2, -3, -3, -2, -1, -1,  1,  0, -3, -5, -2,  0,  2,
> +   -2, -1, -2, -5, -4,  1,  6,  9, -3, -2, -3, -4, -2,  5, 11, 13,
> +   -4, -2,  2,  6,  4, -3,-10,-14, -2, -1,  1,  4,  4,  1, -1, -2,
> +    0,  0, -1, -2, -2,  0,  4,  6,  2,  2,  0, -3, -3,  0,  5,  9,
> +   -4, -4, -2,  1,  6,  9,  3, -7, -2, -2, -2, -1,  4,  8,  0,-11,
> +    1,  1,  0,  0,  2,  6, -1,-10,  2,  2,  1,  0,  2,  4,  0, -7,
> +   -1, -2, -3, -6, -7, -8, -8, -8,  2,  3,  3,  1, -1, -2, -3, -4,
> +    5,  5,  5,  4,  3,  2,  0, -1,  3,  3,  3,  3,  2,  2,  1,  1,
> +    3,  3,  2, -2, -3,  0,  7, 10,  1,  2,  2, -2, -5, -4,  0,  3,
> +    0,  3,  4,  2, -3, -5, -6, -4,  0,  2,  4,  4,  1, -4, -7, -7,
> +    2,  4,  5,  5,  5,  5,  6,  6, -4, -4, -3, -5, -5, -3, -3, -2,
> +   -3, -4, -4, -5, -4, -2, -2, -2,  1,  1,  0,  0,  2,  4,  5,  4,
> +   -2,  0,  3,  4,  4,  3,  2,  2, -9, -7, -4,  0,  3,  6,  6,  6,
> +   -5, -5, -3, -2,  0,  1,  3,  4,  5,  5,  2, -2, -4, -6, -5, -3,
> +    1, -6, -4,  7,  5, -2, -2,  1,  5, -5, -4,  6,  4, -5, -4,  1,
> +    5, -5, -4,  6,  4, -5, -3,  1,  1, -7, -3,  8,  7, -1, -3,  1,
> +   -8, -7, -4,  0,  2,  4,  5,  5,  5,  6,  5,  2, -1, -5, -7, -7,
> +    5,  6,  4,  1, -3, -5, -6, -5, -7, -7, -5, -2,  1,  6,  9, 10,
> +    6,  3,  0,  1,  3,  0, -8,-14,  3,  0, -1,  1,  4,  3,  0, -4,
> +    1,  0,  0,  1,  2,  1,  1,  1, -1, -1,  1,  2,  1, -1, -1,  0,
> +    1,  1,  1,  1,  0, -2, -3,  0,  1,  2,  1,  0, -2, -8, -9, -4,
> +    1,  3,  3,  2,  1, -3, -3,  1,  0,  1,  1,  1,  1,  1,  4,  8,
> +    2,  5,  9,  7,  2, -1, -1,  1, -4, -1,  1,  0, -3, -4, -1,  2,
> +   -3,  0,  3,  3,  0, -1,  0,  2, -4, -1,  1,  1, -2, -4, -5, -4,
> +    1, -1, -2, -2, -1,  2,  4,  5,  2,  1,  1,  0, -1, -1,  0,  0,
> +    2,  3,  4,  5,  4,  2,  1,  0, -9, -9, -6, -3, -1, -1, -1, -1,
> +   -6, -6,  4,  7,  0, -2, -1, -2, -1, -2,  5,  6, -1, -2,  0, -1,
> +    4, -1,  1,  0, -4, -2,  0, -2,  7,  1, -1, -2, -3,  1,  3,  1,
> +    4,  2,  1,  3,  3,  1,  1,  2,  2, -2, -4,  0,  3,  1,  0,  0,
> +    1, -4, -8, -4,  1,  2,  1,  0,  2, -3, -9, -6,  0,  3,  3,  2,
> +   -1, -1,  0, -1, -1,  0,  1,  2,  3,  1, -4, -8, -7, -3,  1,  2,
> +    2, -1, -3, -2, -1,  0,  1,  0, -1,  0,  5, 11,  9,  3, -1, -3,
> +   -1, -2, -2, -1,  1,  1,  1,  1,  0, -1,  0,  3,  6,  6,  5,  5,
> +    2,  1, -1, -1, -2, -5, -6, -4,  2,  2,  2,  1, -1, -4, -5, -5,
> +   -1, -3, -6, -7, -6, -4, -1,  1,  5,  5,  3,  4,  4,  3,  4,  5,
> +   -1, -2, -3, -2, -2, -2,  0,  1,  0,  0,  0,  0,  0,  1,  2,  3,
> +   -6, -6, -4, -1,  2,  2,  2,  2, -6, -7, -5, -2,  0, -1, -1,  0,
> +    2,  2,  2,  4,  4,  3,  3,  4,  2,  1,  0, -1,  0,  0,  2,  4,
> +   12,  5, -5, -8, -5,  0,  2,  2,  2, -3, -6, -3,  0,  0, -1, -2,
> +   -2, -3, -1,  3,  4,  1, -2, -3,  2,  2,  3,  4,  3,  1, -1, -1,
> +    3,  2,  1,  0,  1,  4,  3,  0,  4,  3,  0, -5, -6,  0,  3,  3,
> +    2,  3,  1, -7,-12, -6,  1,  3,  1,  3,  4, -1, -6, -4,  0,  1,
> +   -9, -4,  2,  6,  7,  4,  1,  0, -7, -1,  4,  6,  4,  0, -3, -3,
> +   -6,  0,  4,  4,  1, -2, -3, -2, -4,  1,  3,  2,  0, -2, -1,  0,
> +    0,  5,  2, -5, -3,  3,  1, -4, -2,  4,  2, -6, -3,  6,  4, -3,
> +   -1,  5,  3, -5, -1,  7,  3, -4, -1,  2,  0, -6, -3,  5,  3, -3,
> +   -8, -3,  3,  5,  3,  1, -2, -2,  2,  4,  4, -2, -4, -3,  1,  3,
> +    2,  1, -3, -5, -3,  3,  4,  3, -5, -6, -5,  3, 10,  8, -1, -5,
> +    0,  3,  2, -4, -9, -7,  0,  6, -5, -1,  5,  7,  4, -1, -3, -3,
> +   -5, -5, -2,  3,  6,  5, -1, -4,  9,  6,  0, -4, -2,  1,  1, -1,
> +   -1, -1, -1,  1,  1,  0, -1,  0, -1,  0,  0,  0,  0, -1, -1,  0,
> +    2,  1, -2, -1,  1,  1,  0,  0, 12,  8,  2, -1, -1, -4, -7, -7,
> +    2,  1,  3,  6,  7,  4,  2,  0,  1,  0, -1,  0, -1, -4, -7, -8,
> +    0,  0, -1,  0,  0,  0, -1, -3,  0,  0,  0,  0,  1,  1,  0, -2,
> +   -1,  0,  1,  1,  0,  0, -1, -2,  0,  0, -1, -3, -4, -3, -1,  1,
> +   -1,  0,  0,  0,  1,  4, 10, 12, -1,  0, -2, -2, -3, -3, -1,  1,
> +   -3, -1, -2, -4,  2,  9,  9,  7, -3,  0, -1, -3,  0,  2, -1,  1,
> +   -1,  1, -2, -3,  0, -1, -3,  0,  0,  0, -3, -2,  0, -1, -1,  1,
> +   -1, -2, -1, -1, -2, -1, -1, -2,  2, -1, -2, -1,  0,  1,  0, -2,
> +    3, -1, -2,  2,  5,  3, -1, -3,  1, -5, -5,  1,  6,  6,  2,  0,
> +    1,  2,  0, -1,  0,  1,  0, -2, -5, -3, -1,  0,  1,  2,  1, -2,
> +   -7, -5, -2, -2, -2, -2,  0,  1, -1,  0,  1,  1,  0,  3,  9, 12,
> +    0,  6,  5,  1, -2, -3,  0,  3,  0,  6,  5,  1,  1,  1,  2,  3,
> +   -5, -2, -2, -3,  0,  0,  0,  0, -6, -3, -3, -2,  0,  0, -1, -2,
> +    4,  4,  2,  1,  0, -1, -1,  0, -2, -2,  0,  1,  2,  1,  1,  0,
> +    2,  2,  1, -1, -3, -5, -9,-10,  2,  1, -1, -1,  1,  4,  4,  1,
> +    4,  0, -2, -2, -2, -2, -1,  0,  7,  1, -4, -3, -2,  0,  1,  1,
> +   10,  5, -1, -2,  0,  1,  1,  0,  5,  1, -3, -4, -3, -1, -1, -2,
> +    2,  1, -1, -3, -3,  1,  1, -1, -2, -1,  3,  0, -1,  1,  1,  0,
> +   -3,  1,  7,  2, -3, -2, -1,  0, -2,  4,  8, -1, -8, -5,  0,  2,
> +   -4, -1,  1,  2,  1, -3, -4, -2, -5, -3, -2,  1,  4,  4,  4,  6,
> +   -3, -2, -4, -3,  0,  1,  1,  2,  2,  2,  2,  1,  2,  1, -1, -1,
> +   -4, -1,  0, -1, -3, -3, -1, -1,  1,  4,  4,  2,  0, -1, -2, -3,
> +    4,  6,  5,  3,  2,  1, -2, -4,  0,  1,  1,  1,  1, -1, -4, -6,
> +    1,  2,  2, -1, -6, -5, -1,  2, -3, -2,  1,  1, -4, -3,  2,  5,
> +   -2, -1,  2,  2, -3, -4,  0,  3, -2, -2,  2,  6,  5,  2,  1,  2,
> +    2, -3, -3,  0,  0,  2,  3,  1,  3, -1,  1,  3,  1,  2, -1, -5,
> +   -5, -7, -4, -2,  1,  8,  8,  1, -1,  0,  2,  0, -3,  0,  1, -3,
> +   -2, -5, -5, -2, -3, -1,  0, -2, -1, -4,  0,  4,  0,  2,  4,  0,
> +    0,  0,  8, 10,  2,  1,  3, -1, -4, -3,  2,  3, -3, -3,  1, -1,
> +    1, -2, -4,  2,  7,  3, -2, -1,  6,  4, -2, -1,  2,  0, -1,  3,
> +    1,  1, -2, -2, -2, -5, -3,  4, -6, -2,  1,  1, -1, -4, -2,  4,
> +   -2, -1, -2, -2,  0,  1,  0, -2, -1,  1,  0, -1,  0,  0, -1, -3,
> +    0,  1, -2, -4, -3, -1,  0,  0,  6,  8,  5,  0,  0,  1,  2,  3,
> +   -2, -2,  2,  5,  2,  0,  0,  1,  2, -2, -2, -1, -1,  1,  2,  4,
> +    2, -1,  0,  1,  0,  0,  0,  1, -8, -7, -1,  1, -1, -1,  1,  3,
> +    0,  3,  6,  2, -2,  1,  2,  0,-10, -7, -1,  0, -3, -1,  2,  1,
> +    0,  0,  2,  2,  1,  1,  1, -1,  3,  0, -2, -2,  0,  2,  1,  0,
> +    8,  1,  0,  0, -2, -3, -1,  0,  2, -2,  2,  5,  1, -2, -1,  1,
> +   -3, -6, -3, -1, -3, -3, -1,  2,  2,  0,  1,  2,  2,  1,  0,  0,
> +    1, -1, -1, -2, -1,  0,  1,  0, 15,  9,  2, -1, -2, -3, -3, -3,
> +    0, -3, -2,  0,  0, -1, -1, -1,  1,  0,  1,  0,  0, -1, -1, -1,
> +    0,  2,  2, -2, -3, -3, -7, -8,  0,  2,  2,  0,  1,  2,  1,  1,
> +    1,  2,  2,  2,  3,  1,  0,  3,  1,  0, -1, -2, -1, -2,  0,  5,
> +  -11, -6, -1,  1,  2,  3,  1, -3,  1,  4,  3, -1, -2,  1,  2, -1,
> +    2,  2,  1, -1, -2,  0,  1, -1,  0,  0, -1, -1,  0,  2,  3,  2,
> +    1,  1,  2,  1, -1,  1,  0, -4,  0,  0,  0, -2, -2,  2,  4, -2,
> +   -2, -3,  0,  0, -1,  2,  1, -6,  0,  2,  5,  5,  3,  2, -1, -7,
> +    4,  2,  0,  0,  3,  3,  1, -1,  0, -1, -1,  3,  6,  4,  1, -1,
> +   -2, -2,  0,  2,  2,  0, -2, -2, -1,  0, -1, -5, -7, -5, -1,  1,
> +    5, -1, -2,  0,  2,  4,  2, -5,  0, -5, -2,  2,  1,  2,  0, -6,
> +    6,  1,  0,  1, -2, -1,  4,  2,  2, -3, -3,  0, -1, -2,  0,  0,
> +    1, -1,  0,  2,  0,  0,  6, 11,  2, -1, -1,  0, -3, -2,  3,  5,
> +    0, -2, -1,  0, -1,  0,  0, -3,  1, -1, -1, -1, -2, -1, -3, -7,
> +    1,  1, -2, -2,  1,  3,  1, -2, -1,  2,  0, -1, -1,  1,  0,  0,
> +   -4,  2,  3, -1, -2, -2,  0,  1,-11, -2,  4,  5,  6,  2, -1, -2,
> +   -6, -2,  1, -1, -3, -4,  1,  9, -3,  0,  3,  3,  2, -3, -3,  3,
> +    1,  1,  0,  0,  1, -1, -2,  3,  2,  0, -3, -3,  0, -1, -1,  3,
> +    1, -1, -3,  1,  2, -6, -4,  6,  0, -2, -5, -2,  0, -3, -2,  3,
> +    2,  2,  1, -2, -2,  1,  2, -1, -1,  1,  1, -2, -1,  6,  7, -1,
> +    1,  0, -4, -2,  1, -2, -3,  1, -4,  0, -3, -2,  2,  0, -3,  0,
> +   -3,  4,  3,  1,  8,  7,  0, -1, -3,  4,  1, -4,  2,  3, -2, -3,
> +   -3,  6,  1, -4,  1,  1, -1, -1, -2,  4, -3, -3,  3,  0, -1, -1,
> +    1,  2, -4,  2,  4, -3, -1,  2,  3, -1, -4,  5,  4, -6, -3,  2
> +};
> +
> +static const int8 s_svq1InterCodebook8x8[6144] = {
> +   -4, -3,  4,  5,  2,  1,  1,  0, -5, -3,  5,  5,  2,  1,  0,  0,
> +   -6, -4,  5,  5,  2,  1,  0,  0, -7, -4,  4,  5,  2,  1,  0,  0,
> +   -8, -5,  3,  4,  2,  1,  0,  0, -8, -6,  3,  4,  1,  1,  1,  0,
> +   -8, -6,  2,  4,  2,  1,  1,  0, -8, -6,  2,  4,  1,  1,  1,  1,
> +   -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2,
> +   -2, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, -3, -3, -4, -3,
> +   -2, -2, -2, -2, -2, -3, -3, -2,  1,  1,  1,  1,  1,  0, -1, -1,
> +    4,  5,  5,  5,  4,  3,  3,  2,  7,  7,  8,  8,  8,  7,  6,  5,
> +    2,  1,  2,  4,  4,  0, -4, -6,  1,  1,  2,  5,  5,  1, -5, -7,
> +    1,  2,  1,  4,  5,  1, -5, -8,  1,  1,  1,  5,  5,  0, -6, -8,
> +    0,  1,  1,  5,  6,  1, -6, -9,  0,  0,  1,  4,  5,  0, -5, -8,
> +    0,  0,  1,  4,  5,  0, -5, -7,  0,  0,  1,  4,  4,  1, -4, -7,
> +    1,  2,  3,  0, -3, -4, -3, -1,  1,  3,  4,  0, -3, -4, -3, -1,
> +    2,  4,  5,  1, -3, -4, -3, -2,  2,  5,  6,  1, -3, -5, -4, -2,
> +    3,  6,  6,  1, -3, -5, -4, -2,  3,  6,  6,  1, -3, -5, -4, -2,
> +    3,  6,  6,  1, -3, -5, -4, -2,  3,  5,  5,  1, -3, -4, -4, -2,
> +    2,  2,  2,  2,  1,  0,  0, -1,  4,  4,  4,  3,  2,  1,  1,  0,
> +    4,  5,  4,  4,  3,  3,  2,  1,  4,  4,  4,  4,  4,  3,  2,  2,
> +    2,  3,  3,  3,  3,  3,  2,  1, -1, -1, -1, -1,  0,  0,  0,  0,
> +   -5, -6, -6, -5, -5, -4, -3, -3, -7, -9, -9, -8, -7, -6, -6, -5,
> +    6,  6,  6,  6,  6,  5,  5,  4,  4,  4,  4,  3,  3,  3,  3,  2,
> +    0, -1, -1, -1, -2, -2, -1, -1, -3, -5, -6, -6, -6, -6, -5, -4,
> +   -3, -5, -6, -7, -6, -6, -5, -4, -1, -2, -2, -2, -2, -2, -1, -1,
> +    0,  1,  1,  1,  1,  1,  1,  1,  3,  3,  3,  3,  3,  3,  3,  3,
> +    2,  1, -2, -5, -4,  0,  2,  5,  2,  1, -2, -6, -5,  0,  3,  5,
> +    2,  1, -2, -6, -6, -1,  3,  6,  3,  2, -2, -7, -6,  0,  4,  7,
> +    2,  1, -2, -7, -5,  0,  5,  7,  2,  1, -2, -6, -5,  0,  4,  7,
> +    2,  1, -2, -6, -4,  0,  4,  6,  1,  1, -2, -5, -4,  0,  3,  6,
> +  -10, -9, -6, -4, -1,  2,  3,  2,-10, -9, -5, -3,  0,  4,  4,  3,
> +   -9, -7, -3, -1,  2,  5,  5,  3, -7, -5, -2,  0,  3,  5,  5,  3,
> +   -6, -3,  0,  1,  4,  6,  5,  3, -4, -2,  1,  2,  3,  5,  4,  2,
> +   -2,  0,  1,  2,  2,  4,  3,  1, -1,  1,  2,  2,  2,  3,  3,  1,
> +   -4, -5, -5, -6, -6, -6, -6, -5, -3, -3, -4, -4, -4, -4, -4, -4,
> +    0,  0,  0,  0, -1, -1, -1, -1,  5,  5,  6,  5,  5,  4,  3,  2,
> +    5,  6,  7,  7,  7,  6,  5,  4,  3,  3,  4,  4,  4,  4,  3,  2,
> +    0, -1,  0,  0, -1, -1,  0, -1, -3, -3, -4, -4, -4, -4, -3, -3,
> +    1, -2, -5,  1,  5,  4,  2,  0,  1, -3, -6,  1,  6,  5,  2,  0,
> +    0, -4, -7,  0,  6,  6,  2,  1, -1, -5, -9, -1,  6,  6,  3,  1,
> +   -1, -6,-10, -2,  6,  6,  3,  1, -1, -6, -9, -2,  5,  6,  3,  1,
> +   -2, -6, -9, -2,  5,  5,  3,  1, -2, -6, -7, -2,  4,  4,  2,  1,
> +   -5, -7, -8, -9, -9, -8, -7, -6, -5, -6, -6, -7, -7, -6, -6, -5,
> +   -3, -3, -3, -4, -5, -5, -4, -4, -1,  0,  0, -1, -1, -1, -1, -1,
> +    0,  1,  2,  2,  2,  2,  2,  1,  2,  3,  4,  5,  5,  5,  5,  4,
> +    3,  4,  5,  6,  8,  8,  8,  7,  3,  4,  5,  6,  7,  7,  7,  6,
> +    5,  6,  7,  8,  9, 10, 10,  9,  3,  4,  6,  7,  8,  9,  9,  8,
> +    0,  1,  2,  3,  4,  5,  5,  5, -1, -2, -1, -1,  0,  1,  2,  2,
> +   -2, -3, -3, -3, -3, -2, -1,  0, -3, -4, -5, -5, -5, -5, -5, -4,
> +   -4, -5, -5, -6, -7, -7, -6, -5, -3, -4, -5, -6, -7, -7, -6, -6,
> +   13,  7,  0, -3, -3, -4, -4, -5, 14,  7,  0, -3, -3, -4, -4, -4,
> +   15,  8, -1, -4, -4, -4, -5, -4, 15,  8, -1, -4, -4, -5, -4, -3,
> +   15,  7, -1, -4, -5, -5, -5, -4, 14,  7, -1, -4, -4, -4, -4, -3,
> +   12,  6, -1, -4, -4, -4, -4, -3, 11,  5, -1, -4, -4, -4, -4, -3,
> +  -17, -4,  5,  4,  4,  4,  3,  3,-18, -5,  5,  4,  4,  4,  3,  3,
> +  -19, -5,  6,  4,  4,  4,  3,  2,-20, -5,  6,  4,  4,  4,  3,  3,
> +  -20, -4,  6,  4,  4,  5,  3,  3,-19, -5,  6,  4,  4,  5,  3,  3,
> +  -18, -4,  5,  4,  4,  4,  3,  2,-17, -5,  4,  3,  4,  4,  3,  3,
> +   -6, -6, -6, -4, -2,  1,  6, 11, -6, -7, -7, -4, -2,  2,  8, 13,
> +   -8, -8, -7, -4, -2,  3,  9, 14, -8, -8, -7, -5, -1,  4, 10, 16,
> +   -8, -8, -7, -5, -1,  4, 10, 17, -8, -8, -7, -4,  0,  5, 10, 16,
> +   -8, -8, -6, -3,  0,  4,  9, 15, -7, -7, -5, -3,  0,  4,  8, 12,
> +    8,  7,  7,  5,  2, -2, -8,-14,  8,  8,  7,  5,  2, -2, -8,-15,
> +    8,  8,  7,  5,  1, -3, -9,-16,  8,  8,  7,  5,  1, -3,-10,-17,
> +    8,  9,  8,  5,  1, -3,-10,-17,  8,  8,  7,  4,  1, -4,-10,-16,
> +    7,  7,  7,  4,  1, -3, -9,-14,  6,  7,  6,  3,  0, -3, -9,-13,
> +    5,  1, -4, -4, -3, -1,  0,  0,  7,  2, -3, -3, -2, -1,  1,  0,
> +    7,  1, -3, -3, -1,  0,  1,  1,  6,  1, -3, -2, -1,  1,  1,  0,
> +    6,  0, -4, -2, -1,  0,  1,  0,  5,  0, -4, -3, -1,  0,  0, -1,
> +    5,  0, -3, -1,  0,  0,  0, -2,  4,  1, -2, -1,  0,  1,  0, -1,
> +    2,  2,  1,  1, -2, -6, -8, -8,  1,  1,  1,  1, -2, -5, -8, -8,
> +    1,  1,  1,  0, -1, -3, -5, -5,  0,  0,  0,  0, -1, -1, -1, -2,
> +    0, -1,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  1,  2,  3,  2,
> +    2,  1,  1,  1,  2,  3,  4,  3,  3,  3,  3,  3,  4,  4,  5,  4,
> +   -4, -4, -3, -2,  0,  0,  1,  1, -4, -4, -3, -2, -1,  0,  0,  1,
> +   -2, -2, -2, -1, -1, -1,  0,  0,  0,  1,  0,  0,  0,  0,  0, -1,
> +    2,  2,  2,  2,  2,  2,  1,  1,  3,  4,  4,  4,  4,  4,  4,  3,
> +    1,  1,  1,  3,  3,  4,  3,  3, -5, -6, -5, -4, -3, -3, -2, -2,
> +   -4, -2, -1, -1, -1, -1,  0,  1, -4, -2, -1, -1, -1, -1,  0,  1,
> +   -3, -2, -1, -1, -1,  0,  1,  2, -4, -3, -2, -1, -1,  1,  3,  3,
> +   -4, -3, -3, -1, -1,  1,  4,  5, -4, -3, -2, -2, -1,  1,  4,  7,
> +   -2, -2, -1, -1,  0,  2,  6,  8, -1,  0,  0,  1,  1,  4,  7,  8,
> +   -3, -3, -3, -2, -2, -1, -1,  0, -1, -1,  0,  1,  2,  2,  3,  3,
> +    0,  1,  2,  4,  5,  6,  6,  5, -1,  0,  2,  3,  5,  6,  5,  3,
> +   -1, -1,  0,  2,  3,  3,  2,  1, -2, -2, -1,  0, -1, -3, -4, -4,
> +    0,  0, -1, -1, -2, -4, -8, -7,  1,  2,  1,  0, -1, -4, -6, -7,
> +   -2,  4,  1, -6,  0,  3,  0,  0, -2,  5,  1, -7,  0,  3,  0,  0,
> +   -3,  5,  1, -8,  0,  3, -1, -1, -2,  6,  1, -9,  0,  3,  0, -1,
> +   -2,  6,  2, -8,  0,  4,  0, -1, -3,  5,  1, -7,  1,  4,  0,  0,
> +   -2,  4,  1, -7,  0,  4,  1,  0, -1,  4,  1, -6,  0,  3,  1,  0,
> +    0,  0,  0,  3,  4,  5,  4,  1,  1,  1,  1,  2,  3,  3,  2,  0,
> +    2,  2,  1,  2,  2,  1, -1, -2,  4,  3,  1,  1,  0, -1, -3, -5,
> +    5,  3,  1, -1, -2, -3, -4, -6,  5,  3,  0, -2, -3, -5, -6, -7,
> +    4,  3,  0, -2, -3, -4, -5, -5,  4,  3,  0, -1, -2, -2, -3, -3,
> +    0,  0,  0,  0, -1, -5, -2,  6,  0,  0,  0,  1, -1, -6, -2,  8,
> +    0,  0,  0,  2,  0, -6, -3,  9,  0, -1,  0,  2,  0, -7, -2, 10,
> +    0, -1,  0,  2, -1, -8, -3, 10,  0, -1, -1,  2, -1, -7, -3,  9,
> +    0, -1,  0,  1, -1, -6, -3,  8,  0,  0,  0,  1,  0, -5, -2,  7,
> +    2,  3,  3,  2,  1,  0, -1, -1,  3,  4,  3,  2,  1,  0, -1, -2,
> +    3,  4,  4,  2,  1, -1, -2, -3,  2,  3,  3,  2,  0, -1, -2, -3,
> +   -1,  0,  1,  1,  0, -1, -2, -2, -5, -4, -3, -1,  0,  1,  1,  1,
> +   -8, -8, -5, -1,  1,  3,  4,  3,-10, -9, -5,  0,  3,  5,  6,  5,
> +   -5, -1,  4,  5,  3,  1,  0,  0, -6, -1,  4,  5,  2,  0, -1, -2,
> +   -6, -1,  5,  4,  2, -1, -2, -2, -7, -1,  4,  4,  1, -2, -3, -3,
> +   -6, -1,  5,  4,  1, -2, -3, -3, -5,  0,  4,  4,  1, -1, -2, -2,
> +   -4,  0,  5,  4,  1, -1, -1, -2, -3,  1,  4,  3,  1, -1, -1, -2,
> +   -2, -3, -2,  1,  4,  6,  5,  3, -3, -4, -4,  0,  3,  5,  4,  2,
> +   -3, -5, -5, -1,  2,  4,  3,  1, -4, -6, -4, -1,  2,  4,  2, -1,
> +   -2, -4, -3,  1,  2,  4,  2, -1, -2, -4, -2,  1,  3,  3,  1, -2,
> +   -2, -3, -2,  1,  3,  3,  1, -2, -2, -2, -1,  1,  3,  3,  0, -2,
> +   -4, -4, -3, -2, -1,  2,  5,  7, -4, -4, -3, -3, -2,  1,  5,  7,
> +   -2, -3, -2, -3, -3, -1,  3,  5, -1, -1,  0, -2, -3, -2,  2,  4,
> +    1,  1,  1, -1, -4, -3,  1,  3,  4,  3,  2, -1, -4, -3, -1,  1,
> +    6,  4,  3,  0, -3, -3, -2,  0,  6,  5,  3,  1, -2, -3, -2, -1,
> +   12, 11,  8,  4,  0, -2, -2, -1, 10,  9,  6,  2, -1, -2, -1,  0,
> +    4,  3,  2,  0, -1, -1,  0,  1, -1, -1, -1, -1, -2,  0,  1,  2,
> +   -3, -5, -4, -2, -2,  0,  2,  3, -5, -5, -4, -2, -1,  0,  1,  2,
> +   -5, -5, -4, -2, -1,  0,  1,  1, -4, -4, -3, -2, -2, -1,  0,  0,
> +    3,  3,  2, -1, -3, -4, -3, -2,  3,  2,  0, -2, -4, -4, -3, -2,
> +    2,  2,  1, -1, -3, -5, -4, -3,  3,  3,  3,  1, -2, -3, -3, -3,
> +    4,  4,  4,  3,  0, -2, -2, -2,  5,  5,  5,  3,  0, -1, -2, -2,
> +    5,  5,  4,  2, -1, -2, -3, -2,  3,  3,  3,  0, -2, -4, -4, -4,
> +   -1, -1,  4, -2, -2,  6,  2, -5, -1,  0,  4, -2, -3,  6,  2, -6,
> +   -1,  0,  4, -2, -3,  7,  3, -7, -1, -1,  4, -3, -4,  8,  3, -7,
> +    0, -1,  4, -3, -4,  7,  3, -6, -1, -1,  4, -3, -4,  7,  3, -6,
> +   -1, -1,  3, -3, -4,  6,  3, -6, -1,  0,  3, -2, -3,  6,  3, -5,
> +    1, -2, -7,  2,  5, -2, -1,  1,  1, -2, -8,  3,  6, -3, -1,  2,
> +    2, -2, -9,  4,  7, -4, -2,  2,  3, -1, -9,  5,  7, -4, -1,  3,
> +    3, -1, -9,  4,  7, -4, -2,  2,  3, -1, -7,  4,  6, -4, -2,  1,
> +    2,  0, -6,  4,  6, -4, -1,  1,  2,  0, -5,  3,  4, -3, -1,  1,
> +   -2,  2,  2,  0,  0, -1, -3, -4, -2,  2,  2,  1,  1,  0, -2, -4,
> +   -2,  2,  2,  2,  2,  1, -1, -2, -3,  2,  3,  3,  4,  2,  0, -2,
> +   -3,  2,  3,  2,  4,  2,  0, -3, -4,  1,  2,  1,  2,  1, -1, -3,
> +   -5,  0,  1,  0,  1,  1, -2, -3, -4,  0,  0,  0,  1,  0, -2, -3,
> +    0,  0, -1, -2, -2,  2,  7,  8,  0,  0, -1, -3, -2,  1,  6,  7,
> +    0,  1, -1, -3, -3,  0,  4,  5,  0,  1,  0, -1, -1,  0,  1,  3,
> +    0,  2,  1,  1,  0, -1,  0,  1, -2,  0,  1,  2,  1,  0, -1, -1,
> +   -5, -2,  0,  1,  1,  0, -3, -3, -6, -4, -1,  1,  1, -1, -3, -4,
> +   -4, -2,  2,  5,  6,  4,  3,  2, -5, -3,  1,  4,  4,  2,  0,  0,
> +   -4, -2,  0,  2,  1, -1, -2, -2, -2, -1,  0,  1,  0, -2, -3, -2,
> +   -2,  0,  0,  0, -1, -1, -2, -1, -2, -1, -1,  0,  0,  0,  1,  2,
> +   -2, -2, -1, -1,  0,  1,  3,  4, -2, -3, -2, -1,  0,  2,  4,  5,
> +    2,  1, -2, -2, -1,  0,  1,  0,  1,  0, -3, -3, -1,  0,  1,  0,
> +    0, -1, -3, -3, -1,  1,  1,  1,  0,  0, -3, -1,  1,  2,  3,  3,
> +    0, -1, -3, -1,  1,  3,  3,  3, -2, -2, -4, -2,  1,  3,  4,  4,
> +   -3, -3, -4, -2,  1,  3,  3,  4, -2, -3, -5, -2,  1,  2,  3,  3,
> +    4,  5,  3,  4,  4,  4,  4,  5,  3,  3,  1,  0,  0,  0,  0,  1,
> +    1,  1, -1, -2, -3, -4, -3, -2,  2,  2,  0, -2, -2, -4, -3, -2,
> +    2,  3,  1, -1, -1, -3, -3, -2,  1,  2,  0,  0, -1, -2, -2, -1,
> +    0,  1,  0, -1, -1, -3, -2, -1,  1,  1,  0, -1, -1, -2, -2, -2,
> +   -2, -1, -1,  0,  1,  2,  1,  0,  1,  2,  3,  5,  6,  5,  5,  3,
> +    1,  2,  3,  4,  5,  5,  4,  3, -2, -2, -3, -3, -2, -1,  0,  0,
> +   -3, -3, -4, -5, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1,  0,  0,
> +    0,  1,  0, -1, -1,  0,  0,  1, -1,  0, -1, -2, -3, -2, -2, -1,
> +    7,  7,  6,  5,  4,  2, -1, -2,  3,  3,  2,  2,  1,  0, -2, -3,
> +    0, -1, -1, -1,  0, -1, -2, -2, -1, -3, -2, -1,  0,  0,  0,  1,
> +    0, -2, -2, -1, -1,  1,  2,  2,  3,  1, -1, -1, -1,  1,  2,  2,
> +    3,  1, -2, -3, -2, -1,  1,  2,  1, -2, -5, -6, -5, -3, -2,  0,
> +    0, -1, -2, -3, -1,  0, -2, -2,  0,  0, -1, -1,  0,  1, -1, -2,
> +    0,  0, -2, -1,  0,  0,  0, -2, -1, -2, -3, -3, -2, -1, -3, -3,
> +   -1, -2, -3, -3, -2, -2, -3, -4,  2,  2,  0,  0,  0,  0, -1, -2,
> +    5,  5,  3,  2,  2,  2,  0, -1,  8,  8,  6,  5,  4,  4,  2,  1,
> +   -7, -8, -6, -3, -1, -1, -2, -1, -5, -5, -3,  0,  2,  1,  0,  0,
> +   -1, -1,  0,  3,  4,  3,  1,  1,  2,  1,  1,  3,  4,  3,  2,  2,
> +    3,  2,  0,  2,  3,  2,  1,  2,  4,  2, -1, -1,  0,  1,  1,  1,
> +    3,  2, -2, -3, -2, -1,  0,  1,  3,  1, -3, -4, -3, -2,  0,  1,
> +   -4, -2, -1,  2,  3,  3,  1,  0, -7, -5, -4, -2,  0,  0, -1, -2,
> +   -6, -5, -5, -4, -2, -2, -2, -3, -1,  0, -1, -1,  0,  0,  0, -1,
> +    2,  3,  2,  2,  2,  2,  1,  0,  3,  5,  4,  3,  1,  0,  1,  0,
> +    3,  4,  3,  2,  0, -1, -1, -1,  5,  5,  3,  1,  0, -1, -1, -1,
> +    1,  1,  0, -1, -3, -5, -6, -4,  1,  1,  0,  0,  0, -3, -3, -1,
> +    0, -1, -1,  0,  1,  0,  1,  3, -2, -2, -3, -1,  2,  2,  4,  7,
> +   -2, -2, -2,  0,  2,  2,  3,  6, -1,  0,  0,  1,  1,  0,  0,  3,
> +    0,  3,  3,  3,  1, -2, -3, -1,  1,  3,  4,  3,  0, -3, -5, -4,
> +    0,  2,  0, -1, -3, -4, -2, -2,  1,  4,  2,  0, -2, -3, -2, -1,
> +    3,  6,  3,  1, -2, -2,  0, -1,  4,  7,  4,  1, -2, -3, -1,  0,
> +    3,  6,  3,  0, -3, -3, -1,  0,  1,  3,  0, -1, -3, -2,  1,  1,
> +    0,  1, -1, -2, -3, -1,  2,  2, -2, -1, -3, -3, -3, -1,  1,  2,
> +    3,  1, -1,  0,  1,  0,  0,  0,  2, -1, -2, -1,  1,  0, -1, -1,
> +    1, -1, -2,  0,  1,  0, -2, -3,  0, -2, -1,  1,  3,  1, -3, -5,
> +    0, -2, -1,  2,  5,  2, -3, -5,  0, -2, -1,  4,  6,  3, -2, -5,
> +    0, -2,  0,  4,  7,  4, -2, -4,  0, -2,  0,  4,  6,  4, -2, -4,
> +   -2, -2, -3, -4, -3, -2, -1,  0,  1,  1,  0, -1, -1, -1,  0,  1,
> +    3,  3,  2,  2,  1,  1,  1,  1,  2,  2,  2,  2,  1,  0,  0,  1,
> +    0,  0,  0,  0, -1, -1, -1, -1, -4, -4, -4, -4, -4, -4, -4, -3,
> +   -3, -3, -2, -3, -2, -1, -1,  0,  3,  4,  4,  5,  5,  6,  6,  7,
> +   -1, -2,  7, -2, -4, -1, -1,  0, -1, -2,  9, -1, -4, -1, -1,  0,
> +   -1, -3, 10, -1, -4, -1, -1,  1, -1, -3, 10, -2, -3, -1, -1,  2,
> +   -1, -2, 10, -2, -4, -1, -1,  2, -1, -2,  9, -2, -4, -1, -1,  2,
> +   -1, -2,  8, -2, -4,  0, -1,  1,  0, -2,  7, -2, -3, -1,  0,  2,
> +    3, -4,  1,  3, -3, -2,  1,  0,  3, -5,  1,  4, -3, -2,  1,  0,
> +    3, -6,  2,  5, -3, -1,  3,  0,  3, -6,  2,  5, -3, -1,  2,  0,
> +    3, -6,  1,  5, -4, -2,  3,  0,  3, -6,  1,  5, -3, -2,  2,  0,
> +    2, -6,  1,  4, -3, -1,  1,  0,  2, -6,  1,  4, -2, -1,  1,  0,
> +    0,  0,  1,  1,  1,  0,  0,  2,  0, -1,  1,  1,  1,  0,  0,  2,
> +    0, -1,  0,  0,  0,  0,  0,  2,  0, -1,  0,  0,  0,  0, -1,  0,
> +    1,  0,  1,  0,  0, -1, -2, -1,  3,  1,  1,  0,  0, -2, -4, -3,
> +    5,  3,  2,  1,  0, -3, -5, -4,  5,  4,  2,  0, -1, -4, -5, -5,
> +    1,  0, -1, -2, -2, -3, -6, -9,  2,  0, -1, -1,  0,  0, -3, -6,
> +    1,  0,  0, -1,  0,  0, -2, -5,  2,  1,  1,  1,  1,  2, -1, -3,
> +    1,  1,  2,  1,  2,  2,  1, -1,  1,  1,  2,  1,  1,  1,  1,  1,
> +    0,  0,  2,  1,  0,  0,  2,  2,  0,  1,  2,  2,  0,  0,  2,  2,
> +   -4, -3,  0,  1,  4,  6,  4,  3, -3, -2,  0,  0,  2,  4,  1,  0,
> +   -1, -1,  0,  0,  1,  1, -2, -3,  1,  1,  1,  0,  1,  1, -3, -5,
> +    1,  1,  1,  0,  1,  1, -3, -5, -1,  0,  0, -1,  1,  1, -2, -4,
> +   -1,  0,  0, -1,  1,  2,  0, -2, -1,  0,  0,  0,  2,  3,  1,  0,
> +   -1,  0,  3,  4,  0, -4, -5, -5,  0,  0,  4,  5,  2, -2, -3, -2,
> +    0, -1,  2,  4,  2, -1, -1,  0,  0, -2, -1,  1,  0, -2,  0,  1,
> +    1, -2, -2,  0,  0, -1, -1,  1,  1, -2, -3,  0,  1,  0, -1,  0,
> +    1, -2, -2,  1,  3,  1,  0,  0,  1, -2, -1,  2,  4,  2,  0,  0,
> +    1,  2,  3,  2,  0,  2,  2,  1, -1,  0,  1,  0, -3,  1,  1,  1,
> +   -1,  0,  0, -2, -4,  0,  2,  1, -1,  2,  2, -1, -5,  0,  2,  1,
> +   -1,  3,  4, -1, -5,  0,  2,  1, -2,  2,  4,  0, -4, -1,  0,  0,
> +   -4,  0,  2,  0, -4, -2,  0,  0, -5, -1,  2,  1, -2,  1,  3,  2,
> +    1,  0,  1,  0,  1,  2, -1, -2,  2,  0, -1, -2,  1,  3,  0, -1,
> +    3,  0, -2, -4,  0,  3,  1,  0,  5,  1, -3, -5, -2,  2,  1,  1,
> +    6,  1, -2, -5, -2,  1,  0,  1,  5,  1, -1, -5, -2,  0, -1,  0,
> +    3,  0, -2, -4, -2,  0, -1,  0,  1, -1,  0, -2,  0,  1,  0,  1,
> +    1,  1,  2,  3,  2,  1,  1,  2, -1, -1,  0,  1,  1,  0,  1,  1,
> +   -4, -3,  0,  0,  1,  1,  1,  2, -4, -3,  0,  2,  2,  2,  3,  2,
> +   -5, -4,  0,  1,  1,  1,  1,  2, -5, -4, -1, -1, -2, -2, -1,  0,
> +   -3, -2,  0,  0, -2, -3, -2, -1,  2,  3,  4,  4,  2,  0,  0,  0,
> +   -4, -2,  0,  1,  0,  0,  0,  0, -3, -1,  1,  1,  0,  0,  0,  0,
> +   -2,  0,  2,  2,  0,  0,  0,  2, -1,  1,  2,  1, -1,  0,  3,  5,
> +    0,  2,  1, -1, -2,  0,  5,  6,  0,  1,  0, -3, -3,  0,  4,  6,
> +    1,  1, -2, -4, -4, -3,  1,  2,  1,  0, -2, -4, -5, -4, -2,  0,
> +   -1, -3, -3, -3, -3, -2, -1, -1,  3,  2,  1,  0,  0,  1,  1,  1,
> +    5,  4,  3,  2,  1,  1,  2,  2,  2,  1,  0, -2, -2, -2, -1, -1,
> +    0,  0,  0, -1, -2, -2, -2, -2,  0,  1,  3,  3,  2,  1, -1, -1,
> +    0,  1,  3,  4,  3,  2,  1, -1, -4, -3, -1,  1,  0, -2, -3, -3,
> +   -3, -4, -7, -8, -7, -4, -1,  2,  0, -1, -3, -4, -4, -2,  0,  2,
> +    1,  0,  0, -1, -3, -2,  0,  2,  2,  1,  1,  0, -1, -1,  0,  2,
> +    1,  1,  1,  1,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,
> +    0,  0,  1,  2,  3,  3,  2,  2,  0,  0,  1,  3,  4,  4,  3,  2,
> +    3,  3,  3,  0, -1,  0,  1,  2,  1,  1,  1, -1, -2, -1, -1,  1,
> +   -2, -2, -1, -3, -3, -2, -2,  0, -4, -4, -2, -2, -2, -2, -3,  0,
> +   -4, -4, -1,  1,  1,  0, -1,  2, -3, -1,  2,  3,  4,  3,  3,  5,
> +   -2,  0,  2,  3,  3,  3,  3,  3, -2, -2,  0,  0,  0,  0,  0,  1,
> +    0,  2,  1, -1, -3, -1,  3, -2, -1,  0, -1, -1, -3,  0,  4, -2,
> +   -2, -2, -2, -2, -2,  1,  5, -2, -3, -2, -3, -1, -2,  1,  4, -3,
> +   -2,  0, -1,  0, -1,  0,  3, -5,  1,  2,  1,  2,  0,  0,  2, -5,
> +    2,  4,  2,  3,  1,  1,  3, -3,  1,  2,  1,  1,  0,  1,  4, -2,
> +    4, -3, -4, -1,  3,  3,  1,  3,  4, -4, -4, -1,  3,  2,  0,  2,
> +    4, -3, -4,  0,  2,  2, -1,  1,  4, -3, -2,  1,  2,  1, -2,  0,
> +    2, -4, -2,  1,  2,  0, -3,  0,  2, -3, -2,  0,  1,  0, -2,  2,
> +    3, -1, -1,  0,  0,  0,  0,  3,  2, -2, -2, -2, -1, -1, -1,  2,
> +    2,  2,  3,  4,  3,  1,  0, -1,  1,  0,  1,  2,  1, -1, -2, -2,
> +    2,  1,  2,  1,  1,  0, -1, -1,  4,  3,  4,  3,  2,  1,  1,  1,
> +    3,  2,  2,  2,  1,  1,  1,  1, -1, -2, -1,  0, -1, -1, -1, -1,
> +   -3, -3, -2, -1, -2, -2, -2, -2, -4, -4, -3, -3, -4, -4, -3, -3,
> +    2,  1, -1, -3, -4, -2,  3,  4,  2,  2,  1, -1, -3, -2,  1,  2,
> +    1,  2,  3,  3,  0, -2, -1, -2, -1,  0,  2,  4,  2,  0, -1, -3,
> +   -2, -2,  0,  3,  3,  2,  0, -3,  0, -2, -3, -1,  1,  2,  2, -1,
> +    3, -1, -4, -5, -3,  0,  2,  0,  6,  3, -2, -6, -5,  0,  3,  1,
> +   -2,  3, -2,  0,  3, -2, -2,  1, -3,  4, -3,  0,  3, -2, -1,  2,
> +   -3,  5, -3,  0,  4, -2, -1,  2, -2,  4, -4, -1,  3, -3, -2,  2,
> +   -3,  4, -3,  0,  3, -3, -1,  2, -2,  5, -2,  0,  3, -3, -1,  2,
> +   -2,  4, -3,  1,  3, -2, -1,  2, -2,  3, -2,  1,  3, -2,  0,  2,
> +    1,  0,  0, -1,  1,  2, -4, -1,  2,  0,  0, -1,  1,  2, -4, -2,
> +    1,  1,  1, -1,  2,  4, -2,  0,  0, -1,  1, -1,  2,  5, -1,  1,
> +    0, -1,  0, -2,  1,  5, -1,  1,  0, -1, -1, -2,  0,  3, -3, -1,
> +    1,  1,  0, -2,  0,  3, -3, -1,  1,  1,  0, -3,  0,  3, -2,  0,
> +    1,  0, -1,  1,  1,  2,  4,  5,  1,  0, -1,  1,  1,  1,  5,  7,
> +    0,  0, -2, -1, -1,  0,  3,  5,  0, -1, -2, -1, -1, -1,  2,  3,
> +    0, -1, -3, -1, -1, -1,  1,  2, -1, -2, -4, -2, -2, -2,  0,  0,
> +   -1, -2, -2, -1, -2, -2,  0,  0,  0, -1, -1,  0, -1, -1,  0,  0,
> +    3,  3,  0, -1, -1,  1,  4,  4,  2,  3,  0, -2, -2,  0,  1,  1,
> +    2,  3,  1, -1, -1,  0,  1,  0,  1,  2,  0, -1, -1, -1,  0, -2,
> +    0,  1,  0, -1, -2, -1,  0, -2,  0,  1,  0, -1, -2, -1,  1,  0,
> +    1,  1, -1, -3, -4, -3,  1,  3,  1,  2, -1, -3, -5, -4,  1,  3,
> +   -3, -2,  0,  1,  1,  1,  0, -2,  0,  1,  1,  1,  0,  0, -1, -3,
> +    1,  2,  1,  1,  0, -1, -1, -2,  0, -1, -3, -1, -1, -1,  0, -1,
> +    0, -3, -6, -3, -2, -1,  1,  1,  2, -1, -4, -3, -2,  0,  2,  2,
> +    5,  4,  1,  1,  0,  1,  3,  2,  5,  4,  2,  1,  0, -1,  0,  1,
> +   -2,  0, -2, -5, -6, -3,  0,  0, -2,  0,  1,  0, -1,  1,  2,  2,
> +   -2,  0,  1,  3,  2,  2,  2,  1, -2,  0,  2,  4,  3,  2,  1,  1,
> +   -2,  0,  2,  3,  2,  0, -1,  0, -3, -1,  1,  1,  0, -1, -1,  1,
> +   -4, -1,  1,  0, -1, -2,  0,  2, -4, -1,  0, -1, -1, -2,  1,  4,
> +   -3,  0,  0, -1,  1,  1,  1,  0, -3,  1,  0, -1,  0,  0, -1, -1,
> +   -1,  3,  3,  0,  1,  0,  0,  1, -3,  2,  2, -2, -1,  0,  0,  1,
> +   -5,  0,  0, -2, -1,  1,  0,  2, -7, -2,  1,  0,  1,  2,  2,  2,
> +   -5,  0,  3,  2,  3,  3,  2,  2, -3,  2,  4,  1,  0,  0, -2, -3,
> +    5,  2, -2, -2,  0, -1, -1, -1,  2, -1, -4, -3, -1, -2, -1, -1,
> +    0, -2, -2,  1,  2, -1,  0,  1, -1, -2, -1,  3,  3, -1,  0,  2,
> +    1,  0,  0,  3,  3, -2, -1,  2,  2,  1,  1,  3,  2, -2, -2,  0,
> +    1,  0, -1,  1,  1, -3, -3, -2,  1,  0,  1,  2,  3,  0,  0,  0,
> +   -4, -5, -3,  0,  1, -1, -2, -1, -2, -3, -1,  1,  2,  0,  0,  0,
> +    1,  1,  2,  1,  2,  1,  1,  1,  3,  4,  3,  1,  0, -2, -1, -1,
> +    3,  3,  2,  0, -2, -3, -3, -2,  1,  1,  0, -1, -2, -4, -2, -2,
> +    2,  1,  0,  0,  0, -1,  0,  1,  2,  1,  1,  1,  1,  1,  1,  3,
> +    0,  0,  0, -1, -2, -1,  1,  0, -2, -1, -1, -2, -3, -2,  0,  0,
> +   -1,  0,  0, -1, -2,  0,  1,  1,  1,  1,  0, -1, -1,  1,  3,  1,
> +    2,  2,  0, -2, -1,  2,  3,  0,  3,  1, -1, -1,  1,  4,  2, -2,
> +    2,  0, -3, -1,  3,  5,  0, -5,  1, -1, -2,  0,  3,  3, -1, -6,
> +   -1,  0,  3,  4,  2,  0,  1,  2, -2, -1,  0,  1, -1, -2,  0,  1,
> +   -2, -3, -2, -3, -6, -7, -6, -3,  2,  2,  3,  1, -1, -2, -3, -2,
> +    2,  2,  3,  1,  0,  0,  0,  0,  2,  1,  1,  0,  1,  1,  0,  1,
> +    1,  0,  0,  0,  0,  1,  1,  2,  1,  0, -1,  0,  0,  2,  2,  1,
> +    1,  1,  3,  1, -1, -1, -1,  1, -2, -1,  0,  0, -2, -2, -1,  2,
> +   -2, -2,  1,  1,  1,  0,  1,  3, -2, -2,  0, -1,  0, -1,  0,  2,
> +    0,  0,  1,  0, -1, -1, -2,  1,  3,  2,  2,  1,  0, -2, -2,  1,
> +    5,  3,  3,  2,  1,  1,  1,  4,  0, -3, -4, -5, -4, -3, -1,  1,
> +   -6, -4, -1,  2,  2,  0,  0, -1, -4, -2,  1,  3,  3,  2,  2,  0,
> +   -3, -2, -1,  2,  3,  3,  2,  0, -3, -2, -2,  1,  2,  1,  1, -1,
> +   -2, -2, -2,  0,  2,  2,  1, -1, -1, -1, -1,  1,  2,  3,  2,  0,
> +   -1, -1, -2,  1,  2,  2,  2, -1,  0, -1, -2,  0,  2,  1,  0, -1,
> +    6,  4,  2,  1,  0,  0,  0,  1,  4,  2, -1, -2, -2, -2, -1, -1,
> +    2,  1, -1, -2, -2, -2, -2, -1,  2,  2,  0, -2, -2, -2, -1,  0,
> +    0,  0, -1, -2, -2, -1,  0,  1, -3, -3, -2, -1, -1, -2, -1,  0,
> +   -3, -2,  2,  3,  2,  0, -1, -2, -2,  0,  4,  5,  5,  2,  0, -1,
> +    5,  4,  2,  0, -1, -2, -1, -1,  4,  3,  2,  1,  0, -1,  0, -1,
> +    1,  1,  0,  1,  1,  0,  1, -1, -2, -1, -1,  0,  0, -2, -2, -3,
> +   -1,  0,  0,  0, -1, -3, -3, -5,  0,  1,  1, -1, -1, -2, -2, -3,
> +   -1, -1, -1, -2, -1,  1,  3,  1, -1, -2, -2, -1,  2,  5,  6,  5,
> +   -3, -3, -2,  1,  1, -2, -1, -1,  1,  2,  3,  4,  1, -3, -1, -3,
> +    3,  2,  0,  1, -1, -3, -1, -3,  1,  0, -1,  0, -1, -1,  1,  0,
> +    1,  1,  0,  1,  2,  2,  5,  3,  1,  1,  1,  2,  2,  2,  3,  0,
> +   -3, -1, -2, -2, -3, -3, -1, -3, -1,  1,  1,  0, -1, -1,  0, -2,
> +    2,  0, -2, -2,  2,  4,  1, -2,  1,  0, -2, -1,  3,  5,  2, -1,
> +   -1, -2, -3, -2,  1,  3,  1, -2, -1, -2, -1, -1,  0,  2,  1, -1,
> +    0,  0,  1,  1,  1,  2,  2,  0,  0,  1,  4,  4,  2,  2,  3,  1,
> +   -2, -1,  2,  1, -2, -3, -2, -3, -1,  0,  1,  0, -3, -4, -4, -5,
> +    4,  0, -3, -4, -4, -4, -2, -1,  5,  0, -1,  0, -1, -3, -2, -1,
> +    4,  0,  0,  1,  1,  0,  0,  0,  0, -3, -2, -1,  0,  0,  1,  0,
> +    0, -2,  0,  0,  1,  1,  2,  1,  2,  0,  0,  0,  1,  1,  1,  0,
> +    2,  0, -1, -1,  1,  1,  1,  0,  1, -1, -2, -2,  0,  2,  2,  2,
> +   -3, -5, -2,  0, -1, -3, -3,  0,  0, -2,  0,  2,  2,  0,  0,  3,
> +    2, -1, -2,  0,  0, -1, -1,  2,  5,  2, -1, -1, -1, -1, -1,  2,
> +    5,  2,  0, -1, -1,  0, -1,  2,  2,  1,  0,  0,  0,  1,  0,  2,
> +   -1, -1,  1,  1,  2,  2,  1,  2, -3, -2,  0,  0,  0,  0, -2, -1,
> +    0,  3,  2,  0, -2, -3, -3, -3,  0,  3,  3,  1,  0,  0,  1,  2,
> +   -1,  0, -1, -2, -1, -1,  1,  3, -1,  0, -1, -2, -1, -1,  0,  2,
> +   -1,  0, -1, -2,  0,  0, -1,  2, -1,  0, -1, -2, -1, -1, -2,  1,
> +    0,  1,  0, -3, -1, -1, -1,  2,  5,  5,  2, -1, -1, -1,  1,  3,
> +    0,  0,  1, -1, -3, -2,  0,  2,  1,  1,  3,  0, -2, -2,  0,  1,
> +    1,  1,  3,  1,  0,  0, -1, -1,  0, -1,  2,  1,  1,  0, -1, -3,
> +   -1, -2,  1,  1,  1,  0, -2, -4, -1,  0,  2,  1,  1,  0, -1, -3,
> +    1,  1,  3,  2,  1,  0, -2, -3,  2,  2,  4,  2,  1, -1, -2, -4,
> +    1,  2,  2,  2,  0, -2,  0,  2, -1, -1, -2, -3, -4, -5, -3,  1,
> +    0,  1,  1,  0, -1, -1, -1,  1,  0,  1,  1,  1,  0,  0,  0,  2,
> +    0,  1,  1,  2,  1,  1,  1,  2, -1, -1,  0,  2,  2,  2,  2,  3,
> +   -2, -4, -4, -1, -2, -2, -2,  0,  1,  0,  0,  1,  0,  0,  0,  1,
> +    0, -1, -3, -2,  0,  2,  2,  1,  0, -1, -2, -3,  0,  1,  1,  2,
> +    1,  0, -2, -3, -1,  0,  0,  1, -1,  0, -1, -2,  0,  0, -1,  0,
> +   -1,  1,  1,  0,  2,  2,  0,  0,  0,  2,  3,  1,  3,  5,  3,  2,
> +   -1,  1,  1, -2,  0,  3,  1,  1, -1,  0,  0, -4, -4, -1, -1, -1,
> +   -1,  1,  1,  0,  1,  2,  1,  2, -3,  0,  1,  0,  1,  1,  0,  2,
> +   -5, -3, -1, -1,  0,  1,  0,  1, -4, -3, -2, -3, -2, -1, -1,  0,
> +    0,  0, -1, -2, -2, -2, -2,  0,  3,  4,  2,  0,  0,  0,  0,  1,
> +    2,  1,  0,  0,  0,  0, -1,  0,  0,  1,  2,  3,  4,  4,  3,  2,
> +   -1,  4,  7,  4,  0,  0,  0,  0, -1,  4,  6,  3,  0,  1,  1,  1,
> +    0,  3,  4,  0, -1,  0,  0,  1,  0,  1,  1, -2, -1,  0, -1, -1,
> +   -1,  0, -1, -1, -1,  0,  0,  0, -1, -1, -1,  0,  0,  0,  0,  0,
> +   -1, -3, -3,  0,  1, -1, -2, -1, -3, -4, -4, -2, -1, -2, -2, -1,
> +    2,  2,  1,  0,  1,  1,  0, -3, -2, -1,  0,  0,  1,  1,  0, -3,
> +   -2, -1,  0,  1,  2,  1,  1, -2,  1,  2,  2,  2,  3,  3,  2, -1,
> +    1,  2,  1,  0,  1,  1,  2, -1,  0,  1, -2, -4, -2,  0,  1, -1,
> +    1,  1, -1, -3, -2,  0, -1, -3,  1,  2,  0, -1,  0,  1, -1, -4,
> +   -1, -1, -2, -2,  0,  3,  4,  3,  1,  1, -1, -3, -2,  0,  0,  0,
> +    2,  2,  2,  2,  2,  1, -1, -1,  1,  1,  1,  3,  3,  0, -2, -2,
> +    0, -1, -1, -1,  0, -2, -1, -1, -1, -3, -4, -3, -2, -2,  0,  2,
> +   -1, -1,  0,  1,  2,  2,  3,  5, -2, -1, -1,  0,  0,  0,  0,  1,
> +   -2, -3,  2,  0,  0,  1,  1, -1, -1, -4,  1, -2, -1,  2,  2,  0,
> +    1, -4,  0, -2, -2,  1,  1, -1,  2, -3,  1, -1, -1,  1,  1, -1,
> +    3, -2,  3,  1,  0,  1,  1, -1,  1, -3,  2,  1,  0,  1,  0, -1,
> +   -1, -5,  1,  0, -1,  0,  1,  1,  0, -3,  3,  3,  1,  2,  3,  3,
> +    0, -1, -2,  1,  5,  5,  2, -1,  1, -1, -2, -1,  1,  1, -2, -5,
> +    1,  1, -1, -2, -1, -1, -1, -3,  1,  1, -1, -1, -1,  2,  4,  3,
> +   -1, -1, -1, -1, -1,  0,  4,  3, -1, -1,  0,  1, -1, -3, -1, -1,
> +    0,  0,  0,  2,  2,  0,  0, -1,  0, -2, -3,  0,  1,  1,  3,  2,
> +    2,  3,  2,  1,  0,  0, -2, -2,  2,  3,  0,  1,  1,  3,  3,  2,
> +    0,  0, -3, -1, -1,  2,  2,  3, -2, -2, -3,  1,  1,  2,  1,  1,
> +   -2, -1, -2,  2,  1,  1, -1, -2,  0,  1,  0,  2,  0,  0, -2, -2,
> +    0,  1,  0,  2,  0,  0, -2, -2, -3, -2, -2,  0, -1, -2, -2, -3,
> +    0,  1, -1,  3, -1,  1,  3, -1,  0,  1, -1,  3, -1, -1,  2, -3,
> +    1,  1, -2,  3, -1, -3,  0, -3,  2,  2, -2,  3,  0, -2,  1, -2,
> +    1,  1, -3,  3, -1, -2,  1, -3,  1,  1, -3,  3,  0, -1,  1, -2,
> +    1,  2, -1,  4,  0, -1,  1, -2,  0,  1, -1,  3, -1, -3,  0, -3,
> +   -3, -3, -1,  1,  2,  1, -1, -2, -2, -2,  0,  2,  1,  0, -2, -2,
> +   -3, -2,  1,  2,  1, -1, -2, -1, -3, -2,  2,  4,  0, -2, -2,  1,
> +   -3, -1,  2,  4,  0, -2, -2,  2, -1,  1,  4,  3, -1, -3, -2,  2,
> +    0,  2,  4,  2, -1, -2, -1,  2,  0,  1,  2,  0, -1,  0,  1,  3,
> +    3,  0, -5,  1,  4,  0,  0,  1,  1, -2, -5,  2,  5, -1, -2,  1,
> +   -1,  0,  0,  3,  3,  1,  0, -1, -2,  3,  4, -2, -3, -1,  0, -2,
> +   -3,  3,  5, -3, -3,  0,  0, -2, -1,  3,  2, -2, -2,  2,  2, -1,
> +    2,  0,  0, -1,  0,  0,  0,  0,  0, -3, -2,  1,  3,  0, -2, -2
> +};
> +
> +static const int8 *const s_svq1InterCodebooks[6] = {
> +    s_svq1InterCodebook4x2, s_svq1InterCodebook4x4,
> +    s_svq1InterCodebook8x4, s_svq1InterCodebook8x8,
> +    0, 0
> +};
> +
> +static const int8 s_svq1IntraCodebook4x2[768] = {
> +   12, 13, 13, 11, -7,-10,-15,-17,-16,-15,-12,-10, 11, 15, 15, 12,
> +    2, 17, 20, 15,-45,-24,  2, 13, 21, 20, -6,-36, 12, 16, -1,-27,
> +  -18,-21, 10, 45,-11,-20, -7, 21, 43, -8,-28,  0, 33,-16,-28,  3,
> +  -12,-18,-18, -6,-20,-10, 28, 55, -5,-18,-21,-18, 56, 30, -6,-20,
> +  -34, 27, 29,-22,-30, 29, 26,-25, 30, 34, 33, 26,-25,-31,-35,-33,
> +  -31,-35,-36,-32, 29, 36, 37, 31,-71,-12, 38, 34,-63, -1, 42, 33,
> +   58, 37,-31,-60, 55, 34,-33,-61,-57,-57, 22, 93,-57,-58, 21, 93,
> +   59, 69, 70, 62,-63,-68,-68,-60,-64,-71,-71,-64, 63, 73, 72, 62,
> +   -2,  0,  7, 15,-11,-10, -3,  5, -5, -8,-10,-10,  1,  9, 14,  9,
> +   15,  8, -4,-11, 12,  2,-11,-12, -8,  0, 19, 28,  4, -1,-15,-26,
> +  -15, 27,  2,-14,-14, 22,  1, -9, -4, -6,-13,-10, -6,-14,  6, 47,
> +  -35,-20,  6, 23,  6,  9,  6,  4, -6,  2, 23,-22, -7,  4, 28,-21,
> +   20,-22, -2,  6, 22,-28, -5,  8,-10,-18,-16,-12, 36, 19,  2, -1,
> +   -3,  0,  4,  8,-45,-10, 23, 23, 40, 15,-20,-35, -4, -1,  4,  1,
> +    9, -5,-33, 24,  8,  3,-26, 19, -1,  4,  6, -3, 32, 25,-13,-49,
> +   24, 24, 15,  7,-17,-27,-19, -7,-47,  0, 39, 24,-21, -6,  7,  4,
> +   -1,  0,-10,-13,  1,  1,  5, 16, 20,  5, -3, -9, -1, -4, -2, -6,
> +  -17, -7,  1,  4, 12,  7,  0,  0,  3,  0, 12, 11, -3,  1,  0,-23,
> +    4, 17, -6,  0,  6,  3,-25,  0,-17, 10,  8,  5,-14,  4,  1,  4,
> +   13, 10,  4,  2,-23, -9,  1,  2,  3, -3,  1,  7,  1,-23, -7, 20,
> +   -7,-18,  2, 12, -5, -4, 10,  9,  4, 10,  7,-24,  6,  3,  4,-10,
> +   22,-14,-22,  6,  0,  5,  5, -1, -4,  3,-11, -4, -7, 31,  7,-14,
> +   -5,-16, -1, 42, -4, -2, -9, -5,  5, -8, -6, -3, 42, -4,-21, -5,
> +  -18, 12, 20,-12, 13,-13,-10,  7, -8, -9, -2,-18,-16,  6, 40,  8,
> +   10, -1,  0,  4, -3,  4, -1,-13, -2,  6,  1,-15,  5,  3,  1,  2,
> +   -4, -2,  1,  3, 15,  0, -9, -4, -3, -4, -4, -4, -3,  5, 16, -3,
> +    2, 13,  3,  4, -3, -8,-10,  0, -6, -2, -4, -1, -2, -3, -6, 23,
> +    6, -6,  7,  1,  4,-18,  5,  1, -1,  1,-15, 14, -5,  6, -4,  4,
> +    2,  2,  2,  6,-24,  2,  7,  3,-26,  0,  3,  3,  5,  7,  1,  6,
> +   14, -2,-18, -3,  7,  5, -4,  2, -6,  3, 32,  1, -6, -6, -6,-12,
> +    5,-36,  7,  6,  9, -1, 11,  0,  4,  4,  5,  3,  4, 15,  3,-38,
> +   10, 23, -5,-42,  0,  4,  4,  4, 23, 17, -6,-13,-13,-37,  1, 29,
> +    5,-14, -1,  1,  5,  0,  3,  1,  0,  4, -5,  2,  8,  0,  0,-10,
> +    4,  7, -2, -3,-10,  3,  1,  1,-12, -1, 13,  3,  0, -1,  1, -3,
> +    0, -1,  3,  1, -6, -9,  3,  9, -6,  1, -4, -6,  8, -1,  0,  8,
> +   -3, -3,  0, 18, -5, -1, -4, -1, -8, -2,  3, -4,  0, 17, -1, -5,
> +    5, -2,  9,-10,  1, -5,  6, -5,  4,  2,  2,  3, 10,-14, -8,  1,
> +   -1, -2,-18, -1, -1, 20,  1,  2, -1,  1, -9,  1, -1, -9, 22, -4,
> +    6, -4,  8, -3, -1,  7,-19,  5, -7, 31, -4, -4, -6,  0, -5, -5,
> +   -7, -8,-19, -4,  1,  1,  4, 32, 38, -1, -8,  4, -7, -8, -6,-12,
> +   -1,  0, -7,  1, -1,  9, -1,  0,  9, -1, -1,  0,  2, -6,  1, -3,
> +  -12,  0,  2,  1,  1,  1,  8,  0,  9,  1,  0,  2, -2,  1,-11,  0,
> +    0,  8,  2,-10, -1,  2, -1,  0, -2, -4,  0, -5, -2, -1, -1, 14,
> +   -3,  7, -1,  5,  0,-10,  1,  1, -1, -5, 14, -1, -2,  1, -3, -2,
> +   -6,  0,  0,  6,  2,  3, -9,  4,  4, -5, -1, -1, -7,  3,  8, -1,
> +    2, -4, -1,-11, 11,  2,  1,  0, -1,  2,  3,  9,  0,  2,  0,-15,
> +    3,  5,-20,  3,  3, -1,  3,  3,  1, -1, 16,  1,  2,-29,  9,  2,
> +  -13, -6, -1, -3, 36, -1, -8, -3,  2,  5,  4,  2,-37,  9, 11,  3
> +};
> +
> +static const int8 s_svq1IntraCodebook4x4[1536] = {
> +  -11, -3,  3,  6,-10, -1,  5,  7, -9, -1,  6,  7, -9, -1,  4,  6,
> +    5,  7,  0,-14,  6,  9,  2,-15,  6,  9,  2,-15,  4,  6,  0,-14,
> +   16,  3, -5, -6, 16,  1, -8, -8, 14, -1, -9, -9, 12,  0, -8, -8,
> +    8, 12, 16, 17, -2,  2,  6,  9,-10, -8, -4,  0,-15,-14,-11, -7,
> +   -7,-10, -2, 16, -7,-11, -3, 18, -7,-11, -1, 20, -6, -8,  1, 19,
> +   -9,-13,-16,-17,  2, -2, -7, -9, 11,  8,  4, -1, 16, 15, 11,  7,
> +  -22, -2, 13, 15,-24, -2, 14, 16,-25, -4, 13, 15,-25, -6, 10, 13,
> +   26, 26, 22, 16, 17, 15,  9,  3, -2, -6,-11,-14,-20,-25,-28,-28,
> +  -27,-27,-25,-21,-16,-15,-11, -7,  3,  8, 12, 13, 23, 28, 31, 30,
> +   20, 16, -7,-33, 22, 19, -6,-35, 22, 19, -6,-34, 20, 17, -6,-32,
> +  -20,-20,  2, 38,-21,-22,  2, 40,-21,-22,  2, 40,-20,-20,  3, 38,
> +  -47, -4, 24, 26,-50, -3, 26, 27,-50, -3, 26, 27,-47, -4, 24, 26,
> +   45,  6,-23,-27, 48,  5,-25,-28, 48,  5,-26,-28, 44,  6,-24,-27,
> +  -30,-36,-10, 76,-31,-37,-11, 78,-31,-37,-11, 78,-31,-36,-10, 77,
> +  -53,-32, 35, 52,-54,-34, 36, 52,-54,-34, 36, 52,-53,-33, 34, 51,
> +  -93,-34, 62, 65,-93,-34, 62, 66,-93,-34, 62, 65,-93,-34, 60, 64,
> +   -7,  0,  2,  2, -8, -1,  3,  3, -8,  0,  4,  5, -6,  1,  5,  5,
> +    3,  7, 11, 11,  2,  2,  3,  3,  1, -2, -6, -7,  1, -5,-11,-13,
> +    3, -2, -4, -3,  7,  0, -5, -5, 12,  4, -5, -7, 14,  6, -4, -7,
> +   18, 14,  3, -2,  6,  4,  0, -3, -8, -5, -2,  0,-16,-11, -2,  2,
> +   -8, -6,  7, 18, -7, -8,  2, 13, -4, -6, -2,  6,  0, -4, -3,  1,
> +    1, -3,-13,-18,  0, -1, -5, -7, -1,  1,  6,  7, -2,  4, 15, 17,
> +  -15,-14, -7, -2, -6, -5, -1,  0,  6,  6,  3,  1, 15, 13,  6,  1,
> +    2, -2,-11, 10,  2, -1,-12, 11,  3, -1,-12, 11,  2, -2,-11, 11,
> +   -9, 14, -1, -5, -9, 15, -2, -5, -8, 16, -2, -5, -7, 15, -1, -4,
> +    2,  6,  8,  8, -2,  3,  9, 12,-11, -5,  4, 10,-19,-16, -8,  0,
> +   14,  8, -7,-15, 12,  7, -7,-14,  8,  5, -4, -9,  5,  3, -1, -4,
> +   12,-14, -2,  2, 13,-15, -1,  3, 14,-15, -1,  3, 13,-14, -1,  3,
> +    0,  6, 10,-13,  0,  6, 10,-15,  0,  7,  9,-17,  1,  6,  8,-16,
> +   -8, -5, 15, -2, -8, -6, 17, -2, -8, -6, 16, -3, -8, -5, 15, -2,
> +   -9,-11,-11,-10,  9, 10,  9,  8,  8, 10, 10,  9, -8, -9, -8, -7,
> +    9, 10,  9,  7, -8,-10,-10,-10, -7,-10,-11,-11, 11, 12, 11,  8,
> +    0, 10,  7,  0,  0,  7,  0, -6,  0,  2, -5, -6, -2, -1, -4, -1,
> +    5,  0, -6, -9,  2,  2,  2,  1, -2,  0,  5,  7, -6, -5,  1,  4,
> +    3, -8,  2, -1,  4, -9,  3,  0,  5, -7,  3,  0,  7, -5,  3,  0,
> +   -5, -3,  2,  9, -6, -3,  1,  8, -6, -3,  1,  7, -5, -2,  0,  4,
> +   13,  8,  3,  1, -3, -5, -4, -1, -8, -7, -3,  0, -1,  1,  3,  2,
> +    3,  2, -5,-12,  4,  3, -2, -9,  3,  4,  1, -4,  3,  5,  4, -1,
> +   -9, -8, -4,  0,  8,  6,  2,  0, 10,  8,  3,  0, -6, -5, -3, -1,
> +   -3, -9,-12, -5,  0, -3, -5,  0,  2,  3,  2,  4,  5,  8,  7,  6,
> +   -1, -2,  5, 12, -1, -1,  5,  9,  2,  1, -1, -2,  2, -1,-11,-17,
> +   -7,  3,  3, -1, -9,  3,  4, -1,-10,  4,  6, -1, -9,  5,  7,  0,
> +  -18, -7,  2,  2, -8,  1,  5,  3,  3,  4,  1,  0,  9,  5, -2, -3,
> +   -2,  0,  6,  8, -4, -5, -5, -3,  1, -2, -6, -8, 10,  9,  3, -1,
> +    0, -2, -2,  0,  0, -4, -5,  0, -2, -8, -4,  8, -5, -7,  6, 24,
> +    9,  1, -7,  1,  9,  1, -8,  1,  8,  0,-10,  1,  8, -1,-11, -1,
> +    8,  8,  6,  3,  5,  4,  3,  2, -2, -3, -1,  0,-10,-13, -8, -4,
> +    0,  4,  2, -3,  0,  6,  3, -5,  3, 10,  2,-12,  5, 10, -4,-22,
> +    0, -4, -1,  3,  1, -4, -1,  5,  1, -5,  0,  8, -1, -6, -2,  7,
> +   -1, -1, -2, -4, -1, -2, -4, -6, -1, -1, -1, -2,  1,  5, 10,  9,
> +   10,  3,  0, -2,  6, -1, -2, -5,  3, -1, -2, -6,  2,  0,  0, -5,
> +    6,  3,  0,  0,  6,  3,  1,  1,  4, -2, -2,  1,  0, -9, -9, -2,
> +  -11, -3,  1,  2, -6,  2,  4,  5, -3,  2,  3,  4, -2,  1,  1,  2,
> +   -6, -4, -1, -2,  2, -1, -1, -2, 10,  2, -2, -2, 11,  2, -4, -1,
> +    6,  0, -2,  2,  3,  3,  0,  0, -6,  3,  3,  0,-17, -1,  5,  0,
> +   -1,  4, 10, 11, -3, -2,  0,  1, -3, -4, -5, -3, -1, -2, -2, -1,
> +    2, -3, -9,-12,  3,  3,  3,  2,  2,  2,  4,  4,  2,  1, -1, -2,
> +   -2,  9,  5,-10, -3,  5,  5, -5, -2,  1,  2,  0, -1, -2, -2,  1,
> +   -2, -3,  7, -2, -1, -3,  7, -3, -1, -2,  8, -4, -2, -2,  7, -3,
> +    1, -8, -3, 12,  2, -2, -2,  4,  1,  3,  0, -5, -1,  5,  2, -7,
> +   -1,  3,  1, -5, -7, -2,  3,  1, -2, -7, -2,  2, 20,  3, -5, -1,
> +    5,  0, -3, -2, -7, -7,  0,  6, -6,  0,  7,  6,  2,  6,  0, -7,
> +   -2,  6, -7,  1, -2,  7, -8,  3, -2,  7, -7,  3, -1,  7, -6,  2,
> +   -5, -2,  5,  7,  4,  1, -4, -8,  6,  3, -2, -5, -7, -5,  3,  7,
> +   -1, -1,  6,  5,  0, -1,  1, -4,  2,  1,  0, -7,  1,  0,  0, -4,
> +   -8,  0,  3,  1, -2,  1, -1, -1,  1, -1, -3,  1,  1, -2,  1,  9,
> +    5,  2, -3, -4, -1,  0, -1, -3, -3,  1,  3,  1, -4,  0,  4,  2,
> +    2, -2, -2, 12,  0, -2, -5,  3, -1,  0, -3,  1, -3, -1, -2,  1,
> +    1,  5,  3,  0, -6, -4, -2,  1,  0, -2, -2,  2,  6,  1, -4, -1,
> +   -3, -5, -5, -1,  3,  5,  5,  4,  0,  3,  1, -1, -2,  1, -2, -3,
> +    2, -4, -5, -3,  4, -2, -3, -2,  6,  0, -1, -1,  7,  1,  0,  0,
> +   -3, -2, -2,  0, -2, -3, -5, -1, -2,  2,  0, -1, -1, 11,  9, -1,
> +    0,  1, -1,-10, -1,  1,  0, -6,  1,  0,  1,  4,  2, -5, -1, 13,
> +   -2,  4,  5,  0, -5,  1,  6,  3, -6, -2,  3,  2, -5, -2,  0, -2,
> +   -1,  1,  1, -2, -1, -2,  0,  2,  5,  5,  5,  7,  0, -4, -8, -7,
> +    0,  2, -1, -5, -1,  2,  2, -3,  0,  5,  3, -5,  3,  8,  2,-12,
> +    8,  4,  0, -2, 10, -1, -4, -1,  3, -6, -3,  0, -4, -5,  0,  0,
> +    0,-10, -4,  2, -1, -6,  3,  5, -1, -3,  6,  4,  0, -2,  4,  2,
> +    0,  8,  1, -1,  0, 11,  1, -3, -1,  6, -2, -4, -3, -2, -7, -4,
> +    0, -1, -1, -1,  4,  5,  6,  5, -5, -9, -8, -5,  2,  2,  3,  2,
> +    0,  2,  6,  1,  2,  0,  3,  0,  1, -2, -1, -2,  0, -1, -3, -6,
> +    0,  0,  2,  0,  4,  0,  2,  1,  5, -2,  0,  0, -2, -9, -1,  2,
> +    0,  1,  0,-10, -1,  1,  8,  0, -1, -2,  4,  0,  1, -1,  2, -1,
> +   -3, -2,  2, -1, -3, -1,  2, -3,  0, -1,  1,  0,  8,  1, -1,  3,
> +    0,  1,  1,  2,  0, -4, -2,  0, -1, -5,  1, -1, -2, -1, 11,  2,
> +    1,  5, -2, -2,  0,  2, -4,  0, -2,  1, -5,  1,  0,  5,  0,  1,
> +   -5, -3,  0,  6, -4,  2,  0,  0, -3,  5,  1,  0, -3,  3,  0,  0,
> +    3, -2, -3,  1,  1, -4,  0,  8, -2, -3, -2,  3,  1,  2, -1, -1,
> +    1,  1,  0,  2,  2,  0,  1,  6,  1, -1,  2,  1,  0,  3,  0,-19,
> +    1, -3, -2,  2,  6,  5, -2, -7, -3,  1,  3,  1, -1, -1,  0,  2,
> +   -8, -1, -1, -4,  1,  1, -1,  2,  4,  3,  2,  3, -5,  1,  3,  0,
> +    0,  2, -1,  1, -3,  0,  0,  5, -5, -2,  0,  8, -4, -4, -4,  6,
> +    1,  2,  1,  2,  2,  2, -3,  2,  4,  0, -9,  0,  7,  0,-11,  1,
> +    0,  0,  0, -2,  3,  3, -1, -6,  4,  3, -3,-10, -1,  2,  6,  2,
> +    7, -2, -3,  5, -4,  0,  3, -1, -4,  2,  1, -7,  2, -1, -1,  3,
> +    3,  2,  2,  2, -5, -7, -7, -5,  5,  6,  4,  2, -2, -1,  0,  1
> +};
> +
> +static const int8 s_svq1IntraCodebook8x4[3072] = {
> +    5,  6,  6,  6,  7,  7,  8,  8,  0,  0,  0,  0,  0,  1,  2,  3,
> +   -3, -4, -4, -5, -5, -4, -3, -2, -4, -4, -4, -5, -4, -4, -3, -3,
> +    1,  2,  2,  2,  2,  3,  3,  3,  2,  3,  3,  4,  4,  5,  5,  5,
> +   -1,  0,  1,  1,  2,  3,  4,  4, -9,-10, -9, -9, -8, -7, -6, -5,
> +   -4, -4, -5, -6, -6, -7, -7, -7,  0, -1, -2, -2, -3, -3, -4, -4,
> +    4,  4,  3,  3,  2,  1,  1,  0,  7,  7,  7,  6,  6,  5,  4,  4,
> +    2,  4,  5,  6,  4,  1, -3, -6,  3,  4,  5,  5,  4,  0, -5, -8,
> +    2,  3,  4,  4,  2, -2, -7,-10,  2,  2,  2,  1,  0, -4, -9,-12,
> +   -9, -7, -3,  1,  4,  4,  3,  3,-10, -7, -2,  3,  5,  5,  3,  3,
> +   -9, -6, -2,  3,  6,  5,  4,  3, -8, -6, -1,  3,  4,  4,  3,  2,
> +   -5, -5, -5, -5, -3,  1,  4,  7, -5, -5, -5, -4, -2,  1,  6,  8,
> +   -4, -5, -4, -3, -1,  3,  8, 10, -3, -4, -3, -2,  1,  5,  9, 11,
> +   -2, -2, -2, -2, -2, -2, -2, -2, -4, -5, -5, -5, -5, -5, -5, -4,
> +   -3, -4, -4, -4, -4, -4, -4, -3,  9, 10, 10, 11, 11, 11, 10, 10,
> +    7,  4,  1, -2, -4, -6, -9,-10,  9,  7,  3,  0, -2, -4, -8, -9,
> +   11,  8,  4,  2,  0, -3, -6, -8, 11,  9,  5,  3,  1, -2, -5, -7,
> +  -13,-13,-13,-12,-11,-10, -8, -8,  0,  1,  2,  3,  4,  4,  4,  3,
> +    3,  4,  5,  6,  6,  6,  5,  4,  3,  4,  4,  4,  3,  3,  3,  2,
> +   10, 10, 11, 10,  9,  9,  8,  7,  6,  6,  6,  6,  5,  4,  3,  2,
> +    0,  0,  0, -1, -2, -3, -4, -4,-10,-10,-11,-12,-13,-14,-14,-14,
> +   16, 16, 17, 16, 15, 13, 12, 11, -1, -2, -3, -4, -4, -4, -4, -3,
> +   -4, -5, -6, -6, -6, -6, -6, -6, -5, -6, -6, -6, -6, -6, -5, -5,
> +  -13,-13,-13,-12,-11,-10, -8, -6, -9, -8, -7, -6, -4, -2,  0,  1,
> +   -2, -1,  1,  3,  5,  7,  8,  9,  5,  7,  9, 11, 13, 14, 15, 15,
> +   16, 14, 11,  7,  2, -3, -7, -9, 14, 12,  8,  3, -1, -6, -9,-11,
> +   11,  9,  4,  0, -4, -8,-11,-13,  8,  5,  1, -3, -6,-10,-12,-14,
> +  -18,-15, -9, -3,  1,  6,  9, 11,-17,-13, -7, -1,  3,  7, 11, 12,
> +  -15,-11, -5,  1,  5,  9, 12, 13,-13, -9, -3,  2,  5,  9, 11, 13,
> +   22, 21, 19, 15, 10,  3, -4, -9, 20, 18, 15,  9,  2, -5,-12,-17,
> +   16, 13,  8,  1, -7,-14,-20,-24, 10,  6, -1, -8,-15,-21,-25,-27,
> +  -25,-23,-20,-14, -7,  1,  9, 14,-23,-21,-16, -9,  0,  9, 16, 21,
> +  -20,-16,-10, -1,  8, 16, 22, 25,-15,-11, -3,  6, 14, 20, 25, 27,
> +   -4, -2,  0,  1,  2,  2,  2,  2, -5, -2,  0,  2,  3,  3,  3,  3,
> +   -6, -4, -1,  1,  2,  3,  3,  3, -7, -5, -2,  0,  1,  1,  2,  2,
> +    2,  1,  1,  1,  1,  0, -2, -3,  3,  3,  2,  1,  0, -1, -3, -4,
> +    4,  3,  2,  1,  0, -2, -4, -6,  5,  4,  3,  1, -1, -3, -5, -6,
> +    5,  6,  6,  4,  2,  0, -2, -3,  3,  4,  4,  4,  3,  1,  0, -1,
> +   -2, -2, -1, -1, -1, -1, -2, -2, -5, -4, -3, -2, -2, -2, -3, -3,
> +   -1, -1, -1, -1, -1, -1, -1, -1, -3, -4, -4, -4, -3, -3, -3, -3,
> +   -1, -1, -1, -1, -1, -1, -1, -2,  5,  6,  6,  6,  6,  5,  4,  3,
> +    4,  4,  4,  4,  4,  5,  6,  7,  0, -1, -1, -1, -1,  0,  1,  2,
> +   -2, -3, -3, -3, -3, -2, -1,  0, -3, -3, -4, -4, -4, -3, -2, -1,
> +    0, -2, -4, -4, -2,  0,  2,  3,  0, -2, -3, -3, -1,  2,  4,  5,
> +   -1, -2, -4, -3,  0,  3,  5,  6, -2, -3, -4, -3, -1,  2,  4,  5,
> +    9,  4,  0, -3, -3, -1,  0,  1,  8,  4, -1, -4, -3, -1,  1,  2,
> +    6,  2, -3, -5, -4, -2,  0,  1,  5,  1, -3, -4, -4, -2,  0,  1,
> +    5,  3,  1, -1, -4, -8,-10,-10,  3,  3,  2,  1,  0, -2, -3, -4,
> +    1,  1,  1,  2,  3,  2,  1,  0, -1,  0,  1,  2,  3,  4,  3,  2,
> +    0,  1,  2,  2,  1, -1, -3, -3,  0,  1,  1,  1, -1, -2, -4, -3,
> +   -3, -3, -3, -3, -3, -3, -1,  2, -4, -4, -3,  0,  3,  7, 12, 14,
> +   -5, -5, -6, -6, -6, -6, -6, -5,  2,  2,  2,  1,  0,  0,  0,  0,
> +    4,  4,  3,  2,  1,  0,  0,  0,  6,  6,  5,  4,  2,  2,  1,  1,
> +   -7, -7, -6, -3,  0,  4,  7,  8, -1, -2, -3, -3, -2, -1,  1,  2,
> +    3,  3,  1, -1, -2, -2, -2, -1,  6,  6,  4,  2,  0, -2, -2, -2,
> +   -6, -5, -2,  2,  5,  9, 11, 12, -4, -4, -2,  0,  2,  4,  5,  6,
> +   -3, -2, -2, -2, -2, -1,  0,  1, -2, -2, -2, -3, -3, -3, -3, -2,
> +   -7, -3,  1,  3,  3,  0, -3, -5, -6, -2,  3,  5,  4,  1, -3, -5,
> +   -5, -1,  4,  6,  5,  2, -3, -4, -4,  0,  5,  7,  6,  3, -1, -3,
> +    0,  0,  0,  0,  0,  0,  0,  0, -2, -2, -3, -3, -3, -3, -2, -1,
> +    6,  7,  8,  9,  9,  8,  7,  6, -4, -4, -5, -5, -6, -6, -5, -4,
> +   -9, -8, -6, -4,  0,  3,  6,  6, -5, -4, -1,  3,  5,  6,  5,  3,
> +    1,  3,  6,  6,  4,  1, -2, -5,  6,  7,  5,  1, -3, -7,-10,-11,
> +   10,  9,  5,  1, -3, -6, -6, -4,  5,  3, -1, -5, -6, -5, -2,  2,
> +   -2, -4, -6, -6, -4,  1,  6, 10, -6, -7, -7, -4,  1,  7, 11, 12,
> +    6,  5,  3,  2,  0,  0,  0,  0,  2,  1, -1, -2, -3, -2, -1, -1,
> +    0, -1, -2, -4, -4, -2, -1,  1,  0,  0, -1, -2, -1,  0,  2,  3,
> +    0, -1, -2, -2, -2, -2, -1, -1,  5,  4,  2,  1,  0,  0,  0,  0,
> +    6,  5,  3,  1,  0,  0,  0,  0,  2,  0, -2, -4, -4, -3, -2, -2,
> +   -7, -4,  0,  2,  2,  2,  2,  1, -7, -3,  0,  0,  0,  0,  0,  0,
> +   -4, -1,  1,  1,  0,  0,  0,  1, -1,  1,  2,  2,  2,  2,  3,  3,
> +   -2,  0,  2,  2,  1,  1,  1,  1, -1,  1,  2,  2,  1,  0,  0, -1,
> +    0,  2,  4,  2,  0, -1, -2, -3,  1,  2,  3,  1, -2, -4, -6, -6,
> +    1,  2,  2,  4,  5,  6,  4,  1,  0, -1, -1, -1,  0,  0, -2, -4,
> +    0,  0, -1, -2, -2, -2, -4, -6,  2,  1,  0,  0,  1,  1, -1, -3,
> +    1,  1,  1,  1,  1,  2,  3,  3,  0,  0,  1,  0,  1,  2,  4,  4,
> +   -1, -1, -1, -1,  0,  1,  2,  3, -4, -4, -5, -5, -5, -3, -1,  0,
> +   -6, -5, -5, -4, -3, -2, -1, -1, -1,  0,  0,  1,  1,  2,  3,  3,
> +    0,  1,  1,  1,  2,  2,  3,  4,  0,  0, -1, -1,  0,  1,  2,  3,
> +    0,  1,  1,  1,  0,  0, -1, -1,  1,  3,  3,  2,  1, -1, -2, -2,
> +   -2,  0,  2,  2,  2,  2,  1,  1, -9, -8, -4, -2,  1,  3,  3,  3,
> +   -1, -1, -1, -2, -3, -3, -3, -4,  0,  0,  0, -1, -2, -2, -3, -3,
> +    2,  2,  2,  0, -1, -1, -1, -1,  5,  5,  4,  3,  2,  2,  2,  2,
> +    6,  3, -1, -4, -3, -1,  1,  1,  2, -1, -3, -4, -1,  2,  2,  0,
> +   -1, -2, -2,  1,  4,  4,  1, -3, -2, -1,  1,  4,  6,  3, -3, -8,
> +    3,  3,  2,  1, -1, -2, -2, -2, -4, -4, -2, -1,  1,  3,  4,  4,
> +   -4, -5, -5, -4, -2,  0,  2,  2,  7,  7,  4,  1, -1, -2, -3, -2,
> +   -1,  1,  3,  0, -4, -6,  0,  6, -2,  1,  4,  1, -4, -6, -1,  7,
> +   -3,  1,  4,  2, -3, -6, -1,  6, -2,  0,  3,  2, -2, -5, -1,  4,
> +    1, -1, -2,  1,  4,  4, -1, -7,  1, -1, -4, -1,  5,  6,  0, -6,
> +    3,  0, -4, -3,  3,  6,  2, -4,  3,  0, -5, -4,  1,  4,  1, -3,
> +    2,  2,  3,  3,  3,  3,  2,  2, -4, -5, -6, -7, -7, -7, -7, -6,
> +    1,  2,  3,  3,  3,  3,  2,  2,  0,  0,  1,  1,  1,  2,  2,  1,
> +    3, -3, -3,  3,  4, -2, -2,  2,  3, -4, -4,  4,  4, -4, -4,  2,
> +    4, -4, -4,  4,  4, -4, -3,  3,  3, -3, -4,  3,  3, -3, -3,  3,
> +   -2, -2, -2, -2, -2, -2, -1, -1,  6,  7,  8,  8,  8,  7,  6,  5,
> +   -5, -6, -7, -7, -8, -7, -6, -5,  1,  1,  2,  2,  2,  2,  1,  1,
> +    0,  0,  0,  0,  0, -1,  0,  0, -1,  0,  0,  0,  0, -1,  0,  0,
> +   -2, -3, -2, -2, -2, -3, -3, -3,  2,  3,  5,  6,  4,  2,  1,  0,
> +    8,  6,  2,  0,  0,  0,  0,  0,  4,  1,  0,  0,  0, -1, -1, -1,
> +    1, -1,  0,  0,  0, -1, -2, -3, -2, -2, -1,  0,  0, -2, -4, -5,
> +    3,  1, -1, -2, -3, -4, -5, -5,  2,  1,  0,  0,  1,  1,  0,  0,
> +    0, -1, -1,  0,  2,  2,  2,  2, -1, -2, -1,  1,  2,  2,  2,  2,
> +    0, -1, -2, -1, -1, -1, -1,  0, -1, -2, -2, -1, -1,  0,  0,  1,
> +    2,  1,  1,  2,  2,  1,  1,  0,  6,  5,  3,  1,  0, -2, -4, -4,
> +   -3, -2, -1,  0,  1,  1,  0, -1,  0,  1,  3,  4,  5,  5,  3,  1,
> +   -1, -1, -1,  0,  1,  0, -1, -2, -2, -2, -2, -1,  0, -1, -2, -3,
> +    0, -1, -2, -2, -1, -1,  0,  2,  1, -1, -2, -1, -1, -1,  0,  2,
> +    1,  0, -2, -2, -2, -2,  1,  5,  1, -1, -2, -2, -2,  0,  5, 10,
> +    0,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1,  0,  0,  0,  1,  2,
> +    1,  2,  2,  3,  4,  4,  6,  5, -3, -3, -3, -2, -2, -3, -3, -3,
> +    1, -1, -2, -2,  0,  3,  5,  7,  2,  0, -2, -3, -2,  0,  2,  3,
> +    3,  1, -2, -3, -3, -2, -1, -1,  3,  1,  0, -1, -1, -1, -1, -1,
> +    1,  3,  5,  4,  2, -1, -3, -4, -3, -2,  1,  2,  1,  0, -1, -2,
> +   -5, -3,  0,  2,  2,  1,  0,  0, -3, -1,  1,  2,  2,  1,  0,  0,
> +    0, -1, -1, -1,  1,  2,  3,  4, -3, -4, -4, -3, -1,  0,  0,  1,
> +   -2, -3, -2, -1,  1,  1,  1,  1, -2, -2,  0,  3,  4,  4,  3,  2,
> +   -4, -4, -3, -2, -1,  1,  2,  3,  0,  1,  1,  1, -1, -2, -3, -3,
> +    3,  4,  5,  4,  2, -1, -3, -3, -2, -2,  0,  2,  2,  2,  1,  0,
> +   -4,  0,  5,  7,  4, -1, -4, -4, -1,  2,  4,  3,  0, -3, -3, -2,
> +    2,  1,  0, -1, -2, -2,  0,  1,  0,  0, -1, -2, -2, -1,  1,  2,
> +   -4, -3, -2, -1,  0,  1,  2,  2, 10,  9,  5,  0, -3, -4, -3, -2,
> +    1, -1, -2, -2, -1,  0,  0,  0, -2, -2, -1,  1,  1,  1,  0, -1,
> +   -5, -3,  0,  3,  4,  2,  0, -2, -2, -1,  0,  1,  1,  0, -1, -1,
> +    3,  2, -1, -2, -2, -1,  1,  1,  7,  5, -1, -5, -6, -2,  2,  4,
> +   -2,  3,  3, -3, -4,  1,  2, -2, -3,  3,  4, -3, -4,  2,  3, -2,
> +   -3,  3,  4, -3, -4,  2,  3, -2, -4,  2,  4, -2, -3,  1,  2, -1,
> +    4,  3, -1, -3, -3, -1,  1,  2, -4, -6, -4,  0,  4,  5,  4,  1,
> +    0,  2,  5,  6,  2, -3, -5, -4,  1,  1, -1, -3, -5, -2,  2,  4,
> +   -1,  0,  1,  2,  2,  3,  3,  4, -1,  0,  1,  1,  0, -1, -1, -1,
> +   -1,  0,  1,  2,  2,  1, -1, -2, -3, -2, -1,  0,  0, -1, -2, -3,
> +    1,  1,  1,  1,  0,  0,  1,  2,  1,  0, -1,  0,  0,  1,  1,  0,
> +    1, -2, -4, -1,  1,  2,  1,  0,  1, -4, -7, -3,  1,  3,  2,  1,
> +    1,  1,  1,  1,  1,  1,  0, -1,  1,  1,  1,  0,  1,  2,  2,  0,
> +    1,  1,  0,  0,  0,  2,  0, -3,  3,  2,  0, -1, -1, -2, -6, -9,
> +    0,  0,  0,  1,  0,  0,  1,  2,  1,  0,  0,  0, -1, -1,  0,  2,
> +    0,  1,  1,  1, -1, -3, -2,  0, -7, -5,  1,  6,  6,  2, -1, -1,
> +    3,  1, -1, -3, -4, -2,  1,  4,  2,  0, -2, -3, -4, -3, -1,  2,
> +    2,  2,  1,  1,  1,  0,  0,  1,  1,  1,  0,  0,  0,  0,  0,  1,
> +   -1,  1,  1, -2, -5, -6, -4, -1, -1,  1,  4,  3,  2,  0,  1,  2,
> +   -1,  0,  2,  3,  1,  0,  0,  1, -1,  0,  1,  0,  0, -1, -1,  0,
> +    0,  1,  2,  2,  0, -2, -1,  1, -2, -1, -1, -2, -1,  2,  6,  8,
> +   -1, -1, -2, -3, -2,  0,  1,  2, -1,  0,  0, -1, -1,  0, -1, -1,
> +    2,  1,  1,  1,  1,  0,  0,  0,  0,  0,  1,  1,  1, -1, -1,  1,
> +   -1,  0,  2,  2, -1, -3, -2,  3,  0,  2,  3,  0, -5, -7, -2,  4,
> +   -1,  0,  0,  0, -1, -2, -3, -3, -1,  0, -1, -2, -2, -2, -2, -2,
> +    1,  1,  0,  0,  1,  2,  0, -1,  1,  2,  1,  2,  5,  6,  2,  0,
> +   -2, -4, -3,  0,  2,  2,  0, -3,  3,  1,  0,  1,  2,  1, -2, -3,
> +    3,  1,  0,  0,  0,  0,  0, -1,  1, -1, -2, -2, -1,  1,  3,  3,
> +    3,  2,  1,  2,  4,  3,  1, -2, -2, -4, -4, -3, -1,  0, -2, -3,
> +    1,  0, -1, -1,  0,  1,  0, -1,  3,  2,  0,  0,  0,  1,  1,  0,
> +    1,  1,  0,  0,  0,  0,  0,  0,  2,  3,  3,  2,  2,  2,  1,  1,
> +    0, -1, -2, -3, -5, -5, -5, -4,  1,  1,  0, -1,  0,  1,  3,  3,
> +   -9, -6, -2,  0,  1,  1,  2,  2, -6, -2,  1,  2,  1,  1,  0,  1,
> +   -2,  1,  2,  2,  1,  1,  1,  1,  0,  2,  2,  1,  0,  1,  1,  1,
> +    1,  0,  0,  0,  0,  0, -1,  0,  0,  0,  0,  0, -1, -3, -2,  0,
> +   -3, -3, -3, -2, -1,  3,  7,  9,  1,  2,  2,  2,  0, -2, -4, -3,
> +    2,  0, -2, -1,  3,  4, -1, -6,  1,  0, -2, -3, -1,  3,  3,  0,
> +    0,  3,  3,  0, -2, -1,  1,  1, -6, -1,  3,  2, -1, -2,  0,  1,
> +    5,  3,  0, -2, -3,  0,  2,  1,  1,  1,  2,  2,  0, -2, -4, -7,
> +   -3, -2,  1,  2,  2,  1, -1, -4,  2,  2,  0, -2, -2,  0,  2,  2,
> +    0,  0, -2, -3, -2, -1,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,
> +   -2, -1,  0,  1,  0,  1,  2,  3, -4, -2,  0,  0, -1,  0,  2,  3,
> +   -2, -2, -2, -1, -1,  0,  2,  4,  0,  0,  0,  0, -1, -1,  0,  1,
> +    0, -1, -1, -1, -1, -1,  0,  0,  6,  4,  2,  0, -1, -2, -1, -1,
> +    0,  1,  1,  1,  1, -1, -5,-10,  1,  1,  1,  1,  1,  1,  0, -4,
> +    1,  0,  1,  1,  1,  1,  1, -1,  2,  1,  1,  1,  0,  0,  0,  0,
> +   -3,  1,  4,  3,  3,  1, -1,  0, -4,  0,  1,  0, -1,  0,  0,  0,
> +   -5,  0,  2,  1,  1,  1,  0, -1, -1,  2,  1, -2, -2, -1,  0, -1,
> +    2,  4,  5,  3,  0, -1,  1,  2,  0,  0,  1,  0, -2, -2, -1, -1,
> +   -2, -2, -2, -2, -3, -2, -1,  0,  0,  0,  1,  0,  0,  0,  1,  2,
> +    0, -2, -2, -3, -1,  2,  2, -1,  1,  0,  0,  0,  1,  5,  3, -2,
> +   -1, -1,  0, -1,  0,  2,  0, -5, -1,  0,  1,  0,  0,  2,  2, -2,
> +    3,  1, -1, -1,  0,  1,  1,  2,  1,  0,  0,  1,  1,  1,  1,  1,
> +  -10, -8, -2,  1,  2,  1,  1,  1, -1,  1,  2,  1,  0,  0,  0,  0,
> +   -1, -1,  0,  1,  2,  2,  2,  1, -1, -1, -1,  0, -1, -3, -5, -4,
> +    1,  1,  2,  1,  1,  0,  0,  2, -1, -2, -1, -1, -1,  0,  2,  4,
> +   -3, -7, -5,  0,  2,  0,  0,  0,  3, -1, -2,  1,  2,  1,  1,  2,
> +    1, -2, -1,  1,  2,  1,  0,  1,  0, -1,  0,  3,  2, -1, -1, -1,
> +    2,  1,  1,  0,  0,  0,  0,  0, -9, -7, -2,  3,  3,  2,  1,  1,
> +    3,  2,  0, -2, -2, -1,  1,  1,  0, -1,  0,  0,  1,  1,  0,  0,
> +   -2, -1,  1,  1,  1,  0,  0,  0,  1,  2,  1, -2, -4, -3,  1,  2,
> +    1,  2,  1, -2, -3,  0,  3,  1, -1, -1,  0,  0,  1,  3,  0, -4,
> +    2,  0, -1,  1,  2, -2, -2,  3,  2,  0, -1,  2,  3, -2, -4,  1,
> +    0,  1,  1,  1,  2, -2, -6, -2, -1,  0,  0,  0,  2,  0, -2, -1,
> +   -1, -1,  1,  2,  1, -2, -3, -2,  3, -1, -2, -1, -1,  0,  1,  2,
> +   10,  4,  0,  0, -1, -2, -2, -1,  3, -1, -2, -1,  0, -1, -1,  0,
> +   -5,  2,  7,  1, -4, -2,  1,  0, -2,  2,  3, -1, -3,  0,  2,  0,
> +    2,  1,  0,  0,  1,  1, -1, -2,  1, -2, -2, -1, -1, -2,  0,  0,
> +    0,  3, -2, -7, -1,  3,  0,  0,  1,  3, -3, -5,  2,  3, -1,  0,
> +    0,  2, -2, -2,  4,  2, -2,  0, -1,  1, -1,  0,  2, -1, -2,  1,
> +    4,  0, -3, -4, -2,  1,  2,  1,  0,  0,  3,  5,  3,  1, -1, -2,
> +    1,  1,  1, -1, -3, -1,  1,  1,  1, -1, -2, -2,  0,  0, -1, -2
> +};
> +
> +static const int8 s_svq1IntraCodebook8x8[6144] = {
> +    4,  4,  3,  2,  2,  1,  0, -1,  4,  3,  3,  2,  1,  0, -1, -1,
> +    3,  3,  2,  2,  1,  0, -1, -2,  3,  2,  2,  1,  0, -1, -2, -3,
> +    2,  2,  1,  0, -1, -1, -2, -3,  2,  1,  0,  0, -1, -2, -3, -4,
> +    1,  0,  0, -1, -2, -3, -4, -4,  0,  0, -1, -2, -2, -3, -4, -4,
> +    2,  3,  3,  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  3,  3,
> +    1,  2,  2,  2,  2,  2,  2,  2,  0,  1,  1,  1,  1,  1,  1,  1,
> +   -1,  0,  0,  0,  0,  0,  1,  1, -2, -2, -1, -1, -1, -1, -1, -1,
> +   -3, -3, -3, -3, -3, -3, -2, -2, -5, -4, -4, -4, -4, -4, -4, -3,
> +   -4, -2, -1,  0,  1,  2,  2,  3, -4, -2, -1,  0,  1,  2,  3,  3,
> +   -4, -3, -1,  0,  1,  2,  3,  3, -4, -3, -1,  0,  1,  2,  3,  3,
> +   -5, -3, -1,  0,  1,  2,  3,  3, -5, -3, -1,  0,  1,  2,  3,  3,
> +   -5, -3, -1,  0,  1,  1,  2,  3, -5, -3, -2, -1,  0,  1,  2,  3,
> +    4,  4,  5,  5,  6,  6,  7,  7,  2,  2,  2,  3,  3,  4,  4,  4,
> +    0,  0,  0,  0,  1,  1,  1,  2, -2, -2, -2, -2, -1, -1, -1,  0,
> +   -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
> +   -1, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -2, -2, -2, -2,
> +    5,  3,  1, -1, -2, -3, -3, -3,  5,  3,  1, -1, -2, -3, -3, -3,
> +    5,  3,  1, -1, -2, -3, -3, -3,  5,  3,  1, -1, -2, -3, -3, -3,
> +    5,  4,  1,  0, -2, -3, -3, -3,  6,  4,  2,  0, -2, -2, -3, -3,
> +    6,  4,  2,  0, -1, -2, -2, -3,  6,  4,  2,  1, -1, -2, -2, -2,
> +   -1,  1,  3,  3,  2,  0, -3, -6, -1,  1,  3,  4,  3,  0, -3, -6,
> +   -1,  1,  4,  4,  3,  1, -3, -6, -1,  1,  3,  4,  3,  1, -3, -6,
> +   -2,  1,  3,  4,  3,  1, -3, -6, -2,  1,  3,  4,  3,  1, -3, -7,
> +   -2,  1,  3,  3,  2,  0, -3, -7, -2,  0,  2,  3,  2,  0, -3, -6,
> +   10,  9,  8,  6,  6,  5,  4,  4,  6,  5,  4,  3,  2,  2,  2,  1,
> +    2,  1,  0, -1, -2, -2, -2, -1, -1, -2, -3, -4, -4, -4, -4, -3,
> +   -2, -3, -4, -4, -5, -4, -4, -3, -2, -2, -3, -3, -3, -3, -2, -2,
> +   -1, -1, -1, -1, -1, -1, -1,  0,  1,  1,  1,  1,  1,  1,  1,  2,
> +   -2, -1,  1,  2,  4,  5,  7,  8, -3, -2,  0,  1,  3,  5,  7,  8,
> +   -4, -3, -1,  0,  2,  4,  6,  7, -5, -4, -2, -1,  1,  3,  5,  7,
> +   -6, -5, -3, -2,  0,  2,  4,  6, -6, -5, -4, -2, -1,  1,  3,  5,
> +   -7, -6, -5, -3, -2,  0,  2,  3, -8, -7, -5, -4, -3, -1,  1,  2,
> +   11,  9,  7,  5,  3,  1, -1, -1, 10,  8,  6,  3,  1,  0, -2, -2,
> +    9,  7,  5,  2,  0, -2, -3, -4,  8,  6,  3,  1, -1, -3, -4, -4,
> +    6,  4,  2, -1, -3, -4, -5, -5,  5,  3,  0, -2, -4, -5, -6, -6,
> +    3,  1, -1, -3, -5, -6, -7, -7,  2,  0, -2, -4, -6, -6, -7, -7,
> +    5,  6,  7,  7,  7,  8,  8,  8,  3,  4,  5,  5,  6,  6,  6,  6,
> +    0,  2,  2,  3,  4,  4,  4,  5, -2, -1,  0,  1,  2,  2,  3,  3,
> +   -4, -3, -2, -1,  0,  1,  1,  2, -6, -5, -4, -3, -2, -2, -1,  0,
> +   -8, -7, -6, -6, -5, -4, -3, -3,-10, -9, -8, -8, -7, -6, -6, -5,
> +    6,  5,  3,  1, -1, -3, -6, -8,  6,  5,  4,  2, -1, -3, -6, -8,
> +    6,  5,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2,  0, -3, -6, -8,
> +    6,  6,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2,  0, -3, -6, -8,
> +    6,  5,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2, -1, -3, -5, -8,
> +   11, 10,  9,  8,  7,  6,  5,  4,  8,  8,  7,  6,  5,  4,  3,  2,
> +    6,  5,  4,  4,  2,  2,  1,  0,  3,  3,  2,  1,  0,  0, -1, -2,
> +    1,  1,  0, -1, -2, -2, -3, -3, -1, -1, -2, -3, -4, -4, -5, -5,
> +   -3, -4, -4, -5, -6, -6, -7, -7, -5, -5, -6, -7, -8, -8, -8, -8,
> +  -14,-13,-12,-11, -9, -7, -6, -4,-12,-11,-10, -9, -7, -5, -3, -1,
> +  -10, -9, -7, -6, -3, -2,  0,  2, -8, -6, -4, -2,  0,  2,  4,  5,
> +   -5, -3,  0,  2,  4,  5,  7,  8, -2,  0,  2,  4,  6,  8,  9, 10,
> +    0,  3,  5,  7,  8, 10, 11, 12,  3,  5,  7,  8, 10, 11, 12, 12,
> +  -19,-19,-18,-18,-17,-16,-15,-14,-15,-15,-14,-13,-12,-11,-10, -9,
> +  -11,-10, -9, -8, -6, -5, -4, -3, -6, -5, -3, -2, -1,  0,  1,  2,
> +   -1,  0,  2,  3,  4,  5,  6,  6,  4,  6,  7,  8,  9, 10, 10, 10,
> +    9, 10, 11, 12, 13, 14, 14, 14, 12, 14, 14, 15, 16, 16, 16, 16,
> +   22, 21, 19, 17, 14, 11,  9,  5, 20, 19, 17, 14, 11,  8,  4,  1,
> +   17, 15, 13, 10,  6,  3,  0, -4, 13, 11,  8,  5,  1, -2, -5, -9,
> +    9,  6,  3, -1, -4, -7,-11,-13,  4,  0, -3, -6, -9,-12,-15,-17,
> +   -2, -5, -8,-11,-14,-16,-18,-20, -8,-10,-13,-16,-17,-19,-21,-22,
> +   17, 18, 18, 18, 17, 16, 16, 14, 16, 16, 15, 15, 14, 13, 12, 11,
> +   12, 12, 11, 10,  9,  8,  7,  5,  7,  6,  6,  4,  3,  2,  1, -1,
> +    1,  0, -1, -2, -3, -4, -5, -6, -5, -6, -7, -8, -9,-10,-11,-12,
> +  -11,-12,-13,-14,-15,-16,-16,-17,-16,-17,-17,-18,-19,-20,-20,-20,
> +    0,  0,  0,  0, -1, -1, -2, -3,  1,  0,  0,  0,  0, -1, -2, -3,
> +    1,  1,  0,  0, -1, -1, -2, -2,  1,  1,  1,  0,  0, -1, -1, -2,
> +    2,  1,  1,  1,  0, -1, -1, -2,  2,  2,  1,  1,  0,  0, -1, -2,
> +    2,  2,  1,  1,  1,  0, -1, -1,  2,  2,  1,  1,  1,  0,  0, -2,
> +    0, -1, -1,  0,  0,  1,  2,  3,  0, -1, -1,  0,  1,  1,  2,  2,
> +   -1, -1, -1, -1,  0,  1,  2,  2, -1, -1, -2, -1,  0,  1,  1,  2,
> +   -1, -2, -2, -1,  0,  0,  1,  2, -1, -2, -2, -2, -1,  0,  1,  2,
> +   -1, -1, -2, -1,  0,  0,  1,  2, -1, -1, -1, -1,  0,  1,  1,  2,
> +    3,  2,  2,  2,  1,  1,  0,  0,  3,  2,  2,  2,  2,  1,  0,  0,
> +    2,  2,  2,  1,  1,  1,  0,  0,  2,  2,  1,  1,  1,  0,  0, -1,
> +    1,  1,  1,  0,  0,  0, -1, -1,  0,  0, -1, -1, -1, -1, -1, -1,
> +   -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -2, -2, -2, -2,
> +    5,  2,  0,  0, -1,  0,  0,  0,  4,  2,  0, -1, -1, -1,  0, -1,
> +    4,  1, -1, -1, -2, -1, -1, -1,  4,  1, -1, -1, -2, -1, -1, -1,
> +    4,  1, -1, -2, -2, -1, -1, -1,  4,  1, -1, -2, -2, -1, -1, -1,
> +    4,  1, -1, -1, -1, -1, -1, -1,  4,  2,  0, -1,  0,  0,  0, -1,
> +   -2, -1,  0,  1,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  1,  1,
> +   -3, -1,  0,  1,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  1,  1,
> +   -3, -2,  0,  1,  2,  2,  1,  1, -4, -2,  0,  1,  2,  2,  2,  2,
> +   -5, -3, -1,  1,  1,  2,  1,  2, -5, -3, -2,  0,  1,  1,  1,  1,
> +    3,  3,  1,  0, -2, -4, -4, -5,  3,  3,  2,  0, -1, -2, -3, -4,
> +    2,  2,  1,  1,  0, -1, -2, -2,  1,  1,  1,  1,  1,  0,  0,  0,
> +    0,  0,  0,  1,  1,  1,  1,  1, -2, -1, -1,  0,  0,  1,  2,  2,
> +   -3, -2, -2, -1,  0,  1,  2,  3, -3, -3, -2, -1,  0,  1,  2,  3,
> +   -3, -3, -3, -3, -3, -2, -2, -2, -3, -3, -2, -2, -2, -1, -1, -1,
> +   -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1,  0,  0,  0,  0,  0,
> +    0,  0,  0,  0,  1,  1,  1,  1,  0,  0,  1,  1,  2,  2,  2,  2,
> +    1,  1,  1,  2,  2,  3,  3,  3,  2,  2,  2,  2,  3,  3,  3,  3,
> +   -8, -7, -5, -3, -2, -1,  0, -1, -4, -3, -1,  0,  1,  2,  1,  1,
> +   -1,  1,  2,  3,  3,  2,  2,  1,  1,  2,  3,  3,  2,  2,  1,  0,
> +    2,  3,  3,  2,  1,  0,  0, -1,  1,  2,  1,  0, -1, -1, -1, -1,
> +    1,  1,  0, -1, -1, -2, -2, -1,  1,  1,  0,  0, -1, -1,  0, -1,
> +   -4, -3, -2,  0,  1,  2,  3,  3, -4, -3, -2,  0,  1,  2,  2,  2,
> +   -3, -3, -2, -1,  0,  1,  1,  1, -2, -2, -2, -1, -1,  0,  0,  0,
> +    0, -1, -1, -1, -1, -1, -1, -1,  2,  1,  1,  0,  0, -1, -1, -2,
> +    3,  3,  3,  1,  0, -1, -2, -2,  5,  4,  4,  2,  1,  0, -1, -2,
> +    0,  0,  0,  0,  1,  2,  3,  3,  0, -1,  0,  0,  1,  2,  3,  3,
> +    0, -1,  0,  0,  1,  2,  3,  2,  0,  0,  0,  1,  1,  2,  2,  2,
> +    2,  1,  1,  1,  1,  1,  1,  0,  2,  2,  2,  1,  0,  0, -1, -2,
> +    2,  1,  0,  0, -2, -3, -5, -6,  0, -1, -1, -3, -5, -6, -8, -9,
> +   -2,  0,  1,  2,  2,  1, -1, -4, -2,  0,  2,  2,  2,  1, -1, -4,
> +   -2,  0,  2,  2,  2,  1, -1, -3, -2,  0,  2,  2,  2,  1, -1, -3,
> +   -2, -1,  2,  2,  2,  1, -1, -3, -2, -1,  1,  2,  2,  1, -1, -3,
> +   -3, -1,  1,  2,  2,  1, -1, -3, -2, -1,  1,  2,  2,  1, -1, -3,
> +   -1,  1,  1, -1, -3, -3,  0,  4, -1,  1,  1, -1, -3, -3,  0,  4,
> +   -1,  1,  1,  0, -3, -3,  0,  4, -1,  1,  2,  0, -3, -3,  0,  5,
> +    0,  1,  2,  0, -3, -4,  0,  4,  0,  1,  2,  0, -3, -4,  0,  5,
> +    0,  1,  2,  0, -3, -3,  0,  4,  0,  1,  2, -1, -2, -2,  0,  4,
> +    6,  6,  5,  6,  5,  5,  5,  5,  2,  2,  2,  2,  2,  2,  2,  2,
> +    0,  0,  0,  0,  0,  0,  0,  0, -1, -1, -1, -1, -2, -2, -2, -2,
> +   -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
> +   -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
> +    2,  2,  2,  2,  2,  2,  2,  2,  0,  1,  1,  0,  0,  0,  0,  0,
> +   -1, -2, -2, -2, -2, -2, -2, -1, -3, -3, -3, -3, -3, -3, -3, -2,
> +   -3, -4, -4, -3, -3, -3, -2, -2, -2, -2, -2, -2, -1, -1,  0,  0,
> +    0,  1,  1,  1,  2,  2,  3,  3,  3,  4,  4,  5,  5,  6,  6,  6,
> +    4,  1, -2, -3, -3, -1,  1,  3,  4,  1, -2, -4, -3, -1,  1,  3,
> +    5,  1, -2, -4, -3, -1,  1,  4,  5,  1, -2, -3, -3, -1,  2,  4,
> +    5,  1, -2, -3, -3, -1,  2,  4,  4,  0, -3, -4, -3, -1,  2,  4,
> +    4,  0, -3, -3, -3, -1,  1,  3,  3,  0, -2, -3, -2, -1,  1,  3,
> +   -3, -4, -4, -4, -4, -4, -4, -4, -1, -1, -1, -1, -1, -1, -2, -2,
> +    2,  1,  1,  2,  2,  1,  1,  1,  3,  3,  3,  4,  4,  3,  3,  3,
> +    3,  3,  3,  4,  4,  4,  3,  3,  1,  2,  1,  2,  2,  2,  2,  2,
> +   -2, -2, -2, -1, -1, -1,  0,  0, -4, -4, -4, -4, -3, -3, -3, -3,
> +   -1, -2, -3, -3, -2, -2, -1,  0,  0, -1, -2, -2, -2, -1,  0,  1,
> +    2,  1, -1, -1, -1, -1,  0,  1,  3,  1,  0, -1, -1,  0,  0,  1,
> +    3,  2,  0, -1,  0,  0,  0,  1,  3,  1,  0, -1,  0,  0,  0,  1,
> +    3,  1,  0, -1,  0,  0,  0,  1,  2,  1,  0,  0,  0,  0,  0,  1,
> +    0,  0,  0,  1,  1,  2,  3,  4,  0,  0, -1,  0,  0,  0,  2,  3,
> +    0, -1, -1, -1, -1, -1,  0,  1,  0, -1, -1, -1, -1, -1, -1,  0,
> +    0,  0, -1, -1, -1, -2, -2, -1,  1,  0,  0, -1, -1, -2, -2, -1,
> +    2,  2,  1,  0, -1, -1, -1, -1,  3,  3,  2,  1,  0, -1, -1,  0,
> +    1,  0,  1,  0,  0, -1, -2, -1,  0,  0,  0,  0, -1, -1, -2, -1,
> +    0, -1,  0,  0, -1, -1, -1, -1, -1, -1, -1,  0,  0,  0,  0,  0,
> +   -1, -1, -1,  0,  0,  0,  1,  1, -1, -1, -1,  0,  1,  1,  2,  3,
> +   -2, -2, -1,  0,  1,  2,  3,  4, -2, -2, -1,  0,  1,  2,  4,  5,
> +   -3, -1,  1,  0,  0, -1,  0,  1, -3,  0,  1,  0, -1, -1,  0,  2,
> +   -3,  0,  1,  0, -1, -1,  0,  2, -2,  1,  2,  0, -1, -1,  0,  2,
> +   -2,  1,  2,  0, -1, -1,  0,  2, -2,  1,  2,  0, -1, -1,  0,  2,
> +   -1,  2,  2,  0, -1, -1,  0,  2, -1,  1,  1,  0, -1, -1, -1,  1,
> +   -2, -2, -1,  1,  3,  4,  3,  1, -2, -2, -1,  0,  2,  3,  2,  0,
> +   -2, -2, -1,  0,  1,  2,  1, -1, -1, -1, -1,  0,  1,  2,  1, -1,
> +   -1, -1, -1,  0,  1,  1,  0, -2,  0, -1, -1,  0,  1,  1,  0, -1,
> +    0, -1, -1,  0,  1,  1,  1, -1,  0, -1, -1,  0,  0,  1,  0, -1,
> +   -2, -1,  0,  1,  1,  1,  1,  1, -2, -1,  0,  0,  0,  0,  0,  0,
> +   -2, -1, -1,  0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -2, -2, -3,
> +   -1,  0,  1,  1,  0, -1, -2, -2,  1,  2,  3,  3,  2,  1,  0,  0,
> +    1,  2,  3,  3,  3,  2,  1,  0,  0,  0,  1,  1,  1,  1,  0,  0,
> +    0, -1, -1, -1,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  1,
> +    1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  2,  2,  1,  1,  1,  1,
> +    1,  1,  1,  1,  1,  1,  1,  1, -1,  0,  0,  1,  1,  0,  0,  0,
> +   -3, -2, -1, -1, -1, -1,  0, -1, -5, -5, -4, -3, -2, -2, -2, -1,
> +    1,  1,  1,  1,  2,  1,  0, -1,  1,  1,  1,  2,  1,  1,  0, -1,
> +    1,  1,  1,  1,  1,  1,  0, -2,  2,  1,  1,  1,  1,  1,  0, -2,
> +    1,  1,  0,  0,  0,  0, -1, -3,  1,  1,  0,  0,  0, -1, -2, -3,
> +    1,  1,  0,  0, -1, -1, -2, -4,  1,  0,  0, -1, -2, -2, -3, -4,
> +    8,  7,  5,  3,  2,  1,  1,  1,  2,  1,  0,  0, -1, -1, -2, -1,
> +   -1, -1, -1, -2, -2, -2, -2, -1, -1, -1, -1, -1,  0, -1, -1,  0,
> +    0,  0,  0,  1,  1,  0,  0,  0,  0,  0,  1,  1,  1,  0,  0,  0,
> +   -1,  0,  0,  0,  0,  0, -1, -1, -2, -2, -1, -1, -1, -2, -2, -1,
> +    9,  4,  0, -2, -2, -2, -1, -1,  7,  2, -1, -2, -2, -1,  0,  0,
> +    4,  0, -2, -2, -1,  0,  1,  1,  1, -2, -2, -2, -1,  0,  1,  1,
> +   -1, -2, -2, -1,  0,  1,  1,  1, -1, -2, -1,  0,  1,  1,  1,  0,
> +   -1, -1,  0,  1,  1,  1,  0, -1,  0, -1,  0,  1,  0,  0, -1, -1,
> +    0,  1,  1,  1,  1,  1,  0,  0,  1,  2,  2,  2,  1,  0,  0,  0,
> +    2,  2,  2,  2,  1,  0, -1, -1,  1,  1,  1,  0, -1, -2, -2, -2,
> +    0,  0,  0, -1, -2, -3, -2, -2, -1, -1, -1, -2, -2, -2, -1,  0,
> +   -1, -1, -1, -1,  0,  0,  1,  2, -1, -1, -1,  0,  1,  2,  3,  4,
> +   -1, -1,  0,  0, -1, -2, -3, -3, -1, -1,  0,  0,  0, -1, -1, -1,
> +   -2, -2, -1,  0,  1,  1,  1,  1, -2, -2, -2,  0,  1,  2,  3,  3,
> +   -1, -1, -1,  0,  1,  3,  3,  3,  1,  0,  0,  0,  1,  1,  2,  2,
> +    2,  2,  1,  0,  0, -1, -1, -1,  3,  2,  1,  0, -1, -2, -3, -3,
> +   -1, -1, -1, -2, -2, -3, -4, -5,  0,  0,  0, -1, -1, -3, -3, -4,
> +    1,  1,  1,  0,  0, -1, -2, -3,  2,  2,  2,  1,  1,  0, -1, -1,
> +    2,  2,  2,  2,  1,  1,  0, -1,  2,  2,  2,  2,  2,  1,  0,  0,
> +    1,  1,  2,  1,  1,  1,  0,  0,  0,  0,  1,  1,  0,  0,  0, -1,
> +   -2,  2,  3,  1, -1,  1,  1, -1, -3,  2,  3,  0, -1,  1,  1, -1,
> +   -3,  2,  3,  0, -1,  1,  1, -1, -4,  2,  3,  0, -1,  1,  1, -2,
> +   -4,  1,  3,  0, -1,  1,  1, -2, -4,  1,  3, -1, -2,  1,  1, -2,
> +   -3,  1,  2,  0, -1,  1,  1, -2, -3,  1,  2,  0, -1,  1,  1, -1,
> +   -1, -1, -1, -2, -2, -2, -2, -2,  1,  1,  1,  1,  0,  0,  0,  0,
> +    1,  2,  2,  2,  2,  2,  2,  2,  0,  0,  1,  1,  1,  2,  2,  2,
> +   -2, -2, -1, -1, -1,  0,  0,  0, -3, -3, -3, -3, -3, -3, -3, -2,
> +   -1, -1, -1, -1, -2, -2, -2, -2,  4,  4,  4,  4,  4,  3,  3,  2,
> +   -3, -3, -2, -1,  0,  1,  2,  5, -3, -3, -3, -2, -1,  1,  3,  6,
> +   -3, -3, -2, -2,  0,  2,  3,  5, -3, -2, -2, -2,  0,  1,  3,  5,
> +   -2, -2, -2, -1, -1,  1,  3,  5, -2, -2, -1, -1,  0,  1,  2,  4,
> +   -1, -1, -1, -1,  0,  1,  1,  4, -1, -1, -1, -1,  0,  1,  2,  3,
> +    0, -1,  0,  1,  1,  0, -1, -1,  0,  0,  0,  1,  2,  0, -1, -1,
> +    1,  0, -1,  0,  1,  0,  0,  0,  1, -1, -2, -1,  0,  0,  0,  0,
> +    1, -2, -3, -1,  0,  0,  0,  1,  1, -1, -3, -2,  0,  1,  1,  2,
> +    1, -1, -2, -1,  0,  1,  1,  2,  2,  0, -1,  0,  1,  1,  2,  2,
> +    1,  1,  1,  1,  0,  0,  1,  2, -1,  0,  0, -1,  0,  0,  0,  1,
> +   -3, -2, -1, -1, -1,  0,  1,  1, -4, -2, -1,  0,  0,  1,  1,  1,
> +   -3, -2,  0,  0,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  0,  0,
> +   -1,  0,  1,  1,  1,  0,  0, -1,  0,  1,  2,  2,  1,  0,  0, -1,
> +   -4, -4, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1,  0,  0,  0,  0,
> +   -1,  0,  0,  0,  1,  1,  1,  1,  0,  0,  1,  1,  1,  1,  1,  1,
> +    0,  0,  1,  1,  2,  2,  1,  0,  0,  0,  1,  1,  1,  1,  1,  0,
> +    0,  0,  0,  1,  1,  1,  1,  0, -1,  0,  0,  1,  1,  1,  0,  0,
> +    1,  2,  2,  2,  1, -1, -2, -4,  1,  1,  2,  2,  1,  0, -2, -4,
> +    0,  1,  1,  1,  1,  0, -1, -3, -1,  0,  1,  1,  0,  0, -1, -2,
> +   -1,  0,  1,  1,  1,  0,  0, -1, -2, -1,  0,  0,  0,  0,  0, -1,
> +   -1, -1,  0,  1,  1,  0,  0,  0, -1,  0,  1,  1,  1,  1,  1,  0,
> +    2,  2,  0, -1, -2, -1, -1, -2,  1,  1, -1, -2, -2, -1, -1, -2,
> +    1,  1, -1, -2, -2,  0,  0, -1,  1,  1,  0, -2, -1,  1,  1,  0,
> +    1,  1,  0, -1, -1,  1,  2,  1,  1,  1,  0, -1, -1,  1,  2,  1,
> +    1,  1,  0, -1, -1,  1,  1,  1,  1,  1,  0, -1,  0,  1,  1,  1,
> +    0,  0, -1, -2, -4, -4, -4, -4,  3,  3,  3,  2,  1,  0,  0,  0,
> +    3,  3,  3,  3,  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  1,
> +   -1, -1, -1, -1, -1, -1, -1,  0,  0, -1,  0,  0, -1,  0,  0,  0,
> +    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1, -1,  0,
> +   -1, -1,  0, -1, -1,  1,  2, -1,  1,  1,  0,  0,  0,  2,  3, -1,
> +    1,  1,  0, -1, -1,  1,  3, -1,  1,  1,  0, -2, -2,  0,  1, -2,
> +    1,  0,  0, -2, -2,  0,  1, -3,  0,  0,  0,  0, -1,  1,  1, -3,
> +    0,  1,  1,  0,  1,  2,  1, -3, -1,  0,  1,  1,  1,  2,  1, -4,
> +   -4, -3,  0,  1,  1,  1,  0,  0, -4, -2,  0,  1,  1,  1,  0, -1,
> +   -3, -1,  1,  1,  1,  0, -1, -1, -1,  1,  1,  1,  1,  0, -1,  0,
> +    1,  2,  2,  1,  0, -1,  0,  0,  2,  2,  1,  0, -1, -1,  0,  1,
> +    2,  1,  0, -1, -2, -1,  0,  1,  2,  2,  0, -1, -2, -1,  1,  1,
> +    1,  1,  0,  0, -1, -1, -1, -1,  0, -1, -1, -1, -1, -1, -1, -1,
> +   -1, -1, -1, -1, -1, -1, -1, -1,  0,  0, -1, -1, -1, -1, -1, -1,
> +    1,  0,  0, -1, -1, -1, -1, -1,  2,  1,  0,  0, -1, -1, -1, -1,
> +    5,  3,  2,  1,  0,  0,  0,  0,  6,  5,  3,  2,  1,  0,  0,  0,
> +    4,  4,  3,  1,  0,  0,  0,  1,  3,  3,  2,  1,  0,  0,  0,  1,
> +    2,  2,  1,  0, -1, -1,  0,  1,  0,  0,  0, -1, -1, -1,  0,  1,
> +    0,  0, -1, -1, -2, -1,  0,  2,  0, -1, -1, -2, -2, -2,  0,  1,
> +    0, -1, -1, -2, -2, -2, -1,  0,  0,  0, -1, -2, -2, -2, -1,  0,
> +    0,  0, -1, -1, -1,  0,  2,  3,  0, -1, -2, -2, -1, -1,  1,  2,
> +    1,  0, -1, -1, -1,  0,  0,  0,  1,  1,  1,  0,  0,  0, -1, -1,
> +    1,  2,  1,  0,  0, -1, -1, -1, -1,  0,  0,  0, -1, -1, -1, -1,
> +   -3, -2, -1, -1,  0,  1,  1,  2, -4, -3, -1,  1,  2,  3,  5,  5,
> +    0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,
> +    0,  0,  0, -1,  0,  0,  0,  1, -1, -1, -2, -2, -2, -1, -1,  0,
> +    0,  0,  0,  0,  0,  1,  1,  1,  2,  2,  2,  2,  2,  3,  3,  3,
> +    1,  1,  1,  1,  2,  2,  1,  1, -4, -3, -4, -4, -4, -4, -3, -3,
> +   -1,  0,  1,  2,  2,  3,  3,  3, -1, -1, -1, -1,  0,  0,  0,  0,
> +    0,  0, -1, -2, -2, -3, -3, -2,  3,  2,  1,  0, -1, -2, -2, -2,
> +    4,  3,  2,  1,  1,  0,  0,  0,  2,  2,  1,  1,  0,  1,  1,  1,
> +    0, -1, -1, -1, -1,  0,  0,  1, -2, -2, -2, -2, -2, -1,  0,  0,
> +    1, -1,  0,  2,  1, -2, -1,  1,  1, -1,  0,  2,  1, -2, -2,  1,
> +    1, -1,  0,  3,  2, -2, -1,  1,  0, -2,  0,  3,  2, -2, -2,  1,
> +    0, -2,  0,  3,  2, -2, -2,  1,  0, -2,  0,  3,  1, -2, -1,  1,
> +    0, -2,  0,  2,  1, -2, -2,  1,  0, -1,  0,  2,  1, -2, -1,  1,
> +    0,  1,  2,  2,  3,  3,  2,  2,  0,  1,  1,  2,  3,  3,  2,  1,
> +    0,  0,  1,  2,  2,  2,  2,  1, -1,  0,  0,  1,  1,  1,  1,  1,
> +   -1, -1,  0,  0,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1, -1, -1,
> +   -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -1,
> +    0,  0, -1, -2, -1,  0,  3,  5,  0,  0, -1, -1, -1,  0,  2,  4,
> +    1,  1,  0,  0, -1, -1,  1,  2,  1,  2,  1,  1,  0, -1, -1,  0,
> +    0,  1,  2,  1,  0, -1, -2, -2, -1,  0,  1,  2,  1,  0, -3, -3,
> +   -2, -1,  1,  2,  2,  0, -2, -4, -2, -1,  0,  2,  2,  1, -1, -3,
> +    0,  0,  0,  0,  0,  0, -1, -1,  0,  0, -1,  0,  0,  0,  0,  0,
> +   -1, -1, -1, -1,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1, -1,  0,
> +   -1, -1, -1, -1, -1, -1, -1,  0, -1,  0,  0,  0,  0, -1, -1,  0,
> +    0,  0,  1,  1,  0,  0,  0,  1,  3,  3,  3,  4,  3,  3,  3,  3,
> +    5,  1, -2, -2,  0,  0,  0, -1,  4, -1, -3, -1,  0,  0,  0, -1,
> +    3, -1, -1,  0,  1,  1,  0, -1,  2,  0,  0,  1,  1,  1,  0, -2,
> +    1,  0,  0,  1,  1,  1,  0, -2,  0, -1, -1, -1,  0,  0,  0, -1,
> +    0, -1, -1, -1, -1,  0,  0, -1,  2,  1,  0,  0,  0,  1,  0,  0,
> +    1,  0,  1,  1,  1,  1,  0,  0,  1,  0,  0,  1,  1,  0,  0,  0,
> +    1, -1, -1,  0,  0,  0,  0,  0,  2,  0, -1, -1, -1, -1, -1,  0,
> +    3,  1, -1, -1, -2, -2, -2, -1,  4,  2,  1,  0, -1, -2, -2, -1,
> +    2,  1,  0,  0, -1, -1,  0,  0,  0, -1, -1, -1, -1,  0,  1,  1,
> +    0,  1,  2,  2,  2,  1, -1, -3,  0,  0,  1,  1,  1,  0, -1, -2,
> +    0,  0,  0,  0,  0,  0, -1, -1,  0,  0, -1,  0,  0,  1,  1,  0,
> +    0,  0, -1,  0,  1,  1,  1,  1,  0,  0,  0,  0,  1,  1,  1,  0,
> +    0,  0,  1,  1,  2,  1, -1, -3,  0,  0,  0,  1,  1, -1, -4, -5,
> +   -2, -2, -2, -1,  0,  2,  2,  2,  0,  0,  0,  0,  1,  1,  1,  0,
> +    1,  1,  1,  1,  1,  0, -2, -3,  0,  0,  1,  1,  0, -1, -3, -4,
> +   -1, -1,  0,  1,  0,  0, -2, -3, -1, -1,  0,  1,  1,  1,  0, -1,
> +    0,  0,  0,  1,  1,  1,  1,  0,  1,  1,  1,  1,  0,  0,  0,  0,
> +    0,  1,  0,  0,  1,  1,  1,  2,  1,  2,  0,  0,  0,  0, -1,  1,
> +    0,  2,  0, -1,  1,  0, -1,  0,  0,  1,  0,  0,  2,  1,  0,  1,
> +    0,  1, -1,  0,  2,  2,  0,  1, -1,  0, -1, -1,  2,  1,  1,  2,
> +   -2, -2, -3, -2,  0,  1,  1,  1, -2, -2, -3, -3, -1, -1, -1,  0,
> +   -3, -1,  0,  1,  2,  1,  1,  0, -3, -1,  0,  1,  2,  1,  1,  1,
> +   -2,  0,  0,  1,  1,  1,  1,  1, -1,  0,  0,  0,  0,  0,  0,  0,
> +   -2,  0,  0,  0,  0, -1, -1,  0, -2,  0,  0,  0,  0,  0, -1, -1,
> +   -3,  0,  1,  1,  1,  1,  0,  1, -5, -2,  0,  1,  2,  2,  1,  2,
> +   -2, -1, -1,  0,  0,  1,  2,  3,  0,  0,  1,  1,  0,  0,  1,  2,
> +    0,  0,  1,  0, -1, -1,  0,  1, -1, -1, -1, -1, -2, -2, -1,  0,
> +   -2, -2, -2, -2, -2, -1,  0,  1,  0,  0,  0, -1,  0,  1,  2,  2,
> +    2,  1,  0,  0,  0,  1,  2,  2,  2,  1,  0, -1, -1, -1,  0,  0,
> +    0,  1,  1,  1,  1,  1, -1, -4, -1, -1,  0,  1,  1,  1,  0, -3,
> +   -2, -1,  0,  0,  1,  2,  2, -2, -1,  0,  0,  0,  0,  2,  3, -1,
> +   -1,  0,  0,  0,  0,  1,  2,  0,  0,  0, -1, -2, -1,  1,  1,  0,
> +    0,  0, -1, -2, -2,  0,  2,  1,  0,  0, -1, -2, -1,  1,  2,  2,
> +    1,  0,  0,  0, -2, -3, -2, -3,  0,  0,  1,  0, -2, -2, -1, -1,
> +    0, -1,  1,  1, -1, -1,  0,  0,  0, -1,  1,  1, -1, -1,  0,  0,
> +    0,  1,  2,  1, -1, -1,  0,  1,  1,  2,  3,  2,  0,  0,  1,  2,
> +   -1,  0,  2,  1,  0,  0,  2,  3, -2, -1,  0,  0, -1,  0,  1,  2,
> +    1,  1,  0, -1, -2, -2, -1,  1,  1,  1,  1, -1, -2, -2,  0,  2,
> +    1,  1,  1, -1, -1, -1,  0,  2,  0,  0,  0,  0,  0,  0,  1,  2,
> +   -1, -1, -1,  0,  0,  0,  1,  2, -1, -2, -1,  1,  1,  1,  0,  0,
> +   -1, -2, -1,  1,  2,  2,  0, -1, -1, -2, -1,  2,  2,  2,  0, -1,
> +   -1, -1, -1, -2, -1, -1,  0,  1,  0,  0, -1, -1, -1,  0,  1,  2,
> +    1,  0,  0,  0,  0,  1,  1,  2,  1,  1,  0,  0,  1,  1,  1,  1,
> +    1,  1,  0,  1,  1,  0,  1,  1,  1,  1,  1,  1,  0, -1, -1, -1,
> +    1,  2,  1,  0, -1, -2, -2, -3,  2,  2,  1,  0, -2, -3, -4, -4,
> +   -4, -2,  1,  1,  1,  1,  0,  0, -2,  0,  1,  0,  0,  0,  0,  0,
> +    0,  1,  1, -2, -2, -1,  0,  1,  2,  2,  1, -2, -2, -1,  1,  2,
> +    1,  2,  1, -2, -2, -1,  1,  2, -1,  1,  1, -1, -1, -1,  0,  1,
> +   -2,  0,  1,  1,  0, -1, -1,  0, -2,  0,  2,  2,  1, -1, -1,  0,
> +    1,  1,  0,  0,  0,  1,  0,  0, -2, -3, -3, -2, -2, -1,  0,  0,
> +   -3, -4, -3, -2, -1,  0,  0,  0, -1, -1,  0,  1,  2,  3,  2,  1,
> +    0,  1,  2,  3,  3,  3,  2,  1,  1,  1,  1,  2,  1,  0,  0, -1,
> +    0,  0,  0,  0, -1, -1, -1, -1,  0, -1, -1,  0,  0,  0,  0,  0,
> +    1,  1,  0,  0, -1, -1,  0,  2,  0,  0,  1,  0, -1, -1,  1,  1,
> +   -2, -1,  0,  1,  1,  1,  1,  1, -3, -3,  0,  2,  2,  1,  1,  0,
> +   -2, -2,  0,  1,  1,  1,  0,  0,  1,  0,  0,  0,  0,  0, -1, -1,
> +    3,  1, -1, -3, -2, -1,  0,  1,  4,  2, -1, -3, -3, -1,  1,  2,
> +    0,  0,  0, -1, -1, -1, -1, -1,  1,  2,  1,  0,  0,  0, -1, -1,
> +    2,  3,  3,  2,  1,  0, -1, -1,  3,  4,  4,  2,  1,  0, -1, -2,
> +    3,  3,  2,  1,  0, -1, -2, -2,  1,  1,  0, -1, -1, -2, -2, -3,
> +    0,  0,  0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -1, -2, -2, -1,
> +    1,  2,  2,  2,  2,  1,  2,  2,  0,  1,  1,  1,  1,  0,  0,  0,
> +    0,  0,  0,  1,  1,  0, -1, -2,  0,  0,  0,  0,  1,  0, -1, -4,
> +    1,  0,  0,  0,  0,  0, -2, -5,  1,  0,  0,  0,  0,  0, -1, -4,
> +    1,  0, -1,  0,  0,  0, -1, -3,  0, -1, -1,  0,  1,  1,  1, -1,
> +   -2, -1,  0,  0, -1, -1, -1, -2, -1,  0,  0,  0, -1, -1, -2, -2,
> +    0,  1,  1,  0, -1, -1, -1, -2,  0,  1,  1,  0,  0,  0, -1, -1,
> +    0,  1,  0,  0,  1,  1,  1,  0,  1,  1,  0,  0,  1,  2,  2,  1,
> +    1,  1,  0,  0,  1,  2,  2,  1,  1,  1,  0, -1,  0,  1,  1,  0,
> +    4,  2,  1,  0,  0,  1,  1,  1,  4,  2,  1,  0,  0,  0,  0,  1,
> +    3,  1,  0,  0, -1, -1, -1,  0,  1,  0,  0, -1, -1, -2, -1,  0,
> +    0,  0,  0,  0, -1, -1, -1,  0, -1, -1,  0,  0, -1, -1,  0,  1,
> +   -2, -1,  0, -1, -1,  0,  0,  1, -2, -2, -1, -2, -1,  0,  0,  1,
> +    0,  1,  1,  1,  2,  1,  0, -1, -1, -1, -1,  0,  0, -1, -2, -2,
> +   -1,  0, -1,  0,  0, -1, -2, -1,  0,  0,  0,  0,  0,  0,  1,  2,
> +    0,  0,  0,  0,  0,  0,  2,  3, -1,  0, -1, -1, -1, -1,  0,  3,
> +   -1,  0,  0, -1, -1, -2,  0,  3,  0,  0,  0,  0, -1, -1,  1,  4,
> +    2,  2,  0,  0,  0,  0,  0,  1,  1,  1, -1, -2, -1, -2, -1,  1,
> +   -1, -1, -2, -2, -2, -3, -2,  0, -1,  0, -1, -1, -1, -2, -1,  1,
> +    1,  1,  0,  0,  1,  0,  0,  1,  2,  2,  0,  0,  1,  0,  0,  1,
> +    2,  2,  0,  0,  0,  0, -1, -1,  2,  2,  0,  0,  1,  0, -1, -1,
> +   -1,  0,  1,  1,  0, -1, -1, -1,  1,  2,  3,  2,  1,  0,  0,  0,
> +    0,  1,  1,  1,  0, -1,  0,  0, -2, -2, -1,  0,  1,  0,  0,  0,
> +   -2, -2, -1,  2,  2,  2,  1,  0, -2, -1,  0,  1,  1,  0,  0, -1,
> +   -1, -1,  0,  0, -1, -2, -1, -2,  0,  1,  1,  1,  0,  0,  1,  1,
> +   -3, -3, -3, -2, -1, -1, -2, -2, -1, -1,  0,  1,  2,  1,  0,  0,
> +    1,  1,  1,  2,  2,  1,  0,  0,  1,  1,  1,  1,  1,  0, -1,  1,
> +    1,  0, -1, -1,  0,  0, -1,  1,  0, -1, -1, -1,  0, -1, -1,  1,
> +    1,  0, -1,  0,  0, -1,  0,  2,  2,  0, -1,  0,  0,  0,  0,  2,
> +    1,  0, -2, -1,  0,  1,  1,  0,  2,  0, -1, -1,  0,  1,  1,  0,
> +    1,  0, -2, -1,  0,  1,  0, -1,  1,  0, -1, -1,  0,  1,  0, -1,
> +    0,  1,  1,  0,  1,  1,  0,  0, -2,  1,  2,  1,  0,  0,  0,  1,
> +   -5,  0,  2,  1,  0, -1,  0,  1, -6, -1,  2,  1,  0, -1,  0,  0,
> +    5,  3,  0, -1, -2, -1, -1, -1,  1,  1,  0, -1, -1,  0, -1, -1,
> +   -1,  0,  1,  1,  2,  2,  1,  0, -2, -1,  0,  1,  2,  1,  1,  1,
> +   -2, -1, -1, -1,  0, -1,  0,  1,  0,  1,  0,  0, -1, -1,  0,  0,
> +    0,  1,  1,  1,  1,  0,  0,  0, -3, -2,  0,  1,  1,  0,  0, -1,
> +   -1,  0,  1,  0, -1,  0,  2,  3, -1,  0,  0, -2, -4, -2, -1,  0,
> +    0,  1,  1,  0, -2, -1,  0, -1,  1,  2,  3,  1,  0,  1,  1,  0,
> +   -1,  0,  1,  1,  1,  1,  1,  0, -2, -3, -2,  0,  0,  0,  1,  0,
> +   -1, -2, -2,  0,  1,  0,  0, -1,  3,  1,  0,  0,  1,  0, -1, -1,
> +   -2, -1,  0,  0, -1, -1,  0,  0, -1,  0,  0,  0,  0,  1,  1,  1,
> +   -1, -1, -1,  0,  1,  1,  1,  1,  0, -2, -3, -1,  1,  0,  0,  0,
> +    1, -1, -3, -1,  1,  1,  0, -1,  3,  1, -1,  1,  2,  2,  0, -1,
> +    3,  1,  0,  1,  2,  1,  1,  0,  0, -2, -2, -1, -1,  0,  0,  0,
> +    1,  0, -1, -1,  1,  2,  1,  0,  0, -1, -2, -1,  1,  2,  2,  1,
> +   -1, -1, -1,  0,  0,  1,  2,  0, -2,  0,  0,  0,  0,  0,  1, -1,
> +   -1,  0,  1,  0, -1, -1, -1, -1,  0,  1,  1,  2,  0, -2, -1,  0,
> +    1,  2,  2,  2,  1, -1, -1,  0,  0,  1,  1,  1,  0, -2, -2, -1,
> +    0,  0, -1, -1, -1, -1, -2, -2,  0,  0, -1,  0,  1,  2,  2,  1,
> +    0,  0, -1, -1,  0,  1,  2,  2,  1,  1, -1, -2, -1, -1, -1, -1,
> +    2,  2,  1,  0,  0, -1, -2, -2,  1,  2,  2,  1,  0,  0, -2, -2,
> +    0,  0,  0,  0,  1,  1,  0, -1,  0, -1, -1, -1,  2,  3,  2,  1,
> +    0, -2,  1,  2, -1,  0,  0,  1, -1, -2,  2,  3, -1,  0,  0,  0,
> +    0, -2,  2,  3, -1, -1,  0,  0,  0, -1,  3,  2, -2,  0,  1,  0,
> +    0, -1,  3,  1, -2,  0,  1,  0,  0, -1,  2,  1, -1,  1,  0, -1,
> +    0,  0,  1, -1, -2,  0,  0, -1,  1,  0,  0, -2, -2, -1, -1, -1,
> +    1,  1,  1,  1,  1, -1, -1, -2,  0,  0,  0,  1,  1,  1,  1,  1,
> +    0,  0,  0,  1,  1,  1,  2,  3,  1,  0,  0, -1,  0,  0,  1,  2,
> +    0, -1, -1, -2, -1,  0,  1,  2, -2, -2, -2, -2, -1,  0,  1,  1,
> +   -1, -1, -1, -1,  0,  0,  0, -1,  2,  2,  2,  0, -1, -1, -2, -4,
> +   -1, -2, -1, -1,  0,  1,  2,  3, -1, -1, -1, -1,  0,  1,  2,  3,
> +    1,  0, -1,  0, -1,  0,  1,  2,  1,  0,  0,  0, -1,  0,  2,  2,
> +    1,  0, -1, -1, -2,  0,  1,  2,  0, -2, -2, -2, -3, -1,  0,  1,
> +    0, -2, -2, -2, -2, -1,  1,  1,  0,  0,  0,  0,  0,  1,  2,  2
> +};
> +
> +static const int8 *const s_svq1IntraCodebooks[6] = {
> +    s_svq1IntraCodebook4x2, s_svq1IntraCodebook4x4,
> +    s_svq1IntraCodebook8x4, s_svq1IntraCodebook8x8,
> +    0, 0
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/svq1_vlc.h b/image/codecs/svq1_vlc.h
> new file mode 100644
> index 0000000..19cfb34
> --- /dev/null
> +++ b/image/codecs/svq1_vlc.h
> @@ -0,0 +1,341 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// These tables are modified versions of the FFmpeg ones so that they
> +// will work with our BitStream class directly.
> +
> +#ifndef IMAGE_CODECS_SVQ1_VLC_H
> +#define IMAGE_CODECS_SVQ1_VLC_H
> +
> +#include "common/scummsys.h"
> +
> +namespace Image {
> +
> +static const byte s_svq1BlockTypeLengths[4] = {
> +       1, 2, 3, 3
> +};
> +
> +static const uint32 s_svq1BlockTypeCodes[4] = {
> +       1, 1, 1, 0
> +};
> +
> +static const byte s_svq1IntraMultistageLengths0[8] = {
> +       5, 1, 3, 3, 4, 4, 5, 4
> +};
> +
> +static const uint32 s_svq1IntraMultistageCodes0[8] = {
> +       1, 1, 3, 2, 3, 2, 0, 1
> +};
> +
> +static const byte s_svq1IntraMultistageLengths1[8] = {
> +       4, 2, 3, 3, 3, 3, 4, 3
> +};
> +
> +static const uint32 s_svq1IntraMultistageCodes1[8] = {
> +       1, 3, 5, 4, 3, 2, 0, 1
> +};
> +
> +static const byte s_svq1IntraMultistageLengths2[8] = {
> +       5, 1, 3, 5, 4, 3, 4, 4
> +};
> +
> +static const uint32 s_svq1IntraMultistageCodes2[8] = {
> +       1, 1, 3, 0, 3, 2, 2, 1
> +};
> +
> +static const byte s_svq1IntraMultistageLengths3[8] = {
> +       6, 1, 2, 6, 4, 4, 5, 4
> +};
> +
> +static const uint32 s_svq1IntraMultistageCodes3[8] = {
> +       1, 1, 1, 0, 3, 2, 1, 1
> +};
> +
> +static const byte s_svq1IntraMultistageLengths4[8] = {
> +       6, 1, 2, 5, 5, 6, 5, 3
> +};
> +
> +static const uint32 s_svq1IntraMultistageCodes4[8] = {
> +       1, 1, 1, 3, 2, 0, 1, 1
> +};
> +
> +static const byte s_svq1IntraMultistageLengths5[8] = {
> +       7, 1, 2, 3, 4, 6, 7, 5
> +};
> +
> +static const uint32 s_svq1IntraMultistageCodes5[8] = {
> +       1, 1, 1, 1, 1, 1, 0, 1
> +};
> +
> +static const byte *s_svq1IntraMultistageLengths[6] = {
> +       s_svq1IntraMultistageLengths0, s_svq1IntraMultistageLengths1,
> s_svq1IntraMultistageLengths2,
> +       s_svq1IntraMultistageLengths3, s_svq1IntraMultistageLengths4,
> s_svq1IntraMultistageLengths5
> +};
> +
> +static const uint32 *s_svq1IntraMultistageCodes[6] = {
> +       s_svq1IntraMultistageCodes0, s_svq1IntraMultistageCodes1,
> s_svq1IntraMultistageCodes2,
> +       s_svq1IntraMultistageCodes3, s_svq1IntraMultistageCodes4,
> s_svq1IntraMultistageCodes5
> +};
> +
> +static const byte s_svq1InterMultistageLengths0[8] = {
> +       2, 3, 3, 3, 3, 3, 4, 4
> +};
> +
> +static const uint32 s_svq1InterMultistageCodes0[8] = {
> +       3, 5, 4, 3, 2, 1, 1, 0
> +};
> +
> +static const byte s_svq1InterMultistageLengths1[8] = {
> +       2, 3, 3, 3, 3, 3, 4, 4
> +};
> +
> +static const uint32 s_svq1InterMultistageCodes1[8] = {
> +       3, 5, 4, 3, 2, 1, 1, 0
> +};
> +
> +static const byte s_svq1InterMultistageLengths2[8] = {
> +       1, 3, 3, 4, 4, 4, 5, 5
> +};
> +
> +static const uint32 s_svq1InterMultistageCodes2[8] = {
> +       1, 3, 2, 3, 2, 1, 1, 0
> +};
> +
> +static const byte s_svq1InterMultistageLengths3[8] = {
> +       1, 3, 3, 4, 4, 4, 5, 5
> +};
> +
> +static const uint32 s_svq1InterMultistageCodes3[8] = {
> +       1, 3, 2, 3, 2, 1, 1, 0
> +};
> +
> +static const byte s_svq1InterMultistageLengths4[8] = {
> +       1, 3, 3, 4, 4, 4, 5, 5
> +};
> +
> +static const uint32 s_svq1InterMultistageCodes4[8] = {
> +       1, 3, 2, 3, 2, 1, 1, 0
> +};
> +
> +static const byte s_svq1InterMultistageLengths5[8] = {
> +       1, 2, 3, 5, 5, 5, 6, 6
> +};
> +
> +static const uint32 s_svq1InterMultistageCodes5[8] = {
> +       1, 1, 1, 3, 2, 1, 1, 0
> +};
> +
> +static const byte *s_svq1InterMultistageLengths[6] = {
> +       s_svq1InterMultistageLengths0, s_svq1InterMultistageLengths1,
> s_svq1InterMultistageLengths2,
> +       s_svq1InterMultistageLengths3, s_svq1InterMultistageLengths4,
> s_svq1InterMultistageLengths5
> +};
> +
> +static const uint32 *s_svq1InterMultistageCodes[6] = {
> +       s_svq1InterMultistageCodes0, s_svq1InterMultistageCodes1,
> s_svq1InterMultistageCodes2,
> +       s_svq1InterMultistageCodes3, s_svq1InterMultistageCodes4,
> s_svq1InterMultistageCodes5
> +};
> +
> +static const byte s_svq1IntraMeanLengths[256] = {
> +       6, 7, 17, 20, 20, 20, 20, 20, 20, 19,
> +       11, 9, 11, 14, 14, 15, 16, 12, 10, 11,
> +       11, 9, 8, 8, 7, 4, 4, 6, 7, 8,
> +       8, 9, 9, 9, 9, 9, 9, 9, 9, 9,
> +       9, 9, 9, 9, 9, 9, 9, 9, 8, 8,
> +       8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
> +       8, 8, 8, 8, 7, 8, 8, 8, 8, 8,
> +       8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
> +       8, 8, 8, 8, 8, 7, 8, 8, 7, 8,
> +       8, 8, 8, 8, 7, 8, 7, 7, 8, 7,
> +       7, 8, 7, 8, 8, 8, 7, 7, 8, 7,
> +       8, 7, 7, 7, 7, 7, 7, 7, 7, 7,
> +       7, 7, 7, 7, 7, 7, 7, 8, 8, 8,
> +       8, 8, 8, 8, 8, 8, 8, 7, 7, 7,
> +       7, 7, 7, 7, 7, 7, 7, 7, 6, 6,
> +       7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
> +       8, 8, 8, 8, 8, 8, 8, 8, 8, 9,
> +       9, 9, 9, 9, 8, 8, 9, 9, 9, 9,
> +       9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
> +       9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
> +       9, 9, 9, 9, 10, 10, 10, 10, 10, 10,
> +       10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
> +       10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
> +       10, 10, 10, 11, 11, 11, 10, 11, 11, 11,
> +       11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
> +       11, 11, 11, 11, 11, 14
> +};
> +
> +static const uint32 s_svq1IntraMeanCodes[256] = {
> +       55, 86, 1, 1, 2, 3, 0, 4, 5, 3,
> +       21, 66, 20, 3, 2, 1, 1, 1, 43, 24,
> +       12, 65, 120, 108, 85, 15, 14, 52, 81, 114,
> +       110, 64, 63, 62, 61, 60, 59, 58, 57, 56,
> +       55, 67, 70, 71, 69, 68, 73, 72, 74, 121,
> +       118, 119, 113, 117, 116, 115, 106, 85, 112, 111,
> +       82, 109, 76, 107, 64, 105, 104, 103, 102, 101,
> +       100, 99, 98, 97, 96, 95, 94, 93, 92, 91,
> +       90, 89, 88, 87, 86, 61, 84, 83, 63, 81,
> +       80, 79, 78, 77, 65, 75, 83, 62, 72, 79,
> +       82, 69, 80, 67, 66, 65, 66, 67, 62, 68,
> +       60, 69, 70, 71, 72, 73, 74, 75, 76, 77,
> +       78, 88, 89, 90, 91, 92, 93, 68, 73, 41,
> +       63, 61, 59, 44, 40, 37, 38, 94, 87, 84,
> +       95, 98, 99, 100, 97, 101, 103, 102, 53, 54,
> +       96, 57, 58, 56, 55, 54, 53, 52, 51, 50,
> +       49, 48, 45, 43, 42, 39, 64, 70, 71, 38,
> +       37, 36, 35, 34, 46, 47, 31, 54, 29, 33,
> +       27, 28, 25, 26, 24, 23, 22, 30, 32, 39,
> +       40, 41, 42, 43, 44, 45, 46, 47, 48, 53,
> +       49, 50, 51, 52, 25, 42, 23, 22, 21, 40,
> +       38, 37, 34, 33, 24, 20, 41, 18, 13, 14,
> +       15, 16, 17, 26, 27, 28, 29, 30, 31, 32,
> +       19, 35, 36, 9, 8, 7, 39, 5, 11, 6,
> +       4, 3, 2, 1, 10, 22, 25, 23, 13, 14,
> +       15, 16, 17, 18, 19, 1
> +};
> +
> +static const byte s_svq1InterMeanLengths[512] = {
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 21, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 21,
> +       22, 22, 22, 22, 22, 22, 20, 21, 22, 21,
> +       22, 22, 20, 22, 22, 21, 19, 18, 20, 22,
> +       22, 21, 20, 19, 20, 20, 19, 19, 19, 18,
> +       19, 18, 19, 20, 19, 19, 18, 18, 18, 19,
> +       18, 18, 18, 17, 19, 18, 18, 17, 18, 18,
> +       18, 17, 17, 17, 17, 16, 16, 16, 16, 16,
> +       16, 16, 16, 16, 15, 16, 15, 15, 15, 15,
> +       15, 15, 15, 15, 14, 14, 14, 14, 14, 14,
> +       14, 14, 14, 13, 13, 13, 13, 13, 13, 13,
> +       13, 12, 12, 12, 12, 12, 12, 11, 11, 11,
> +       11, 11, 11, 10, 10, 10, 10, 10, 10, 9,
> +       9, 9, 9, 9, 8, 8, 8, 8, 7, 7,
> +       7, 6, 6, 5, 5, 4, 1, 3, 5, 5,
> +       6, 6, 7, 7, 7, 7, 8, 8, 8, 9,
> +       9, 9, 9, 9, 10, 10, 10, 10, 11, 11,
> +       11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
> +       12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
> +       14, 14, 14, 14, 14, 14, 14, 14, 15, 15,
> +       15, 15, 15, 15, 15, 15, 15, 15, 16, 16,
> +       16, 16, 16, 16, 16, 16, 16, 16, 17, 17,
> +       17, 17, 17, 17, 17, 17, 18, 17, 17, 17,
> +       17, 17, 17, 17, 19, 18, 18, 19, 18, 18,
> +       19, 18, 18, 18, 19, 18, 19, 19, 18, 20,
> +       20, 19, 19, 19, 19, 19, 19, 18, 19, 20,
> +       19, 19, 21, 20, 19, 20, 19, 19, 20, 20,
> +       22, 20, 22, 22, 21, 22, 22, 21, 21, 22,
> +       22, 20, 22, 22, 21, 22, 22, 22, 20, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 21, 21, 22, 22, 22, 21,
> +       22, 21, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
> +       22, 22
> +};
> +
> +static const uint32 s_svq1InterMeanCodes[512] = {
> +       90, 212, 213, 214, 215, 216, 217, 218, 219, 220,
> +       221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
> +       232, 203, 233, 234, 231, 236, 237, 238, 239, 240,
> +       241, 242, 243, 244, 245, 246, 247, 248, 258, 235,
> +       249, 252, 253, 254, 256, 92, 96, 257, 113, 260,
> +       261, 251, 255, 134, 250, 124, 117, 259, 120, 211,
> +       123, 130, 210, 209, 208, 207, 206, 205, 204, 195,
> +       202, 201, 200, 199, 198, 197, 139, 196, 194, 193,
> +       192, 191, 190, 189, 188, 187, 186, 185, 97, 132,
> +       133, 134, 135, 136, 137, 138, 140, 141, 142, 143,
> +       144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
> +       154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
> +       164, 165, 166, 167, 168, 169, 170, 171, 127, 143,
> +       172, 173, 174, 175, 176, 177, 83, 144, 178, 145,
> +       179, 180, 84, 181, 182, 140, 52, 61, 85, 183,
> +       184, 139, 86, 61, 87, 88, 64, 67, 71, 42,
> +       46, 44, 70, 89, 73, 45, 56, 54, 57, 69,
> +       40, 48, 53, 32, 68, 50, 49, 31, 47, 46,
> +       45, 33, 34, 35, 36, 39, 35, 32, 29, 37,
> +       30, 36, 42, 38, 33, 41, 34, 35, 36, 27,
> +       26, 29, 31, 39, 23, 24, 25, 27, 28, 30,
> +       37, 32, 33, 19, 20, 21, 22, 23, 24, 25,
> +       26, 24, 23, 21, 20, 19, 18, 15, 16, 18,
> +       19, 27, 26, 14, 19, 15, 16, 17, 18, 13,
> +       20, 21, 12, 19, 15, 14, 16, 17, 12, 9,
> +       10, 8, 9, 9, 8, 5, 1, 3, 7, 6,
> +       11, 10, 14, 15, 11, 13, 11, 13, 12, 15,
> +       16, 17, 14, 18, 23, 20, 22, 21, 25, 24,
> +       23, 22, 21, 20, 17, 25, 26, 22, 29, 27,
> +       28, 32, 28, 35, 34, 33, 31, 30, 27, 29,
> +       36, 22, 26, 34, 29, 31, 21, 35, 24, 32,
> +       41, 40, 38, 37, 25, 28, 30, 23, 44, 43,
> +       28, 33, 45, 40, 31, 27, 26, 34, 45, 50,
> +       44, 39, 49, 51, 47, 43, 55, 42, 46, 48,
> +       41, 40, 38, 37, 47, 51, 52, 48, 58, 59,
> +       49, 60, 43, 41, 72, 39, 66, 65, 38, 82,
> +       81, 63, 62, 57, 60, 59, 58, 37, 56, 80,
> +       55, 54, 135, 79, 53, 78, 51, 50, 77, 76,
> +       131, 75, 129, 128, 142, 126, 125, 132, 141, 122,
> +       121, 74, 119, 118, 137, 116, 115, 114, 73, 112,
> +       111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
> +       101, 100, 99, 98, 138, 136, 95, 94, 93, 133,
> +       91, 131, 89, 88, 87, 86, 85, 84, 83, 82,
> +       81, 80, 79, 78, 77, 76, 75, 74, 73, 72,
> +       71, 70, 69, 68, 67, 66, 65, 64, 63, 62,
> +       61, 60, 59, 58, 57, 56, 55, 54, 53, 52,
> +       51, 50, 49, 48, 47, 46, 45, 44, 43, 42,
> +       41, 40, 39, 38, 37, 36, 35, 34, 33, 32,
> +       31, 30, 29, 28, 27, 26, 25, 24, 23, 22,
> +       21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
> +       11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
> +       1, 0
> +};
> +
> +static const byte s_svq1MotionComponentLengths[33] = {
> +       1, 2, 3, 4, 6, 7, 7, 7, 9, 9,
> +       9, 10, 10, 10, 10, 10, 10, 10, 10, 10,
> +       10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
> +       11, 12, 12
> +};
> +
> +static const uint32 s_svq1MotionComponentCodes[33] = {
> +       1, 1, 1, 1, 3, 5, 4, 3, 11, 10,
> +       9, 17, 16, 15, 14, 13, 12, 11, 10, 9,
> +       8, 7, 6, 5, 4, 7, 6, 5, 4, 3,
> +       2, 3, 2
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/codecs/truemotion1.cpp b/image/codecs/truemotion1.cpp
> new file mode 100644
> index 0000000..3b8ad85
> --- /dev/null
> +++ b/image/codecs/truemotion1.cpp
> @@ -0,0 +1,422 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +// Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson
> in FFmpeg
> +
> +#include "common/scummsys.h"
> +#include "image/codecs/truemotion1.h"
> +
> +#ifdef IMAGE_CODECS_TRUEMOTION1_H
> +
> +#include "image/codecs/truemotion1data.h"
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +#include "common/util.h"
> +
> +namespace Image {
> +
> +enum {
> +       FLAG_SPRITE = (1 << 5),
> +       FLAG_KEYFRAME = (1 << 4),
> +       FLAG_INTERFRAME = (1 << 3),
> +       FLAG_INTERPOLATED = (1 << 2)
> +};
> +
> +enum {
> +       ALGO_NOP = 0,
> +       ALGO_RGB16V = 1,
> +       ALGO_RGB16H = 2,
> +       ALGO_RGB24H = 3
> +};
> +
> +// these are the various block sizes that can occupy a 4x4 block
> +enum {
> +       BLOCK_2x2 = 0,
> +       BLOCK_2x4 = 1,
> +       BLOCK_4x2 = 2,
> +       BLOCK_4x4 = 3
> +};
> +
> +// { valid for metatype }, algorithm, num of deltas, vert res, horiz res
> +struct CompressionType {
> +       int algorithm;
> +       int blockWidth; // vres
> +       int blockHeight; // hres
> +       int blockType;
> +};
> +
> +static const CompressionType compressionTypes[17] = {
> +       { ALGO_NOP,     0, 0, 0 },
> +
> +       { ALGO_RGB16V, 4, 4, BLOCK_4x4 },
> +       { ALGO_RGB16H, 4, 4, BLOCK_4x4 },
> +       { ALGO_RGB16V, 4, 2, BLOCK_4x2 },
> +       { ALGO_RGB16H, 4, 2, BLOCK_4x2 },
> +
> +       { ALGO_RGB16V, 2, 4, BLOCK_2x4 },
> +       { ALGO_RGB16H, 2, 4, BLOCK_2x4 },
> +       { ALGO_RGB16V, 2, 2, BLOCK_2x2 },
> +       { ALGO_RGB16H, 2, 2, BLOCK_2x2 },
> +
> +       { ALGO_NOP,     4, 4, BLOCK_4x4 },
> +       { ALGO_RGB24H, 4, 4, BLOCK_4x4 },
> +       { ALGO_NOP,     4, 2, BLOCK_4x2 },
> +       { ALGO_RGB24H, 4, 2, BLOCK_4x2 },
> +
> +       { ALGO_NOP,     2, 4, BLOCK_2x4 },
> +       { ALGO_RGB24H, 2, 4, BLOCK_2x4 },
> +       { ALGO_NOP,     2, 2, BLOCK_2x2 },
> +       { ALGO_RGB24H, 2, 2, BLOCK_2x2 }
> +};
> +
> +TrueMotion1Decoder::TrueMotion1Decoder(uint16 width, uint16 height) {
> +       _surface = new Graphics::Surface();
> +       _width = width;
> +       _height = height;
> +
> +       _surface->create(width, height, getPixelFormat());
> +
> +       // there is a vertical predictor for each pixel in a line; each
> vertical
> +       // predictor is 0 to start with
> +       _vertPred = new uint32[_width];
> +
> +       _buf = _mbChangeBits = _indexStream = 0;
> +       _lastDeltaset = _lastVectable = -1;
> +}
> +
> +TrueMotion1Decoder::~TrueMotion1Decoder() {
> +       _surface->free();
> +       delete _surface;
> +       delete[] _vertPred;
> +}
> +
> +void TrueMotion1Decoder::selectDeltaTables(int deltaTableIndex) {
> +       if (deltaTableIndex > 3)
> +               return;
> +
> +       for (byte i = 0; i < 8; i++) {
> +               _ydt[i] = ydts[deltaTableIndex][i];
> +               _cdt[i] = cdts[deltaTableIndex][i];
> +
> +               // Y skinny deltas need to be halved for some reason;
> maybe the
> +               // skinny Y deltas should be modified
> +               // Drop the lsb before dividing by 2-- net effect: round
> down
> +               // when dividing a negative number (e.g., -3/2 = -2, not
> -1)
> +               _ydt[i] &= 0xFFFE;
> +               _ydt[i] /= 2;
> +       }
> +}
> +
> +int TrueMotion1Decoder::makeYdt16Entry(int p1, int p2) {
> +#ifdef SCUMM_BIG_ENDIAN
> +       // Swap the values on BE systems. FFmpeg does this too.
> +       SWAP<int>(p1, p2);
> +#endif
> +
> +       int lo = _ydt[p1];
> +       lo += (lo << 6) + (lo << 11);
> +       int hi = _ydt[p2];
> +       hi += (hi << 6) + (hi << 11);
> +       return lo + (hi << 16);
> +}
> +
> +int TrueMotion1Decoder::makeCdt16Entry(int p1, int p2) {
> +       int b = _cdt[p2];
> +       int r = _cdt[p1] << 11;
> +       int lo = b + r;
> +       return lo + (lo << 16);
> +}
> +
> +void TrueMotion1Decoder::genVectorTable16(const byte *selVectorTable) {
> +       memset(&_yPredictorTable, 0, sizeof(PredictorTableEntry) * 1024);
> +       memset(&_cPredictorTable, 0, sizeof(PredictorTableEntry) * 1024);
> +
> +       for (int i = 0; i < 1024; i += 4) {
> +               int len = *selVectorTable++ / 2;
> +               for (int j = 0; j < len; j++) {
> +                       byte deltaPair = *selVectorTable++;
> +                       _yPredictorTable[i + j].color =
> makeYdt16Entry(deltaPair >> 4, deltaPair & 0xf);
> +                       _cPredictorTable[i + j].color =
> makeCdt16Entry(deltaPair >> 4, deltaPair & 0xf);
> +               }
> +
> +               _yPredictorTable[i + (len - 1)].getNextIndex = true;
> +               _cPredictorTable[i + (len - 1)].getNextIndex = true;
> +       }
> +}
> +
> +void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream *stream)
> {
> +       _buf = new byte[stream->size()];
> +       stream->read(_buf, stream->size());
> +
> +       byte headerBuffer[128];  // logical maximum size of the header
> +       const byte *selVectorTable;
> +
> +       // There is 1 change bit per 4 pixels, so each change byte
> represents
> +       // 32 pixels; divide width by 4 to obtain the number of change
> bits and
> +       // then round up to the nearest byte.
> +       _mbChangeBitsRowSize = ((_width >> 2) + 7) >> 3;
> +
> +       _header.headerSize = ((_buf[0] >> 5) | (_buf[0] << 3)) & 0x7f;
> +
> +       if (_buf[0] < 0x10)
> +               error("Invalid TrueMotion1 header size %d",
> _header.headerSize);
> +
> +       // unscramble the header bytes with a XOR operation
> +       memset(headerBuffer, 0, 128);
> +       for (int i = 1; i < _header.headerSize; i++)
> +               headerBuffer[i - 1] = _buf[i] ^ _buf[i + 1];
> +
> +       _header.compression = headerBuffer[0];
> +       _header.deltaset = headerBuffer[1];
> +       _header.vectable = headerBuffer[2];
> +       _header.ysize = READ_LE_UINT16(&headerBuffer[3]);
> +       _header.xsize = READ_LE_UINT16(&headerBuffer[5]);
> +       _header.checksum = READ_LE_UINT16(&headerBuffer[7]);
> +       _header.version = headerBuffer[9];
> +       _header.headerType = headerBuffer[10];
> +       _header.flags = headerBuffer[11];
> +       _header.control = headerBuffer[12];
> +
> +       // Version 2
> +       if (_header.version >= 2) {
> +               if (_header.headerType > 3) {
> +                       error("Invalid header type %d",
> _header.headerType);
> +               } else if (_header.headerType == 2 || _header.headerType
> == 3) {
> +                       _flags = _header.flags;
> +                       if (!(_flags & FLAG_INTERFRAME))
> +                               _flags |= FLAG_KEYFRAME;
> +               } else
> +                       _flags = FLAG_KEYFRAME;
> +       } else // Version 1
> +               _flags = FLAG_KEYFRAME;
> +
> +       if (_flags & FLAG_SPRITE) {
> +               error("SPRITE frame found, please report the sample to the
> developers");
> +       } else if (_header.headerType < 2 && _header.xsize < 213 &&
> _header.ysize >= 176) {
> +               _flags |= FLAG_INTERPOLATED;
> +               error("INTERPOLATION selected, please report the sample to
> the developers");
> +       }
> +
> +       if (_header.compression >= 17)
> +               error("Invalid TrueMotion1 compression type %d",
> _header.compression);
> +
> +       if (_header.deltaset != _lastDeltaset || _header.vectable !=
> _lastVectable)
> +               selectDeltaTables(_header.deltaset);
> +
> +       if ((_header.compression & 1) && _header.headerType)
> +               selVectorTable = pc_tbl2;
> +       else if (_header.vectable < 4)
> +               selVectorTable = tables[_header.vectable - 1];
> +       else
> +               error("Invalid vector table id %d", _header.vectable);
> +
> +       if (_header.deltaset != _lastDeltaset || _header.vectable !=
> _lastVectable)
> +               genVectorTable16(selVectorTable);
> +
> +       // set up pointers to the other key data chunks
> +       _mbChangeBits = _buf + _header.headerSize;
> +
> +       if (_flags & FLAG_KEYFRAME) {
> +               // no change bits specified for a keyframe; only index
> bytes
> +               _indexStream = _mbChangeBits;
> +       } else {
> +               // one change bit per 4x4 block
> +               _indexStream = _mbChangeBits + _mbChangeBitsRowSize *
> (_height >> 2);
> +       }
> +
> +       _indexStreamSize = stream->size() - (_indexStream - _buf);
> +
> +       _lastDeltaset = _header.deltaset;
> +       _lastVectable = _header.vectable;
> +       _blockWidth = compressionTypes[_header.compression].blockWidth;
> +       _blockHeight = compressionTypes[_header.compression].blockHeight;
> +       _blockType = compressionTypes[_header.compression].blockType;
> +}
> +
> +#define GET_NEXT_INDEX() \
> +do { \
> +       if (indexStreamIndex >= _indexStreamSize) \
> +               error("TrueMotion1 decoder went out of bounds"); \
> +       index = _indexStream[indexStreamIndex++] * 4; \
> +} while (0) \
> +
> +#define APPLY_C_PREDICTOR() \
> +       predictor_pair = _cPredictorTable[index].color; \
> +       horizPred += predictor_pair; \
> +       if (_cPredictorTable[index].getNextIndex) { \
> +               GET_NEXT_INDEX(); \
> +               if (!index) { \
> +                       GET_NEXT_INDEX(); \
> +                       predictor_pair = _cPredictorTable[index].color; \
> +                       horizPred += predictor_pair * 5; \
> +                       if (_cPredictorTable[index].getNextIndex) \
> +                               GET_NEXT_INDEX(); \
> +                       else \
> +                               index++; \
> +               } \
> +       } else \
> +               index++
> +
> +#define APPLY_Y_PREDICTOR() \
> +       predictor_pair = _yPredictorTable[index].color; \
> +       horizPred += predictor_pair; \
> +       if (_yPredictorTable[index].getNextIndex) { \
> +               GET_NEXT_INDEX(); \
> +               if (!index) { \
> +                       GET_NEXT_INDEX(); \
> +                       predictor_pair = _yPredictorTable[index].color; \
> +                       horizPred += predictor_pair * 5; \
> +                       if (_yPredictorTable[index].getNextIndex) \
> +                               GET_NEXT_INDEX(); \
> +                       else \
> +                               index++; \
> +               } \
> +       } else \
> +               index++
> +
> +#define OUTPUT_PIXEL_PAIR() \
> +       *currentPixelPair = *vertPred + horizPred; \
> +       *vertPred++ = *currentPixelPair++
> +
> +void TrueMotion1Decoder::decode16() {
> +       uint32 predictor_pair;
> +       bool keyframe = _flags & FLAG_KEYFRAME;
> +       int indexStreamIndex = 0;
> +
> +       // these variables are for managing the main index stream
> +       int index;
> +
> +       // clean out the line buffer
> +       memset(_vertPred, 0, _width * 4);
> +
> +       GET_NEXT_INDEX();
> +
> +       for (int y = 0; y < _height; y++) {
> +               // re-init variables for the next line iteration
> +               uint32 horizPred = 0;
> +               uint32 *currentPixelPair = (uint32
> *)_surface->getBasePtr(0, y);
> +               uint32 *vertPred = _vertPred;
> +               int mbChangeIndex = 0;
> +               byte mbChangeByte = _mbChangeBits[mbChangeIndex++];
> +               byte mbChangeByteMask = 1;
> +
> +               for (int pixelsLeft = _width; pixelsLeft > 0; pixelsLeft
> -= 4) {
> +                       if (keyframe || (mbChangeByte & mbChangeByteMask)
> == 0) {
> +                               switch (y & 3) {
> +                               case 0:
> +                                       // if macroblock width is 2, apply
> C-Y-C-Y; else
> +                                       // apply C-Y-Y
> +                                       if (_blockWidth == 2) {
> +                                               APPLY_C_PREDICTOR();
> +                                               APPLY_Y_PREDICTOR();
> +                                               OUTPUT_PIXEL_PAIR();
>
>
> Commit: c432b96cf667a1b7f1386cc4c97fcf5411690f7d
>
> https://github.com/scummvm/scummvm/commit/c432b96cf667a1b7f1386cc4c97fcf5411690f7d
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:27:36-08:00
>
> Commit Message:
> IMAGE: Merge the JPEG codec into the ImageDecoder
>
> Changed paths:
>   R image/codecs/jpeg.cpp
>   R image/codecs/jpeg.h
>     image/jpeg.cpp
>     image/jpeg.h
>     image/module.mk
>     video/qt_decoder.cpp
>
>
>
> diff --git a/image/codecs/jpeg.cpp b/image/codecs/jpeg.cpp
> deleted file mode 100644
> index 9e8ba5a..0000000
> --- a/image/codecs/jpeg.cpp
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -#include "common/system.h"
> -#include "common/textconsole.h"
> -#include "graphics/surface.h"
> -#include "image/jpeg.h"
> -
> -#include "image/codecs/jpeg.h"
> -
> -namespace Common {
> -class SeekableReadStream;
> -}
> -
> -namespace Image {
> -
> -JPEGCodec::JPEGCodec() : Codec() {
> -       _pixelFormat = g_system->getScreenFormat();
> -       _surface = NULL;
> -}
> -
> -JPEGCodec::~JPEGCodec() {
> -       if (_surface) {
> -               _surface->free();
> -               delete _surface;
> -       }
> -}
> -
> -const Graphics::Surface
> *JPEGCodec::decodeImage(Common::SeekableReadStream *stream) {
> -       JPEGDecoder jpeg;
> -
> -       if (!jpeg.loadStream(*stream)) {
> -               warning("Failed to decode JPEG frame");
> -               return 0;
> -       }
> -
> -       if (_surface) {
> -               _surface->free();
> -               delete _surface;
> -       }
> -
> -       _surface = jpeg.getSurface()->convertTo(_pixelFormat);
> -
> -       return _surface;
> -}
> -
> -} // End of namespace Image
> diff --git a/image/codecs/jpeg.h b/image/codecs/jpeg.h
> deleted file mode 100644
> index d48604b..0000000
> --- a/image/codecs/jpeg.h
> +++ /dev/null
> @@ -1,60 +0,0 @@
> -/* ScummVM - Graphic Adventure Engine
> - *
> - * ScummVM is the legal property of its developers, whose names
> - * are too numerous to list here. Please refer to the COPYRIGHT
> - * file distributed with this source distribution.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version 2
> - * of the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> - *
> - */
> -
> -#ifndef IMAGE_CODECS_JPEG_H
> -#define IMAGE_CODECS_JPEG_H
> -
> -#include "image/codecs/codec.h"
> -#include "graphics/pixelformat.h"
> -
> -namespace Common {
> -class SeekableReadStream;
> -}
> -
> -namespace Graphics {
> -struct Surface;
> -}
> -
> -namespace Image {
> -
> -/**
> - * JPEG decoder.
> - *
> - * Used in video:
> - *  - QuickTimeDecoder
> - */
> -class JPEGCodec : public Codec {
> -public:
> -       JPEGCodec();
> -       ~JPEGCodec();
> -
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> -       Graphics::PixelFormat getPixelFormat() const { return
> _pixelFormat; }
> -
> -private:
> -       Graphics::PixelFormat _pixelFormat;
> -       Graphics::Surface *_surface;
> -};
> -
> -} // End of namespace Image
> -
> -#endif
> diff --git a/image/jpeg.cpp b/image/jpeg.cpp
> index 9d4b0a7..3602d50 100644
> --- a/image/jpeg.cpp
> +++ b/image/jpeg.cpp
> @@ -44,7 +44,7 @@ extern "C" {
>
>  namespace Image {
>
> -JPEGDecoder::JPEGDecoder() : ImageDecoder(), _surface(),
> _colorSpace(kColorSpaceRGBA) {
> +JPEGDecoder::JPEGDecoder() : _surface(), _colorSpace(kColorSpaceRGBA) {
>  }
>
>  JPEGDecoder::~JPEGDecoder() {
> @@ -59,6 +59,17 @@ void JPEGDecoder::destroy() {
>         _surface.free();
>  }
>
> +const Graphics::Surface
> *JPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +       if (!loadStream(*stream))
> +               return 0;
> +
> +       return getSurface();
> +}
> +
> +Graphics::PixelFormat JPEGDecoder::getPixelFormat() const {
> +       return _surface.format;
> +}
> +
>  #ifdef USE_JPEG
>  namespace {
>
> diff --git a/image/jpeg.h b/image/jpeg.h
> index f578170..1bf76ec 100644
> --- a/image/jpeg.h
> +++ b/image/jpeg.h
> @@ -26,6 +26,12 @@
>   *  - groovie
>   *  - mohawk
>   *  - wintermute
> + *
> + * Used in image:
> + *  - PICTDecoder
> + *
> + * Used in video:
> + *  - QuickTimeDecoder
>   */
>
>  #ifndef IMAGE_JPEG_H
> @@ -33,6 +39,7 @@
>
>  #include "graphics/surface.h"
>  #include "image/image_decoder.h"
> +#include "image/codecs/codec.h"
>
>  namespace Common {
>  class SeekableReadStream;
> @@ -40,7 +47,7 @@ class SeekableReadStream;
>
>  namespace Image {
>
> -class JPEGDecoder : public ImageDecoder {
> +class JPEGDecoder : public ImageDecoder, public Codec {
>  public:
>         JPEGDecoder();
>         ~JPEGDecoder();
> @@ -50,6 +57,10 @@ public:
>         virtual bool loadStream(Common::SeekableReadStream &str);
>         virtual const Graphics::Surface *getSurface() const;
>
> +       // Codec API
> +       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       Graphics::PixelFormat getPixelFormat() const;
> +
>         // Special API for JPEG
>         enum ColorSpace {
>                 /**
> @@ -90,6 +101,6 @@ private:
>         ColorSpace _colorSpace;
>  };
>
> -} // End of Graphics namespace
> +} // End of namespace Image
>
> -#endif // GRAPHICS_JPEG_H
> +#endif
> diff --git a/image/module.mk b/image/module.mk
> index 28d7503..46129cb 100644
> --- a/image/module.mk
> +++ b/image/module.mk
> @@ -11,7 +11,6 @@ MODULE_OBJS := \
>         codecs/cdtoons.o \
>         codecs/cinepak.o \
>         codecs/indeo3.o \
> -       codecs/jpeg.o \
>         codecs/mjpeg.o \
>         codecs/msrle.o \
>         codecs/msvideo1.o \
> diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
> index 25ac05c..20c20d0 100644
> --- a/video/qt_decoder.cpp
> +++ b/video/qt_decoder.cpp
> @@ -40,7 +40,7 @@
>
>  // Video codecs
>  #include "image/codecs/cinepak.h"
> -#include "image/codecs/jpeg.h"
> +#include "image/jpeg.h"
>  #include "image/codecs/qtrle.h"
>  #include "image/codecs/rpza.h"
>  #include "image/codecs/smc.h"
> @@ -297,7 +297,7 @@ void QuickTimeDecoder::VideoSampleDesc::initCodec() {
>                 break;
>         case MKTAG('j','p','e','g'):
>                 // JPEG: Used by some Myst ME 10th Anniversary videos.
> -               _videoCodec = new Image::JPEGCodec();
> +               _videoCodec = new Image::JPEGDecoder();
>                 break;
>         case MKTAG('Q','k','B','k'):
>                 // CDToons: Used by most of the Broderbund games.
>
>
> Commit: e6717aaf43c7a25d426502a6d5d7028d50aab255
>
> https://github.com/scummvm/scummvm/commit/e6717aaf43c7a25d426502a6d5d7028d50aab255
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:27:37-08:00
>
> Commit Message:
> IMAGE: Clarify difference between ImageDecoder and Codec a bit
>
> Changed paths:
>     image/codecs/codec.h
>     image/image_decoder.h
>
>
>
> diff --git a/image/codecs/codec.h b/image/codecs/codec.h
> index c84f3e3..1b7a295 100644
> --- a/image/codecs/codec.h
> +++ b/image/codecs/codec.h
> @@ -33,8 +33,16 @@ class SeekableReadStream;
>  namespace Image {
>
>  /**
> - * An abstract representation of a video codec used for decoding
> - * video frames.
> + * An abstract representation of a image codec.
> + *
> + * Unlike ImageDecoder, the entire info for a frame may not be present
> + * within the stream. The codec may rely on the supporting container
> + * for parameters and can also rely on a previous (or future) frame.
> + * When decoding, the previous frame may not destroyed and could be
> + * maintained for use in the next one.
> + *
> + * An ImageDecoder can always be a Codec, but a Codec may not necessarily
> + * be able to be an ImageDecoder.
>   *
>   * Used in video:
>   *  - AVIDecoder
> diff --git a/image/image_decoder.h b/image/image_decoder.h
> index 08fa4d8..4d3512e 100644
> --- a/image/image_decoder.h
> +++ b/image/image_decoder.h
> @@ -39,6 +39,8 @@ namespace Image {
>  /**
>   * A representation of an image decoder that maintains ownership of the
> surface
>   * and palette it decodes to.
> + *
> + * This is designed for still frames only.
>   */
>  class ImageDecoder {
>  public:
>
>
> Commit: 08ea14a8d0e1a1478d1f486edeecea3e619e0cd0
>
> https://github.com/scummvm/scummvm/commit/08ea14a8d0e1a1478d1f486edeecea3e619e0cd0
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:27:37-08:00
>
> Commit Message:
> IMAGE: Make Codec take a stream reference; change function name to
> decodeFrame
>
> Changed paths:
>     image/codecs/cdtoons.cpp
>     image/codecs/cdtoons.h
>     image/codecs/cinepak.cpp
>     image/codecs/cinepak.h
>     image/codecs/codec.h
>     image/codecs/indeo3.cpp
>     image/codecs/indeo3.h
>     image/codecs/mjpeg.cpp
>     image/codecs/mjpeg.h
>     image/codecs/mpeg.cpp
>     image/codecs/mpeg.h
>     image/codecs/msrle.cpp
>     image/codecs/msrle.h
>     image/codecs/msvideo1.cpp
>     image/codecs/msvideo1.h
>     image/codecs/qtrle.cpp
>     image/codecs/qtrle.h
>     image/codecs/rpza.cpp
>     image/codecs/rpza.h
>     image/codecs/smc.cpp
>     image/codecs/smc.h
>     image/codecs/svq1.cpp
>     image/codecs/svq1.h
>     image/codecs/truemotion1.cpp
>     image/codecs/truemotion1.h
>     image/jpeg.cpp
>     image/jpeg.h
>     video/avi_decoder.cpp
>     video/coktel_decoder.cpp
>     video/qt_decoder.cpp
>
>
>
> diff --git a/image/codecs/cdtoons.cpp b/image/codecs/cdtoons.cpp
> index e1246a0..6a2dc51 100644
> --- a/image/codecs/cdtoons.cpp
> +++ b/image/codecs/cdtoons.cpp
> @@ -39,12 +39,12 @@ struct CDToonsDiff {
>         Common::Rect rect;
>  };
>
> -static Common::Rect readRect(Common::SeekableReadStream *stream) {
> +static Common::Rect readRect(Common::SeekableReadStream &stream) {
>         Common::Rect rect;
> -       rect.top = stream->readUint16BE();
> -       rect.left = stream->readUint16BE();
> -       rect.bottom = stream->readUint16BE();
> -       rect.right = stream->readUint16BE();
> +       rect.top = stream.readUint16BE();
> +       rect.left = stream.readUint16BE();
> +       rect.bottom = stream.readUint16BE();
> +       rect.right = stream.readUint16BE();
>         return rect;
>  }
>
> @@ -67,14 +67,14 @@ CDToonsDecoder::~CDToonsDecoder() {
>                 delete[] i->_value.data;
>  }
>
> -Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream
> *stream) {
> -       uint16 u0 = stream->readUint16BE(); // always 9?
> -       uint16 frameId = stream->readUint16BE();
> -       uint16 blocksValidUntil = stream->readUint16BE();
> -       byte u6 = stream->readByte();
> -       byte backgroundColor = stream->readByte();
> +Graphics::Surface *CDToonsDecoder::decodeFrame(Common::SeekableReadStream
> &stream) {
> +       uint16 u0 = stream.readUint16BE(); // always 9?
> +       uint16 frameId = stream.readUint16BE();
> +       uint16 blocksValidUntil = stream.readUint16BE();
> +       byte u6 = stream.readByte();
> +       byte backgroundColor = stream.readByte();
>         debugN(5, "CDToons frame %d, size %d, unknown %04x (at 0), blocks
> valid until %d, unknown 6 is %02x, bkg color is %02x\n",
> -               frameId, stream->size(), u0, blocksValidUntil, u6,
> backgroundColor);
> +               frameId, stream.size(), u0, blocksValidUntil, u6,
> backgroundColor);
>
>         Common::Rect clipRect = readRect(stream);
>         debugN(9, "CDToons clipRect: (%d, %d) to (%d, %d)\n",
> @@ -84,31 +84,31 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>         debugN(9, "CDToons dirtyRect: (%d, %d) to (%d, %d)\n",
>                 dirtyRect.left, dirtyRect.top, dirtyRect.right,
> dirtyRect.bottom);
>
> -       uint32 flags = stream->readUint32BE();
> +       uint32 flags = stream.readUint32BE();
>         if (flags & 0x80)
>                 error("CDToons: frame already processed?");
>         debugN(5, "CDToons flags: %08x\n", flags);
>
> -       uint16 blockCount = stream->readUint16BE();
> -       uint16 blockOffset = stream->readUint16BE();
> +       uint16 blockCount = stream.readUint16BE();
> +       uint16 blockOffset = stream.readUint16BE();
>         debugN(9, "CDToons: %d blocks at 0x%04x\n",
>                 blockCount, blockOffset);
>
>         // max block id?
> -       uint16 u32 = stream->readUint16BE();
> +       uint16 u32 = stream.readUint16BE();
>         debugN(5, "CDToons unknown at 32: %04x\n", u32);
>
> -       byte actionCount = stream->readByte();
> -       byte u35 = stream->readByte();
> +       byte actionCount = stream.readByte();
> +       byte u35 = stream.readByte();
>
> -       uint16 paletteId = stream->readUint16BE();
> -       byte paletteSet = stream->readByte();
> +       uint16 paletteId = stream.readUint16BE();
> +       byte paletteSet = stream.readByte();
>         debugN(9, "CDToons palette id %04x, palette byte %02x\n",
>                 paletteId, paletteSet);
>
> -       byte u39 = stream->readByte();
> -       uint16 u40 = stream->readUint16BE();
> -       uint16 u42 = stream->readUint16BE();
> +       byte u39 = stream.readByte();
> +       uint16 u40 = stream.readUint16BE();
> +       uint16 u42 = stream.readUint16BE();
>         debugN(5, "CDToons: unknown at 35 is %02x, unknowns at 39: %02x,
> %04x, %04x\n",
>                 u35, u39, u40, u42);
>
> @@ -116,41 +116,41 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>
>         for (uint i = 0; i < actionCount; i++) {
>                 CDToonsAction action;
> -               action.blockId = stream->readUint16BE();
> +               action.blockId = stream.readUint16BE();
>                 action.rect = readRect(stream);
>                 debugN(9, "CDToons action: render block %d at (%d, %d) to
> (%d, %d)\n",
>                         action.blockId, action.rect.left, action.rect.top,
> action.rect.right, action.rect.bottom);
>                 actions.push_back(action);
>         }
>
> -       if (stream->pos() > blockOffset)
> +       if (stream.pos() > blockOffset)
>                 error("CDToons header ended at 0x%08x, but blocks should
> have started at 0x%08x",
> -                       stream->pos(), blockOffset);
> +                       stream.pos(), blockOffset);
>
> -       if (stream->pos() != blockOffset)
> -               error("CDToons had %d unknown bytes after header",
> blockOffset - stream->pos());
> +       if (stream.pos() != blockOffset)
> +               error("CDToons had %d unknown bytes after header",
> blockOffset - stream.pos());
>
>         for (uint i = 0; i < blockCount; i++) {
> -               uint16 blockId = stream->readUint16BE();
> +               uint16 blockId = stream.readUint16BE();
>                 if (blockId >= 1200)
>                         error("CDToons: block id %d was too high",
> blockId);
>                 if (_blocks.contains(blockId))
>                         error("CDToons: new block %d was already seen",
> blockId);
>
>                 CDToonsBlock block;
> -               block.flags = stream->readUint16BE();
> +               block.flags = stream.readUint16BE();
>                 // flag 1 = palette, flag 2 = data?
>                 if (block.flags & 0x8000)
>                         error("CDToons: block already processed?");
> -               block.size = stream->readUint32BE();
> +               block.size = stream.readUint32BE();
>                 if (block.size < 14)
>                         error("CDToons: block size was %d, too small",
> block.size);
>                 block.size -= 14;
> -               block.startFrame = stream->readUint16BE();
> -               block.endFrame = stream->readUint16BE();
> -               block.unknown12 = stream->readUint16BE();
> +               block.startFrame = stream.readUint16BE();
> +               block.endFrame = stream.readUint16BE();
> +               block.unknown12 = stream.readUint16BE();
>                 block.data = new byte[block.size];
> -               stream->read(block.data, block.size);
> +               stream.read(block.data, block.size);
>
>                 debugN(9, "CDToons block id 0x%04x of size 0x%08x, flags
> %04x, from frame %d to %d, unknown at 12 is %04x\n",
>                         blockId, block.size, block.flags,
> block.startFrame, block.endFrame, block.unknown12);
> @@ -162,16 +162,16 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>         Common::Array<CDToonsDiff> diffs;
>
>         while (true) {
> -               int32 nextPos = stream->pos();
> -               uint32 tag = stream->readUint32BE();
> -               uint32 size = stream->readUint32BE();
> +               int32 nextPos = stream.pos();
> +               uint32 tag = stream.readUint32BE();
> +               uint32 size = stream.readUint32BE();
>                 nextPos += size;
>
>                 switch (tag) {
>                 case MKTAG('D','i','f','f'):
>                         {
>                         debugN(5, "CDToons: Diff\n");
> -                       uint16 count = stream->readUint16BE();
> +                       uint16 count = stream.readUint16BE();
>
>                         Common::Rect diffClipRect = readRect(stream);
>                         debugN(9, "CDToons diffClipRect: (%d, %d) to (%d,
> %d)\n",
> @@ -182,14 +182,14 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>                                 CDToonsDiff diff;
>
>                                 diff.rect = readRect(stream);
> -                               diff.size = stream->readUint32BE();
> +                               diff.size = stream.readUint32BE();
>                                 if (diff.size < 20)
>                                         error("CDToons: Diff block size
> was %d, too small", diff.size);
>
> -                               uint16 diffWidth = stream->readUint16BE();
> -                               uint16 diffHeight = stream->readUint16BE();
> -                               uint16 unknown16 = stream->readUint16BE();
> -                               uint16 unknown18 = stream->readUint16BE();
> +                               uint16 diffWidth = stream.readUint16BE();
> +                               uint16 diffHeight = stream.readUint16BE();
> +                               uint16 unknown16 = stream.readUint16BE();
> +                               uint16 unknown18 = stream.readUint16BE();
>                                 diff.size -= 8;
>
>                                 if (diffWidth != diff.rect.width() ||
> diffHeight != diff.rect.height())
> @@ -199,7 +199,7 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>                                         unknown16, unknown18);
>
>                                 diff.data = new byte[diff.size];
> -                               stream->read(diff.data, diff.size);
> +                               stream.read(diff.data, diff.size);
>                                 diffs.push_back(diff);
>                         }
>                         }
> @@ -212,8 +212,8 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>
>                         if (xFrmBegin)
>                                 error("CDToons: duplicate XFrm");
> -                       xFrmBegin = stream->readByte();
> -                       xFrmCount = stream->readByte();
> +                       xFrmBegin = stream.readByte();
> +                       xFrmCount = stream.readByte();
>                         debugN(9, "CDToons XFrm: run %d actions from
> %d\n", xFrmCount, xFrmBegin - 1);
>
>                         // TODO: don't ignore (if xFrmCount is non-zero)
> @@ -248,7 +248,7 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>                         if (!(flags & 0x40))
>                                 error("CDToons: useless FrtR?");
>
> -                       uint16 count = stream->readUint16BE();
> +                       uint16 count = stream.readUint16BE();
>                         debugN(9, "CDToons FrtR: %d dirty rectangles\n",
> count);
>                         for (uint i = 0; i < count; i++) {
>                                 Common::Rect dirtyRectFrtR =
> readRect(stream);
> @@ -263,7 +263,7 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>                         if (!(flags & 0x20))
>                                 error("CDToons: useless BckR?");
>
> -                       uint16 count = stream->readUint16BE();
> +                       uint16 count = stream.readUint16BE();
>                         debugN(9, "CDToons BckR: %d subentries\n", count);
>                         for (uint i = 0; i < count; i++) {
>                                 Common::Rect dirtyRectBckR =
> readRect(stream);
> @@ -276,15 +276,15 @@ Graphics::Surface
> *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea
>                         warning("Unknown CDToons tag '%s'", tag2str(tag));
>                 }
>
> -               if (stream->pos() > nextPos)
> +               if (stream.pos() > nextPos)
>                         error("CDToons ran off the end of a block while
> reading it (at %d, next block at %d)",
> -                               stream->pos(), nextPos);
> -               if (stream->pos() != nextPos) {
> -                       warning("CDToons had %d unknown bytes after
> block", nextPos - stream->pos());
> -                       stream->seek(nextPos);
> +                               stream.pos(), nextPos);
> +               if (stream.pos() != nextPos) {
> +                       warning("CDToons had %d unknown bytes after
> block", nextPos - stream.pos());
> +                       stream.seek(nextPos);
>                 }
>
> -               if (stream->pos() == stream->size())
> +               if (stream.pos() == stream.size())
>                         break;
>         }
>
> diff --git a/image/codecs/cdtoons.h b/image/codecs/cdtoons.h
> index ac569b5..a75ce55 100644
> --- a/image/codecs/cdtoons.h
> +++ b/image/codecs/cdtoons.h
> @@ -49,7 +49,7 @@ public:
>         CDToonsDecoder(uint16 width, uint16 height);
>         ~CDToonsDecoder();
>
> -       Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
> +       Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat::createFormatCLUT8(); }
>         bool containsPalette() const { return true; }
>         const byte *getPalette() { _dirtyPalette = false; return _palette;
> }
> diff --git a/image/codecs/cinepak.cpp b/image/codecs/cinepak.cpp
> index 6af7ab0..8d5dbce 100644
> --- a/image/codecs/cinepak.cpp
> +++ b/image/codecs/cinepak.cpp
> @@ -83,13 +83,13 @@ CinepakDecoder::~CinepakDecoder() {
>         delete[] _clipTableBuf;
>  }
>
> -const Graphics::Surface
> *CinepakDecoder::decodeImage(Common::SeekableReadStream *stream) {
> -       _curFrame.flags = stream->readByte();
> -       _curFrame.length = (stream->readByte() << 16);
> -       _curFrame.length |= stream->readUint16BE();
> -       _curFrame.width = stream->readUint16BE();
> -       _curFrame.height = stream->readUint16BE();
> -       _curFrame.stripCount = stream->readUint16BE();
> +const Graphics::Surface
> *CinepakDecoder::decodeFrame(Common::SeekableReadStream &stream) {
> +       _curFrame.flags = stream.readByte();
> +       _curFrame.length = (stream.readByte() << 16);
> +       _curFrame.length |= stream.readUint16BE();
> +       _curFrame.width = stream.readUint16BE();
> +       _curFrame.height = stream.readUint16BE();
> +       _curFrame.stripCount = stream.readUint16BE();
>
>         if (_curFrame.strips == NULL)
>                 _curFrame.strips = new CinepakStrip[_curFrame.stripCount];
> @@ -98,11 +98,11 @@ const Graphics::Surface
> *CinepakDecoder::decodeImage(Common::SeekableReadStream
>
>         // Borrowed from FFMPEG. This should cut out the extra data
> Cinepak for Sega has (which is useless).
>         // The theory behind this is that this is here to confuse standard
> Cinepak decoders. But, we won't let that happen! ;)
> -       if (_curFrame.length != (uint32)stream->size()) {
> -               if (stream->readUint16BE() == 0xFE00)
> -                       stream->readUint32BE();
> -               else if ((stream->size() % _curFrame.length) == 0)
> -                       stream->seek(-2, SEEK_CUR);
> +       if (_curFrame.length != (uint32)stream.size()) {
> +               if (stream.readUint16BE() == 0xFE00)
> +                       stream.readUint32BE();
> +               else if ((stream.size() % _curFrame.length) == 0)
> +                       stream.seek(-2, SEEK_CUR);
>         }
>
>         if (!_curFrame.surface) {
> @@ -121,29 +121,29 @@ const Graphics::Surface
> *CinepakDecoder::decodeImage(Common::SeekableReadStream
>                         }
>                 }
>
> -               _curFrame.strips[i].id = stream->readUint16BE();
> -               _curFrame.strips[i].length = stream->readUint16BE() - 12;
> // Subtract the 12 byte header
> -               _curFrame.strips[i].rect.top = _y; stream->readUint16BE();
> // Ignore, substitute with our own.
> -               _curFrame.strips[i].rect.left = 0; stream->readUint16BE();
> // Ignore, substitute with our own
> -               _curFrame.strips[i].rect.bottom = _y +
> stream->readUint16BE();
> -               _curFrame.strips[i].rect.right = _curFrame.width;
> stream->readUint16BE(); // Ignore, substitute with our own
> +               _curFrame.strips[i].id = stream.readUint16BE();
> +               _curFrame.strips[i].length = stream.readUint16BE() - 12;
> // Subtract the 12 byte header
> +               _curFrame.strips[i].rect.top = _y; stream.readUint16BE();
> // Ignore, substitute with our own.
> +               _curFrame.strips[i].rect.left = 0; stream.readUint16BE();
> // Ignore, substitute with our own
> +               _curFrame.strips[i].rect.bottom = _y +
> stream.readUint16BE();
> +               _curFrame.strips[i].rect.right = _curFrame.width;
> stream.readUint16BE(); // Ignore, substitute with our own
>
>                 // Sanity check. Because Cinepak is based on 4x4 blocks,
> the width and height of each strip needs to be divisible by 4.
>                 assert(!(_curFrame.strips[i].rect.width() % 4) &&
> !(_curFrame.strips[i].rect.height() % 4));
>
> -               uint32 pos = stream->pos();
> +               uint32 pos = stream.pos();
>
> -               while ((uint32)stream->pos() < (pos +
> _curFrame.strips[i].length) && !stream->eos()) {
> -                       byte chunkID = stream->readByte();
> +               while ((uint32)stream.pos() < (pos +
> _curFrame.strips[i].length) && !stream.eos()) {
> +                       byte chunkID = stream.readByte();
>
> -                       if (stream->eos())
> +                       if (stream.eos())
>                                 break;
>
>                         // Chunk Size is 24-bit, ignore the first 4 bytes
> -                       uint32 chunkSize = stream->readByte() << 16;
> -                       chunkSize += stream->readUint16BE() - 4;
> +                       uint32 chunkSize = stream.readByte() << 16;
> +                       chunkSize += stream.readUint16BE() - 4;
>
> -                       int32 startPos = stream->pos();
> +                       int32 startPos = stream.pos();
>
>                         switch (chunkID) {
>                         case 0x20:
> @@ -168,8 +168,8 @@ const Graphics::Surface
> *CinepakDecoder::decodeImage(Common::SeekableReadStream
>                                 return _curFrame.surface;
>                         }
>
> -                       if (stream->pos() != startPos + (int32)chunkSize)
> -                               stream->seek(startPos + chunkSize);
> +                       if (stream.pos() != startPos + (int32)chunkSize)
> +                               stream.seek(startPos + chunkSize);
>                 }
>
>                 _y = _curFrame.strips[i].rect.bottom;
> @@ -178,32 +178,32 @@ const Graphics::Surface
> *CinepakDecoder::decodeImage(Common::SeekableReadStream
>         return _curFrame.surface;
>  }
>
> -void CinepakDecoder::loadCodebook(Common::SeekableReadStream *stream,
> uint16 strip, byte codebookType, byte chunkID, uint32 chunkSize) {
> +void CinepakDecoder::loadCodebook(Common::SeekableReadStream &stream,
> uint16 strip, byte codebookType, byte chunkID, uint32 chunkSize) {
>         CinepakCodebook *codebook = (codebookType == 1) ?
> _curFrame.strips[strip].v1_codebook : _curFrame.strips[strip].v4_codebook;
>
> -       int32 startPos = stream->pos();
> +       int32 startPos = stream.pos();
>         uint32 flag = 0, mask = 0;
>
>         for (uint16 i = 0; i < 256; i++) {
>                 if ((chunkID & 0x01) && !(mask >>= 1)) {
> -                       if ((stream->pos() - startPos + 4) >
> (int32)chunkSize)
> +                       if ((stream.pos() - startPos + 4) >
> (int32)chunkSize)
>                                 break;
>
> -                       flag  = stream->readUint32BE();
> +                       flag  = stream.readUint32BE();
>                         mask  = 0x80000000;
>                 }
>
>                 if (!(chunkID & 0x01) || (flag & mask)) {
>                         byte n = (chunkID & 0x04) ? 4 : 6;
> -                       if ((stream->pos() - startPos + n) >
> (int32)chunkSize)
> +                       if ((stream.pos() - startPos + n) >
> (int32)chunkSize)
>                                 break;
>
>                         for (byte j = 0; j < 4; j++)
> -                               codebook[i].y[j] = stream->readByte();
> +                               codebook[i].y[j] = stream.readByte();
>
>                         if (n == 6) {
> -                               codebook[i].u = stream->readSByte();
> -                               codebook[i].v = stream->readSByte();
> +                               codebook[i].u = stream.readSByte();
> +                               codebook[i].v = stream.readSByte();
>                         } else {
>                                 // This codebook type indicates either
> greyscale or
>                                 // palettized video. For greyscale,
> default us to
> @@ -215,10 +215,10 @@ void
> CinepakDecoder::loadCodebook(Common::SeekableReadStream *stream, uint16 str
>         }
>  }
>
> -void CinepakDecoder::decodeVectors(Common::SeekableReadStream *stream,
> uint16 strip, byte chunkID, uint32 chunkSize) {
> +void CinepakDecoder::decodeVectors(Common::SeekableReadStream &stream,
> uint16 strip, byte chunkID, uint32 chunkSize) {
>         uint32 flag = 0, mask = 0;
>         uint32 iy[4];
> -       int32 startPos = stream->pos();
> +       int32 startPos = stream.pos();
>
>         for (uint16 y = _curFrame.strips[strip].rect.top; y <
> _curFrame.strips[strip].rect.bottom; y += 4) {
>                 iy[0] = _curFrame.strips[strip].rect.left + y *
> _curFrame.width;
> @@ -228,28 +228,28 @@ void
> CinepakDecoder::decodeVectors(Common::SeekableReadStream *stream, uint16 st
>
>                 for (uint16 x = _curFrame.strips[strip].rect.left; x <
> _curFrame.strips[strip].rect.right; x += 4) {
>                         if ((chunkID & 0x01) && !(mask >>= 1)) {
> -                               if ((stream->pos() - startPos + 4) >
> (int32)chunkSize)
> +                               if ((stream.pos() - startPos + 4) >
> (int32)chunkSize)
>                                         return;
>
> -                               flag  = stream->readUint32BE();
> +                               flag  = stream.readUint32BE();
>                                 mask  = 0x80000000;
>                         }
>
>                         if (!(chunkID & 0x01) || (flag & mask)) {
>                                 if (!(chunkID & 0x02) && !(mask >>= 1)) {
> -                                       if ((stream->pos() - startPos + 4)
> > (int32)chunkSize)
> +                                       if ((stream.pos() - startPos + 4)
> > (int32)chunkSize)
>                                                 return;
>
> -                                       flag  = stream->readUint32BE();
> +                                       flag  = stream.readUint32BE();
>                                         mask  = 0x80000000;
>                                 }
>
>                                 if ((chunkID & 0x02) || (~flag & mask)) {
> -                                       if ((stream->pos() - startPos + 1)
> > (int32)chunkSize)
> +                                       if ((stream.pos() - startPos + 1)
> > (int32)chunkSize)
>                                                 return;
>
>                                         // Get the codebook
> -                                       CinepakCodebook codebook =
> _curFrame.strips[strip].v1_codebook[stream->readByte()];
> +                                       CinepakCodebook codebook =
> _curFrame.strips[strip].v1_codebook[stream.readByte()];
>
>                                         PUT_PIXEL(iy[0] + 0,
> codebook.y[0], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[0] + 1,
> codebook.y[0], codebook.u, codebook.v);
> @@ -271,28 +271,28 @@ void
> CinepakDecoder::decodeVectors(Common::SeekableReadStream *stream, uint16 st
>                                         PUT_PIXEL(iy[3] + 2,
> codebook.y[3], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[3] + 3,
> codebook.y[3], codebook.u, codebook.v);
>                                 } else if (flag & mask) {
> -                                       if ((stream->pos() - startPos + 4)
> > (int32)chunkSize)
> +                                       if ((stream.pos() - startPos + 4)
> > (int32)chunkSize)
>                                                 return;
>
> -                                       CinepakCodebook codebook =
> _curFrame.strips[strip].v4_codebook[stream->readByte()];
> +                                       CinepakCodebook codebook =
> _curFrame.strips[strip].v4_codebook[stream.readByte()];
>                                         PUT_PIXEL(iy[0] + 0,
> codebook.y[0], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[0] + 1,
> codebook.y[1], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[1] + 0,
> codebook.y[2], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[1] + 1,
> codebook.y[3], codebook.u, codebook.v);
>
> -                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream->readByte()];
> +                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream.readByte()];
>                                         PUT_PIXEL(iy[0] + 2,
> codebook.y[0], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[0] + 3,
> codebook.y[1], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[1] + 2,
> codebook.y[2], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[1] + 3,
> codebook.y[3], codebook.u, codebook.v);
>
> -                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream->readByte()];
> +                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream.readByte()];
>                                         PUT_PIXEL(iy[2] + 0,
> codebook.y[0], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[2] + 1,
> codebook.y[1], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[3] + 0,
> codebook.y[2], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[3] + 1,
> codebook.y[3], codebook.u, codebook.v);
>
> -                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream->readByte()];
> +                                       codebook =
> _curFrame.strips[strip].v4_codebook[stream.readByte()];
>                                         PUT_PIXEL(iy[2] + 2,
> codebook.y[0], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[2] + 3,
> codebook.y[1], codebook.u, codebook.v);
>                                         PUT_PIXEL(iy[3] + 2,
> codebook.y[2], codebook.u, codebook.v);
> diff --git a/image/codecs/cinepak.h b/image/codecs/cinepak.h
> index 99a316e..985fc91 100644
> --- a/image/codecs/cinepak.h
> +++ b/image/codecs/cinepak.h
> @@ -71,7 +71,7 @@ public:
>         CinepakDecoder(int bitsPerPixel = 24);
>         ~CinepakDecoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> _pixelFormat; }
>
>  private:
> @@ -80,8 +80,8 @@ private:
>         Graphics::PixelFormat _pixelFormat;
>         byte *_clipTable, *_clipTableBuf;
>
> -       void loadCodebook(Common::SeekableReadStream *stream, uint16
> strip, byte codebookType, byte chunkID, uint32 chunkSize);
> -       void decodeVectors(Common::SeekableReadStream *stream, uint16
> strip, byte chunkID, uint32 chunkSize);
> +       void loadCodebook(Common::SeekableReadStream &stream, uint16
> strip, byte codebookType, byte chunkID, uint32 chunkSize);
> +       void decodeVectors(Common::SeekableReadStream &stream, uint16
> strip, byte chunkID, uint32 chunkSize);
>  };
>
>  } // End of namespace Image
> diff --git a/image/codecs/codec.h b/image/codecs/codec.h
> index 1b7a295..092f975 100644
> --- a/image/codecs/codec.h
> +++ b/image/codecs/codec.h
> @@ -59,9 +59,8 @@ public:
>          * containing the decoded frame.
>          *
>          * @return a pointer to the decoded frame
> -        * @note stream is not deleted
>          */
> -       virtual const Graphics::Surface
> *decodeImage(Common::SeekableReadStream *stream) = 0;
> +       virtual const Graphics::Surface
> *decodeFrame(Common::SeekableReadStream &stream) = 0;
>
>         /**
>          * Get the format that the surface returned from decodeImage() will
> diff --git a/image/codecs/indeo3.cpp b/image/codecs/indeo3.cpp
> index 77bcec0..af9120c 100644
> --- a/image/codecs/indeo3.cpp
> +++ b/image/codecs/indeo3.cpp
> @@ -165,24 +165,24 @@ void Indeo3Decoder::allocFrames() {
>         }
>  }
>
> -const Graphics::Surface
> *Indeo3Decoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *Indeo3Decoder::decodeFrame(Common::SeekableReadStream &stream) {
>         // Not Indeo 3? Fail
> -       if (!isIndeo3(*stream))
> +       if (!isIndeo3(stream))
>                 return 0;
>
> -       stream->seek(12);
> -       uint32 frameDataLen = stream->readUint32LE();
> +       stream.seek(12);
> +       uint32 frameDataLen = stream.readUint32LE();
>
>         // Less data than the frame should have? Fail
> -       if (stream->size() < (int)(frameDataLen - 16))
> +       if (stream.size() < (int)(frameDataLen - 16))
>                 return 0;
>
> -       stream->seek(16); // Behind header
> -       stream->skip(2);  // Unknown
> +       stream.seek(16); // Behind header
> +       stream.skip(2);  // Unknown
>
> -       uint16 flags1 = stream->readUint16LE();
> -       uint32 flags3 = stream->readUint32LE();
> -       uint8  flags2 = stream->readByte();
> +       uint16 flags1 = stream.readUint16LE();
> +       uint32 flags3 = stream.readUint32LE();
> +       uint8  flags2 = stream.readByte();
>
>         // Finding the reference frame
>         if (flags1 & 0x200) {
> @@ -196,22 +196,22 @@ const Graphics::Surface
> *Indeo3Decoder::decodeImage(Common::SeekableReadStream *
>         if (flags3 == 0x80)
>                 return _surface;
>
> -       stream->skip(3);
> +       stream.skip(3);
>
> -       uint16 fHeight = stream->readUint16LE();
> -       uint16 fWidth  = stream->readUint16LE();
> +       uint16 fHeight = stream.readUint16LE();
> +       uint16 fWidth  = stream.readUint16LE();
>
>         uint32 chromaHeight = ((fHeight >> 2) + 3) & 0x7FFC;
>         uint32 chromaWidth  = ((fWidth  >> 2) + 3) & 0x7FFC;
>
>         uint32 offs;
> -       uint32 offsY = stream->readUint32LE() + 16;
> -       uint32 offsU = stream->readUint32LE() + 16;
> -       uint32 offsV = stream->readUint32LE() + 16;
> +       uint32 offsY = stream.readUint32LE() + 16;
> +       uint32 offsU = stream.readUint32LE() + 16;
> +       uint32 offsV = stream.readUint32LE() + 16;
>
> -       stream->skip(4);
> +       stream.skip(4);
>
> -       uint32 hPos = stream->pos();
> +       uint32 hPos = stream.pos();
>
>         if (offsY < hPos) {
>                 warning("Indeo3Decoder::decodeImage: offsY < hPos");
> @@ -226,11 +226,11 @@ const Graphics::Surface
> *Indeo3Decoder::decodeImage(Common::SeekableReadStream *
>                 return 0;
>         }
>
> -       uint32 dataSize = stream->size() - hPos;
> +       uint32 dataSize = stream.size() - hPos;
>
>         byte *inData = new byte[dataSize];
>
> -       if (stream->read(inData, dataSize) != dataSize) {
> +       if (stream.read(inData, dataSize) != dataSize) {
>                 delete[] inData;
>                 return 0;
>         }
> @@ -239,23 +239,23 @@ const Graphics::Surface
> *Indeo3Decoder::decodeImage(Common::SeekableReadStream *
>         byte *buf_pos;
>
>         // Luminance Y
> -       stream->seek(offsY);
> +       stream.seek(offsY);
>         buf_pos = inData + offsY + 4 - hPos;
> -       offs = stream->readUint32LE();
> +       offs = stream.readUint32LE();
>         decodeChunk(_cur_frame->Ybuf, _ref_frame->Ybuf, fWidth, fHeight,
>                         buf_pos + offs * 2, flags2, hdr_pos, buf_pos,
> MIN<int>(fWidth, 160));
>
>         // Chrominance U
> -       stream->seek(offsU);
> +       stream.seek(offsU);
>         buf_pos = inData + offsU + 4 - hPos;
> -       offs = stream->readUint32LE();
> +       offs = stream.readUint32LE();
>         decodeChunk(_cur_frame->Vbuf, _ref_frame->Vbuf, chromaWidth,
> chromaHeight,
>                         buf_pos + offs * 2, flags2, hdr_pos, buf_pos,
> MIN<int>(chromaWidth, 40));
>
>         // Chrominance V
> -       stream->seek(offsV);
> +       stream.seek(offsV);
>         buf_pos = inData + offsV + 4 - hPos;
> -       offs = stream->readUint32LE();
> +       offs = stream.readUint32LE();
>         decodeChunk(_cur_frame->Ubuf, _ref_frame->Ubuf, chromaWidth,
> chromaHeight,
>                         buf_pos + offs * 2, flags2, hdr_pos, buf_pos,
> MIN<int>(chromaWidth, 40));
>
> diff --git a/image/codecs/indeo3.h b/image/codecs/indeo3.h
> index 275cbc1..f1b406d 100644
> --- a/image/codecs/indeo3.h
> +++ b/image/codecs/indeo3.h
> @@ -48,7 +48,7 @@ public:
>         Indeo3Decoder(uint16 width, uint16 height);
>         ~Indeo3Decoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const;
>
>         static bool isIndeo3(Common::SeekableReadStream &stream);
> diff --git a/image/codecs/mjpeg.cpp b/image/codecs/mjpeg.cpp
> index aa7e1d0..4ad72f2 100644
> --- a/image/codecs/mjpeg.cpp
> +++ b/image/codecs/mjpeg.cpp
> @@ -147,20 +147,20 @@ static const byte s_mjpegValACChrominance[] = {
>         0xf9, 0xfa
>  };
>
> -const Graphics::Surface
> *MJPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *MJPEGDecoder::decodeFrame(Common::SeekableReadStream &stream) {
>         // We need to reconstruct an actual JPEG stream here, then feed it
> to the JPEG decoder
>         // Yes, this is a pain.
>
> -       stream->readUint32BE(); // Skip nonsense JPEG header
> -       uint16 inputSkip = stream->readUint16BE() + 4;
> -       uint32 tag = stream->readUint32BE();
> +       stream.readUint32BE(); // Skip nonsense JPEG header
> +       uint16 inputSkip = stream.readUint16BE() + 4;
> +       uint32 tag = stream.readUint32BE();
>
>         if (tag != MKTAG('A', 'V', 'I', '1')) {
>                 warning("Invalid MJPEG tag found");
>                 return 0;
>         }
>
> -       uint32 outputSize = stream->size() - inputSkip +
> sizeof(s_jpegHeader) + DHT_SEGMENT_SIZE;
> +       uint32 outputSize = stream.size() - inputSkip +
> sizeof(s_jpegHeader) + DHT_SEGMENT_SIZE;
>         byte *data = (byte *)malloc(outputSize);
>
>         if (!data) {
> @@ -193,8 +193,8 @@ const Graphics::Surface
> *MJPEGDecoder::decodeImage(Common::SeekableReadStream *s
>         dataOffset += 162;
>
>         // Write the actual data
> -       stream->seek(inputSkip);
> -       stream->read(data + dataOffset, stream->size() - inputSkip);
> +       stream.seek(inputSkip);
> +       stream.read(data + dataOffset, stream.size() - inputSkip);
>
>         Common::MemoryReadStream convertedStream(data, outputSize,
> DisposeAfterUse::YES);
>         JPEGDecoder jpeg;
> diff --git a/image/codecs/mjpeg.h b/image/codecs/mjpeg.h
> index b34b84b..904b89d 100644
> --- a/image/codecs/mjpeg.h
> +++ b/image/codecs/mjpeg.h
> @@ -47,7 +47,7 @@ public:
>         MJPEGDecoder();
>         ~MJPEGDecoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> _pixelFormat; }
>
>  private:
> diff --git a/image/codecs/mpeg.cpp b/image/codecs/mpeg.cpp
> index d81123f..beb042d 100644
> --- a/image/codecs/mpeg.cpp
> +++ b/image/codecs/mpeg.cpp
> @@ -52,13 +52,13 @@ MPEGDecoder::~MPEGDecoder() {
>         }
>  }
>
> -const Graphics::Surface
> *MPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *MPEGDecoder::decodeFrame(Common::SeekableReadStream &stream) {
>         uint32 framePeriod;
>         decodePacket(stream, framePeriod);
>         return _surface;
>  }
>
> -bool MPEGDecoder::decodePacket(Common::SeekableReadStream *packet, uint32
> &framePeriod, Graphics::Surface *dst) {
> +bool MPEGDecoder::decodePacket(Common::SeekableReadStream &packet, uint32
> &framePeriod, Graphics::Surface *dst) {
>         // Decode as much as we can out of this packet
>         uint32 size = 0xFFFFFFFF;
>         mpeg2_state_t state;
> @@ -70,7 +70,7 @@ bool
> MPEGDecoder::decodePacket(Common::SeekableReadStream *packet, uint32 &frame
>
>                 switch (state) {
>                 case STATE_BUFFER:
> -                       size = packet->read(_buffer, BUFFER_SIZE);
> +                       size = packet.read(_buffer, BUFFER_SIZE);
>                         mpeg2_buffer(_mpegDecoder, _buffer, _buffer +
> size);
>                         break;
>                 case STATE_SLICE:
> diff --git a/image/codecs/mpeg.h b/image/codecs/mpeg.h
> index b9e961c..7f231dd 100644
> --- a/image/codecs/mpeg.h
> +++ b/image/codecs/mpeg.h
> @@ -72,11 +72,11 @@ public:
>         ~MPEGDecoder();
>
>         // Codec interface
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> _pixelFormat; }
>
>         // MPEGPSDecoder call
> -       bool decodePacket(Common::SeekableReadStream *packet, uint32
> &framePeriod, Graphics::Surface *dst = 0);
> +       bool decodePacket(Common::SeekableReadStream &packet, uint32
> &framePeriod, Graphics::Surface *dst = 0);
>
>  private:
>         Graphics::PixelFormat _pixelFormat;
> diff --git a/image/codecs/msrle.cpp b/image/codecs/msrle.cpp
> index 951de83..89fe869 100644
> --- a/image/codecs/msrle.cpp
> +++ b/image/codecs/msrle.cpp
> @@ -39,7 +39,7 @@ MSRLEDecoder::~MSRLEDecoder() {
>         delete _surface;
>  }
>
> -const Graphics::Surface
> *MSRLEDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *MSRLEDecoder::decodeFrame(Common::SeekableReadStream &stream) {
>         if (_bitsPerPixel == 8) {
>                 decode8(stream);
>         } else
> @@ -48,7 +48,7 @@ const Graphics::Surface
> *MSRLEDecoder::decodeImage(Common::SeekableReadStream *s
>         return _surface;
>  }
>
> -void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) {
> +void MSRLEDecoder::decode8(Common::SeekableReadStream &stream) {
>
>         int x = 0;
>         int y = _surface->h - 1;
> @@ -60,9 +60,9 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream
> *stream) {
>         byte *output     = data + ((height - 1) * width);
>         byte *output_end = data + ((height)     * width);
>
> -       while (!stream->eos()) {
> -               byte count = stream->readByte();
> -               byte value = stream->readByte();
> +       while (!stream.eos()) {
> +               byte count = stream.readByte();
> +               byte value = stream.readByte();
>
>                 if (count == 0) {
>                         if (value == 0) {
> @@ -84,8 +84,8 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream
> *stream) {
>                         } else if (value == 2) {
>                                 // Skip
>
> -                               count = stream->readByte();
> -                               value = stream->readByte();
> +                               count = stream.readByte();
> +                               value = stream.readByte();
>
>                                 y -= value;
>                                 x += count;
> @@ -101,15 +101,15 @@ void
> MSRLEDecoder::decode8(Common::SeekableReadStream *stream) {
>                                 // Copy data
>
>                                 if (output + value > output_end) {
> -                                       stream->skip(value);
> +                                       stream.skip(value);
>                                         continue;
>                                 }
>
>                                 for (int i = 0; i < value; i++)
> -                                       *output++ = stream->readByte();
> +                                       *output++ = stream.readByte();
>
>                                 if (value & 1)
> -                                       stream->skip(1);
> +                                       stream.skip(1);
>
>                                 x += value;
>                         }
> diff --git a/image/codecs/msrle.h b/image/codecs/msrle.h
> index 10e3531..a65ef1c 100644
> --- a/image/codecs/msrle.h
> +++ b/image/codecs/msrle.h
> @@ -38,7 +38,7 @@ public:
>         MSRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel);
>         ~MSRLEDecoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat::createFormatCLUT8(); }
>
>  private:
> @@ -46,7 +46,7 @@ private:
>
>         Graphics::Surface *_surface;
>
> -       void decode8(Common::SeekableReadStream *stream);
> +       void decode8(Common::SeekableReadStream &stream);
>  };
>
>  } // End of namespace Image
> diff --git a/image/codecs/msvideo1.cpp b/image/codecs/msvideo1.cpp
> index e94afed..25d7395 100644
> --- a/image/codecs/msvideo1.cpp
> +++ b/image/codecs/msvideo1.cpp
> @@ -29,8 +29,8 @@
>  namespace Image {
>
>  #define CHECK_STREAM_PTR(n) \
> -  if ((stream->pos() + n) > stream->size() ) { \
> -       warning ("MS Video-1: Stream out of bounds (%d >= %d)",
> stream->pos() + n, stream->size()); \
> +  if ((stream.pos() + n) > stream.size() ) { \
> +       warning ("MS Video-1: Stream out of bounds (%d >= %d)",
> stream.pos() + n, stream.size()); \
>      return; \
>    }
>
> @@ -46,7 +46,7 @@ MSVideo1Decoder::~MSVideo1Decoder() {
>         delete _surface;
>  }
>
> -void MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) {
> +void MSVideo1Decoder::decode8(Common::SeekableReadStream &stream) {
>      byte colors[8];
>      byte *pixels = (byte *)_surface->getPixels();
>      uint16 stride = _surface->w;
> @@ -73,8 +73,8 @@ void MSVideo1Decoder::decode8(Common::SeekableReadStream
> *stream) {
>
>              /* get the next two bytes in the encoded data stream */
>              CHECK_STREAM_PTR(2);
> -            byte byte_a = stream->readByte();
> -            byte byte_b = stream->readByte();
> +            byte byte_a = stream.readByte();
> +            byte byte_b = stream.readByte();
>
>              /* check if the decode is finished */
>              if (byte_a == 0 && byte_b == 0 && totalBlocks == 0) {
> @@ -87,8 +87,8 @@ void MSVideo1Decoder::decode8(Common::SeekableReadStream
> *stream) {
>                  uint16 flags = (byte_b << 8) | byte_a;
>
>                  CHECK_STREAM_PTR(2);
> -                colors[0] = stream->readByte();
> -                colors[1] = stream->readByte();
> +                colors[0] = stream.readByte();
> +                colors[1] = stream.readByte();
>
>                  for (byte pixel_y = 0; pixel_y < 4; pixel_y++) {
>                      for (byte pixel_x = 0; pixel_x < 4; pixel_x++, flags
> >>= 1)
> @@ -101,7 +101,7 @@ void
> MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) {
>
>                  CHECK_STREAM_PTR(8);
>                                 for (byte i = 0; i < 8; i++)
> -                                       colors[i] = stream->readByte();
> +                                       colors[i] = stream.readByte();
>
>                  for (byte pixel_y = 0; pixel_y < 4; pixel_y++) {
>                      for (byte pixel_x = 0; pixel_x < 4; pixel_x++, flags
> >>= 1)
> @@ -125,7 +125,7 @@ void
> MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) {
>      }
>  }
>
> -const Graphics::Surface
> *MSVideo1Decoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *MSVideo1Decoder::decodeFrame(Common::SeekableReadStream &stream) {
>         if (_bitsPerPixel == 8)
>                 decode8(stream);
>         else {
> diff --git a/image/codecs/msvideo1.h b/image/codecs/msvideo1.h
> index 517936d..bdee5ac 100644
> --- a/image/codecs/msvideo1.h
> +++ b/image/codecs/msvideo1.h
> @@ -38,7 +38,7 @@ public:
>         MSVideo1Decoder(uint16 width, uint16 height, byte bitsPerPixel);
>         ~MSVideo1Decoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat::createFormatCLUT8(); }
>
>  private:
> @@ -46,8 +46,8 @@ private:
>
>         Graphics::Surface *_surface;
>
> -       void decode8(Common::SeekableReadStream *stream);
> -       //void decode16(Common::SeekableReadStream *stream);
> +       void decode8(Common::SeekableReadStream &stream);
> +       //void decode16(Common::SeekableReadStream &stream);
>  };
>
>  } // End of namespace Image
> diff --git a/image/codecs/qtrle.cpp b/image/codecs/qtrle.cpp
> index a609e9b..94744ef 100644
> --- a/image/codecs/qtrle.cpp
> +++ b/image/codecs/qtrle.cpp
> @@ -48,8 +48,8 @@ QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height,
> byte bitsPerPixel) : Cod
>  }
>
>  #define CHECK_STREAM_PTR(n) \
> -  if ((stream->pos() + n) > stream->size()) { \
> -    warning("QTRLE Problem: stream out of bounds (%d > %d)",
> stream->pos() + n, stream->size()); \
> +  if ((stream.pos() + n) > stream.size()) { \
> +    warning("QTRLE Problem: stream out of bounds (%d > %d)", stream.pos()
> + n, stream.size()); \
>      return; \
>    }
>
> @@ -59,14 +59,14 @@ QTRLEDecoder::QTRLEDecoder(uint16 width, uint16
> height, byte bitsPerPixel) : Cod
>      return; \
>    } \
>
> -void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +void QTRLEDecoder::decode1(Common::SeekableReadStream &stream, uint32
> rowPtr, uint32 linesToChange) {
>         uint32 pixelPtr = 0;
>         byte *rgb = (byte *)_surface->getPixels();
>
>         while (linesToChange) {
>                 CHECK_STREAM_PTR(2);
> -               byte skip = stream->readByte();
> -               int8 rleCode = stream->readSByte();
> +               byte skip = stream.readByte();
> +               int8 rleCode = stream.readSByte();
>
>                 if (rleCode == 0)
>                         break;
> @@ -83,8 +83,8 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream
> *stream, uint32 rowPtr, ui
>                         rleCode = -rleCode;
>                         // get the next 2 bytes from the stream, treat
> them as groups of 8 pixels, and output them rleCode times */
>                         CHECK_STREAM_PTR(2);
> -                       byte pi0 = stream->readByte();
> -                       byte pi1 = stream->readByte();
> +                       byte pi0 = stream.readByte();
> +                       byte pi1 = stream.readByte();
>                         CHECK_PIXEL_PTR(rleCode * 2);
>
>                         while (rleCode--) {
> @@ -98,25 +98,25 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream
> *stream, uint32 rowPtr, ui
>                         CHECK_PIXEL_PTR(rleCode);
>
>                         while (rleCode--)
> -                               rgb[pixelPtr++] = stream->readByte();
> +                               rgb[pixelPtr++] = stream.readByte();
>                 }
>         }
>  }
>
> -void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange, byte bpp) {
> +void QTRLEDecoder::decode2_4(Common::SeekableReadStream &stream, uint32
> rowPtr, uint32 linesToChange, byte bpp) {
>         uint32 pixelPtr = 0;
>         byte *rgb = (byte *)_surface->getPixels();
>         byte numPixels = (bpp == 4) ? 8 : 16;
>
>         while (linesToChange--) {
>                 CHECK_STREAM_PTR(2);
> -               pixelPtr = rowPtr + (numPixels * (stream->readByte() - 1));
> +               pixelPtr = rowPtr + (numPixels * (stream.readByte() - 1));
>
> -               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +               for (int8 rleCode = stream.readSByte(); rleCode != -1;
> rleCode = stream.readSByte()) {
>                         if (rleCode == 0) {
>                                 // there's another skip code in the stream
>                                 CHECK_STREAM_PTR(1);
> -                               pixelPtr += (numPixels *
> (stream->readByte() - 1));
> +                               pixelPtr += (numPixels *
> (stream.readByte() - 1));
>                         } else if (rleCode < 0) {
>                                 // decode the run length code
>                                 rleCode = -rleCode;
> @@ -127,10 +127,10 @@ void
> QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr,
>                                 byte pi[16]; // 16 palette indices
>
>                                 for (int8 i = numPixels - 1; i >= 0; i--) {
> -                                       pi[numPixels - 1 - i] =
> (stream->readByte() >> ((i * bpp) & 0x07)) & ((1 << bpp) - 1);
> +                                       pi[numPixels - 1 - i] =
> (stream.readByte() >> ((i * bpp) & 0x07)) & ((1 << bpp) - 1);
>
>                                         if ((i & ((numPixels >> 2) - 1))
> == 0)
> -                                               stream->readByte();
> +                                               stream.readByte();
>                                 }
>
>                                 CHECK_PIXEL_PTR(rleCode * numPixels);
> @@ -145,7 +145,7 @@ void
> QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr,
>                                 CHECK_PIXEL_PTR(rleCode * (numPixels >>
> 2));
>
>                                 while (rleCode--) {
> -                                       byte temp = stream->readByte();
> +                                       byte temp = stream.readByte();
>                                         if (bpp == 4) {
>                                                 rgb[pixelPtr++] = (temp >>
> 4) & 0x0f;
>                                                 rgb[pixelPtr++] = temp &
> 0x0f;
> @@ -163,19 +163,19 @@ void
> QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr,
>         }
>  }
>
> -void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +void QTRLEDecoder::decode8(Common::SeekableReadStream &stream, uint32
> rowPtr, uint32 linesToChange) {
>         uint32 pixelPtr = 0;
>         byte *rgb = (byte *)_surface->getPixels();
>
>         while (linesToChange--) {
>                 CHECK_STREAM_PTR(2);
> -               pixelPtr = rowPtr + 4 * (stream->readByte() - 1);
> +               pixelPtr = rowPtr + 4 * (stream.readByte() - 1);
>
> -               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +               for (int8 rleCode = stream.readSByte(); rleCode != -1;
> rleCode = stream.readSByte()) {
>                         if (rleCode == 0) {
>                                 // there's another skip code in the stream
>                                 CHECK_STREAM_PTR(1);
> -                               pixelPtr += 4 * (stream->readByte() - 1);
> +                               pixelPtr += 4 * (stream.readByte() - 1);
>                         } else if (rleCode < 0) {
>                                 // decode the run length code
>                                 rleCode = -rleCode;
> @@ -186,7 +186,7 @@ void QTRLEDecoder::decode8(Common::SeekableReadStream
> *stream, uint32 rowPtr, ui
>                                 byte pi[4];  // 4 palette indexes
>
>                                 for (byte i = 0; i < 4; i++)
> -                                       pi[i] = stream->readByte();
> +                                       pi[i] = stream.readByte();
>
>                                 CHECK_PIXEL_PTR(rleCode * 4);
>
> @@ -200,7 +200,7 @@ void QTRLEDecoder::decode8(Common::SeekableReadStream
> *stream, uint32 rowPtr, ui
>                                 CHECK_PIXEL_PTR(rleCode);
>
>                                 while (rleCode--)
> -                                       rgb[pixelPtr++] =
> stream->readByte();
> +                                       rgb[pixelPtr++] =
> stream.readByte();
>                         }
>                 }
>
> @@ -208,25 +208,25 @@ void
> QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32 rowPtr, ui
>         }
>  }
>
> -void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +void QTRLEDecoder::decode16(Common::SeekableReadStream &stream, uint32
> rowPtr, uint32 linesToChange) {
>         uint32 pixelPtr = 0;
>         uint16 *rgb = (uint16 *)_surface->getPixels();
>
>         while (linesToChange--) {
>                 CHECK_STREAM_PTR(2);
> -               pixelPtr = rowPtr + stream->readByte() - 1;
> +               pixelPtr = rowPtr + stream.readByte() - 1;
>
> -               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +               for (int8 rleCode = stream.readSByte(); rleCode != -1;
> rleCode = stream.readSByte()) {
>                         if (rleCode == 0) {
>                                 // there's another skip code in the stream
>                                 CHECK_STREAM_PTR(1);
> -                               pixelPtr += stream->readByte() - 1;
> +                               pixelPtr += stream.readByte() - 1;
>                         } else if (rleCode < 0) {
>                                 // decode the run length code
>                                 rleCode = -rleCode;
>                                 CHECK_STREAM_PTR(2);
>
> -                               uint16 rgb16 = stream->readUint16BE();
> +                               uint16 rgb16 = stream.readUint16BE();
>
>                                 CHECK_PIXEL_PTR(rleCode);
>
> @@ -238,7 +238,7 @@ void QTRLEDecoder::decode16(Common::SeekableReadStream
> *stream, uint32 rowPtr, u
>
>                                 // copy pixels directly to output
>                                 while (rleCode--)
> -                                       rgb[pixelPtr++] =
> stream->readUint16BE();
> +                                       rgb[pixelPtr++] =
> stream.readUint16BE();
>                         }
>                 }
>
> @@ -246,28 +246,28 @@ void
> QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, u
>         }
>  }
>
> -void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +void QTRLEDecoder::decode24(Common::SeekableReadStream &stream, uint32
> rowPtr, uint32 linesToChange) {
>         uint32 pixelPtr = 0;
>         uint32 *rgb = (uint32 *)_surface->getPixels();
>
>         while (linesToChange--) {
>                 CHECK_STREAM_PTR(2);
> -               pixelPtr = rowPtr + stream->readByte() - 1;
> +               pixelPtr = rowPtr + stream.readByte() - 1;
>
> -               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +               for (int8 rleCode = stream.readSByte(); rleCode != -1;
> rleCode = stream.readSByte()) {
>                         if (rleCode == 0) {
>                                 // there's another skip code in the stream
>                                 CHECK_STREAM_PTR(1);
> -                               pixelPtr += stream->readByte() - 1;
> +                               pixelPtr += stream.readByte() - 1;
>                         } else if (rleCode < 0) {
>                                 // decode the run length code
>                                 rleCode = -rleCode;
>
>                                 CHECK_STREAM_PTR(3);
>
> -                               byte r = stream->readByte();
> -                               byte g = stream->readByte();
> -                               byte b = stream->readByte();
> +                               byte r = stream.readByte();
> +                               byte g = stream.readByte();
> +                               byte b = stream.readByte();
>                                 uint32 color =
> _surface->format.RGBToColor(r, g, b);
>
>                                 CHECK_PIXEL_PTR(rleCode);
> @@ -280,9 +280,9 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream
> *stream, uint32 rowPtr, u
>
>                                 // copy pixels directly to output
>                                 while (rleCode--) {
> -                                       byte r = stream->readByte();
> -                                       byte g = stream->readByte();
> -                                       byte b = stream->readByte();
> +                                       byte r = stream.readByte();
> +                                       byte g = stream.readByte();
> +                                       byte b = stream.readByte();
>                                         rgb[pixelPtr++] =
> _surface->format.RGBToColor(r, g, b);
>                                 }
>                         }
> @@ -292,29 +292,29 @@ void
> QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u
>         }
>  }
>
> -void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32
> rowPtr, uint32 linesToChange) {
> +void QTRLEDecoder::decode32(Common::SeekableReadStream &stream, uint32
> rowPtr, uint32 linesToChange) {
>         uint32 pixelPtr = 0;
>         uint32 *rgb = (uint32 *)_surface->getPixels();
>
>         while (linesToChange--) {
>                 CHECK_STREAM_PTR(2);
> -               pixelPtr = rowPtr + stream->readByte() - 1;
> +               pixelPtr = rowPtr + stream.readByte() - 1;
>
> -               for (int8 rleCode = stream->readSByte(); rleCode != -1;
> rleCode = stream->readSByte()) {
> +               for (int8 rleCode = stream.readSByte(); rleCode != -1;
> rleCode = stream.readSByte()) {
>                         if (rleCode == 0) {
>                                 // there's another skip code in the stream
>                                 CHECK_STREAM_PTR(1);
> -                               pixelPtr += stream->readByte() - 1;
> +                               pixelPtr += stream.readByte() - 1;
>                         } else if (rleCode < 0) {
>                                 // decode the run length code
>                                 rleCode = -rleCode;
>
>                                 CHECK_STREAM_PTR(4);
>
> -                               byte a = stream->readByte();
> -                               byte r = stream->readByte();
> -                               byte g = stream->readByte();
> -                               byte b = stream->readByte();
> +                               byte a = stream.readByte();
> +                               byte r = stream.readByte();
> +                               byte g = stream.readByte();
> +                               byte b = stream.readByte();
>                                 uint32 color =
> _surface->format.ARGBToColor(a, r, g, b);
>
>                                 CHECK_PIXEL_PTR(rleCode);
> @@ -327,10 +327,10 @@ void
> QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u
>
>                                 // copy pixels directly to output
>                                 while (rleCode--) {
> -                                       byte a = stream->readByte();
> -                                       byte r = stream->readByte();
> -                                       byte g = stream->readByte();
> -                                       byte b = stream->readByte();
> +                                       byte a = stream.readByte();
> +                                       byte r = stream.readByte();
> +                                       byte g = stream.readByte();
> +                                       byte b = stream.readByte();
>                                         rgb[pixelPtr++] =
> _surface->format.ARGBToColor(a, r, g, b);
>                                 }
>                         }
> @@ -340,29 +340,29 @@ void
> QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u
>         }
>  }
>
> -const Graphics::Surface
> *QTRLEDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *QTRLEDecoder::decodeFrame(Common::SeekableReadStream &stream) {
>         uint16 startLine = 0;
>         uint16 height = _surface->h;
>
>         // check if this frame is even supposed to change
> -       if (stream->size() < 8)
> +       if (stream.size() < 8)
>                 return _surface;
>
>         // start after the chunk size
> -       stream->readUint32BE();
> +       stream.readUint32BE();
>
>         // fetch the header
> -       uint16 header = stream->readUint16BE();
> +       uint16 header = stream.readUint16BE();
>
>         // if a header is present, fetch additional decoding parameters
>         if (header & 8) {
> -               if (stream->size() < 14)
> +               if (stream.size() < 14)
>                         return _surface;
>
> -               startLine = stream->readUint16BE();
> -               stream->readUint16BE(); // Unknown
> -               height = stream->readUint16BE();
> -               stream->readUint16BE(); // Unknown
> +               startLine = stream.readUint16BE();
> +               stream.readUint16BE(); // Unknown
> +               height = stream.readUint16BE();
> +               stream.readUint16BE(); // Unknown
>         }
>
>         uint32 rowPtr = _surface->w * startLine;
> diff --git a/image/codecs/qtrle.h b/image/codecs/qtrle.h
> index c16daa0..7ef8953 100644
> --- a/image/codecs/qtrle.h
> +++ b/image/codecs/qtrle.h
> @@ -39,7 +39,7 @@ public:
>         QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel);
>         ~QTRLEDecoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const;
>
>  private:
> @@ -47,12 +47,12 @@ private:
>
>         Graphics::Surface *_surface;
>
> -       void decode1(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> -       void decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange, byte bpp);
> -       void decode8(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> -       void decode16(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> -       void decode24(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> -       void decode32(Common::SeekableReadStream *stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode1(Common::SeekableReadStream &stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode2_4(Common::SeekableReadStream &stream, uint32 rowPtr,
> uint32 linesToChange, byte bpp);
> +       void decode8(Common::SeekableReadStream &stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode16(Common::SeekableReadStream &stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode24(Common::SeekableReadStream &stream, uint32 rowPtr,
> uint32 linesToChange);
> +       void decode32(Common::SeekableReadStream &stream, uint32 rowPtr,
> uint32 linesToChange);
>  };
>
>  } // End of namespace Image
> diff --git a/image/codecs/rpza.cpp b/image/codecs/rpza.cpp
> index ecd930f..5aeee7c 100644
> --- a/image/codecs/rpza.cpp
> +++ b/image/codecs/rpza.cpp
> @@ -61,7 +61,7 @@ RPZADecoder::~RPZADecoder() {
>                 WRITE_UINT16((uint16 *)_surface->getPixels() + blockPtr,
> color); \
>         blockPtr++
>
> -const Graphics::Surface
> *RPZADecoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *RPZADecoder::decodeFrame(Common::SeekableReadStream &stream) {
>         uint16 colorA = 0, colorB = 0;
>         uint16 color4[4];
>
> @@ -73,40 +73,40 @@ const Graphics::Surface
> *RPZADecoder::decodeImage(Common::SeekableReadStream *st
>         uint16 tb;
>
>         // First byte is always 0xe1. Warn if it's different
> -       byte firstByte = stream->readByte();
> +       byte firstByte = stream.readByte();
>         if (firstByte != 0xe1)
>                 warning("First RPZA chunk byte is 0x%02x instead of 0xe1",
> firstByte);
>
>         // Get chunk size, ingnoring first byte
> -       uint32 chunkSize = stream->readUint16BE() << 8;
> -       chunkSize += stream->readByte();
> +       uint32 chunkSize = stream.readUint16BE() << 8;
> +       chunkSize += stream.readByte();
>
>         // If length mismatch use size from MOV file and try to decode
> anyway
> -       if (chunkSize != (uint32)stream->size()) {
> +       if (chunkSize != (uint32)stream.size()) {
>                 warning("MOV chunk size != encoded chunk size; using MOV
> chunk size");
> -               chunkSize = stream->size();
> +               chunkSize = stream.size();
>         }
>
>         // Number of 4x4 blocks in frame
>         int32 totalBlocks = ((_surface->w + 3) / 4) * ((_surface->h + 3) /
> 4);
>
>         // Process chunk data
> -       while ((uint32)stream->pos() < chunkSize) {
> -               byte opcode = stream->readByte(); // Get opcode
> +       while ((uint32)stream.pos() < chunkSize) {
> +               byte opcode = stream.readByte(); // Get opcode
>                 byte numBlocks = (opcode & 0x1f) + 1; // Extract block
> counter from opcode
>
>                 // If opcode MSbit is 0, we need more data to decide what
> to do
>                 if ((opcode & 0x80) == 0) {
> -                       colorA = (opcode << 8) | stream->readByte();
> +                       colorA = (opcode << 8) | stream.readByte();
>                         opcode = 0;
> -                       if (stream->readByte() & 0x80) {
> +                       if (stream.readByte() & 0x80) {
>                                 // Must behave as opcode 110xxxxx, using
> colorA computed
>                                 // above. Use fake opcode 0x20 to enter
> switch block at
>                                 // the right place
>                                 opcode = 0x20;
>                                 numBlocks = 1;
>                         }
> -                       stream->seek(-1, SEEK_CUR);
> +                       stream.seek(-1, SEEK_CUR);
>                 }
>
>                 switch (opcode & 0xe0) {
> @@ -116,7 +116,7 @@ const Graphics::Surface
> *RPZADecoder::decodeImage(Common::SeekableReadStream *st
>                         }
>                         break;
>                 case 0xa0: // Fill blocks with one color
> -                       colorA = stream->readUint16BE();
> +                       colorA = stream.readUint16BE();
>                         while (numBlocks--) {
>                                 blockPtr = rowPtr + pixelPtr;
>                                 for (byte pixel_y = 0; pixel_y < 4;
> pixel_y++) {
> @@ -131,9 +131,9 @@ const Graphics::Surface
> *RPZADecoder::decodeImage(Common::SeekableReadStream *st
>
>                 // Fill blocks with 4 colors
>                 case 0xc0:
> -                       colorA = stream->readUint16BE();
> +                       colorA = stream.readUint16BE();
>                 case 0x20:
> -                       colorB = stream->readUint16BE();
> +                       colorB = stream.readUint16BE();
>
>                         // Sort out the colors
>                         color4[0] = colorB;
> @@ -162,7 +162,7 @@ const Graphics::Surface
> *RPZADecoder::decodeImage(Common::SeekableReadStream *st
>                         while (numBlocks--) {
>                                 blockPtr = rowPtr + pixelPtr;
>                                 for (byte pixel_y = 0; pixel_y < 4;
> pixel_y++) {
> -                                       byte index = stream->readByte();
> +                                       byte index = stream.readByte();
>                                         for (byte pixel_x = 0; pixel_x <
> 4; pixel_x++) {
>                                                 byte idx = (index >> (2 *
> (3 - pixel_x))) & 0x03;
>                                                 PUT_PIXEL(color4[idx]);
> @@ -180,7 +180,7 @@ const Graphics::Surface
> *RPZADecoder::decodeImage(Common::SeekableReadStream *st
>                                 for (byte pixel_x = 0; pixel_x < 4;
> pixel_x++) {
>                                         // We already have color of upper
> left pixel
>                                         if (pixel_y != 0 || pixel_x != 0)
> -                                               colorA =
> stream->readUint16BE();
> +                                               colorA =
> stream.readUint16BE();
>
>                                         PUT_PIXEL(colorA);
>                                 }
> diff --git a/image/codecs/rpza.h b/image/codecs/rpza.h
> index f87ee11..62f4c02 100644
> --- a/image/codecs/rpza.h
> +++ b/image/codecs/rpza.h
> @@ -39,7 +39,7 @@ public:
>         RPZADecoder(uint16 width, uint16 height);
>         ~RPZADecoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); }
>
>  private:
> diff --git a/image/codecs/smc.cpp b/image/codecs/smc.cpp
> index 434a105..54493d0 100644
> --- a/image/codecs/smc.cpp
> +++ b/image/codecs/smc.cpp
> @@ -29,7 +29,7 @@
>  namespace Image {
>
>  #define GET_BLOCK_COUNT() \
> -  (opcode & 0x10) ? (1 + stream->readByte()) : 1 + (opcode & 0x0F);
> +  (opcode & 0x10) ? (1 + stream.readByte()) : 1 + (opcode & 0x0F);
>
>  #define ADVANCE_BLOCK() \
>  { \
> @@ -55,7 +55,7 @@ SMCDecoder::~SMCDecoder() {
>         delete _surface;
>  }
>
> -const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *SMCDecoder::decodeFrame(Common::SeekableReadStream &stream) {
>         byte *pixels = (byte *)_surface->getPixels();
>
>         uint32 numBlocks = 0;
> @@ -77,9 +77,9 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>         uint32 colorOctetIndex = 0;
>         uint32 colorTableIndex = 0;  // indices to color pair, quad, or
> octet tables
>
> -       int32 chunkSize = stream->readUint32BE() & 0x00FFFFFF;
> -       if (chunkSize != stream->size())
> -               warning("MOV chunk size != SMC chunk size (%d != %d);
> ignoring SMC chunk size", chunkSize, stream->size());
> +       int32 chunkSize = stream.readUint32BE() & 0x00FFFFFF;
> +       if (chunkSize != stream.size())
> +               warning("MOV chunk size != SMC chunk size (%d != %d);
> ignoring SMC chunk size", chunkSize, stream.size());
>
>         int32 totalBlocks = ((_surface->w + 3) / 4) * ((_surface->h + 3) /
> 4);
>
> @@ -88,8 +88,8 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                 // sanity checks
>
>                 // make sure stream ptr hasn't gone out of bounds
> -               if (stream->pos() > stream->size()) {
> -                       warning("SMC decoder just went out of bounds
> (stream ptr = %d, chunk size = %d)", stream->pos(), stream->size());
> +               if (stream.pos() > stream.size()) {
> +                       warning("SMC decoder just went out of bounds
> (stream ptr = %d, chunk size = %d)", stream.pos(), stream.size());
>                         return _surface;
>                 }
>
> @@ -99,7 +99,7 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                         return _surface;
>                 }
>
> -               byte opcode = stream->readByte();
> +               byte opcode = stream.readByte();
>
>                 switch (opcode & 0xF0) {
>                 // skip n blocks
> @@ -192,7 +192,7 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                 case 0x60:
>                 case 0x70:
>                         numBlocks = GET_BLOCK_COUNT();
> -                       pixel = stream->readByte();
> +                       pixel = stream.readByte();
>
>                         while (numBlocks--) {
>                                 blockPtr = rowPtr + pixelPtr;
> @@ -216,7 +216,7 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                                 // fetch the next 2 colors from bytestream
> and store in next
>                                 // available entry in the color pair table
>                                 for (byte i = 0; i < CPAIR; i++) {
> -                                       pixel = stream->readByte();
> +                                       pixel = stream.readByte();
>                                         colorTableIndex = CPAIR *
> colorPairIndex + i;
>                                         _colorPairs[colorTableIndex] =
> pixel;
>                                 }
> @@ -229,10 +229,10 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                                 if (colorPairIndex == COLORS_PER_TABLE)
>                                         colorPairIndex = 0;
>                         } else
> -                               colorTableIndex = CPAIR *
> stream->readByte();
> +                               colorTableIndex = CPAIR *
> stream.readByte();
>
>                         while (numBlocks--) {
> -                               colorFlags = stream->readUint16BE();
> +                               colorFlags = stream.readUint16BE();
>                                 uint16 flagMask = 0x8000;
>                                 blockPtr = rowPtr + pixelPtr;
>                                 for (byte y = 0; y < 4; y++) {
> @@ -262,7 +262,7 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                                 // fetch the next 4 colors from bytestream
> and store in next
>                                 // available entry in the color quad table
>                                 for (byte i = 0; i < CQUAD; i++) {
> -                                       pixel = stream->readByte();
> +                                       pixel = stream.readByte();
>                                         colorTableIndex = CQUAD *
> colorQuadIndex + i;
>                                         _colorQuads[colorTableIndex] =
> pixel;
>                                 }
> @@ -275,10 +275,10 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                                 if (colorQuadIndex == COLORS_PER_TABLE)
>                                         colorQuadIndex = 0;
>                         } else
> -                               colorTableIndex = CQUAD *
> stream->readByte();
> +                               colorTableIndex = CQUAD *
> stream.readByte();
>
>                         while (numBlocks--) {
> -                               colorFlags = stream->readUint32BE();
> +                               colorFlags = stream.readUint32BE();
>
>                                 // flag mask actually acts as a bit shift
> count here
>                                 byte flagMask = 30;
> @@ -306,7 +306,7 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                                 // fetch the next 8 colors from bytestream
> and store in next
>                                 // available entry in the color octet table
>                                 for (byte i = 0; i < COCTET; i++) {
> -                                       pixel = stream->readByte();
> +                                       pixel = stream.readByte();
>                                         colorTableIndex = COCTET *
> colorOctetIndex + i;
>                                         _colorOctets[colorTableIndex] =
> pixel;
>                                 }
> @@ -319,7 +319,7 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                                 if (colorOctetIndex == COLORS_PER_TABLE)
>                                         colorOctetIndex = 0;
>                         } else
> -                               colorTableIndex = COCTET *
> stream->readByte();
> +                               colorTableIndex = COCTET *
> stream.readByte();
>
>                         while (numBlocks--) {
>                                 /*
> @@ -331,7 +331,7 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>
>                                 // build the color flags
>                                 byte flagData[6];
> -                               stream->read(flagData, 6);
> +                               stream.read(flagData, 6);
>
>                                 colorFlagsA = ((READ_BE_UINT16(flagData) &
> 0xFFF0) << 8) | (READ_BE_UINT16(flagData + 2) >> 4);
>                                 colorFlagsB = ((READ_BE_UINT16(flagData +
> 4) & 0xFFF0) << 8) | ((flagData[1] & 0xF) << 8) |
> @@ -369,7 +369,7 @@ const Graphics::Surface
> *SMCDecoder::decodeImage(Common::SeekableReadStream *str
>                                 blockPtr = rowPtr + pixelPtr;
>                                 for (byte y = 0; y < 4; y++) {
>                                         for (byte x = 0; x < 4; x++)
> -                                               pixels[blockPtr++] =
> stream->readByte();
> +                                               pixels[blockPtr++] =
> stream.readByte();
>
>                                         blockPtr += rowInc;
>                                 }
> diff --git a/image/codecs/smc.h b/image/codecs/smc.h
> index 2de1f69..579d629 100644
> --- a/image/codecs/smc.h
> +++ b/image/codecs/smc.h
> @@ -45,7 +45,7 @@ public:
>         SMCDecoder(uint16 width, uint16 height);
>         ~SMCDecoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat::createFormatCLUT8(); }
>
>  private:
> diff --git a/image/codecs/svq1.cpp b/image/codecs/svq1.cpp
> index 550445b..765d512 100644
> --- a/image/codecs/svq1.cpp
> +++ b/image/codecs/svq1.cpp
> @@ -91,10 +91,10 @@ SVQ1Decoder::~SVQ1Decoder() {
>
>  #define ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
>
> -const Graphics::Surface
> *SVQ1Decoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *SVQ1Decoder::decodeFrame(Common::SeekableReadStream &stream) {
>         debug(1, "SVQ1Decoder::decodeImage()");
>
> -       Common::BitStream32BEMSB frameData(*stream);
> +       Common::BitStream32BEMSB frameData(stream);
>
>         uint32 frameCode = frameData.getBits(22);
>         debug(1, " frameCode: %d", frameCode);
> diff --git a/image/codecs/svq1.h b/image/codecs/svq1.h
> index 56310a1..687f761 100644
> --- a/image/codecs/svq1.h
> +++ b/image/codecs/svq1.h
> @@ -44,7 +44,7 @@ public:
>         SVQ1Decoder(uint16 width, uint16 height);
>         ~SVQ1Decoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const { return
> _surface->format; }
>
>  private:
> diff --git a/image/codecs/truemotion1.cpp b/image/codecs/truemotion1.cpp
> index 3b8ad85..1302d72 100644
> --- a/image/codecs/truemotion1.cpp
> +++ b/image/codecs/truemotion1.cpp
> @@ -163,9 +163,9 @@ void TrueMotion1Decoder::genVectorTable16(const byte
> *selVectorTable) {
>         }
>  }
>
> -void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream *stream)
> {
> -       _buf = new byte[stream->size()];
> -       stream->read(_buf, stream->size());
> +void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream &stream)
> {
> +       _buf = new byte[stream.size()];
> +       stream.read(_buf, stream.size());
>
>         byte headerBuffer[128];  // logical maximum size of the header
>         const byte *selVectorTable;
> @@ -243,7 +243,7 @@ void
> TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream *stream) {
>                 _indexStream = _mbChangeBits + _mbChangeBitsRowSize *
> (_height >> 2);
>         }
>
> -       _indexStreamSize = stream->size() - (_indexStream - _buf);
> +       _indexStreamSize = stream.size() - (_indexStream - _buf);
>
>         _lastDeltaset = _header.deltaset;
>         _lastVectable = _header.vectable;
> @@ -397,7 +397,7 @@ void TrueMotion1Decoder::decode16() {
>         }
>  }
>
> -const Graphics::Surface
> *TrueMotion1Decoder::decodeImage(Common::SeekableReadStream *stream) {
> +const Graphics::Surface
> *TrueMotion1Decoder::decodeFrame(Common::SeekableReadStream &stream) {
>         decodeHeader(stream);
>
>         if (compressionTypes[_header.compression].algorithm == ALGO_NOP) {
> diff --git a/image/codecs/truemotion1.h b/image/codecs/truemotion1.h
> index e836ddb..bb87dbc 100644
> --- a/image/codecs/truemotion1.h
> +++ b/image/codecs/truemotion1.h
> @@ -43,7 +43,7 @@ public:
>         TrueMotion1Decoder(uint16 width, uint16 height);
>         ~TrueMotion1Decoder();
>
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>
>         // Always return RGB565
>         Graphics::PixelFormat getPixelFormat() const { return
> Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); }
> @@ -96,7 +96,7 @@ private:
>         } _header;
>
>         void selectDeltaTables(int deltaTableIndex);
> -       void decodeHeader(Common::SeekableReadStream *stream);
> +       void decodeHeader(Common::SeekableReadStream &stream);
>         void decode16();
>         int makeYdt16Entry(int p1, int p2);
>         int makeCdt16Entry(int p1, int p2);
> diff --git a/image/jpeg.cpp b/image/jpeg.cpp
> index 3602d50..1ce45f2 100644
> --- a/image/jpeg.cpp
> +++ b/image/jpeg.cpp
> @@ -59,8 +59,8 @@ void JPEGDecoder::destroy() {
>         _surface.free();
>  }
>
> -const Graphics::Surface
> *JPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
> -       if (!loadStream(*stream))
> +const Graphics::Surface
> *JPEGDecoder::decodeFrame(Common::SeekableReadStream &stream) {
> +       if (!loadStream(stream))
>                 return 0;
>
>         return getSurface();
> diff --git a/image/jpeg.h b/image/jpeg.h
> index 1bf76ec..dea799c 100644
> --- a/image/jpeg.h
> +++ b/image/jpeg.h
> @@ -58,7 +58,7 @@ public:
>         virtual const Graphics::Surface *getSurface() const;
>
>         // Codec API
> -       const Graphics::Surface *decodeImage(Common::SeekableReadStream
> *stream);
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
>         Graphics::PixelFormat getPixelFormat() const;
>
>         // Special API for JPEG
> diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
> index 5e404ec..e9c6ef9 100644
> --- a/video/avi_decoder.cpp
> +++ b/video/avi_decoder.cpp
> @@ -711,7 +711,7 @@ AVIDecoder::AVIVideoTrack::~AVIVideoTrack() {
>  void AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream
> *stream) {
>         if (stream) {
>                 if (_videoCodec)
> -                       _lastFrame = _videoCodec->decodeImage(stream);
> +                       _lastFrame = _videoCodec->decodeFrame(*stream);
>         } else {
>                 // Empty frame
>                 _lastFrame = 0;
> diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp
> index e01c5f3..21dda15 100644
> --- a/video/coktel_decoder.cpp
> +++ b/video/coktel_decoder.cpp
> @@ -2262,7 +2262,7 @@ bool VMDDecoder::renderFrame(Common::Rect &rect) {
>                         return false;
>
>                 Common::MemoryReadStream frameStream(_videoBuffer[0],
> _videoBufferLen[0]);
> -               const Graphics::Surface *codecSurf =
> _codec->decodeImage(&frameStream);
> +               const Graphics::Surface *codecSurf =
> _codec->decodeFrame(frameStream);
>                 if (!codecSurf)
>                         return false;
>
> diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
> index 20c20d0..cd36796 100644
> --- a/video/qt_decoder.cpp
> +++ b/video/qt_decoder.cpp
> @@ -725,7 +725,7 @@ const Graphics::Surface
> *QuickTimeDecoder::VideoTrackHandler::bufferNextFrame()
>                 return 0;
>         }
>
> -       const Graphics::Surface *frame =
> entry->_videoCodec->decodeImage(frameData);
> +       const Graphics::Surface *frame =
> entry->_videoCodec->decodeFrame(*frameData);
>         delete frameData;
>
>         // Update the palette
>
>
> Commit: 0f07f85a948e39c286b0bbd9e9191d517108c2da
>
> https://github.com/scummvm/scummvm/commit/0f07f85a948e39c286b0bbd9e9191d517108c2da
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:31:59-08:00
>
> Commit Message:
> IMAGE: Split raw bitmap decoding into a Codec
>
> Changed paths:
>   A image/codecs/bmp_raw.cpp
>   A image/codecs/bmp_raw.h
>     image/bmp.cpp
>     image/bmp.h
>     image/module.mk
>
>
>
> diff --git a/image/bmp.cpp b/image/bmp.cpp
> index 113e268..eb8e300 100644
> --- a/image/bmp.cpp
> +++ b/image/bmp.cpp
> @@ -23,9 +23,11 @@
>  #include "image/bmp.h"
>
>  #include "common/stream.h"
> +#include "common/substream.h"
>  #include "common/textconsole.h"
>  #include "graphics/pixelformat.h"
>  #include "graphics/surface.h"
> +#include "image/codecs/bmp_raw.h"
>
>  namespace Image {
>
> @@ -33,6 +35,7 @@ BitmapDecoder::BitmapDecoder() {
>         _surface = 0;
>         _palette = 0;
>         _paletteColorCount = 0;
> +       _codec = 0;
>  }
>
>  BitmapDecoder::~BitmapDecoder() {
> @@ -40,13 +43,15 @@ BitmapDecoder::~BitmapDecoder() {
>  }
>
>  void BitmapDecoder::destroy() {
> -       if (_surface) {
> -               _surface->free();
> -               delete _surface; _surface = 0;
> -       }
> +       _surface = 0;
> +
> +       delete[] _palette;
> +       _palette = 0;
>
> -       delete[] _palette; _palette = 0;
>         _paletteColorCount = 0;
> +
> +       delete _codec;
> +       _codec = 0;
>  }
>
>  bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
> @@ -95,7 +100,7 @@ bool
> BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
>                 return false;
>         }
>
> -       /* uint32 imageSize = */ stream.readUint32LE();
> +       uint32 imageSize = stream.readUint32LE();
>         /* uint32 pixelsPerMeterX = */ stream.readUint32LE();
>         /* uint32 pixelsPerMeterY = */ stream.readUint32LE();
>         _paletteColorCount = stream.readUint32LE();
> @@ -115,67 +120,12 @@ bool
> BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
>                 }
>         }
>
> -       // Start us at the beginning of the image
> -       stream.seek(imageOffset);
> -
> -       Graphics::PixelFormat format =
> Graphics::PixelFormat::createFormatCLUT8();
> -
> -       // BGRA for 24bpp and 32 bpp
> -       if (bitsPerPixel == 24 || bitsPerPixel == 32)
> -               format = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24,
> 0);
> -
> -       _surface = new Graphics::Surface();
> -       _surface->create(width, height, format);
> +       // Grab the frame data
> +       Common::SeekableSubReadStream subStream(&stream, imageOffset,
> imageOffset + imageSize);
>
> -       int srcPitch = width * (bitsPerPixel >> 3);
> -       const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) :
> 0;
> -
> -       if (bitsPerPixel == 8) {
> -               byte *dst = (byte *)_surface->getPixels();
> -
> -               for (int32 i = 0; i < height; i++) {
> -                       stream.read(dst + (height - i - 1) * width, width);
> -                       stream.skip(extraDataLength);
> -               }
> -       } else if (bitsPerPixel == 24) {
> -               byte *dst = (byte *)_surface->getBasePtr(0, height - 1);
> -
> -               for (int32 i = 0; i < height; i++) {
> -                       for (uint32 j = 0; j < width; j++) {
> -                               byte b = stream.readByte();
> -                               byte g = stream.readByte();
> -                               byte r = stream.readByte();
> -                               uint32 color = format.RGBToColor(r, g, b);
> -
> -                               *((uint32 *)dst) = color;
> -                               dst += format.bytesPerPixel;
> -                       }
> -
> -                       stream.skip(extraDataLength);
> -                       dst -= _surface->pitch * 2;
> -               }
> -       } else { // 32 bpp
> -               byte *dst = (byte *)_surface->getBasePtr(0, height - 1);
> -
> -               for (int32 i = 0; i < height; i++) {
> -                       for (uint32 j = 0; j < width; j++) {
> -                               byte b = stream.readByte();
> -                               byte g = stream.readByte();
> -                               byte r = stream.readByte();
> -                               // Ignore the last byte, as in v3 it is
> unused
> -                               // and should thus NOT be used as alpha.
> -                               // ref:
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx
> -                               stream.readByte();
> -                               uint32 color = format.RGBToColor(r, g, b);
> -
> -                               *((uint32 *)dst) = color;
> -                               dst += format.bytesPerPixel;
> -                       }
> -
> -                       stream.skip(extraDataLength);
> -                       dst -= _surface->pitch * 2;
> -               }
> -       }
> +       // We only support raw bitmaps for now
> +       _codec = new BitmapRawDecoder(width, height, bitsPerPixel);
> +       _surface = _codec->decodeFrame(subStream);
>
>         return true;
>  }
> diff --git a/image/bmp.h b/image/bmp.h
> index bc4cfc3..b482cc6 100644
> --- a/image/bmp.h
> +++ b/image/bmp.h
> @@ -45,6 +45,8 @@ struct Surface;
>
>  namespace Image {
>
> +class Codec;
> +
>  class BitmapDecoder : public ImageDecoder {
>  public:
>         BitmapDecoder();
> @@ -58,7 +60,8 @@ public:
>         uint16 getPaletteColorCount() const { return _paletteColorCount; }
>
>  private:
> -       Graphics::Surface *_surface;
> +       Codec *_codec;
> +       const Graphics::Surface *_surface;
>         byte *_palette;
>         uint16 _paletteColorCount;
>  };
> diff --git a/image/codecs/bmp_raw.cpp b/image/codecs/bmp_raw.cpp
> new file mode 100644
> index 0000000..83aedc8
> --- /dev/null
> +++ b/image/codecs/bmp_raw.cpp
> @@ -0,0 +1,113 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "image/codecs/bmp_raw.h"
> +
> +#include "common/stream.h"
> +#include "common/textconsole.h"
> +#include "graphics/surface.h"
> +
> +namespace Image {
> +
> +BitmapRawDecoder::BitmapRawDecoder(int width, int height, int
> bitsPerPixel) : Codec(),
> +               _surface(0), _width(width), _height(height),
> _bitsPerPixel(bitsPerPixel) {
> +}
> +
> +BitmapRawDecoder::~BitmapRawDecoder() {
> +       if (_surface) {
> +               _surface->free();
> +               delete _surface;
> +       }
> +}
> +
> +const Graphics::Surface
> *BitmapRawDecoder::decodeFrame(Common::SeekableReadStream &stream) {
> +       Graphics::PixelFormat format = getPixelFormat();
> +
> +       _surface = new Graphics::Surface();
> +       _surface->create(_width, _height, format);
> +
> +       int srcPitch = _width * (_bitsPerPixel >> 3);
> +       const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) :
> 0;
> +
> +       if (_bitsPerPixel == 8) {
> +               byte *dst = (byte *)_surface->getPixels();
> +
> +               for (int i = 0; i < _height; i++) {
> +                       stream.read(dst + (_height - i - 1) * _width,
> _width);
> +                       stream.skip(extraDataLength);
> +               }
> +       } else if (_bitsPerPixel == 24) {
> +               byte *dst = (byte *)_surface->getBasePtr(0, _height - 1);
> +
> +               for (int i = 0; i < _height; i++) {
> +                       for (int j = 0; j < _width; j++) {
> +                               byte b = stream.readByte();
> +                               byte g = stream.readByte();
> +                               byte r = stream.readByte();
> +                               uint32 color = format.RGBToColor(r, g, b);
> +
> +                               *((uint32 *)dst) = color;
> +                               dst += format.bytesPerPixel;
> +                       }
> +
> +                       stream.skip(extraDataLength);
> +                       dst -= _surface->pitch * 2;
> +               }
> +       } else { // 32 bpp
> +               byte *dst = (byte *)_surface->getBasePtr(0, _height - 1);
> +
> +               for (int i = 0; i < _height; i++) {
> +                       for (int j = 0; j < _width; j++) {
> +                               byte b = stream.readByte();
> +                               byte g = stream.readByte();
> +                               byte r = stream.readByte();
> +                               // Ignore the last byte, as in v3 it is
> unused
> +                               // and should thus NOT be used as alpha.
> +                               // ref:
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx
> +                               stream.readByte();
> +                               uint32 color = format.RGBToColor(r, g, b);
> +
> +                               *((uint32 *)dst) = color;
> +                               dst += format.bytesPerPixel;
> +                       }
> +
> +                       stream.skip(extraDataLength);
> +                       dst -= _surface->pitch * 2;
> +               }
> +       }
> +
> +       return _surface;
> +}
> +
> +Graphics::PixelFormat BitmapRawDecoder::getPixelFormat() const {
> +       switch (_bitsPerPixel) {
> +       case 8:
> +               return Graphics::PixelFormat::createFormatCLUT8();
> +       case 24:
> +       case 32:
> +               return Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0);
> +       }
> +
> +       error("Unhandled BMP raw %dbpp", _bitsPerPixel);
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/bmp_raw.h b/image/codecs/bmp_raw.h
> new file mode 100644
> index 0000000..d589d7e
> --- /dev/null
> +++ b/image/codecs/bmp_raw.h
> @@ -0,0 +1,52 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#ifndef IMAGE_CODECS_BMP_RAW_H
> +#define IMAGE_CODECS_BMP_RAW_H
> +
> +#include "image/codecs/codec.h"
> +
> +namespace Image {
> +
> +/**
> + * Bitmap raw image decoder.
> + *
> + * Used in image:
> + *  - BitmapDecoder
> + */
> +class BitmapRawDecoder : public Codec {
> +public:
> +       BitmapRawDecoder(int width, int height, int bitsPerPixel);
> +       ~BitmapRawDecoder();
> +
> +       const Graphics::Surface *decodeFrame(Common::SeekableReadStream
> &stream);
> +       Graphics::PixelFormat getPixelFormat() const;
> +
> +private:
> +       Graphics::Surface *_surface;
> +       int _width, _height;
> +       int _bitsPerPixel;
> +};
> +
> +} // End of namespace Image
> +
> +#endif
> diff --git a/image/module.mk b/image/module.mk
> index 46129cb..ab0a2a9 100644
> --- a/image/module.mk
> +++ b/image/module.mk
> @@ -8,6 +8,7 @@ MODULE_OBJS := \
>         pict.o \
>         png.o \
>         tga.o \
> +       codecs/bmp_raw.o \
>         codecs/cdtoons.o \
>         codecs/cinepak.o \
>         codecs/indeo3.o \
>
>
> Commit: 231a02c759169a5c927018699e1533d267ea8372
>
> https://github.com/scummvm/scummvm/commit/231a02c759169a5c927018699e1533d267ea8372
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:32:06-08:00
>
> Commit Message:
> VIDEO: Use the bitmap header compression field for AVI codecs
>
> Changed paths:
>     video/avi_decoder.cpp
>
>
>
> diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
> index e9c6ef9..59ee72d 100644
> --- a/video/avi_decoder.cpp
> +++ b/video/avi_decoder.cpp
> @@ -74,18 +74,6 @@ namespace Video {
>  #define ID_PRMI MKTAG('P','R','M','I')
>  #define ID_STRN MKTAG('s','t','r','n')
>
> -// Codec tags
> -#define ID_RLE  MKTAG('R','L','E',' ')
> -#define ID_CRAM MKTAG('C','R','A','M')
> -#define ID_MSVC MKTAG('m','s','v','c')
> -#define ID_WHAM MKTAG('W','H','A','M')
> -#define ID_CVID MKTAG('c','v','i','d')
> -#define ID_IV32 MKTAG('i','v','3','2')
> -#define ID_DUCK MKTAG('D','U','C','K')
> -#define ID_DUCK2 MKTAG('d','u','c','k') // Some videos have DUCK tag in
> lowercase
> -#define ID_MPG2 MKTAG('m','p','g','2')
> -#define ID_MJPG MKTAG('m','j','p','g')
> -
>  // Stream Types
>  enum {
>         kStreamTypePaletteChange = MKTAG16('p', 'c'),
> @@ -266,9 +254,6 @@ void AVIDecoder::handleStreamHeader(uint32 size) {
>                 if (bmInfo.clrUsed == 0)
>                         bmInfo.clrUsed = 256;
>
> -               if (sHeader.streamHandler == 0)
> -                       sHeader.streamHandler = bmInfo.compression;
> -
>                 byte *initialPalette = 0;
>
>                 if (bmInfo.bitCount == 8) {
> @@ -770,30 +755,34 @@ bool AVIDecoder::AVIVideoTrack::rewind() {
>  }
>
>  Image::Codec *AVIDecoder::AVIVideoTrack::createCodec() {
> -       switch (_vidsHeader.streamHandler) {
> -       case ID_CRAM:
> -       case ID_MSVC:
> -       case ID_WHAM:
> -               return new Image::MSVideo1Decoder(_bmInfo.width,
> _bmInfo.height, _bmInfo.bitCount);
> -       case ID_RLE:
> +       switch (_bmInfo.compression) {
> +       case SWAP_CONSTANT_32(1):
>                 return new Image::MSRLEDecoder(_bmInfo.width,
> _bmInfo.height, _bmInfo.bitCount);
> -       case ID_CVID:
> +       case MKTAG('C','R','A','M'):
> +       case MKTAG('m','s','v','c'):
> +       case MKTAG('W','H','A','M'):
> +               return new Image::MSVideo1Decoder(_bmInfo.width,
> _bmInfo.height, _bmInfo.bitCount);
> +       case MKTAG('c','v','i','d'):
>                 return new Image::CinepakDecoder(_bmInfo.bitCount);
> -       case ID_IV32:
> +       case MKTAG('I','V','3','2'):
>                 return new Image::Indeo3Decoder(_bmInfo.width,
> _bmInfo.height);
>  #ifdef VIDEO_CODECS_TRUEMOTION1_H
> -       case ID_DUCK:
> -       case ID_DUCK2:
> +       case MKTAG('D','U','C','K'):
> +       case MKTAG('d','u','c','k'):
>                 return new Image::TrueMotion1Decoder(_bmInfo.width,
> _bmInfo.height);
>  #endif
>  #ifdef USE_MPEG2
> -       case ID_MPG2:
> +       case MKTAG('m','p','g','2'):
>                 return new Image::MPEGDecoder();
>  #endif
> -       case ID_MJPG:
> +       case MKTAG('M','J','P','G'):
> +       case MKTAG('m','j','p','g'):
>                 return new Image::MJPEGDecoder();
>         default:
> -               warning("Unknown/Unhandled compression format \'%s\'",
> tag2str(_vidsHeader.streamHandler));
> +               if (_bmInfo.compression & 0x00FFFFFF)
> +                       warning("Unknown/Unhandled AVI compression format
> \'%s\'", tag2str(_bmInfo.compression));
> +               else
> +                       warning("Unknown/Unhandled AVI compression format
> %d", SWAP_BYTES_32(_bmInfo.compression));
>         }
>
>         return 0;
>
>
> Commit: 05e9ff136ae059622a0262380be7bc6460d204f0
>
> https://github.com/scummvm/scummvm/commit/05e9ff136ae059622a0262380be7bc6460d204f0
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:32:06-08:00
>
> Commit Message:
> IMAGE: Share the same pool of codecs between bitmap and AVI
>
> Changed paths:
>   A image/codecs/codec.cpp
>     image/bmp.cpp
>     image/codecs/codec.h
>     image/module.mk
>     video/avi_decoder.cpp
>
>
>
> diff --git a/image/bmp.cpp b/image/bmp.cpp
> index eb8e300..cdf6e40 100644
> --- a/image/bmp.cpp
> +++ b/image/bmp.cpp
> @@ -27,7 +27,7 @@
>  #include "common/textconsole.h"
>  #include "graphics/pixelformat.h"
>  #include "graphics/surface.h"
> -#include "image/codecs/bmp_raw.h"
> +#include "image/codecs/codec.h"
>
>  namespace Image {
>
> @@ -93,13 +93,7 @@ bool
> BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
>                 return false;
>         }
>
> -       uint32 compression = stream.readUint32LE();
> -
> -       if (compression != 0) {
> -               warning("Compressed bitmaps not supported");
> -               return false;
> -       }
> -
> +       uint32 compression = stream.readUint32BE();
>         uint32 imageSize = stream.readUint32LE();
>         /* uint32 pixelsPerMeterX = */ stream.readUint32LE();
>         /* uint32 pixelsPerMeterY = */ stream.readUint32LE();
> @@ -120,11 +114,15 @@ bool
> BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
>                 }
>         }
>
> +       // Create the codec (it will warn about unhandled compression)
> +       _codec = createBitmapCodec(compression, width, height,
> bitsPerPixel);
> +       if (!_codec)
> +               return false;
> +
>         // Grab the frame data
>         Common::SeekableSubReadStream subStream(&stream, imageOffset,
> imageOffset + imageSize);
>
>         // We only support raw bitmaps for now
> -       _codec = new BitmapRawDecoder(width, height, bitsPerPixel);
>         _surface = _codec->decodeFrame(subStream);
>
>         return true;
> diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp
> new file mode 100644
> index 0000000..7d4e343
> --- /dev/null
> +++ b/image/codecs/codec.cpp
> @@ -0,0 +1,77 @@
> +/* ScummVM - Graphic Adventure Engine
> + *
> + * ScummVM is the legal property of its developers, whose names
> + * are too numerous to list here. Please refer to the COPYRIGHT
> + * file distributed with this source distribution.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> +
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> +
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA.
> + *
> + */
> +
> +#include "common/scummsys.h"
> +
> +#include "image/codecs/codec.h"
> +
> +#include "image/codecs/bmp_raw.h"
> +#include "image/codecs/cinepak.h"
> +#include "image/codecs/indeo3.h"
> +#include "image/codecs/mjpeg.h"
> +#include "image/codecs/mpeg.h"
> +#include "image/codecs/msvideo1.h"
> +#include "image/codecs/msrle.h"
> +#include "image/codecs/truemotion1.h"
> +
> +#include "common/endian.h"
> +#include "common/textconsole.h"
> +
> +namespace Image {
> +
> +Codec *createBitmapCodec(uint32 tag, int width, int height, int
> bitsPerPixel) {
> +       switch (tag) {
> +       case SWAP_CONSTANT_32(0):
> +               return new BitmapRawDecoder(width, height, bitsPerPixel);
> +       case SWAP_CONSTANT_32(1):
> +               return new MSRLEDecoder(width, height, bitsPerPixel);
> +       case MKTAG('C','R','A','M'):
> +       case MKTAG('m','s','v','c'):
> +       case MKTAG('W','H','A','M'):
> +               return new MSVideo1Decoder(width, height, bitsPerPixel);
> +       case MKTAG('c','v','i','d'):
> +               return new CinepakDecoder(bitsPerPixel);
> +       case MKTAG('I','V','3','2'):
> +               return new Indeo3Decoder(width, height);
> +#ifdef VIDEO_CODECS_TRUEMOTION1_H
> +       case MKTAG('D','U','C','K'):
> +       case MKTAG('d','u','c','k'):
> +               return new TrueMotion1Decoder(width, height);
> +#endif
> +#ifdef USE_MPEG2
> +       case MKTAG('m','p','g','2'):
> +               return new MPEGDecoder();
> +#endif
> +       case MKTAG('M','J','P','G'):
> +       case MKTAG('m','j','p','g'):
> +               return new MJPEGDecoder();
> +       default:
> +               if (tag & 0x00FFFFFF)
> +                       warning("Unknown BMP/AVI compression format
> \'%s\'", tag2str(tag));
> +               else
> +                       warning("Unknown BMP/AVI compression format %d",
> SWAP_BYTES_32(tag));
> +       }
> +
> +       return 0;
> +}
> +
> +} // End of namespace Image
> diff --git a/image/codecs/codec.h b/image/codecs/codec.h
> index 092f975..87d6d6b 100644
> --- a/image/codecs/codec.h
> +++ b/image/codecs/codec.h
> @@ -84,6 +84,11 @@ public:
>         virtual bool hasDirtyPalette() const { return false; }
>  };
>
> +/**
> + * Create a codec given a bitmap/AVI compression tag.
> + */
> +Codec *createBitmapCodec(uint32 tag, int width, int height, int
> bitsPerPixel);
> +
>  } // End of namespace Image
>
>  #endif
> diff --git a/image/module.mk b/image/module.mk
> index ab0a2a9..fdf52ec 100644
> --- a/image/module.mk
> +++ b/image/module.mk
> @@ -11,6 +11,7 @@ MODULE_OBJS := \
>         codecs/bmp_raw.o \
>         codecs/cdtoons.o \
>         codecs/cinepak.o \
> +       codecs/codec.o \
>         codecs/indeo3.o \
>         codecs/mjpeg.o \
>         codecs/msrle.o \
> diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
> index 59ee72d..0697d89 100644
> --- a/video/avi_decoder.cpp
> +++ b/video/avi_decoder.cpp
> @@ -34,13 +34,7 @@
>  #include "audio/decoders/raw.h"
>
>  // Video Codecs
> -#include "image/codecs/cinepak.h"
> -#include "image/codecs/indeo3.h"
> -#include "image/codecs/mjpeg.h"
> -#include "image/codecs/mpeg.h"
> -#include "image/codecs/msvideo1.h"
> -#include "image/codecs/msrle.h"
> -#include "image/codecs/truemotion1.h"
> +#include "image/codecs/codec.h"
>
>  namespace Video {
>
> @@ -755,37 +749,7 @@ bool AVIDecoder::AVIVideoTrack::rewind() {
>  }
>
>  Image::Codec *AVIDecoder::AVIVideoTrack::createCodec() {
> -       switch (_bmInfo.compression) {
> -       case SWAP_CONSTANT_32(1):
> -               return new Image::MSRLEDecoder(_bmInfo.width,
> _bmInfo.height, _bmInfo.bitCount);
> -       case MKTAG('C','R','A','M'):
> -       case MKTAG('m','s','v','c'):
> -       case MKTAG('W','H','A','M'):
> -               return new Image::MSVideo1Decoder(_bmInfo.width,
> _bmInfo.height, _bmInfo.bitCount);
> -       case MKTAG('c','v','i','d'):
> -               return new Image::CinepakDecoder(_bmInfo.bitCount);
> -       case MKTAG('I','V','3','2'):
> -               return new Image::Indeo3Decoder(_bmInfo.width,
> _bmInfo.height);
> -#ifdef VIDEO_CODECS_TRUEMOTION1_H
> -       case MKTAG('D','U','C','K'):
> -       case MKTAG('d','u','c','k'):
> -               return new Image::TrueMotion1Decoder(_bmInfo.width,
> _bmInfo.height);
> -#endif
> -#ifdef USE_MPEG2
> -       case MKTAG('m','p','g','2'):
> -               return new Image::MPEGDecoder();
> -#endif
> -       case MKTAG('M','J','P','G'):
> -       case MKTAG('m','j','p','g'):
> -               return new Image::MJPEGDecoder();
> -       default:
> -               if (_bmInfo.compression & 0x00FFFFFF)
> -                       warning("Unknown/Unhandled AVI compression format
> \'%s\'", tag2str(_bmInfo.compression));
> -               else
> -                       warning("Unknown/Unhandled AVI compression format
> %d", SWAP_BYTES_32(_bmInfo.compression));
> -       }
> -
> -       return 0;
> +       return Image::createBitmapCodec(_bmInfo.compression,
> _bmInfo.width, _bmInfo.height, _bmInfo.bitCount);
>  }
>
>  void AVIDecoder::AVIVideoTrack::forceTrackEnd() {
>
>
> Commit: acec700c11040320122ed86cd5f1dad20de2d2a8
>
> https://github.com/scummvm/scummvm/commit/acec700c11040320122ed86cd5f1dad20de2d2a8
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:32:06-08:00
>
> Commit Message:
> IMAGE: Share the same pool of codecs between PICT and QuickTime
>
> Changed paths:
>     image/codecs/codec.cpp
>     image/codecs/codec.h
>     image/pict.cpp
>     video/qt_decoder.cpp
>
>
>
> diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp
> index 7d4e343..530fb3b 100644
> --- a/image/codecs/codec.cpp
> +++ b/image/codecs/codec.cpp
> @@ -24,13 +24,19 @@
>
>  #include "image/codecs/codec.h"
>
> +#include "image/jpeg.h"
>  #include "image/codecs/bmp_raw.h"
> +#include "image/codecs/cdtoons.h"
>  #include "image/codecs/cinepak.h"
>  #include "image/codecs/indeo3.h"
>  #include "image/codecs/mjpeg.h"
>  #include "image/codecs/mpeg.h"
>  #include "image/codecs/msvideo1.h"
>  #include "image/codecs/msrle.h"
> +#include "image/codecs/qtrle.h"
> +#include "image/codecs/rpza.h"
> +#include "image/codecs/smc.h"
> +#include "image/codecs/svq1.h"
>  #include "image/codecs/truemotion1.h"
>
>  #include "common/endian.h"
> @@ -74,4 +80,38 @@ Codec *createBitmapCodec(uint32 tag, int width, int
> height, int bitsPerPixel) {
>         return 0;
>  }
>
> +Codec *createQuickTimeCodec(uint32 tag, int width, int height, int
> bitsPerPixel) {
> +       switch (tag) {
> +       case MKTAG('c','v','i','d'):
> +               // Cinepak: As used by most Myst and all Riven videos as
> well as some Myst ME videos. "The Chief" videos also use this.
> +               return new CinepakDecoder(bitsPerPixel);
> +       case MKTAG('r','p','z','a'):
> +               // Apple Video ("Road Pizza"): Used by some Myst videos.
> +               return new RPZADecoder(width, height);
> +       case MKTAG('r','l','e',' '):
> +               // QuickTime RLE: Used by some Myst ME videos.
> +               return new QTRLEDecoder(width, height, bitsPerPixel);
> +       case MKTAG('s','m','c',' '):
> +               // Apple SMC: Used by some Myst videos.
> +               return new SMCDecoder(width, height);
> +       case MKTAG('S','V','Q','1'):
> +               // Sorenson Video 1: Used by some Myst ME videos.
> +               return new SVQ1Decoder(width, height);
> +       case MKTAG('S','V','Q','3'):
> +               // Sorenson Video 3: Used by some Myst ME videos.
> +               warning("Sorenson Video 3 not yet supported");
> +               break;
> +       case MKTAG('j','p','e','g'):
> +               // JPEG: Used by some Myst ME 10th Anniversary videos.
> +               return new JPEGDecoder();
> +       case MKTAG('Q','k','B','k'):
> +               // CDToons: Used by most of the Broderbund games.
> +               return new CDToonsDecoder(width, height);
> +       default:
> +               warning("Unsupported QuickTime codec \'%s\'",
> tag2str(tag));
> +       }
> +
> +       return 0;
> +}
> +
>  } // End of namespace Image
> diff --git a/image/codecs/codec.h b/image/codecs/codec.h
> index 87d6d6b..89c8ec9 100644
> --- a/image/codecs/codec.h
> +++ b/image/codecs/codec.h
> @@ -89,6 +89,11 @@ public:
>   */
>  Codec *createBitmapCodec(uint32 tag, int width, int height, int
> bitsPerPixel);
>
> +/**
> + * Create a codec given a QuickTime compression tag.
> + */
> +Codec *createQuickTimeCodec(uint32 tag, int width, int height, int
> bitsPerPixel);
> +
>  } // End of namespace Image
>
>  #endif
> diff --git a/image/pict.cpp b/image/pict.cpp
> index 07e657f..89f115d 100644
> --- a/image/pict.cpp
> +++ b/image/pict.cpp
> @@ -20,8 +20,8 @@
>   *
>   */
>
> -#include "image/jpeg.h"
>  #include "image/pict.h"
> +#include "image/codecs/codec.h"
>
>  #include "common/debug.h"
>  #include "common/endian.h"
> @@ -229,7 +229,7 @@ bool
> PICTDecoder::loadStream(Common::SeekableReadStream &stream) {
>
>         // NOTE: This is only a subset of the full PICT format.
>         //     - Only V2 (Extended) Images Supported
> -       //     - CompressedQuickTime (JPEG) compressed data is supported
> +       //     - CompressedQuickTime compressed data is supported
>         //     - DirectBitsRect/PackBitsRect compressed data is supported
>         for (uint32 opNum = 0; !stream.eos() && !stream.err() &&
> stream.pos() < stream.size() && _continueParsing; opNum++) {
>                 // PICT v2 opcodes are two bytes
> @@ -550,31 +550,37 @@ void
> PICTDecoder::decodeCompressedQuickTime(Common::SeekableReadStream &stream)
>         // Now we've reached the image descriptor, so read the relevant
> data from that
>         uint32 idStart = stream.pos();
>         uint32 idSize = stream.readUint32BE();
> -       uint32 codec = stream.readUint32BE();
> -       stream.skip(36); // miscellaneous stuff
> -       uint32 jpegSize = stream.readUint32BE();
> +       uint32 codecTag = stream.readUint32BE();
> +       stream.skip(24); // miscellaneous stuff
> +       uint16 width = stream.readUint16BE();
> +       uint16 height = stream.readUint16BE();
> +       stream.skip(8); // resolution, dpi
> +       uint32 imageSize = stream.readUint32BE();
> +       stream.skip(34);
> +       uint16 bitsPerPixel = stream.readUint16BE();
>         stream.skip(idSize - (stream.pos() - idStart)); // more useless
> stuff
>
> -       if (codec != MKTAG('j', 'p', 'e', 'g'))
> -               error("Unhandled CompressedQuickTime format '%s'",
> tag2str(codec));
> +       Common::SeekableSubReadStream imageStream(&stream, stream.pos(),
> stream.pos() + imageSize);
>
> -       Common::SeekableSubReadStream jpegStream(&stream, stream.pos(),
> stream.pos() + jpegSize);
> +       Codec *codec = createQuickTimeCodec(codecTag, width, height,
> bitsPerPixel);
> +       if (!codec)
> +               error("Unhandled CompressedQuickTime format");
>
> -       JPEGDecoder jpeg;
> -       if (!jpeg.loadStream(jpegStream))
> -               error("PICTDecoder::decodeCompressedQuickTime(): Could not
> decode JPEG data");
> +       const Graphics::Surface *surface = codec->decodeFrame(imageStream);
>
> -       const Graphics::Surface *jpegSurface = jpeg.getSurface();
> +       if (!surface)
> +               error("PICTDecoder::decodeCompressedQuickTime(): Could not
> decode data");
>
>         if (!_outputSurface) {
>                 _outputSurface = new Graphics::Surface();
> -               _outputSurface->create(_imageRect.width(),
> _imageRect.height(), jpegSurface->format);
> +               _outputSurface->create(_imageRect.width(),
> _imageRect.height(), surface->format);
>         }
>
> -       for (uint16 y = 0; y < jpegSurface->h; y++)
> -               memcpy(_outputSurface->getBasePtr(0 + xOffset, y +
> yOffset), jpegSurface->getBasePtr(0, y), jpegSurface->w *
> jpegSurface->format.bytesPerPixel);
> +       for (uint16 y = 0; y < surface->h; y++)
> +               memcpy(_outputSurface->getBasePtr(0 + xOffset, y +
> yOffset), surface->getBasePtr(0, y), surface->w *
> surface->format.bytesPerPixel);
>
>         stream.seek(startPos + dataSize);
> +       delete codec;
>  }
>
>  } // End of namespace Image
> diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
> index cd36796..0a29692 100644
> --- a/video/qt_decoder.cpp
> +++ b/video/qt_decoder.cpp
> @@ -39,13 +39,7 @@
>  #include "common/util.h"
>
>  // Video codecs
> -#include "image/codecs/cinepak.h"
> -#include "image/jpeg.h"
> -#include "image/codecs/qtrle.h"
> -#include "image/codecs/rpza.h"
> -#include "image/codecs/smc.h"
> -#include "image/codecs/cdtoons.h"
> -#include "image/codecs/svq1.h"
> +#include "image/codecs/codec.h"
>
>  namespace Video {
>
> @@ -270,42 +264,7 @@ QuickTimeDecoder::VideoSampleDesc::~VideoSampleDesc()
> {
>  }
>
>  void QuickTimeDecoder::VideoSampleDesc::initCodec() {
> -       switch (_codecTag) {
> -       case MKTAG('c','v','i','d'):
> -               // Cinepak: As used by most Myst and all Riven videos as
> well as some Myst ME videos. "The Chief" videos also use this.
> -               _videoCodec = new Image::CinepakDecoder(_bitsPerSample &
> 0x1f);
> -               break;
> -       case MKTAG('r','p','z','a'):
> -               // Apple Video ("Road Pizza"): Used by some Myst videos.
> -               _videoCodec = new Image::RPZADecoder(_parentTrack->width,
> _parentTrack->height);
> -               break;
> -       case MKTAG('r','l','e',' '):
> -               // QuickTime RLE: Used by some Myst ME videos.
> -               _videoCodec = new Image::QTRLEDecoder(_parentTrack->width,
> _parentTrack->height, _bitsPerSample & 0x1f);
> -               break;
> -       case MKTAG('s','m','c',' '):
> -               // Apple SMC: Used by some Myst videos.
> -               _videoCodec = new Image::SMCDecoder(_parentTrack->width,
> _parentTrack->height);
> -               break;
> -       case MKTAG('S','V','Q','1'):
> -               // Sorenson Video 1: Used by some Myst ME videos.
> -               _videoCodec = new Image::SVQ1Decoder(_parentTrack->width,
> _parentTrack->height);
> -               break;
> -       case MKTAG('S','V','Q','3'):
> -               // Sorenson Video 3: Used by some Myst ME videos.
> -               warning("Sorenson Video 3 not yet supported");
> -               break;
> -       case MKTAG('j','p','e','g'):
> -               // JPEG: Used by some Myst ME 10th Anniversary videos.
> -               _videoCodec = new Image::JPEGDecoder();
> -               break;
> -       case MKTAG('Q','k','B','k'):
> -               // CDToons: Used by most of the Broderbund games.
> -               _videoCodec = new
> Image::CDToonsDecoder(_parentTrack->width, _parentTrack->height);
> -               break;
> -       default:
> -               warning("Unsupported codec \'%s\'", tag2str(_codecTag));
> -       }
> +       _videoCodec = Image::createQuickTimeCodec(_codecTag,
> _parentTrack->width, _parentTrack->height, _bitsPerSample & 0x1f);
>  }
>
>  QuickTimeDecoder::AudioTrackHandler::AudioTrackHandler(QuickTimeDecoder
> *decoder, QuickTimeAudioTrack *audioTrack)
>
>
> Commit: 57aa610f0c6199fbe41fc5de495356aa29fae6b8
>
> https://github.com/scummvm/scummvm/commit/57aa610f0c6199fbe41fc5de495356aa29fae6b8
> Author: Matthew Hoops (clone2727 at gmail.com)
> Date: 2014-02-27T21:32:06-08:00
>
> Commit Message:
> IMAGE: Update comments
>
> Changed paths:
>     image/codecs/bmp_raw.h
>     image/codecs/cdtoons.h
>     image/codecs/cinepak.h
>     image/codecs/codec.h
>     image/codecs/indeo3.h
>     image/codecs/mjpeg.h
>     image/codecs/mpeg.h
>     image/codecs/msrle.h
>     image/codecs/msvideo1.h
>     image/codecs/qtrle.h
>     image/codecs/rpza.h
>     image/codecs/smc.h
>     image/codecs/svq1.h
>     image/codecs/truemotion1.h
>     image/jpeg.h
>
>
>
> diff --git a/image/codecs/bmp_raw.h b/image/codecs/bmp_raw.h
> index d589d7e..99509a1 100644
> --- a/image/codecs/bmp_raw.h
> +++ b/image/codecs/bmp_raw.h
> @@ -30,8 +30,7 @@ namespace Image {
>  /**
>   * Bitmap raw image decoder.
>   *
> - * Used in image:
> - *  - BitmapDecoder
> + * Used by BMP/AVI.
>   */
>  class BitmapRawDecoder : public Codec {
>  public:
> diff --git a/image/codecs/cdtoons.h b/image/codecs/cdtoons.h
> index a75ce55..889ec3e 100644
> --- a/image/codecs/cdtoons.h
> +++ b/image/codecs/cdtoons.h
> @@ -41,8 +41,7 @@ struct CDToonsBlock {
>  /**
>   * Broderbund CDToons decoder.
>   *
> - * Used in video:
> - *  - QuickTimeDecoder
> + * Used by PICT/QuickTime.
>   */
>  class CDToonsDecoder : public Codec {
>  public:
> diff --git a/image/codecs/cinepak.h b/image/codecs/cinepak.h
> index 985fc91..e9cd437 100644
> --- a/image/codecs/cinepak.h
> +++ b/image/codecs/cinepak.h
> @@ -62,9 +62,7 @@ struct CinepakFrame {
>  /**
>   * Cinepak decoder.
>   *
> - * Used in video:
> - *  - AVIDecoder
> - *  - QuickTimeDecoder
> + * Used by BMP/AVI and PICT/QuickTime.
>   */
>  class CinepakDecoder : public Codec {
>  public:
> diff --git a/image/codecs/codec.h b/image/codecs/codec.h
> index 89c8ec9..d87758e 100644
> --- a/image/codecs/codec.h
> +++ b/image/codecs/codec.h
> @@ -44,6 +44,10 @@ namespace Image {
>   * An ImageDecoder can always be a Codec, but a Codec may not necessarily
>   * be able to be an ImageDecoder.
>   *
> + * Used in image:
> + *  - BitmapDecoder
> + *  - PICTDecoder
> + *
>   * Used in video:
>   *  - AVIDecoder
>   *  - QuickTimeDecoder
> diff --git a/image/codecs/indeo3.h b/image/codecs/indeo3.h
> index f1b406d..0ff0265 100644
> --- a/image/codecs/indeo3.h
> +++ b/image/codecs/indeo3.h
> @@ -39,8 +39,9 @@ namespace Image {
>  /**
>   * Intel Indeo 3 decoder.
>   *
> + * Used by BMP/AVI.
> + *
>   * Used in video:
> - *  - AVIDecoder
>   *  - VMDDecoder
>   */
>  class Indeo3Decoder : public Codec {
> diff --git a/image/codecs/mjpeg.h b/image/codecs/mjpeg.h
> index 904b89d..2db736c 100644
> --- a/image/codecs/mjpeg.h
> +++ b/image/codecs/mjpeg.h
> @@ -39,8 +39,7 @@ namespace Image {
>  /**
>   * Motion JPEG decoder.
>   *
> - * Used in video:
> - *  - AVIDecoder
> + * Used by BMP/AVI.
>   */
>  class MJPEGDecoder : public Codec {
>  public:
> diff --git a/image/codecs/mpeg.h b/image/codecs/mpeg.h
> index 7f231dd..6cb10f2 100644
> --- a/image/codecs/mpeg.h
> +++ b/image/codecs/mpeg.h
> @@ -62,10 +62,13 @@ namespace Graphics {
>  struct Surface;
>  }
>
> -namespace Image {
> -
> -// MPEG 1/2 video decoder
> +namespace Image {
>
> +/**
> + * MPEG 1/2 video decoder.
> + *
> + * Used by BMP/AVI.
> + */
>  class MPEGDecoder : public Codec {
>  public:
>         MPEGDecoder();
> diff --git a/image/codecs/msrle.h b/image/codecs/msrle.h
> index a65ef1c..116b1bc 100644
> --- a/image/codecs/msrle.h
> +++ b/image/codecs/msrle.h
> @@ -30,8 +30,7 @@ namespace Image {
>  /**
>   * Microsoft Run-Length Encoding decoder.
>   *
> - * Used in video:
> - *  - AVIDecoder
> + * Used by BMP/AVI.
>   */
>  class MSRLEDecoder : public Codec {
>  public:
> diff --git a/image/codecs/msvideo1.h b/image/codecs/msvideo1.h
> index bdee5ac..2a6dcd0 100644
> --- a/image/codecs/msvideo1.h
> +++ b/image/codecs/msvideo1.h
> @@ -30,8 +30,7 @@ namespace Image {
>  /**
>   * Microsoft Video 1 decoder.
>   *
> - * Used in video:
> - *  - AVIDecoder
> + * Used by BMP/AVI.
>   */
>  class MSVideo1Decoder : public Codec {
>  public:
> diff --git a/image/codecs/qtrle.h b/image/codecs/qtrle.h
> index 7ef8953..b44a46c 100644
> --- a/image/codecs/qtrle.h
> +++ b/image/codecs/qtrle.h
> @@ -31,8 +31,7 @@ namespace Image {
>  /**
>   * QuickTime Run-Length Encoding decoder.
>   *
> - * Used in video:
> - *  - QuickTimeDecoder
> + * Used by PICT/QuickTime.
>   */
>  class QTRLEDecoder : public Codec {
>  public:
> diff --git a/image/codecs/rpza.h b/image/codecs/rpza.h
> index 62f4c02..d1dbbdb 100644
> --- a/image/codecs/rpza.h
> +++ b/image/codecs/rpza.h
> @@ -31,8 +31,7 @@ namespace Image {
>  /**
>   * Apple RPZA decoder.
>   *
> - * Used in video:
> - *  - QuickTimeDecoder
> + * Used by PICT/QuickTime.
>   */
>  class RPZADecoder : public Codec {
>  public:
> diff --git a/image/codecs/smc.h b/image/codecs/smc.h
> index 579d629..655ff0a 100644
> --- a/image/codecs/smc.h
> +++ b/image/codecs/smc.h
> @@ -37,8 +37,7 @@ enum {
>  /**
>   * Apple SMC decoder.
>   *
> - * Used in video:
> - *  - QuickTimeDecoder
> + * Used by PICT/QuickTime.
>   */
>  class SMCDecoder : public Codec {
>  public:
> diff --git a/image/codecs/svq1.h b/image/codecs/svq1.h
> index 687f761..236b810 100644
> --- a/image/codecs/svq1.h
> +++ b/image/codecs/svq1.h
> @@ -36,8 +36,7 @@ namespace Image {
>  /**
>   * Sorenson Vector Quantizer 1 decoder.
>   *
> - * Used in video:
> - *  - QuickTimeDecoder
> + * Used by PICT/QuickTime.
>   */
>  class SVQ1Decoder : public Codec {
>  public:
> diff --git a/image/codecs/truemotion1.h b/image/codecs/truemotion1.h
> index bb87dbc..12570f0 100644
> --- a/image/codecs/truemotion1.h
> +++ b/image/codecs/truemotion1.h
> @@ -35,8 +35,7 @@ namespace Image {
>  /**
>   * Duck TrueMotion 1 decoder.
>   *
> - * Used in video:
> - *  - AVIDecoder
> + * Used by BMP/AVI.
>   */
>  class TrueMotion1Decoder : public Codec {
>  public:
> diff --git a/image/jpeg.h b/image/jpeg.h
> index dea799c..ac0d22d 100644
> --- a/image/jpeg.h
> +++ b/image/jpeg.h
> @@ -27,11 +27,7 @@
>   *  - mohawk
>   *  - wintermute
>   *
> - * Used in image:
> - *  - PICTDecoder
> - *
> - * Used in video:
> - *  - QuickTimeDecoder
> + * Used by PICT/QuickTime.
>   */
>
>  #ifndef IMAGE_JPEG_H
>
>
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> Scummvm-cvs-logs mailing list
> Scummvm-cvs-logs at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scummvm-cvs-logs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20140312/db2a2db2/attachment.html>


More information about the Scummvm-devel mailing list