From 806ccf5d25ebe337103942cdb6b5cf8800de115a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 23 Jan 2011 17:14:43 +0000 Subject: GRAPHICS: Move graphics/video/ to video/. Step 1/2 svn-id: r55473 --- graphics/video/avi_decoder.cpp | 459 ---- graphics/video/avi_decoder.h | 225 -- graphics/video/codecs/cdtoons.cpp | 450 ---- graphics/video/codecs/cdtoons.h | 70 - graphics/video/codecs/cinepak.cpp | 292 --- graphics/video/codecs/cinepak.h | 81 - graphics/video/codecs/codec.h | 53 - graphics/video/codecs/indeo3.cpp | 3495 ------------------------------- graphics/video/codecs/indeo3.h | 94 - graphics/video/codecs/mjpeg.cpp | 70 - graphics/video/codecs/mjpeg.h | 57 - graphics/video/codecs/msrle.cpp | 134 -- graphics/video/codecs/msrle.h | 51 - graphics/video/codecs/msvideo1.cpp | 140 -- graphics/video/codecs/msvideo1.h | 52 - graphics/video/codecs/qdm2.cpp | 3287 ----------------------------- graphics/video/codecs/qdm2.h | 54 - graphics/video/codecs/qdm2data.h | 531 ----- graphics/video/codecs/qtrle.cpp | 421 ---- graphics/video/codecs/qtrle.h | 58 - graphics/video/codecs/rpza.cpp | 214 -- graphics/video/codecs/rpza.h | 49 - graphics/video/codecs/smc.cpp | 391 ---- graphics/video/codecs/smc.h | 59 - graphics/video/codecs/truemotion1.cpp | 418 ---- graphics/video/codecs/truemotion1.h | 106 - graphics/video/codecs/truemotion1data.h | 832 -------- graphics/video/coktel_decoder.cpp | 2757 ------------------------ graphics/video/coktel_decoder.h | 520 ----- graphics/video/dxa_decoder.cpp | 562 ----- graphics/video/dxa_decoder.h | 101 - graphics/video/flic_decoder.cpp | 323 --- graphics/video/flic_decoder.h | 101 - graphics/video/mpeg_player.cpp | 625 ------ graphics/video/mpeg_player.h | 172 -- graphics/video/qt_decoder.cpp | 1488 ------------- graphics/video/qt_decoder.h | 278 --- graphics/video/smk_decoder.cpp | 902 -------- graphics/video/smk_decoder.h | 143 -- graphics/video/video_decoder.cpp | 141 -- graphics/video/video_decoder.h | 290 --- 41 files changed, 20546 deletions(-) delete mode 100644 graphics/video/avi_decoder.cpp delete mode 100644 graphics/video/avi_decoder.h delete mode 100644 graphics/video/codecs/cdtoons.cpp delete mode 100644 graphics/video/codecs/cdtoons.h delete mode 100644 graphics/video/codecs/cinepak.cpp delete mode 100644 graphics/video/codecs/cinepak.h delete mode 100644 graphics/video/codecs/codec.h delete mode 100644 graphics/video/codecs/indeo3.cpp delete mode 100644 graphics/video/codecs/indeo3.h delete mode 100644 graphics/video/codecs/mjpeg.cpp delete mode 100644 graphics/video/codecs/mjpeg.h delete mode 100644 graphics/video/codecs/msrle.cpp delete mode 100644 graphics/video/codecs/msrle.h delete mode 100644 graphics/video/codecs/msvideo1.cpp delete mode 100644 graphics/video/codecs/msvideo1.h delete mode 100644 graphics/video/codecs/qdm2.cpp delete mode 100644 graphics/video/codecs/qdm2.h delete mode 100644 graphics/video/codecs/qdm2data.h delete mode 100644 graphics/video/codecs/qtrle.cpp delete mode 100644 graphics/video/codecs/qtrle.h delete mode 100644 graphics/video/codecs/rpza.cpp delete mode 100644 graphics/video/codecs/rpza.h delete mode 100644 graphics/video/codecs/smc.cpp delete mode 100644 graphics/video/codecs/smc.h delete mode 100644 graphics/video/codecs/truemotion1.cpp delete mode 100644 graphics/video/codecs/truemotion1.h delete mode 100644 graphics/video/codecs/truemotion1data.h delete mode 100644 graphics/video/coktel_decoder.cpp delete mode 100644 graphics/video/coktel_decoder.h delete mode 100644 graphics/video/dxa_decoder.cpp delete mode 100644 graphics/video/dxa_decoder.h delete mode 100644 graphics/video/flic_decoder.cpp delete mode 100644 graphics/video/flic_decoder.h delete mode 100644 graphics/video/mpeg_player.cpp delete mode 100644 graphics/video/mpeg_player.h delete mode 100644 graphics/video/qt_decoder.cpp delete mode 100644 graphics/video/qt_decoder.h delete mode 100644 graphics/video/smk_decoder.cpp delete mode 100644 graphics/video/smk_decoder.h delete mode 100644 graphics/video/video_decoder.cpp delete mode 100644 graphics/video/video_decoder.h (limited to 'graphics/video') diff --git a/graphics/video/avi_decoder.cpp b/graphics/video/avi_decoder.cpp deleted file mode 100644 index ed0b063147..0000000000 --- a/graphics/video/avi_decoder.cpp +++ /dev/null @@ -1,459 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "common/endian.h" -#include "common/file.h" -#include "common/stream.h" -#include "common/events.h" - -#include "sound/audiostream.h" -#include "sound/mixer.h" - -#include "graphics/video/avi_decoder.h" - -// Audio Codecs -#include "sound/decoders/adpcm.h" -#include "sound/decoders/raw.h" - -// Video Codecs -#include "graphics/video/codecs/cinepak.h" -#include "graphics/video/codecs/indeo3.h" -#include "graphics/video/codecs/msvideo1.h" -#include "graphics/video/codecs/msrle.h" -#include "graphics/video/codecs/truemotion1.h" - -namespace Graphics { - -/* -static byte char2num(char c) { - return (c >= 48 && c <= 57) ? c - 48 : 0; -} - -static byte getStreamNum(uint32 tag) { - return char2num((char)(tag >> 24)) * 16 + char2num((char)(tag >> 16)); -} -*/ - -static uint16 getStreamType(uint32 tag) { - return tag & 0xffff; -} - -AviDecoder::AviDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : _mixer(mixer) { - _soundType = soundType; - - _videoCodec = NULL; - _decodedHeader = false; - _audStream = NULL; - _fileStream = NULL; - _audHandle = new Audio::SoundHandle(); - _dirtyPalette = false; - memset(_palette, 0, sizeof(_palette)); - memset(&_wvInfo, 0, sizeof(PCMWAVEFORMAT)); - memset(&_bmInfo, 0, sizeof(BITMAPINFOHEADER)); - memset(&_vidsHeader, 0, sizeof(AVIStreamHeader)); - memset(&_audsHeader, 0, sizeof(AVIStreamHeader)); - memset(&_ixInfo, 0, sizeof(AVIOLDINDEX)); -} - -AviDecoder::~AviDecoder() { - close(); - delete _audHandle; -} - -void AviDecoder::runHandle(uint32 tag) { - assert (_fileStream); - if (_fileStream->eos()) - return; - - debug (3, "Decoding tag %s", tag2str(tag)); - - switch (tag) { - case ID_RIFF: - /*_filesize = */_fileStream->readUint32LE(); - if (_fileStream->readUint32BE() != ID_AVI) - error("RIFF file is not an AVI video"); - break; - case ID_LIST: - handleList(); - break; - case ID_AVIH: - _header.size = _fileStream->readUint32LE(); - _header.microSecondsPerFrame = _fileStream->readUint32LE(); - _header.maxBytesPerSecond = _fileStream->readUint32LE(); - _header.padding = _fileStream->readUint32LE(); - _header.flags = _fileStream->readUint32LE(); - _header.totalFrames = _fileStream->readUint32LE(); - _header.initialFrames = _fileStream->readUint32LE(); - _header.streams = _fileStream->readUint32LE(); - _header.bufferSize = _fileStream->readUint32LE(); - _header.width = _fileStream->readUint32LE(); - _header.height = _fileStream->readUint32LE(); - //Ignore 16 bytes of reserved data - _fileStream->skip(16); - break; - case ID_STRH: - handleStreamHeader(); - break; - case ID_STRD: // Extra stream info, safe to ignore - case ID_VEDT: // Unknown, safe to ignore - case ID_JUNK: // Alignment bytes, should be ignored - { - uint32 junkSize = _fileStream->readUint32LE(); - _fileStream->skip(junkSize + (junkSize & 1)); // Alignment - } break; - case ID_IDX1: - _ixInfo.size = _fileStream->readUint32LE(); - _ixInfo.indices = new AVIOLDINDEX::Index[_ixInfo.size / 16]; - debug (0, "%d Indices", (_ixInfo.size / 16)); - for (uint32 i = 0; i < (_ixInfo.size / 16); i++) { - _ixInfo.indices[i].id = _fileStream->readUint32BE(); - _ixInfo.indices[i].flags = _fileStream->readUint32LE(); - _ixInfo.indices[i].offset = _fileStream->readUint32LE(); - _ixInfo.indices[i].size = _fileStream->readUint32LE(); - debug (0, "Index %d == Tag \'%s\', Offset = %d, Size = %d", i, tag2str(_ixInfo.indices[i].id), _ixInfo.indices[i].offset, _ixInfo.indices[i].size); - } - break; - default: - error ("Unknown tag \'%s\' found", tag2str(tag)); - } -} - -void AviDecoder::handleList() { - uint32 listSize = _fileStream->readUint32LE() - 4; // Subtract away listType's 4 bytes - uint32 listType = _fileStream->readUint32BE(); - uint32 curPos = _fileStream->pos(); - - debug (0, "Found LIST of type %s", tag2str(listType)); - - while ((_fileStream->pos() - curPos) < listSize) - runHandle(_fileStream->readUint32BE()); - - // We now have all the header data - if (listType == ID_HDRL) - _decodedHeader = true; -} - -void AviDecoder::handleStreamHeader() { - AVIStreamHeader sHeader; - sHeader.size = _fileStream->readUint32LE(); - sHeader.streamType = _fileStream->readUint32BE(); - if (sHeader.streamType == ID_MIDS || sHeader.streamType == ID_TXTS) - error ("Unhandled MIDI/Text stream"); - sHeader.streamHandler = _fileStream->readUint32BE(); - sHeader.flags = _fileStream->readUint32LE(); - sHeader.priority = _fileStream->readUint16LE(); - sHeader.language = _fileStream->readUint16LE(); - sHeader.initialFrames = _fileStream->readUint32LE(); - sHeader.scale = _fileStream->readUint32LE(); - sHeader.rate = _fileStream->readUint32LE(); - sHeader.start = _fileStream->readUint32LE(); - sHeader.length = _fileStream->readUint32LE(); - sHeader.bufferSize = _fileStream->readUint32LE(); - sHeader.quality = _fileStream->readUint32LE(); - sHeader.sampleSize = _fileStream->readUint32LE(); - - _fileStream->skip(sHeader.size - 48); // Skip over the remainder of the chunk (frame) - - if (_fileStream->readUint32BE() != ID_STRF) - error("Could not find STRF tag"); - uint32 strfSize = _fileStream->readUint32LE(); - uint32 startPos = _fileStream->pos(); - - if (sHeader.streamType == ID_VIDS) { - _vidsHeader = sHeader; - - _bmInfo.size = _fileStream->readUint32LE(); - _bmInfo.width = _fileStream->readUint32LE(); - assert (_header.width == _bmInfo.width); - _bmInfo.height = _fileStream->readUint32LE(); - assert (_header.height == _bmInfo.height); - _bmInfo.planes = _fileStream->readUint16LE(); - _bmInfo.bitCount = _fileStream->readUint16LE(); - _bmInfo.compression = _fileStream->readUint32BE(); - _bmInfo.sizeImage = _fileStream->readUint32LE(); - _bmInfo.xPelsPerMeter = _fileStream->readUint32LE(); - _bmInfo.yPelsPerMeter = _fileStream->readUint32LE(); - _bmInfo.clrUsed = _fileStream->readUint32LE(); - _bmInfo.clrImportant = _fileStream->readUint32LE(); - - if (_bmInfo.bitCount == 8) { - if (_bmInfo.clrUsed == 0) - _bmInfo.clrUsed = 256; - - for (uint32 i = 0; i < _bmInfo.clrUsed; i++) { - _palette[i * 3 + 2] = _fileStream->readByte(); - _palette[i * 3 + 1] = _fileStream->readByte(); - _palette[i * 3] = _fileStream->readByte(); - _fileStream->readByte(); - } - - _dirtyPalette = true; - } - - if (!_vidsHeader.streamHandler) - _vidsHeader.streamHandler = _bmInfo.compression; - } else if (sHeader.streamType == ID_AUDS) { - _audsHeader = sHeader; - - _wvInfo.tag = _fileStream->readUint16LE(); - _wvInfo.channels = _fileStream->readUint16LE(); - _wvInfo.samplesPerSec = _fileStream->readUint32LE(); - _wvInfo.avgBytesPerSec = _fileStream->readUint32LE(); - _wvInfo.blockAlign = _fileStream->readUint16LE(); - _wvInfo.size = _fileStream->readUint16LE(); - - // AVI seems to treat the sampleSize as including the second - // channel as well, so divide for our sake. - if (_wvInfo.channels == 2) - _audsHeader.sampleSize /= 2; - } - - // Ensure that we're at the end of the chunk - _fileStream->seek(startPos + strfSize); -} - -bool AviDecoder::load(Common::SeekableReadStream *stream) { - close(); - - _fileStream = stream; - _decodedHeader = false; - - // Read chunks until we have decoded the header - while (!_decodedHeader) - runHandle(_fileStream->readUint32BE()); - - uint32 nextTag = _fileStream->readUint32BE(); - - // Throw out any JUNK section - if (nextTag == ID_JUNK) { - runHandle(ID_JUNK); - nextTag = _fileStream->readUint32BE(); - } - - // Ignore the 'movi' LIST - if (nextTag == ID_LIST) { - _fileStream->readUint32BE(); // Skip size - if (_fileStream->readUint32BE() != ID_MOVI) - error ("Expected 'movi' LIST"); - } else - error ("Expected 'movi' LIST"); - - // Now, create the codec - _videoCodec = createCodec(); - - // Initialize the video stuff too - _audStream = createAudioStream(); - if (_audStream) - _mixer->playStream(_soundType, _audHandle, _audStream); - - debug (0, "Frames = %d, Dimensions = %d x %d", _header.totalFrames, _header.width, _header.height); - debug (0, "Frame Rate = %d", _vidsHeader.rate / _vidsHeader.scale); - if (_wvInfo.samplesPerSec != 0) - debug (0, "Sound Rate = %d", _wvInfo.samplesPerSec); - debug (0, "Video Codec = \'%s\'", tag2str(_vidsHeader.streamHandler)); - - if (!_videoCodec) - return false; - - return true; -} - -void AviDecoder::close() { - if (!_fileStream) - return; - - delete _fileStream; - _fileStream = 0; - - // Deinitialize sound - _mixer->stopHandle(*_audHandle); - _audStream = 0; - - _decodedHeader = false; - - delete _videoCodec; - _videoCodec = 0; - - delete[] _ixInfo.indices; - _ixInfo.indices = 0; - - memset(_palette, 0, sizeof(_palette)); - memset(&_wvInfo, 0, sizeof(PCMWAVEFORMAT)); - memset(&_bmInfo, 0, sizeof(BITMAPINFOHEADER)); - memset(&_vidsHeader, 0, sizeof(AVIStreamHeader)); - memset(&_audsHeader, 0, sizeof(AVIStreamHeader)); - memset(&_ixInfo, 0, sizeof(AVIOLDINDEX)); - - reset(); -} - -uint32 AviDecoder::getElapsedTime() const { - if (_audStream) - return _mixer->getSoundElapsedTime(*_audHandle); - - return VideoDecoder::getElapsedTime(); -} - -const Surface *AviDecoder::decodeNextFrame() { - uint32 nextTag = _fileStream->readUint32BE(); - - if (_fileStream->eos()) - return NULL; - - if (_curFrame == -1) - _startTime = g_system->getMillis(); - - if (nextTag == ID_LIST) { - // A list of audio/video chunks - uint32 listSize = _fileStream->readUint32LE() - 4; - int32 startPos = _fileStream->pos(); - - if (_fileStream->readUint32BE() != ID_REC) - error ("Expected 'rec ' LIST"); - - // Decode chunks in the list and see if we get a frame - const Surface *frame = NULL; - while (_fileStream->pos() < startPos + (int32)listSize) { - const Surface *temp = decodeNextFrame(); - if (temp) - frame = temp; - } - - return frame; - } else if (getStreamType(nextTag) == 'wb') { - // Audio Chunk - uint32 chunkSize = _fileStream->readUint32LE(); - queueAudioBuffer(chunkSize); - _fileStream->skip(chunkSize & 1); // Alignment - } else if (getStreamType(nextTag) == 'dc' || getStreamType(nextTag) == 'id' || - getStreamType(nextTag) == 'AM' || getStreamType(nextTag) == '32') { - // Compressed Frame - _curFrame++; - uint32 chunkSize = _fileStream->readUint32LE(); - - if (chunkSize == 0) // Keep last frame on screen - return NULL; - - Common::SeekableReadStream *frameData = _fileStream->readStream(chunkSize); - const Graphics::Surface *surface = _videoCodec->decodeImage(frameData); - delete frameData; - _fileStream->skip(chunkSize & 1); // Alignment - return surface; - } else if (getStreamType(nextTag) == 'pc') { - // Palette Change - _fileStream->readUint32LE(); // Chunk size, not needed here - byte firstEntry = _fileStream->readByte(); - uint16 numEntries = _fileStream->readByte(); - _fileStream->readUint16LE(); // Reserved - - // 0 entries means all colors are going to be changed - if (numEntries == 0) - numEntries = 256; - - for (uint16 i = firstEntry; i < numEntries + firstEntry; i++) { - _palette[i * 3] = _fileStream->readByte(); - _palette[i * 3 + 1] = _fileStream->readByte(); - _palette[i * 3 + 2] = _fileStream->readByte(); - _fileStream->readByte(); // Flags that don't serve us any purpose - } - - _dirtyPalette = true; - - // No alignment necessary. It's always even. - } else if (nextTag == ID_JUNK) { - runHandle(ID_JUNK); - } else if (nextTag == ID_IDX1) { - runHandle(ID_IDX1); - } else - error("Tag = \'%s\', %d", tag2str(nextTag), _fileStream->pos()); - - return NULL; -} - -Codec *AviDecoder::createCodec() { - switch (_vidsHeader.streamHandler) { - case ID_CRAM: - case ID_MSVC: - case ID_WHAM: - return new MSVideo1Decoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount); - case ID_RLE: - return new MSRLEDecoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount); - case ID_CVID: - return new CinepakDecoder(_bmInfo.bitCount); -#ifdef USE_INDEO3 - case ID_IV32: - return new Indeo3Decoder(_bmInfo.width, _bmInfo.height); -#endif -#ifdef GRAPHICS_TRUEMOTION1_H - case ID_DUCK: - return new TrueMotion1Decoder(_bmInfo.width, _bmInfo.height); -#endif - default: - warning ("Unknown/Unhandled compression format \'%s\'", tag2str(_vidsHeader.streamHandler)); - } - - return NULL; -} - -PixelFormat AviDecoder::getPixelFormat() const { - assert(_videoCodec); - return _videoCodec->getPixelFormat(); -} - -Audio::QueuingAudioStream *AviDecoder::createAudioStream() { - if (_wvInfo.tag == kWaveFormatPCM || _wvInfo.tag == kWaveFormatDK3) - return Audio::makeQueuingAudioStream(_wvInfo.samplesPerSec, _wvInfo.channels == 2); - else if (_wvInfo.tag != kWaveFormatNone) // No sound - warning("Unsupported AVI audio format %d", _wvInfo.tag); - - return NULL; -} - -void AviDecoder::queueAudioBuffer(uint32 chunkSize) { - // Return if we haven't created the queue (unsupported audio format) - if (!_audStream) { - _fileStream->skip(chunkSize); - return; - } - - Common::SeekableReadStream *stream = _fileStream->readStream(chunkSize); - - if (_wvInfo.tag == kWaveFormatPCM) { - byte flags = 0; - if (_audsHeader.sampleSize == 2) - flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; - else - flags |= Audio::FLAG_UNSIGNED; - - if (_wvInfo.channels == 2) - flags |= Audio::FLAG_STEREO; - - _audStream->queueAudioStream(Audio::makeRawStream(stream, _wvInfo.samplesPerSec, flags, DisposeAfterUse::YES), DisposeAfterUse::YES); - } else if (_wvInfo.tag == kWaveFormatDK3) { - _audStream->queueAudioStream(Audio::makeADPCMStream(stream, DisposeAfterUse::YES, chunkSize, Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign), DisposeAfterUse::YES); - } -} - -} // End of namespace Graphics diff --git a/graphics/video/avi_decoder.h b/graphics/video/avi_decoder.h deleted file mode 100644 index 9f9f5ed617..0000000000 --- a/graphics/video/avi_decoder.h +++ /dev/null @@ -1,225 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_AVI_PLAYER_H -#define GRAPHICS_AVI_PLAYER_H - -#include "graphics/video/video_decoder.h" -#include "graphics/video/codecs/codec.h" -#include "sound/audiostream.h" -#include "sound/mixer.h" - -namespace Graphics { - -#define UNKNOWN_HEADER(a) error("Unknown header found -- \'%s\'", tag2str(a)) - -// IDs used throughout the AVI files -// that will be handled by this player -#define ID_RIFF MKID_BE('RIFF') -#define ID_AVI MKID_BE('AVI ') -#define ID_LIST MKID_BE('LIST') -#define ID_HDRL MKID_BE('hdrl') -#define ID_AVIH MKID_BE('avih') -#define ID_STRL MKID_BE('strl') -#define ID_STRH MKID_BE('strh') -#define ID_VIDS MKID_BE('vids') -#define ID_AUDS MKID_BE('auds') -#define ID_MIDS MKID_BE('mids') -#define ID_TXTS MKID_BE('txts') -#define ID_JUNK MKID_BE('JUNK') -#define ID_STRF MKID_BE('strf') -#define ID_MOVI MKID_BE('movi') -#define ID_REC MKID_BE('rec ') -#define ID_VEDT MKID_BE('vedt') -#define ID_IDX1 MKID_BE('idx1') -#define ID_STRD MKID_BE('strd') -#define ID_00AM MKID_BE('00AM') -//#define ID_INFO MKID_BE('INFO') - -// Codec tags -#define ID_RLE MKID_BE('RLE ') -#define ID_CRAM MKID_BE('CRAM') -#define ID_MSVC MKID_BE('msvc') -#define ID_WHAM MKID_BE('WHAM') -#define ID_CVID MKID_BE('cvid') -#define ID_IV32 MKID_BE('iv32') -#define ID_DUCK MKID_BE('DUCK') - -struct BITMAPINFOHEADER { - uint32 size; - uint32 width; - uint32 height; - uint16 planes; - uint16 bitCount; - uint32 compression; - uint32 sizeImage; - uint32 xPelsPerMeter; - uint32 yPelsPerMeter; - uint32 clrUsed; - uint32 clrImportant; -}; - -struct WAVEFORMAT { - uint16 tag; - uint16 channels; - uint32 samplesPerSec; - uint32 avgBytesPerSec; - uint16 blockAlign; -}; - -struct PCMWAVEFORMAT : public WAVEFORMAT { - uint16 size; -}; - -struct WAVEFORMATEX : public WAVEFORMAT { - uint16 bitsPerSample; - uint16 size; -}; - -struct AVIOLDINDEX { - uint32 size; - struct Index { - uint32 id; - uint32 flags; - uint32 offset; - uint32 size; - } *indices; -}; - -// Index Flags -enum IndexFlags { - AVIIF_INDEX = 0x10 -}; - -// Audio Codecs -enum { - kWaveFormatNone = 0, - kWaveFormatPCM = 1, - kWaveFormatDK3 = 98 -}; - -struct AVIHeader { - uint32 size; - uint32 microSecondsPerFrame; - uint32 maxBytesPerSecond; - uint32 padding; - uint32 flags; - uint32 totalFrames; - uint32 initialFrames; - uint32 streams; - uint32 bufferSize; - uint32 width; - uint32 height; -}; - -// Flags from the AVIHeader -enum AviFlags { - AVIF_HASINDEX = 0x00000010, - AVIF_MUSTUSEINDEX = 0x00000020, - AVIF_ISINTERLEAVED = 0x00000100, - AVIF_TRUSTCKTYPE = 0x00000800, - AVIF_WASCAPTUREFILE = 0x00010000, - AVIF_WASCOPYRIGHTED = 0x00020000 -}; - -struct AVIStreamHeader { - uint32 size; - uint32 streamType; - uint32 streamHandler; - uint32 flags; - uint16 priority; - uint16 language; - uint32 initialFrames; - uint32 scale; - uint32 rate; - uint32 start; - uint32 length; - uint32 bufferSize; - uint32 quality; - uint32 sampleSize; - Common::Rect frame; -}; - -/** - * Decoder for AVI videos. - * - * Video decoder used in engines: - * - sci - */ -class AviDecoder : public FixedRateVideoDecoder { -public: - AviDecoder(Audio::Mixer *mixer, - Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - virtual ~AviDecoder(); - - bool load(Common::SeekableReadStream *stream); - void close(); - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _header.width; } - uint16 getHeight() const { return _header.height; } - uint32 getFrameCount() const { return _header.totalFrames; } - uint32 getElapsedTime() const; - const Surface *decodeNextFrame(); - PixelFormat getPixelFormat() const; - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } - -protected: - Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); } - -private: - Audio::Mixer *_mixer; - BITMAPINFOHEADER _bmInfo; - PCMWAVEFORMAT _wvInfo; - AVIOLDINDEX _ixInfo; - AVIHeader _header; - AVIStreamHeader _vidsHeader; - AVIStreamHeader _audsHeader; - byte _palette[3 * 256]; - bool _dirtyPalette; - - Common::SeekableReadStream *_fileStream; - bool _decodedHeader; - - Codec *_videoCodec; - Codec *createCodec(); - - Audio::Mixer::SoundType _soundType; - - void runHandle(uint32 tag); - void handleList(); - void handleStreamHeader(); - void handlePalChange(); - - Audio::SoundHandle *_audHandle; - Audio::QueuingAudioStream *_audStream; - Audio::QueuingAudioStream *createAudioStream(); - void queueAudioBuffer(uint32 chunkSize); -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/cdtoons.cpp b/graphics/video/codecs/cdtoons.cpp deleted file mode 100644 index c3d00d8702..0000000000 --- a/graphics/video/codecs/cdtoons.cpp +++ /dev/null @@ -1,450 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "graphics/video/codecs/cdtoons.h" -#include "common/stream.h" - -#include "common/system.h" - -namespace Graphics { - -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, 1); - - _currentPaletteId = 0; - memset(_palette, 0, 256 * 3); - _dirtyPalette = false; -} - -CDToonsDecoder::~CDToonsDecoder() { - _surface->free(); - delete _surface; - - for (Common::HashMap::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 colour 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 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 diffs; - - while (true) { - int32 nextPos = stream->pos(); - uint32 tag = stream->readUint32BE(); - uint32 size = stream->readUint32BE(); - nextPos += size; - - switch (tag) { - case MKID_BE('Diff'): - { - 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 MKID_BE('XFrm'): - { - 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 MKID_BE('Mrks'): - debugN(5, "CDToons: Mrks\n"); - if (!(flags & 0x2)) - error("CDToons: useless Mrks?"); - - // TODO - warning("CDToons: encountered Mrks, not implemented yet"); - break; - case MKID_BE('Scal'): - // TODO - warning("CDToons: encountered Scal, not implemented yet"); - break; - case MKID_BE('WrMp'): - warning("CDToons: encountered WrMp, ignoring"); - break; - case MKID_BE('FrtR'): - { - 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 MKID_BE('BckR'): - { - 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->pixels, 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)_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 Graphics diff --git a/graphics/video/codecs/cdtoons.h b/graphics/video/codecs/cdtoons.h deleted file mode 100644 index 3695302fec..0000000000 --- a/graphics/video/codecs/cdtoons.h +++ /dev/null @@ -1,70 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_CDTOONS_H -#define GRAPHICS_VIDEO_CDTOONS_H - -#include "graphics/video/codecs/codec.h" - -#include "common/hashmap.h" - -namespace Graphics { - -struct CDToonsBlock { - uint16 flags; - uint32 size; - uint16 startFrame; - uint16 endFrame; - uint16 unknown12; - byte *data; -}; - -class CDToonsDecoder : public Codec { -public: - CDToonsDecoder(uint16 width, uint16 height); - ~CDToonsDecoder(); - - Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } - bool containsPalette() const { return true; } - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } - -private: - Surface *_surface; - byte _palette[256 * 3]; - bool _dirtyPalette; - uint16 _currentPaletteId; - - uint16 _currentFrame; - Common::HashMap _blocks; - - void renderBlock(byte *data, uint size, int x, int y, uint width, uint height); - void setPalette(byte *data); -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/cinepak.cpp b/graphics/video/codecs/cinepak.cpp deleted file mode 100644 index 3264810908..0000000000 --- a/graphics/video/codecs/cinepak.cpp +++ /dev/null @@ -1,292 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "graphics/video/codecs/cinepak.h" - -#include "common/system.h" - -// Code here partially based off of ffmpeg ;) - -namespace Graphics { - -// Convert a color from YUV to RGB colorspace, Cinepak style. -inline static void CPYUV2RGB(byte y, byte u, byte v, byte &r, byte &g, byte &b) { - r = CLIP(y + 2 * (v - 128), 0, 255); - g = CLIP(y - (u - 128) / 2 - (v - 128), 0, 255); - b = CLIP(y + 2 * (u - 128), 0, 255); -} - -#define PUT_PIXEL(offset, lum, u, v) \ - if (_pixelFormat.bytesPerPixel != 1) { \ - CPYUV2RGB(lum, u, v, r, g, b); \ - if (_pixelFormat.bytesPerPixel == 2) \ - *((uint16 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \ - else \ - *((uint32 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \ - } else \ - *((byte *)_curFrame.surface->pixels + offset) = lum - -CinepakDecoder::CinepakDecoder(int bitsPerPixel) : Codec() { - _curFrame.surface = NULL; - _curFrame.strips = NULL; - _y = 0; - - if (bitsPerPixel == 8) - _pixelFormat = PixelFormat::createFormatCLUT8(); - else - _pixelFormat = g_system->getScreenFormat(); -} - -CinepakDecoder::~CinepakDecoder() { - if (_curFrame.surface) { - _curFrame.surface->free(); - delete _curFrame.surface; - } - - delete[] _curFrame.strips; -} - -const Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *stream) { - _curFrame.flags = stream->readByte(); - _curFrame.length = (stream->readByte() << 16) + 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(); - } - - if (!_curFrame.surface) { - _curFrame.surface = new Surface(); - _curFrame.surface->create(_curFrame.width, _curFrame.height, _pixelFormat.bytesPerPixel); - } - - // 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->readByte() + 128; - codebook[i].v = stream->readByte() + 128; - } else { - // This codebook type indicates either greyscale or - // palettized video. For greyscale, default us to - // 128 for both u and v. - codebook[i].u = 128; - codebook[i].v = 128; - } - } - } -} - -void CinepakDecoder::decodeVectors(Common::SeekableReadStream *stream, uint16 strip, byte chunkID, uint32 chunkSize) { - uint32 flag = 0, mask = 0; - uint32 iy[4]; - int32 startPos = stream->pos(); - byte r = 0, g = 0, b = 0; - - 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 Graphics diff --git a/graphics/video/codecs/cinepak.h b/graphics/video/codecs/cinepak.h deleted file mode 100644 index b1daece1f3..0000000000 --- a/graphics/video/codecs/cinepak.h +++ /dev/null @@ -1,81 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_CINEPAK_H -#define GRAPHICS_CINEPAK_H - -#include "common/scummsys.h" -#include "common/stream.h" -#include "common/rect.h" -#include "graphics/surface.h" -#include "graphics/pixelformat.h" - -#include "graphics/video/codecs/codec.h" - -namespace Graphics { - -struct CinepakCodebook { - byte y[4]; - byte u, v; -}; - -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; - - Surface *surface; -}; - -class CinepakDecoder : public Codec { -public: - CinepakDecoder(int bitsPerPixel = 24); - ~CinepakDecoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const { return _pixelFormat; } - -private: - CinepakFrame _curFrame; - int32 _y; - PixelFormat _pixelFormat; - - 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 Graphics - -#endif diff --git a/graphics/video/codecs/codec.h b/graphics/video/codecs/codec.h deleted file mode 100644 index 4fa1a041a2..0000000000 --- a/graphics/video/codecs/codec.h +++ /dev/null @@ -1,53 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_CODEC_H -#define GRAPHICS_CODEC_H - -#include "graphics/surface.h" -#include "graphics/pixelformat.h" - -namespace Common{ -class SeekableReadStream; -} - -namespace Graphics { - -class Codec { -public: - Codec() {} - virtual ~Codec() {} - - virtual const Surface *decodeImage(Common::SeekableReadStream *stream) = 0; - virtual PixelFormat getPixelFormat() const = 0; - - virtual bool containsPalette() const { return false; } - virtual const byte *getPalette() { return 0; } - virtual bool hasDirtyPalette() const { return false; } -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/indeo3.cpp b/graphics/video/codecs/indeo3.cpp deleted file mode 100644 index a19764dc11..0000000000 --- a/graphics/video/codecs/indeo3.cpp +++ /dev/null @@ -1,3495 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "common/scummsys.h" - -#ifdef USE_INDEO3 - -/* 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/frac.h" -#include "common/file.h" - -#include "graphics/conversion.h" - -#include "graphics/video/codecs/indeo3.h" - -namespace Graphics { - -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 Surface; - _surface->create(width, height, _pixelFormat.bytesPerPixel); - - buildModPred(); - allocFrames(); -} - -Indeo3Decoder::~Indeo3Decoder() { - _surface->free(); - delete _surface; - - delete[] _iv_frame[0].the_buf; - delete[] _ModPred; - delete[] _corrector_type; -} - -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) != MKID_BE('FRMH')) - 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 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(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(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(chromaWidth, 40)); - - delete[] inData; - - // Blit the frame onto the surface - const byte *srcY = _cur_frame->Ybuf; - const byte *srcU = _cur_frame->Ubuf; - const byte *srcV = _cur_frame->Vbuf; - byte *dest = (byte *)_surface->pixels; - - const byte *srcUP = srcU; - const byte *srcVP = srcV; - const byte *srcUN = srcU + chromaWidth; - const byte *srcVN = srcV + chromaWidth; - - uint32 scaleWidth = _surface->w / fWidth; - uint32 scaleHeight = _surface->h / fHeight; - - for (uint32 y = 0; y < fHeight; y++) { - byte *rowDest = dest; - - for (uint32 sH = 0; sH < scaleHeight; sH++) { - for (uint32 x = 0; x < fWidth; x++) { - uint32 xP = MAX((x >> 2) - 1, 0); - uint32 xN = MIN((x >> 2) + 1, chromaWidth - 1); - - byte cY = srcY[x]; - byte cU = srcU[x >> 2]; - byte cV = srcV[x >> 2]; - - if (((x % 4) == 0) && ((y % 4) == 0)) { - cU = (((uint32) cU) + ((uint32) srcUP[xP])) / 2; - cV = (((uint32) cV) + ((uint32) srcVP[xP])) / 2; - } else if (((x % 4) == 3) && ((y % 4) == 0)) { - cU = (((uint32) cU) + ((uint32) srcUP[xN])) / 2; - cV = (((uint32) cV) + ((uint32) srcVP[xN])) / 2; - } else if (((x % 4) == 0) && ((y % 4) == 3)) { - cU = (((uint32) cU) + ((uint32) srcUN[xP])) / 2; - cV = (((uint32) cV) + ((uint32) srcVN[xP])) / 2; - } else if (((x % 4) == 3) && ((y % 4) == 3)) { - cU = (((uint32) cU) + ((uint32) srcUN[xN])) / 2; - cV = (((uint32) cV) + ((uint32) srcVN[xN])) / 2; - } else if ( (x % 4) == 0) { - cU = (((uint32) cU) + ((uint32) srcU[xP])) / 2; - cV = (((uint32) cV) + ((uint32) srcV[xP])) / 2; - } else if ( (x % 4) == 3) { - cU = (((uint32) cU) + ((uint32) srcU[xN])) / 2; - cV = (((uint32) cV) + ((uint32) srcV[xN])) / 2; - } else if ( (y % 4) == 0) { - cU = (((uint32) cU) + ((uint32) srcUP[x >> 2])) / 2; - cV = (((uint32) cV) + ((uint32) srcVP[x >> 2])) / 2; - } else if ( (y % 4) == 3) { - cU = (((uint32) cU) + ((uint32) srcUN[x >> 2])) / 2; - cV = (((uint32) cV) + ((uint32) srcVN[x >> 2])) / 2; - } - - byte r = 0, g = 0, b = 0; - YUV2RGB(cY, cU, cV, r, g, b); - - const uint32 color = _pixelFormat.RGBToColor(r, g, b); - - for (uint32 sW = 0; sW < scaleWidth; sW++, rowDest += _surface->bytesPerPixel) { - if (_surface->bytesPerPixel == 1) - *((uint8 *)rowDest) = (uint8)color; - else if (_surface->bytesPerPixel == 2) - *((uint16 *)rowDest) = (uint16)color; - } - } - - dest += _surface->pitch; - } - - srcY += fWidth; - - if ((y & 3) == 3) { - srcU += chromaWidth; - srcV += chromaWidth; - - if (y > 0) { - srcUP += chromaWidth; - srcVP += chromaWidth; - } - if (y < (fHeight - 4U)) { - srcUN += chromaWidth; - srcVN += chromaWidth; - } - } - } - - 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: - 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 (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: - 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: - 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. - 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 Graphics - -#endif // USE_INDEO3 diff --git a/graphics/video/codecs/indeo3.h b/graphics/video/codecs/indeo3.h deleted file mode 100644 index d074facea2..0000000000 --- a/graphics/video/codecs/indeo3.h +++ /dev/null @@ -1,94 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "common/scummsys.h" - -#ifdef USE_INDEO3 - -/* 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 GRAPHICS_INDEO3_H -#define GRAPHICS_INDEO3_H - -#include "graphics/video/codecs/codec.h" - -namespace Graphics { - -class Indeo3Decoder : public Codec { -public: - Indeo3Decoder(uint16 width, uint16 height); - ~Indeo3Decoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const; - - static bool isIndeo3(Common::SeekableReadStream &stream); - -private: - Surface *_surface; - - 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 Graphics - -#endif // GRAPHICS_INDEO3_H - -#endif // USE_INDEO3 diff --git a/graphics/video/codecs/mjpeg.cpp b/graphics/video/codecs/mjpeg.cpp deleted file mode 100644 index dc8eb4a58b..0000000000 --- a/graphics/video/codecs/mjpeg.cpp +++ /dev/null @@ -1,70 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "common/system.h" -#include "graphics/conversion.h" // For YUV2RGB - -#include "graphics/video/codecs/mjpeg.h" - -namespace Graphics { - -JPEGDecoder::JPEGDecoder() : Codec() { - _jpeg = new JPEG(); - _pixelFormat = g_system->getScreenFormat(); - _surface = NULL; -} - -JPEGDecoder::~JPEGDecoder() { - delete _jpeg; - - if (_surface) { - _surface->free(); - delete _surface; - } -} - -const Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream* stream) { - if (!_jpeg->read(stream)) { - warning("Failed to decode JPEG frame"); - return 0; - } - - if (!_surface) { - _surface = new Surface(); - _surface->create(_jpeg->getWidth(), _jpeg->getHeight(), _pixelFormat.bytesPerPixel); - } - - Graphics::Surface *frame = _jpeg->getSurface(_pixelFormat); - assert(frame); - - _surface->copyFrom(*frame); - - frame->free(); - delete frame; - - return _surface; -} - -} // End of namespace Graphics diff --git a/graphics/video/codecs/mjpeg.h b/graphics/video/codecs/mjpeg.h deleted file mode 100644 index daa8b12dbb..0000000000 --- a/graphics/video/codecs/mjpeg.h +++ /dev/null @@ -1,57 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_MJPEG_H -#define GRAPHICS_MJPEG_H - -#include "common/scummsys.h" - -#include "graphics/video/codecs/codec.h" -#include "graphics/jpeg.h" -#include "graphics/pixelformat.h" - -namespace Graphics { - -// Motion JPEG Decoder -// Basically a wrapper around JPEG which converts to RGB and also functions -// as a Codec. - -class JPEGDecoder : public Codec { -public: - JPEGDecoder(); - ~JPEGDecoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const { return _pixelFormat; } - -private: - PixelFormat _pixelFormat; - JPEG *_jpeg; - Surface *_surface; -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/msrle.cpp b/graphics/video/codecs/msrle.cpp deleted file mode 100644 index a3929fc1fd..0000000000 --- a/graphics/video/codecs/msrle.cpp +++ /dev/null @@ -1,134 +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. - * - * $URL$ - * $Id$ - * - */ - -// Based off ffmpeg's msrledec.c - -#include "graphics/video/codecs/msrle.h" -#include "common/stream.h" - -namespace Graphics { - -MSRLEDecoder::MSRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) { - _surface = new Graphics::Surface(); - _surface->create(width, height, 1); - _bitsPerPixel = bitsPerPixel; -} - -MSRLEDecoder::~MSRLEDecoder() { - _surface->free(); - delete _surface; -} - -const 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->pixels; - 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("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("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("No end-of-picture code"); -} - -} // End of namespace Graphics diff --git a/graphics/video/codecs/msrle.h b/graphics/video/codecs/msrle.h deleted file mode 100644 index 02b9199e4e..0000000000 --- a/graphics/video/codecs/msrle.h +++ /dev/null @@ -1,51 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_MSRLE_H -#define GRAPHICS_MSRLE_H - -#include "graphics/video/codecs/codec.h" - -namespace Graphics { - -class MSRLEDecoder : public Codec { -public: - MSRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel); - ~MSRLEDecoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } - -private: - byte _bitsPerPixel; - - Surface *_surface; - - void decode8(Common::SeekableReadStream *stream); -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/msvideo1.cpp b/graphics/video/codecs/msvideo1.cpp deleted file mode 100644 index 176efc037f..0000000000 --- a/graphics/video/codecs/msvideo1.cpp +++ /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. - * - * $URL$ - * $Id$ - * - */ - - // Based off ffmpeg's msvideo.cpp - -#include "graphics/video/codecs/msvideo1.h" -#include "common/stream.h" - -namespace Graphics { - -#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(); - _surface->create(width, height, (bitsPerPixel == 8) ? 1 : 2); - _bitsPerPixel = bitsPerPixel; -} - -MSVideo1Decoder::~MSVideo1Decoder() { - _surface->free(); - delete _surface; -} - -void MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) { - byte colors[8]; - byte *pixels = (byte *)_surface->pixels; - 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 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 JMP diff --git a/graphics/video/codecs/msvideo1.h b/graphics/video/codecs/msvideo1.h deleted file mode 100644 index 1b908a6243..0000000000 --- a/graphics/video/codecs/msvideo1.h +++ /dev/null @@ -1,52 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_MSVIDEO1_H -#define GRAPHICS_MSVIDEO1_H - -#include "graphics/video/codecs/codec.h" - -namespace Graphics { - -class MSVideo1Decoder : public Codec { -public: - MSVideo1Decoder(uint16 width, uint16 height, byte bitsPerPixel); - ~MSVideo1Decoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } - -private: - byte _bitsPerPixel; - - Surface *_surface; - - void decode8(Common::SeekableReadStream *stream); - //void decode16(Common::SeekableReadStream *stream); -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/qdm2.cpp b/graphics/video/codecs/qdm2.cpp deleted file mode 100644 index e34c569feb..0000000000 --- a/graphics/video/codecs/qdm2.cpp +++ /dev/null @@ -1,3287 +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. - * - * $URL$ - * $Id$ - * - */ - -// Based off ffmpeg's QDM2 decoder - -#include "common/scummsys.h" -#include "graphics/video/codecs/qdm2.h" - -#ifdef GRAPHICS_QDM2_H - -#include "sound/audiostream.h" -#include "graphics/video/codecs/qdm2data.h" - -#include "common/array.h" -#include "common/stream.h" -#include "common/system.h" - -namespace Graphics { - -enum { - SOFTCLIP_THRESHOLD = 27600, - HARDCLIP_THRESHOLD = 35716, - MPA_MAX_CHANNELS = 2, - MPA_FRAME_SIZE = 1152, - FF_INPUT_BUFFER_PADDING_SIZE = 8 -}; - -typedef int8 sb_int8_array[2][30][64]; - -/* bit input */ -/* buffer, buffer_end and size_in_bits must be present and used by every reader */ -struct GetBitContext { - const uint8 *buffer, *bufferEnd; - int index; - int sizeInBits; -}; - -struct QDM2SubPacket { - int type; - unsigned int size; - const uint8 *data; // pointer to subpacket data (points to input data buffer, it's not a private copy) -}; - -struct QDM2SubPNode { - QDM2SubPacket *packet; - struct QDM2SubPNode *next; // pointer to next packet in the list, NULL if leaf node -}; - -struct QDM2Complex { - float re; - float im; -}; - -struct FFTTone { - float level; - QDM2Complex *complex; - const float *table; - int phase; - int phase_shift; - int duration; - short time_index; - short cutoff; -}; - -struct FFTCoefficient { - int16 sub_packet; - uint8 channel; - int16 offset; - int16 exp; - uint8 phase; -}; - -struct VLC { - int32 bits; - int16 (*table)[2]; // code, bits - int32 table_size; - int32 table_allocated; -}; - -#include "common/pack-start.h" -struct QDM2FFT { - QDM2Complex complex[MPA_MAX_CHANNELS][256]; -} PACKED_STRUCT; -#include "common/pack-end.h" - -enum RDFTransformType { - RDFT, - IRDFT, - RIDFT, - IRIDFT -}; - -struct FFTComplex { - float re, im; -}; - -struct FFTContext { - int nbits; - int inverse; - uint16 *revtab; - FFTComplex *exptab; - FFTComplex *tmpBuf; - int mdctSize; // size of MDCT (i.e. number of input data * 2) - int mdctBits; // n = 2^nbits - // pre/post rotation tables - float *tcos; - float *tsin; - void (*fftPermute)(struct FFTContext *s, FFTComplex *z); - void (*fftCalc)(struct FFTContext *s, FFTComplex *z); - void (*imdctCalc)(struct FFTContext *s, float *output, const float *input); - void (*imdctHalf)(struct FFTContext *s, float *output, const float *input); - void (*mdctCalc)(struct FFTContext *s, float *output, const float *input); - int splitRadix; - int permutation; -}; - -enum { - FF_MDCT_PERM_NONE = 0, - FF_MDCT_PERM_INTERLEAVE = 1 -}; - -struct RDFTContext { - int nbits; - int inverse; - int signConvention; - - // pre/post rotation tables - float *tcos; - float *tsin; - FFTContext fft; -}; - -class QDM2Stream : public Audio::AudioStream { -public: - QDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadStream *extraData); - ~QDM2Stream(); - - bool isStereo() const { return _channels == 2; } - bool endOfData() const { return _stream->pos() >= _stream->size() && _outputSamples.size() == 0 && _subPacket == 0; } - int getRate() const { return _sampleRate; } - int readBuffer(int16 *buffer, const int numSamples); - -private: - Common::SeekableReadStream *_stream; - - // Parameters from codec header, do not change during playback - uint8 _channels; - uint16 _sampleRate; - uint16 _bitRate; - uint16 _blockSize; // Group - uint16 _frameSize; // FFT - uint16 _packetSize; // Checksum - - // Parameters built from header parameters, do not change during playback - int _groupOrder; // order of frame group - int _fftOrder; // order of FFT (actually fft order+1) - int _fftFrameSize; // size of fft frame, in components (1 comples = re + im) - int _sFrameSize; // size of data frame - int _frequencyRange; - int _subSampling; // subsampling: 0=25%, 1=50%, 2=100% */ - int _coeffPerSbSelect; // selector for "num. of coeffs. per subband" tables. Can be 0, 1, 2 - int _cmTableSelect; // selector for "coding method" tables. Can be 0, 1 (from init: 0-4) - - // Packets and packet lists - QDM2SubPacket _subPackets[16]; // the packets themselves - QDM2SubPNode _subPacketListA[16]; // list of all packets - QDM2SubPNode _subPacketListB[16]; // FFT packets B are on list - int _subPacketsB; // number of packets on 'B' list - QDM2SubPNode _subPacketListC[16]; // packets with errors? - QDM2SubPNode _subPacketListD[16]; // DCT packets - - // FFT and tones - FFTTone _fftTones[1000]; - int _fftToneStart; - int _fftToneEnd; - FFTCoefficient _fftCoefs[1000]; - int _fftCoefsIndex; - int _fftCoefsMinIndex[5]; - int _fftCoefsMaxIndex[5]; - int _fftLevelExp[6]; - RDFTContext _rdftCtx; - QDM2FFT _fft; - - // I/O data - uint8 *_compressedData; - float _outputBuffer[1024]; - Common::Array _outputSamples; - - // Synthesis filter - int16 ff_mpa_synth_window[512]; - int16 _synthBuf[MPA_MAX_CHANNELS][512*2]; - int _synthBufOffset[MPA_MAX_CHANNELS]; - int32 _sbSamples[MPA_MAX_CHANNELS][128][32]; - - // Mixed temporary data used in decoding - float _toneLevel[MPA_MAX_CHANNELS][30][64]; - int8 _codingMethod[MPA_MAX_CHANNELS][30][64]; - int8 _quantizedCoeffs[MPA_MAX_CHANNELS][10][8]; - int8 _toneLevelIdxBase[MPA_MAX_CHANNELS][30][8]; - int8 _toneLevelIdxHi1[MPA_MAX_CHANNELS][3][8][8]; - int8 _toneLevelIdxMid[MPA_MAX_CHANNELS][26][8]; - int8 _toneLevelIdxHi2[MPA_MAX_CHANNELS][26]; - int8 _toneLevelIdx[MPA_MAX_CHANNELS][30][64]; - int8 _toneLevelIdxTemp[MPA_MAX_CHANNELS][30][64]; - - // Flags - bool _hasErrors; // packet has errors - int _superblocktype_2_3; // select fft tables and some algorithm based on superblock type - int _doSynthFilter; // used to perform or skip synthesis filter - - uint8 _subPacket; // 0 to 15 - uint32 _superBlockStart; - int _noiseIdx; // index for dithering noise table - - byte _emptyBuffer[FF_INPUT_BUFFER_PADDING_SIZE]; - - VLC _vlcTabLevel; - VLC _vlcTabDiff; - VLC _vlcTabRun; - VLC _fftLevelExpAltVlc; - VLC _fftLevelExpVlc; - VLC _fftStereoExpVlc; - VLC _fftStereoPhaseVlc; - VLC _vlcTabToneLevelIdxHi1; - VLC _vlcTabToneLevelIdxMid; - VLC _vlcTabToneLevelIdxHi2; - VLC _vlcTabType30; - VLC _vlcTabType34; - VLC _vlcTabFftToneOffset[5]; - bool _vlcsInitialized; - void initVlc(void); - - uint16 _softclipTable[HARDCLIP_THRESHOLD - SOFTCLIP_THRESHOLD + 1]; - void softclipTableInit(void); - - float _noiseTable[4096]; - byte _randomDequantIndex[256][5]; - byte _randomDequantType24[128][3]; - void rndTableInit(void); - - float _noiseSamples[128]; - void initNoiseSamples(void); - - void average_quantized_coeffs(void); - void build_sb_samples_from_noise(int sb); - void fix_coding_method_array(int sb, int channels, sb_int8_array coding_method); - void fill_tone_level_array(int flag); - void fill_coding_method_array(sb_int8_array tone_level_idx, sb_int8_array tone_level_idx_temp, - sb_int8_array coding_method, int nb_channels, - int c, int superblocktype_2_3, int cm_table_select); - void synthfilt_build_sb_samples(GetBitContext *gb, int length, int sb_min, int sb_max); - void init_quantized_coeffs_elem0(int8 *quantized_coeffs, GetBitContext *gb, int length); - void init_tone_level_dequantization(GetBitContext *gb, int length); - void process_subpacket_9(QDM2SubPNode *node); - void process_subpacket_10(QDM2SubPNode *node, int length); - void process_subpacket_11(QDM2SubPNode *node, int length); - void process_subpacket_12(QDM2SubPNode *node, int length); - void process_synthesis_subpackets(QDM2SubPNode *list); - void qdm2_decode_super_block(void); - void qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, - int channel, int exp, int phase); - void qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b); - void qdm2_decode_fft_packets(void); - void qdm2_fft_generate_tone(FFTTone *tone); - void qdm2_fft_tone_synthesizer(uint8 sub_packet); - void qdm2_calculate_fft(int channel); - void qdm2_synthesis_filter(uint8 index); - int qdm2_decodeFrame(Common::SeekableReadStream *in); -}; - -// Fix compilation for non C99-compliant compilers, like MSVC -#ifndef int64_t -typedef signed long long int int64_t; -#endif - -// Integer log2 function. This is much faster than invoking -// double precision C99 log2 math functions or equivalent, since -// this is only used to determine maximum number of bits needed -// i.e. only non-fractional part is needed. Also, the double -// version is incorrect for exact cases due to floating point -// rounding errors. -static inline int scummvm_log2(int n) { - int ret = -1; - while(n != 0) { - n /= 2; - ret++; - } - return ret; -} - -#define QDM2_LIST_ADD(list, size, packet) \ - do { \ - if (size > 0) \ - list[size - 1].next = &list[size]; \ - list[size].packet = packet; \ - list[size].next = NULL; \ - size++; \ - } while(0) - -// Result is 8, 16 or 30 -#define QDM2_SB_USED(subSampling) (((subSampling) >= 2) ? 30 : 8 << (subSampling)) - -#define FIX_NOISE_IDX(noiseIdx) \ - if ((noiseIdx) >= 3840) \ - (noiseIdx) -= 3840 \ - -#define SB_DITHERING_NOISE(sb, noiseIdx) (_noiseTable[(noiseIdx)++] * sb_noise_attenuation[(sb)]) - -static inline void initGetBits(GetBitContext *s, const uint8 *buffer, int bitSize) { - int bufferSize = (bitSize + 7) >> 3; - - if (bufferSize < 0 || bitSize < 0) { - bufferSize = bitSize = 0; - buffer = NULL; - } - - s->buffer = buffer; - s->sizeInBits = bitSize; - s->bufferEnd = buffer + bufferSize; - s->index = 0; -} - -static inline int getBitsCount(GetBitContext *s) { - return s->index; -} - -static inline unsigned int getBits1(GetBitContext *s) { - int index; - uint8 result; - - index = s->index; - result = s->buffer[index >> 3]; - - result >>= (index & 0x07); - result &= 1; - index++; - s->index = index; - - return result; -} - -static inline unsigned int getBits(GetBitContext *s, int n) { - int tmp, reCache, reIndex; - - reIndex = s->index; - - reCache = READ_LE_UINT32((const uint8 *)s->buffer + (reIndex >> 3)) >> (reIndex & 0x07); - - tmp = (reCache) & ((uint32)0xffffffff >> (32 - n)); - - s->index = reIndex + n; - - return tmp; -} - -static inline void skipBits(GetBitContext *s, int n) { - int reIndex, reCache; - - reIndex = s->index; - reCache = 0; - - reCache = READ_LE_UINT32((const uint8 *)s->buffer + (reIndex >> 3)) >> (reIndex & 0x07); - s->index = reIndex + n; -} - -#define BITS_LEFT(length, gb) ((length) - getBitsCount((gb))) - -static int splitRadixPermutation(int i, int n, int inverse) { - if (n <= 2) - return i & 1; - - int m = n >> 1; - - if(!(i & m)) - return splitRadixPermutation(i, m, inverse) * 2; - - m >>= 1; - - if (inverse == !(i & m)) - return splitRadixPermutation(i, m, inverse) * 4 + 1; - - return splitRadixPermutation(i, m, inverse) * 4 - 1; -} - -// sin(2*pi*x/n) for 0<=xrevtab; - int np = 1 << s->nbits; - - if (s->tmpBuf) { - // TODO: handle split-radix permute in a more optimal way, probably in-place - for (int j = 0; j < np; j++) - s->tmpBuf[revtab[j]] = z[j]; - memcpy(z, s->tmpBuf, np * sizeof(FFTComplex)); - return; - } - - // reverse - for (int j = 0; j < np; j++) { - int k = revtab[j]; - if (k < j) { - FFTComplex tmp = z[k]; - z[k] = z[j]; - z[j] = tmp; - } - } -} - -#define DECL_FFT(n,n2,n4) \ -static void fft##n(FFTComplex *z) { \ - fft##n2(z); \ - fft##n4(z + n4 * 2); \ - fft##n4(z + n4 * 3); \ - pass(z, ff_cos_##n, n4 / 2); \ -} - -#ifndef M_SQRT1_2 -#define M_SQRT1_2 7.0710678118654752440E-1 -#endif - -#define sqrthalf (float)M_SQRT1_2 - -#define BF(x,y,a,b) { \ - x = a - b; \ - y = a + b; \ -} - -#define BUTTERFLIES(a0, a1, a2, a3) { \ - BF(t3, t5, t5, t1); \ - BF(a2.re, a0.re, a0.re, t5); \ - BF(a3.im, a1.im, a1.im, t3); \ - BF(t4, t6, t2, t6); \ - BF(a3.re, a1.re, a1.re, t4); \ - BF(a2.im, a0.im, a0.im, t6); \ -} - -// force loading all the inputs before storing any. -// this is slightly slower for small data, but avoids store->load aliasing -// for addresses separated by large powers of 2. -#define BUTTERFLIES_BIG(a0, a1, a2, a3) { \ - float r0 = a0.re, i0 = a0.im, r1 = a1.re, i1 = a1.im; \ - BF(t3, t5, t5, t1); \ - BF(a2.re, a0.re, r0, t5); \ - BF(a3.im, a1.im, i1, t3); \ - BF(t4, t6, t2, t6); \ - BF(a3.re, a1.re, r1, t4); \ - BF(a2.im, a0.im, i0, t6); \ -} - -#define TRANSFORM(a0, a1, a2, a3, wre, wim) { \ - t1 = a2.re * wre + a2.im * wim; \ - t2 = a2.im * wre - a2.re * wim; \ - t5 = a3.re * wre - a3.im * wim; \ - t6 = a3.im * wre + a3.re * wim; \ - BUTTERFLIES(a0, a1, a2, a3) \ -} - -#define TRANSFORM_ZERO(a0, a1, a2, a3) { \ - t1 = a2.re; \ - t2 = a2.im; \ - t5 = a3.re; \ - t6 = a3.im; \ - BUTTERFLIES(a0, a1, a2, a3) \ -} - -// z[0...8n-1], w[1...2n-1] -#define PASS(name) \ -static void name(FFTComplex *z, const float *wre, unsigned int n) { \ - float t1, t2, t3, t4, t5, t6; \ - int o1 = 2 * n; \ - int o2 = 4 * n; \ - int o3 = 6 * n; \ - const float *wim = wre + o1; \ - n--; \ - \ - TRANSFORM_ZERO(z[0], z[o1], z[o2], z[o3]); \ - TRANSFORM(z[1], z[o1 + 1], z[o2 + 1], z[o3 + 1], wre[1], wim[-1]); \ - \ - do { \ - z += 2; \ - wre += 2; \ - wim -= 2; \ - TRANSFORM(z[0], z[o1], z[o2], z[o3], wre[0], wim[0]); \ - TRANSFORM(z[1], z[o1 + 1],z[o2 + 1], z[o3 + 1], wre[1], wim[-1]); \ - } while(--n); \ -} - -PASS(pass) -#undef BUTTERFLIES -#define BUTTERFLIES BUTTERFLIES_BIG -PASS(pass_big) - -static void fft4(FFTComplex *z) { - float t1, t2, t3, t4, t5, t6, t7, t8; - - BF(t3, t1, z[0].re, z[1].re); - BF(t8, t6, z[3].re, z[2].re); - BF(z[2].re, z[0].re, t1, t6); - BF(t4, t2, z[0].im, z[1].im); - BF(t7, t5, z[2].im, z[3].im); - BF(z[3].im, z[1].im, t4, t8); - BF(z[3].re, z[1].re, t3, t7); - BF(z[2].im, z[0].im, t2, t5); -} - -static void fft8(FFTComplex *z) { - float t1, t2, t3, t4, t5, t6, t7, t8; - - fft4(z); - - BF(t1, z[5].re, z[4].re, -z[5].re); - BF(t2, z[5].im, z[4].im, -z[5].im); - BF(t3, z[7].re, z[6].re, -z[7].re); - BF(t4, z[7].im, z[6].im, -z[7].im); - BF(t8, t1, t3, t1); - BF(t7, t2, t2, t4); - BF(z[4].re, z[0].re, z[0].re, t1); - BF(z[4].im, z[0].im, z[0].im, t2); - BF(z[6].re, z[2].re, z[2].re, t7); - BF(z[6].im, z[2].im, z[2].im, t8); - - TRANSFORM(z[1], z[3], z[5], z[7], sqrthalf, sqrthalf); -} - -#undef BF - -DECL_FFT(16,8,4) -DECL_FFT(32,16,8) -DECL_FFT(64,32,16) -DECL_FFT(128,64,32) -DECL_FFT(256,128,64) -DECL_FFT(512,256,128) -#define pass pass_big -DECL_FFT(1024,512,256) -DECL_FFT(2048,1024,512) -DECL_FFT(4096,2048,1024) -DECL_FFT(8192,4096,2048) -DECL_FFT(16384,8192,4096) -DECL_FFT(32768,16384,8192) -DECL_FFT(65536,32768,16384) - -void fftCalc(FFTContext *s, FFTComplex *z) { - static void (* const fftDispatch[])(FFTComplex*) = { - fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024, - fft2048, fft4096, fft8192, fft16384, fft32768, fft65536, - }; - - fftDispatch[s->nbits - 2](z); -} - -// complex multiplication: p = a * b -#define CMUL(pre, pim, are, aim, bre, bim) \ -{\ - float _are = (are); \ - float _aim = (aim); \ - float _bre = (bre); \ - float _bim = (bim); \ - (pre) = _are * _bre - _aim * _bim; \ - (pim) = _are * _bim + _aim * _bre; \ -} - -/** - * Compute the middle half of the inverse MDCT of size N = 2^nbits, - * thus excluding the parts that can be derived by symmetry - * @param output N/2 samples - * @param input N/2 samples - */ -void imdctHalfC(FFTContext *s, float *output, const float *input) { - const uint16 *revtab = s->revtab; - const float *tcos = s->tcos; - const float *tsin = s->tsin; - FFTComplex *z = (FFTComplex *)output; - - int n = 1 << s->mdctBits; - int n2 = n >> 1; - int n4 = n >> 2; - int n8 = n >> 3; - - // pre rotation - const float *in1 = input; - const float *in2 = input + n2 - 1; - for (int k = 0; k < n4; k++) { - int j = revtab[k]; - CMUL(z[j].re, z[j].im, *in2, *in1, tcos[k], tsin[k]); - in1 += 2; - in2 -= 2; - } - - fftCalc(s, z); - - // post rotation + reordering - for (int k = 0; k < n8; k++) { - float r0, i0, r1, i1; - CMUL(r0, i1, z[n8 - k - 1].im, z[n8 - k - 1].re, tsin[n8 - k - 1], tcos[n8 - k - 1]); - CMUL(r1, i0, z[n8 + k].im, z[n8 + k].re, tsin[n8 + k], tcos[n8 + k]); - z[n8 - k - 1].re = r0; - z[n8 - k - 1].im = i0; - z[n8 + k].re = r1; - z[n8 + k].im = i1; - } -} - -/** - * Compute inverse MDCT of size N = 2^nbits - * @param output N samples - * @param input N/2 samples - */ -void imdctCalcC(FFTContext *s, float *output, const float *input) { - int n = 1 << s->mdctBits; - int n2 = n >> 1; - int n4 = n >> 2; - - imdctHalfC(s, output + n4, input); - - for (int k = 0; k < n4; k++) { - output[k] = -output[n2 - k - 1]; - output[n - k - 1] = output[n2 + k]; - } -} - -/** - * Compute MDCT of size N = 2^nbits - * @param input N samples - * @param out N/2 samples - */ -void mdctCalcC(FFTContext *s, float *out, const float *input) { - const uint16 *revtab = s->revtab; - const float *tcos = s->tcos; - const float *tsin = s->tsin; - FFTComplex *x = (FFTComplex *)out; - - int n = 1 << s->mdctBits; - int n2 = n >> 1; - int n4 = n >> 2; - int n8 = n >> 3; - int n3 = 3 * n4; - - // pre rotation - for (int i = 0; i < n8; i++) { - float re = -input[2 * i + 3 * n4] - input[n3 - 1 - 2 * i]; - float im = -input[n4 + 2 * i] + input[n4 - 1 - 2 * i]; - int j = revtab[i]; - CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]); - - re = input[2 * i] - input[n2 - 1 - 2 * i]; - im = -(input[n2 + 2 * i] + input[n - 1 - 2 * i]); - j = revtab[n8 + i]; - CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]); - } - - fftCalc(s, x); - - // post rotation - for (int i = 0; i < n8; i++) { - float r0, i0, r1, i1; - CMUL(i1, r0, x[n8 - i - 1].re, x[n8 - i - 1].im, -tsin[n8 - i - 1], -tcos[n8 - i - 1]); - CMUL(i0, r1, x[n8 + i].re, x[n8 + i].im, -tsin[n8 + i], -tcos[n8 + i]); - x[n8 - i - 1].re = r0; - x[n8 - i - 1].im = i0; - x[n8 + i].re = r1; - x[n8 + i].im = i1; - } -} - -int fftInit(FFTContext *s, int nbits, int inverse) { - int i, j, m, n; - float alpha, c1, s1, s2; - - if (nbits < 2 || nbits > 16) - goto fail; - - s->nbits = nbits; - n = 1 << nbits; - s->tmpBuf = NULL; - - s->exptab = (FFTComplex *)malloc((n / 2) * sizeof(FFTComplex)); - if (!s->exptab) - goto fail; - - s->revtab = (uint16 *)malloc(n * sizeof(uint16)); - if (!s->revtab) - goto fail; - s->inverse = inverse; - - s2 = inverse ? 1.0 : -1.0; - - s->fftPermute = fftPermute; - s->fftCalc = fftCalc; - s->imdctCalc = imdctCalcC; - s->imdctHalf = imdctHalfC; - s->mdctCalc = mdctCalcC; - s->splitRadix = 1; - - if (s->splitRadix) { - for (j = 4; j <= nbits; j++) - initCosineTables(j); - - for (i = 0; i < n; i++) - s->revtab[-splitRadixPermutation(i, n, s->inverse) & (n - 1)] = i; - - s->tmpBuf = (FFTComplex *)malloc(n * sizeof(FFTComplex)); - } else { - for (i = 0; i < n / 2; i++) { - alpha = 2 * PI * (float)i / (float)n; - c1 = cos(alpha); - s1 = sin(alpha) * s2; - s->exptab[i].re = c1; - s->exptab[i].im = s1; - } - - //int np = 1 << nbits; - //int nblocks = np >> 3; - //int np2 = np >> 1; - - // compute bit reverse table - for (i = 0; i < n; i++) { - m = 0; - - for (j = 0; j < nbits; j++) - m |= ((i >> j) & 1) << (nbits - j - 1); - - s->revtab[i] = m; - } - } - - return 0; - - fail: - free(&s->revtab); - free(&s->exptab); - free(&s->tmpBuf); - return -1; -} - -/** - * Sets up a real FFT. - * @param nbits log2 of the length of the input array - * @param trans the type of transform - */ -int rdftInit(RDFTContext *s, int nbits, RDFTransformType trans) { - int n = 1 << nbits; - const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1) * 2 * PI / n; - - s->nbits = nbits; - s->inverse = trans == IRDFT || trans == IRIDFT; - s->signConvention = trans == RIDFT || trans == IRIDFT ? 1 : -1; - - if (nbits < 4 || nbits > 16) - return -1; - - if (fftInit(&s->fft, nbits - 1, trans == IRDFT || trans == RIDFT) < 0) - return -1; - - initCosineTables(nbits); - s->tcos = ff_cos_tabs[nbits]; - s->tsin = ff_sin_tabs[nbits] + (trans == RDFT || trans == IRIDFT) * (n >> 2); - - for (int i = 0; i < n >> 2; i++) - s->tsin[i] = sin(i*theta); - - return 0; -} - -/** Map one real FFT into two parallel real even and odd FFTs. Then interleave - * the two real FFTs into one complex FFT. Unmangle the results. - * ref: http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM - */ -void rdftCalc(RDFTContext *s, float *data) { - FFTComplex ev, od; - - const int n = 1 << s->nbits; - const float k1 = 0.5; - const float k2 = 0.5 - s->inverse; - const float *tcos = s->tcos; - const float *tsin = s->tsin; - - if (!s->inverse) { - fftPermute(&s->fft, (FFTComplex *)data); - fftCalc(&s->fft, (FFTComplex *)data); - } - - // i=0 is a special case because of packing, the DC term is real, so we - // are going to throw the N/2 term (also real) in with it. - ev.re = data[0]; - data[0] = ev.re + data[1]; - data[1] = ev.re - data[1]; - - int i; - - for (i = 1; i < n >> 2; i++) { - int i1 = i * 2; - int i2 = n - i1; - - // Separate even and odd FFTs - ev.re = k1 * (data[i1] + data[i2]); - od.im = -k2 * (data[i1] - data[i2]); - ev.im = k1 * (data[i1 + 1] - data[i2 + 1]); - od.re = k2 * (data[i1 + 1] + data[i2 + 1]); - - // Apply twiddle factors to the odd FFT and add to the even FFT - data[i1] = ev.re + od.re * tcos[i] - od.im * tsin[i]; - data[i1 + 1] = ev.im + od.im * tcos[i] + od.re * tsin[i]; - data[i2] = ev.re - od.re * tcos[i] + od.im * tsin[i]; - data[i2 + 1] = -ev.im + od.im * tcos[i] + od.re * tsin[i]; - } - - data[i * 2 + 1] = s->signConvention * data[i * 2 + 1]; - if (s->inverse) { - data[0] *= k1; - data[1] *= k1; - fftPermute(&s->fft, (FFTComplex*)data); - fftCalc(&s->fft, (FFTComplex*)data); - } -} - -// half mpeg encoding window (full precision) -const int32 ff_mpa_enwindow[257] = { - 0, -1, -1, -1, -1, -1, -1, -2, - -2, -2, -2, -3, -3, -4, -4, -5, - -5, -6, -7, -7, -8, -9, -10, -11, - -13, -14, -16, -17, -19, -21, -24, -26, - -29, -31, -35, -38, -41, -45, -49, -53, - -58, -63, -68, -73, -79, -85, -91, -97, - -104, -111, -117, -125, -132, -139, -147, -154, - -161, -169, -176, -183, -190, -196, -202, -208, - 213, 218, 222, 225, 227, 228, 228, 227, - 224, 221, 215, 208, 200, 189, 177, 163, - 146, 127, 106, 83, 57, 29, -2, -36, - -72, -111, -153, -197, -244, -294, -347, -401, - -459, -519, -581, -645, -711, -779, -848, -919, - -991, -1064, -1137, -1210, -1283, -1356, -1428, -1498, - -1567, -1634, -1698, -1759, -1817, -1870, -1919, -1962, - -2001, -2032, -2057, -2075, -2085, -2087, -2080, -2063, - 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535, - 1414, 1280, 1131, 970, 794, 605, 402, 185, - -45, -288, -545, -814, -1095, -1388, -1692, -2006, - -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788, - -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, - -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585, - -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750, - -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134, - 6574, 5959, 5288, 4561, 3776, 2935, 2037, 1082, - 70, -998, -2122, -3300, -4533, -5818, -7154, -8540, - -9975,-11455,-12980,-14548,-16155,-17799,-19478,-21189, --22929,-24694,-26482,-28289,-30112,-31947,-33791,-35640, --37489,-39336,-41176,-43006,-44821,-46617,-48390,-50137, --51853,-53534,-55178,-56778,-58333,-59838,-61289,-62684, --64019,-65290,-66494,-67629,-68692,-69679,-70590,-71420, --72169,-72835,-73415,-73908,-74313,-74630,-74856,-74992, - 75038 -}; - -void ff_mpa_synth_init(int16 *window) { - int i; - int32 v; - - // max = 18760, max sum over all 16 coefs : 44736 - for(i = 0; i < 257; i++) { - v = ff_mpa_enwindow[i]; - v = (v + 2) >> 2; - window[i] = v; - - if ((i & 63) != 0) - v = -v; - - if (i != 0) - window[512 - i] = v; - } -} - -static inline uint16 round_sample(int *sum) { - int sum1; - sum1 = (*sum) >> 14; - *sum &= (1 << 14)-1; - if (sum1 < (-0x7fff - 1)) - sum1 = (-0x7fff - 1); - if (sum1 > 0x7fff) - sum1 = 0x7fff; - return sum1; -} - -static inline int MULH(int a, int b) { - return ((int64_t)(a) * (int64_t)(b))>>32; -} - -// signed 16x16 -> 32 multiply add accumulate -#define MACS(rt, ra, rb) rt += (ra) * (rb) - -#define MLSS(rt, ra, rb) ((rt) -= (ra) * (rb)) - -#define SUM8(op, sum, w, p)\ -{\ - op(sum, (w)[0 * 64], (p)[0 * 64]);\ - op(sum, (w)[1 * 64], (p)[1 * 64]);\ - op(sum, (w)[2 * 64], (p)[2 * 64]);\ - op(sum, (w)[3 * 64], (p)[3 * 64]);\ - op(sum, (w)[4 * 64], (p)[4 * 64]);\ - op(sum, (w)[5 * 64], (p)[5 * 64]);\ - op(sum, (w)[6 * 64], (p)[6 * 64]);\ - op(sum, (w)[7 * 64], (p)[7 * 64]);\ -} - -#define SUM8P2(sum1, op1, sum2, op2, w1, w2, p) \ -{\ - tmp_s = p[0 * 64];\ - op1(sum1, (w1)[0 * 64], tmp_s);\ - op2(sum2, (w2)[0 * 64], tmp_s);\ - tmp_s = p[1 * 64];\ - op1(sum1, (w1)[1 * 64], tmp_s);\ - op2(sum2, (w2)[1 * 64], tmp_s);\ - tmp_s = p[2 * 64];\ - op1(sum1, (w1)[2 * 64], tmp_s);\ - op2(sum2, (w2)[2 * 64], tmp_s);\ - tmp_s = p[3 * 64];\ - op1(sum1, (w1)[3 * 64], tmp_s);\ - op2(sum2, (w2)[3 * 64], tmp_s);\ - tmp_s = p[4 * 64];\ - op1(sum1, (w1)[4 * 64], tmp_s);\ - op2(sum2, (w2)[4 * 64], tmp_s);\ - tmp_s = p[5 * 64];\ - op1(sum1, (w1)[5 * 64], tmp_s);\ - op2(sum2, (w2)[5 * 64], tmp_s);\ - tmp_s = p[6 * 64];\ - op1(sum1, (w1)[6 * 64], tmp_s);\ - op2(sum2, (w2)[6 * 64], tmp_s);\ - tmp_s = p[7 * 64];\ - op1(sum1, (w1)[7 * 64], tmp_s);\ - op2(sum2, (w2)[7 * 64], tmp_s);\ -} - -#define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) - -// tab[i][j] = 1.0 / (2.0 * cos(pi*(2*k+1) / 2^(6 - j))) - -// cos(i*pi/64) - -#define COS0_0 FIXHR(0.50060299823519630134/2) -#define COS0_1 FIXHR(0.50547095989754365998/2) -#define COS0_2 FIXHR(0.51544730992262454697/2) -#define COS0_3 FIXHR(0.53104259108978417447/2) -#define COS0_4 FIXHR(0.55310389603444452782/2) -#define COS0_5 FIXHR(0.58293496820613387367/2) -#define COS0_6 FIXHR(0.62250412303566481615/2) -#define COS0_7 FIXHR(0.67480834145500574602/2) -#define COS0_8 FIXHR(0.74453627100229844977/2) -#define COS0_9 FIXHR(0.83934964541552703873/2) -#define COS0_10 FIXHR(0.97256823786196069369/2) -#define COS0_11 FIXHR(1.16943993343288495515/4) -#define COS0_12 FIXHR(1.48416461631416627724/4) -#define COS0_13 FIXHR(2.05778100995341155085/8) -#define COS0_14 FIXHR(3.40760841846871878570/8) -#define COS0_15 FIXHR(10.19000812354805681150/32) - -#define COS1_0 FIXHR(0.50241928618815570551/2) -#define COS1_1 FIXHR(0.52249861493968888062/2) -#define COS1_2 FIXHR(0.56694403481635770368/2) -#define COS1_3 FIXHR(0.64682178335999012954/2) -#define COS1_4 FIXHR(0.78815462345125022473/2) -#define COS1_5 FIXHR(1.06067768599034747134/4) -#define COS1_6 FIXHR(1.72244709823833392782/4) -#define COS1_7 FIXHR(5.10114861868916385802/16) - -#define COS2_0 FIXHR(0.50979557910415916894/2) -#define COS2_1 FIXHR(0.60134488693504528054/2) -#define COS2_2 FIXHR(0.89997622313641570463/2) -#define COS2_3 FIXHR(2.56291544774150617881/8) - -#define COS3_0 FIXHR(0.54119610014619698439/2) -#define COS3_1 FIXHR(1.30656296487637652785/4) - -#define COS4_0 FIXHR(0.70710678118654752439/2) - -/* butterfly operator */ -#define BF(a, b, c, s)\ -{\ - tmp0 = tab[a] + tab[b];\ - tmp1 = tab[a] - tab[b];\ - tab[a] = tmp0;\ - tab[b] = MULH(tmp1<<(s), c);\ -} - -#define BF1(a, b, c, d)\ -{\ - BF(a, b, COS4_0, 1);\ - BF(c, d,-COS4_0, 1);\ - tab[c] += tab[d];\ -} - -#define BF2(a, b, c, d)\ -{\ - BF(a, b, COS4_0, 1);\ - BF(c, d,-COS4_0, 1);\ - tab[c] += tab[d];\ - tab[a] += tab[c];\ - tab[c] += tab[b];\ - tab[b] += tab[d];\ -} - -#define ADD(a, b) tab[a] += tab[b] - -// DCT32 without 1/sqrt(2) coef zero scaling. -static void dct32(int32 *out, int32 *tab) { - int tmp0, tmp1; - - // pass 1 - BF( 0, 31, COS0_0 , 1); - BF(15, 16, COS0_15, 5); - // pass 2 - BF( 0, 15, COS1_0 , 1); - BF(16, 31,-COS1_0 , 1); - // pass 1 - BF( 7, 24, COS0_7 , 1); - BF( 8, 23, COS0_8 , 1); - // pass 2 - BF( 7, 8, COS1_7 , 4); - BF(23, 24,-COS1_7 , 4); - // pass 3 - BF( 0, 7, COS2_0 , 1); - BF( 8, 15,-COS2_0 , 1); - BF(16, 23, COS2_0 , 1); - BF(24, 31,-COS2_0 , 1); - // pass 1 - BF( 3, 28, COS0_3 , 1); - BF(12, 19, COS0_12, 2); - // pass 2 - BF( 3, 12, COS1_3 , 1); - BF(19, 28,-COS1_3 , 1); - // pass 1 - BF( 4, 27, COS0_4 , 1); - BF(11, 20, COS0_11, 2); - // pass 2 - BF( 4, 11, COS1_4 , 1); - BF(20, 27,-COS1_4 , 1); - // pass 3 - BF( 3, 4, COS2_3 , 3); - BF(11, 12,-COS2_3 , 3); - BF(19, 20, COS2_3 , 3); - BF(27, 28,-COS2_3 , 3); - // pass 4 - BF( 0, 3, COS3_0 , 1); - BF( 4, 7,-COS3_0 , 1); - BF( 8, 11, COS3_0 , 1); - BF(12, 15,-COS3_0 , 1); - BF(16, 19, COS3_0 , 1); - BF(20, 23,-COS3_0 , 1); - BF(24, 27, COS3_0 , 1); - BF(28, 31,-COS3_0 , 1); - - // pass 1 - BF( 1, 30, COS0_1 , 1); - BF(14, 17, COS0_14, 3); - // pass 2 - BF( 1, 14, COS1_1 , 1); - BF(17, 30,-COS1_1 , 1); - // pass 1 - BF( 6, 25, COS0_6 , 1); - BF( 9, 22, COS0_9 , 1); - // pass 2 - BF( 6, 9, COS1_6 , 2); - BF(22, 25,-COS1_6 , 2); - // pass 3 - BF( 1, 6, COS2_1 , 1); - BF( 9, 14,-COS2_1 , 1); - BF(17, 22, COS2_1 , 1); - BF(25, 30,-COS2_1 , 1); - - // pass 1 - BF( 2, 29, COS0_2 , 1); - BF(13, 18, COS0_13, 3); - // pass 2 - BF( 2, 13, COS1_2 , 1); - BF(18, 29,-COS1_2 , 1); - // pass 1 - BF( 5, 26, COS0_5 , 1); - BF(10, 21, COS0_10, 1); - // pass 2 - BF( 5, 10, COS1_5 , 2); - BF(21, 26,-COS1_5 , 2); - // pass 3 - BF( 2, 5, COS2_2 , 1); - BF(10, 13,-COS2_2 , 1); - BF(18, 21, COS2_2 , 1); - BF(26, 29,-COS2_2 , 1); - // pass 4 - BF( 1, 2, COS3_1 , 2); - BF( 5, 6,-COS3_1 , 2); - BF( 9, 10, COS3_1 , 2); - BF(13, 14,-COS3_1 , 2); - BF(17, 18, COS3_1 , 2); - BF(21, 22,-COS3_1 , 2); - BF(25, 26, COS3_1 , 2); - BF(29, 30,-COS3_1 , 2); - - // pass 5 - BF1( 0, 1, 2, 3); - BF2( 4, 5, 6, 7); - BF1( 8, 9, 10, 11); - BF2(12, 13, 14, 15); - BF1(16, 17, 18, 19); - BF2(20, 21, 22, 23); - BF1(24, 25, 26, 27); - BF2(28, 29, 30, 31); - - // pass 6 - ADD( 8, 12); - ADD(12, 10); - ADD(10, 14); - ADD(14, 9); - ADD( 9, 13); - ADD(13, 11); - ADD(11, 15); - - out[ 0] = tab[0]; - out[16] = tab[1]; - out[ 8] = tab[2]; - out[24] = tab[3]; - out[ 4] = tab[4]; - out[20] = tab[5]; - out[12] = tab[6]; - out[28] = tab[7]; - out[ 2] = tab[8]; - out[18] = tab[9]; - out[10] = tab[10]; - out[26] = tab[11]; - out[ 6] = tab[12]; - out[22] = tab[13]; - out[14] = tab[14]; - out[30] = tab[15]; - - ADD(24, 28); - ADD(28, 26); - ADD(26, 30); - ADD(30, 25); - ADD(25, 29); - ADD(29, 27); - ADD(27, 31); - - out[ 1] = tab[16] + tab[24]; - out[17] = tab[17] + tab[25]; - out[ 9] = tab[18] + tab[26]; - out[25] = tab[19] + tab[27]; - out[ 5] = tab[20] + tab[28]; - out[21] = tab[21] + tab[29]; - out[13] = tab[22] + tab[30]; - out[29] = tab[23] + tab[31]; - out[ 3] = tab[24] + tab[20]; - out[19] = tab[25] + tab[21]; - out[11] = tab[26] + tab[22]; - out[27] = tab[27] + tab[23]; - out[ 7] = tab[28] + tab[18]; - out[23] = tab[29] + tab[19]; - out[15] = tab[30] + tab[17]; - out[31] = tab[31]; -} - -// 32 sub band synthesis filter. Input: 32 sub band samples, Output: -// 32 samples. -// XXX: optimize by avoiding ring buffer usage -void ff_mpa_synth_filter(int16 *synth_buf_ptr, int *synth_buf_offset, - int16 *window, int *dither_state, - int16 *samples, int incr, - int32 sb_samples[32]) -{ - int16 *synth_buf; - const int16 *w, *w2, *p; - int j, offset; - int16 *samples2; - int32 tmp[32]; - int sum, sum2; - int tmp_s; - - offset = *synth_buf_offset; - synth_buf = synth_buf_ptr + offset; - - dct32(tmp, sb_samples); - for(j = 0; j < 32; j++) { - // NOTE: can cause a loss in precision if very high amplitude sound - if (tmp[j] < (-0x7fff - 1)) - synth_buf[j] = (-0x7fff - 1); - else if (tmp[j] > 0x7fff) - synth_buf[j] = 0x7fff; - else - synth_buf[j] = tmp[j]; - } - - // copy to avoid wrap - memcpy(synth_buf + 512, synth_buf, 32 * sizeof(int16)); - - samples2 = samples + 31 * incr; - w = window; - w2 = window + 31; - - sum = *dither_state; - p = synth_buf + 16; - SUM8(MACS, sum, w, p); - p = synth_buf + 48; - SUM8(MLSS, sum, w + 32, p); - *samples = round_sample(&sum); - samples += incr; - w++; - - // we calculate two samples at the same time to avoid one memory - // access per two sample - for(j = 1; j < 16; j++) { - sum2 = 0; - p = synth_buf + 16 + j; - SUM8P2(sum, MACS, sum2, MLSS, w, w2, p); - p = synth_buf + 48 - j; - SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p); - - *samples = round_sample(&sum); - samples += incr; - sum += sum2; - *samples2 = round_sample(&sum); - samples2 -= incr; - w++; - w2--; - } - - p = synth_buf + 32; - SUM8(MLSS, sum, w + 32, p); - *samples = round_sample(&sum); - *dither_state= sum; - - offset = (offset - 32) & 511; - *synth_buf_offset = offset; -} - -/** - * parses a vlc code, faster then get_vlc() - * @param bits is the number of bits which will be read at once, must be - * identical to nb_bits in init_vlc() - * @param max_depth is the number of times bits bits must be read to completely - * read the longest vlc code - * = (max_vlc_length + bits - 1) / bits - */ -static int getVlc2(GetBitContext *s, int16 (*table)[2], int bits, int maxDepth) { - int reIndex; - int reCache; - int index; - int code; - int n; - - reIndex = s->index; - reCache = READ_LE_UINT32(s->buffer + (reIndex >> 3)) >> (reIndex & 0x07); - index = reCache & (0xffffffff >> (32 - bits)); - code = table[index][0]; - n = table[index][1]; - - if (maxDepth > 1 && n < 0){ - reIndex += bits; - reCache = READ_LE_UINT32(s->buffer + (reIndex >> 3)) >> (reIndex & 0x07); - - int nbBits = -n; - - index = (reCache & (0xffffffff >> (32 - nbBits))) + code; - code = table[index][0]; - n = table[index][1]; - - if(maxDepth > 2 && n < 0) { - reIndex += nbBits; - reCache = READ_LE_UINT32(s->buffer + (reIndex >> 3)) >> (reIndex & 0x07); - - nbBits = -n; - - index = (reCache & (0xffffffff >> (32 - nbBits))) + code; - code = table[index][0]; - n = table[index][1]; - } - } - - reCache >>= n; - s->index = reIndex + n; - return code; -} - -static int allocTable(VLC *vlc, int size, int use_static) { - int index; - int16 (*temp)[2] = NULL; - index = vlc->table_size; - vlc->table_size += size; - if (vlc->table_size > vlc->table_allocated) { - if(use_static) - error("QDM2 cant do anything, init_vlc() is used with too little memory"); - vlc->table_allocated += (1 << vlc->bits); - temp = (int16 (*)[2])realloc(vlc->table, sizeof(int16 *) * 2 * vlc->table_allocated); - if (!temp) { - free(vlc->table); - vlc->table = NULL; - return -1; - } - vlc->table = temp; - } - return index; -} - -#define GET_DATA(v, table, i, wrap, size)\ -{\ - const uint8 *ptr = (const uint8 *)table + i * wrap;\ - switch(size) {\ - case 1:\ - v = *(const uint8 *)ptr;\ - break;\ - case 2:\ - v = *(const uint16 *)ptr;\ - break;\ - default:\ - v = *(const uint32 *)ptr;\ - break;\ - }\ -} - -static int build_table(VLC *vlc, int table_nb_bits, - int nb_codes, - const void *bits, int bits_wrap, int bits_size, - const void *codes, int codes_wrap, int codes_size, - const void *symbols, int symbols_wrap, int symbols_size, - int code_prefix, int n_prefix, int flags) -{ - int i, j, k, n, table_size, table_index, nb, n1, index, code_prefix2, symbol; - uint32 code; - int16 (*table)[2]; - - table_size = 1 << table_nb_bits; - table_index = allocTable(vlc, table_size, flags & 4); - if (table_index < 0) - return -1; - table = &vlc->table[table_index]; - - for(i = 0; i < table_size; i++) { - table[i][1] = 0; //bits - table[i][0] = -1; //codes - } - - // first pass: map codes and compute auxillary table sizes - for(i = 0; i < nb_codes; i++) { - GET_DATA(n, bits, i, bits_wrap, bits_size); - GET_DATA(code, codes, i, codes_wrap, codes_size); - // we accept tables with holes - if (n <= 0) - continue; - if (!symbols) - symbol = i; - else - GET_DATA(symbol, symbols, i, symbols_wrap, symbols_size); - // if code matches the prefix, it is in the table - n -= n_prefix; - if(flags & 2) - code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (1 << n_prefix)-1); - else - code_prefix2= code >> n; - if (n > 0 && code_prefix2 == code_prefix) { - if (n <= table_nb_bits) { - // no need to add another table - j = (code << (table_nb_bits - n)) & (table_size - 1); - nb = 1 << (table_nb_bits - n); - for(k = 0; k < nb; k++) { - if(flags & 2) - j = (code >> n_prefix) + (k<> ((flags & 2) ? n_prefix : n)) & ((1 << table_nb_bits) - 1); - // compute table size - n1 = -table[j][1]; //bits - if (n > n1) - n1 = n; - table[j][1] = -n1; //bits - } - } - } - - // second pass : fill auxillary tables recursively - for(i = 0;i < table_size; i++) { - n = table[i][1]; //bits - if (n < 0) { - n = -n; - if (n > table_nb_bits) { - n = table_nb_bits; - table[i][1] = -n; //bits - } - index = build_table(vlc, n, nb_codes, - bits, bits_wrap, bits_size, - codes, codes_wrap, codes_size, - symbols, symbols_wrap, symbols_size, - (flags & 2) ? (code_prefix | (i << n_prefix)) : ((code_prefix << table_nb_bits) | i), - n_prefix + table_nb_bits, flags); - if (index < 0) - return -1; - // note: realloc has been done, so reload tables - table = &vlc->table[table_index]; - table[i][0] = index; //code - } - } - return table_index; -} - -/* Build VLC decoding tables suitable for use with get_vlc(). - - 'nb_bits' set thee decoding table size (2^nb_bits) entries. The - bigger it is, the faster is the decoding. But it should not be too - big to save memory and L1 cache. '9' is a good compromise. - - 'nb_codes' : number of vlcs codes - - 'bits' : table which gives the size (in bits) of each vlc code. - - 'codes' : table which gives the bit pattern of of each vlc code. - - 'symbols' : table which gives the values to be returned from get_vlc(). - - 'xxx_wrap' : give the number of bytes between each entry of the - 'bits' or 'codes' tables. - - 'xxx_size' : gives the number of bytes of each entry of the 'bits' - or 'codes' tables. - - 'wrap' and 'size' allows to use any memory configuration and types - (byte/word/long) to store the 'bits', 'codes', and 'symbols' tables. - - 'use_static' should be set to 1 for tables, which should be freed - with av_free_static(), 0 if free_vlc() will be used. -*/ -void initVlcSparse(VLC *vlc, int nb_bits, int nb_codes, - const void *bits, int bits_wrap, int bits_size, - const void *codes, int codes_wrap, int codes_size, - const void *symbols, int symbols_wrap, int symbols_size) { - vlc->bits = nb_bits; - - if(vlc->table_size && vlc->table_size == vlc->table_allocated) { - return; - } else if(vlc->table_size) { - error("called on a partially initialized table"); - } - - if (build_table(vlc, nb_bits, nb_codes, - bits, bits_wrap, bits_size, - codes, codes_wrap, codes_size, - symbols, symbols_wrap, symbols_size, - 0, 0, 4 | 2) < 0) { - free(&vlc->table); - return; // Error - } - - if(vlc->table_size != vlc->table_allocated) - error("QDM2 needed %d had %d", vlc->table_size, vlc->table_allocated); -} - -void QDM2Stream::softclipTableInit(void) { - uint16 i; - double dfl = SOFTCLIP_THRESHOLD - 32767; - float delta = 1.0 / -dfl; - - for (i = 0; i < ARRAYSIZE(_softclipTable); i++) - _softclipTable[i] = SOFTCLIP_THRESHOLD - ((int)(sin((float)i * delta) * dfl) & 0x0000FFFF); -} - -// random generated table -void QDM2Stream::rndTableInit(void) { - uint16 i; - uint16 j; - uint32 ldw, hdw; - // TODO: Replace Code with uint64 less version... - int64_t tmp64_1; - int64_t random_seed = 0; - float delta = 1.0 / 16384.0; - - for(i = 0; i < ARRAYSIZE(_noiseTable); i++) { - random_seed = random_seed * 214013 + 2531011; - _noiseTable[i] = (delta * (float)(((int32)random_seed >> 16) & 0x00007FFF)- 1.0) * 1.3; - } - - for (i = 0; i < 256; i++) { - random_seed = 81; - ldw = i; - for (j = 0; j < 5; j++) { - _randomDequantIndex[i][j] = (uint8)((ldw / random_seed) & 0xFF); - ldw = (uint32)ldw % (uint32)random_seed; - tmp64_1 = (random_seed * 0x55555556); - hdw = (uint32)(tmp64_1 >> 32); - random_seed = (int64_t)(hdw + (ldw >> 31)); - } - } - - for (i = 0; i < 128; i++) { - random_seed = 25; - ldw = i; - for (j = 0; j < 3; j++) { - _randomDequantType24[i][j] = (uint8)((ldw / random_seed) & 0xFF); - ldw = (uint32)ldw % (uint32)random_seed; - tmp64_1 = (random_seed * 0x66666667); - hdw = (uint32)(tmp64_1 >> 33); - random_seed = hdw + (ldw >> 31); - } - } -} - -void QDM2Stream::initNoiseSamples(void) { - uint16 i; - uint32 random_seed = 0; - float delta = 1.0 / 16384.0; - - for (i = 0; i < ARRAYSIZE(_noiseSamples); i++) { - random_seed = random_seed * 214013 + 2531011; - _noiseSamples[i] = (delta * (float)((random_seed >> 16) & 0x00007fff) - 1.0); - } -} - -static const uint16 qdm2_vlc_offs[18] = { - 0, 260, 566, 598, 894, 1166, 1230, 1294, 1678, 1950, 2214, 2278, 2310, 2570, 2834, 3124, 3448, 3838 -}; - -void QDM2Stream::initVlc(void) { - static int16 qdm2_table[3838][2]; - - if (!_vlcsInitialized) { - _vlcTabLevel.table = &qdm2_table[qdm2_vlc_offs[0]]; - _vlcTabLevel.table_allocated = qdm2_vlc_offs[1] - qdm2_vlc_offs[0]; - _vlcTabLevel.table_size = 0; - initVlcSparse(&_vlcTabLevel, 8, 24, - vlc_tab_level_huffbits, 1, 1, - vlc_tab_level_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabDiff.table = &qdm2_table[qdm2_vlc_offs[1]]; - _vlcTabDiff.table_allocated = qdm2_vlc_offs[2] - qdm2_vlc_offs[1]; - _vlcTabDiff.table_size = 0; - initVlcSparse(&_vlcTabDiff, 8, 37, - vlc_tab_diff_huffbits, 1, 1, - vlc_tab_diff_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabRun.table = &qdm2_table[qdm2_vlc_offs[2]]; - _vlcTabRun.table_allocated = qdm2_vlc_offs[3] - qdm2_vlc_offs[2]; - _vlcTabRun.table_size = 0; - initVlcSparse(&_vlcTabRun, 5, 6, - vlc_tab_run_huffbits, 1, 1, - vlc_tab_run_huffcodes, 1, 1, NULL, 0, 0); - - _fftLevelExpAltVlc.table = &qdm2_table[qdm2_vlc_offs[3]]; - _fftLevelExpAltVlc.table_allocated = qdm2_vlc_offs[4] - qdm2_vlc_offs[3]; - _fftLevelExpAltVlc.table_size = 0; - initVlcSparse(&_fftLevelExpAltVlc, 8, 28, - fft_level_exp_alt_huffbits, 1, 1, - fft_level_exp_alt_huffcodes, 2, 2, NULL, 0, 0); - - _fftLevelExpVlc.table = &qdm2_table[qdm2_vlc_offs[4]]; - _fftLevelExpVlc.table_allocated = qdm2_vlc_offs[5] - qdm2_vlc_offs[4]; - _fftLevelExpVlc.table_size = 0; - initVlcSparse(&_fftLevelExpVlc, 8, 20, - fft_level_exp_huffbits, 1, 1, - fft_level_exp_huffcodes, 2, 2, NULL, 0, 0); - - _fftStereoExpVlc.table = &qdm2_table[qdm2_vlc_offs[5]]; - _fftStereoExpVlc.table_allocated = qdm2_vlc_offs[6] - qdm2_vlc_offs[5]; - _fftStereoExpVlc.table_size = 0; - initVlcSparse(&_fftStereoExpVlc, 6, 7, - fft_stereo_exp_huffbits, 1, 1, - fft_stereo_exp_huffcodes, 1, 1, NULL, 0, 0); - - _fftStereoPhaseVlc.table = &qdm2_table[qdm2_vlc_offs[6]]; - _fftStereoPhaseVlc.table_allocated = qdm2_vlc_offs[7] - qdm2_vlc_offs[6]; - _fftStereoPhaseVlc.table_size = 0; - initVlcSparse(&_fftStereoPhaseVlc, 6, 9, - fft_stereo_phase_huffbits, 1, 1, - fft_stereo_phase_huffcodes, 1, 1, NULL, 0, 0); - - _vlcTabToneLevelIdxHi1.table = &qdm2_table[qdm2_vlc_offs[7]]; - _vlcTabToneLevelIdxHi1.table_allocated = qdm2_vlc_offs[8] - qdm2_vlc_offs[7]; - _vlcTabToneLevelIdxHi1.table_size = 0; - initVlcSparse(&_vlcTabToneLevelIdxHi1, 8, 20, - vlc_tab_tone_level_idx_hi1_huffbits, 1, 1, - vlc_tab_tone_level_idx_hi1_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabToneLevelIdxMid.table = &qdm2_table[qdm2_vlc_offs[8]]; - _vlcTabToneLevelIdxMid.table_allocated = qdm2_vlc_offs[9] - qdm2_vlc_offs[8]; - _vlcTabToneLevelIdxMid.table_size = 0; - initVlcSparse(&_vlcTabToneLevelIdxMid, 8, 24, - vlc_tab_tone_level_idx_mid_huffbits, 1, 1, - vlc_tab_tone_level_idx_mid_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabToneLevelIdxHi2.table = &qdm2_table[qdm2_vlc_offs[9]]; - _vlcTabToneLevelIdxHi2.table_allocated = qdm2_vlc_offs[10] - qdm2_vlc_offs[9]; - _vlcTabToneLevelIdxHi2.table_size = 0; - initVlcSparse(&_vlcTabToneLevelIdxHi2, 8, 24, - vlc_tab_tone_level_idx_hi2_huffbits, 1, 1, - vlc_tab_tone_level_idx_hi2_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabType30.table = &qdm2_table[qdm2_vlc_offs[10]]; - _vlcTabType30.table_allocated = qdm2_vlc_offs[11] - qdm2_vlc_offs[10]; - _vlcTabType30.table_size = 0; - initVlcSparse(&_vlcTabType30, 6, 9, - vlc_tab_type30_huffbits, 1, 1, - vlc_tab_type30_huffcodes, 1, 1, NULL, 0, 0); - - _vlcTabType34.table = &qdm2_table[qdm2_vlc_offs[11]]; - _vlcTabType34.table_allocated = qdm2_vlc_offs[12] - qdm2_vlc_offs[11]; - _vlcTabType34.table_size = 0; - initVlcSparse(&_vlcTabType34, 5, 10, - vlc_tab_type34_huffbits, 1, 1, - vlc_tab_type34_huffcodes, 1, 1, NULL, 0, 0); - - _vlcTabFftToneOffset[0].table = &qdm2_table[qdm2_vlc_offs[12]]; - _vlcTabFftToneOffset[0].table_allocated = qdm2_vlc_offs[13] - qdm2_vlc_offs[12]; - _vlcTabFftToneOffset[0].table_size = 0; - initVlcSparse(&_vlcTabFftToneOffset[0], 8, 23, - vlc_tab_fft_tone_offset_0_huffbits, 1, 1, - vlc_tab_fft_tone_offset_0_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabFftToneOffset[1].table = &qdm2_table[qdm2_vlc_offs[13]]; - _vlcTabFftToneOffset[1].table_allocated = qdm2_vlc_offs[14] - qdm2_vlc_offs[13]; - _vlcTabFftToneOffset[1].table_size = 0; - initVlcSparse(&_vlcTabFftToneOffset[1], 8, 28, - vlc_tab_fft_tone_offset_1_huffbits, 1, 1, - vlc_tab_fft_tone_offset_1_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabFftToneOffset[2].table = &qdm2_table[qdm2_vlc_offs[14]]; - _vlcTabFftToneOffset[2].table_allocated = qdm2_vlc_offs[15] - qdm2_vlc_offs[14]; - _vlcTabFftToneOffset[2].table_size = 0; - initVlcSparse(&_vlcTabFftToneOffset[2], 8, 32, - vlc_tab_fft_tone_offset_2_huffbits, 1, 1, - vlc_tab_fft_tone_offset_2_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabFftToneOffset[3].table = &qdm2_table[qdm2_vlc_offs[15]]; - _vlcTabFftToneOffset[3].table_allocated = qdm2_vlc_offs[16] - qdm2_vlc_offs[15]; - _vlcTabFftToneOffset[3].table_size = 0; - initVlcSparse(&_vlcTabFftToneOffset[3], 8, 35, - vlc_tab_fft_tone_offset_3_huffbits, 1, 1, - vlc_tab_fft_tone_offset_3_huffcodes, 2, 2, NULL, 0, 0); - - _vlcTabFftToneOffset[4].table = &qdm2_table[qdm2_vlc_offs[16]]; - _vlcTabFftToneOffset[4].table_allocated = qdm2_vlc_offs[17] - qdm2_vlc_offs[16]; - _vlcTabFftToneOffset[4].table_size = 0; - initVlcSparse(&_vlcTabFftToneOffset[4], 8, 38, - vlc_tab_fft_tone_offset_4_huffbits, 1, 1, - vlc_tab_fft_tone_offset_4_huffcodes, 2, 2, NULL, 0, 0); - - _vlcsInitialized = true; - } -} - -QDM2Stream::QDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadStream *extraData) { - uint32 tmp; - int32 tmp_s; - int tmp_val; - int i; - - debug(1, "QDM2Stream::QDM2Stream() Call"); - - _stream = stream; - _compressedData = NULL; - _subPacket = 0; - _superBlockStart = 0; - memset(_quantizedCoeffs, 0, sizeof(_quantizedCoeffs)); - memset(_fftLevelExp, 0, sizeof(_fftLevelExp)); - _noiseIdx = 0; - memset(_fftCoefsMinIndex, 0, sizeof(_fftCoefsMinIndex)); - memset(_fftCoefsMaxIndex, 0, sizeof(_fftCoefsMaxIndex)); - _fftToneStart = 0; - _fftToneEnd = 0; - for(i = 0; i < ARRAYSIZE(_subPacketListA); i++) { - _subPacketListA[i].packet = NULL; - _subPacketListA[i].next = NULL; - } - _subPacketsB = 0; - for(i = 0; i < ARRAYSIZE(_subPacketListB); i++) { - _subPacketListB[i].packet = NULL; - _subPacketListB[i].next = NULL; - } - for(i = 0; i < ARRAYSIZE(_subPacketListC); i++) { - _subPacketListC[i].packet = NULL; - _subPacketListC[i].next = NULL; - } - for(i = 0; i < ARRAYSIZE(_subPacketListD); i++) { - _subPacketListD[i].packet = NULL; - _subPacketListD[i].next = NULL; - } - memset(_synthBuf, 0, sizeof(_synthBuf)); - memset(_synthBufOffset, 0, sizeof(_synthBufOffset)); - memset(_sbSamples, 0, sizeof(_sbSamples)); - memset(_outputBuffer, 0, sizeof(_outputBuffer)); - _vlcsInitialized = false; - _superblocktype_2_3 = 0; - _hasErrors = false; - - // Rewind extraData stream from any previous calls... - extraData->seek(0, SEEK_SET); - - tmp_s = extraData->readSint32BE(); - debug(1, "QDM2Stream::QDM2Stream() extraSize: %d", tmp_s); - if ((extraData->size() - extraData->pos()) / 4 + 1 != tmp_s) - warning("QDM2Stream::QDM2Stream() extraSize mismatch - Expected %d", (extraData->size() - extraData->pos()) / 4 + 1); - if (tmp_s < 12) - error("QDM2Stream::QDM2Stream() Insufficient extraData"); - - tmp = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() extraTag: %d", tmp); - if (tmp != MKID_BE('frma')) - warning("QDM2Stream::QDM2Stream() extraTag mismatch"); - - tmp = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() extraType: %d", tmp); - if (tmp == MKID_BE('QDMC')) - warning("QDM2Stream::QDM2Stream() QDMC stream type not supported"); - else if (tmp != MKID_BE('QDM2')) - error("QDM2Stream::QDM2Stream() Unsupported stream type"); - - tmp_s = extraData->readSint32BE(); - debug(1, "QDM2Stream::QDM2Stream() extraSize2: %d", tmp_s); - if ((extraData->size() - extraData->pos()) + 4 != tmp_s) - warning("QDM2Stream::QDM2Stream() extraSize2 mismatch - Expected %d", (extraData->size() - extraData->pos()) + 4); - - tmp = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() extraTag2: %d", tmp); - if (tmp != MKID_BE('QDCA')) - warning("QDM2Stream::QDM2Stream() extraTag2 mismatch"); - - if (extraData->readUint32BE() != 1) - warning("QDM2Stream::QDM2Stream() u0 field not 1"); - - _channels = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() channels: %d", _channels); - - _sampleRate = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() sampleRate: %d", _sampleRate); - - _bitRate = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() bitRate: %d", _bitRate); - - _blockSize = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() blockSize: %d", _blockSize); - - _frameSize = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() frameSize: %d", _frameSize); - - _packetSize = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() packetSize: %d", _packetSize); - - if (extraData->size() - extraData->pos() != 0) { - tmp_s = extraData->readSint32BE(); - debug(1, "QDM2Stream::QDM2Stream() extraSize3: %d", tmp_s); - if (extraData->size() + 4 != tmp_s) - warning("QDM2Stream::QDM2Stream() extraSize3 mismatch - Expected %d", extraData->size() + 4); - - tmp = extraData->readUint32BE(); - debug(1, "QDM2Stream::QDM2Stream() extraTag3: %d", tmp); - if (tmp != MKID_BE('QDCP')) - warning("QDM2Stream::QDM2Stream() extraTag3 mismatch"); - - if ((float)extraData->readUint32BE() != 1.0) - warning("QDM2Stream::QDM2Stream() uf0 field not 1.0"); - - if (extraData->readUint32BE() != 0) - warning("QDM2Stream::QDM2Stream() u1 field not 0"); - - if ((float)extraData->readUint32BE() != 1.0) - warning("QDM2Stream::QDM2Stream() uf1 field not 1.0"); - - if ((float)extraData->readUint32BE() != 1.0) - warning("QDM2Stream::QDM2Stream() uf2 field not 1.0"); - - if (extraData->readUint32BE() != 27) - warning("QDM2Stream::QDM2Stream() u2 field not 27"); - - if (extraData->readUint32BE() != 8) - warning("QDM2Stream::QDM2Stream() u3 field not 8"); - - if (extraData->readUint32BE() != 0) - warning("QDM2Stream::QDM2Stream() u4 field not 0"); - } - - _fftOrder = scummvm_log2(_frameSize) + 1; - _fftFrameSize = 2 * _frameSize; // complex has two floats - - // something like max decodable tones - _groupOrder = scummvm_log2(_blockSize) + 1; - _sFrameSize = _blockSize / 16; // 16 iterations per super block - - _subSampling = _fftOrder - 7; - _frequencyRange = 255 / (1 << (2 - _subSampling)); - - switch ((_subSampling * 2 + _channels - 1)) { - case 0: - tmp = 40; - break; - case 1: - tmp = 48; - break; - case 2: - tmp = 56; - break; - case 3: - tmp = 72; - break; - case 4: - tmp = 80; - break; - case 5: - tmp = 100; - break; - default: - tmp = _subSampling; - break; - } - - tmp_val = 0; - if ((tmp * 1000) < _bitRate) tmp_val = 1; - if ((tmp * 1440) < _bitRate) tmp_val = 2; - if ((tmp * 1760) < _bitRate) tmp_val = 3; - if ((tmp * 2240) < _bitRate) tmp_val = 4; - _cmTableSelect = tmp_val; - - if (_subSampling == 0) - tmp = 7999; - else - tmp = ((-(_subSampling -1)) & 8000) + 20000; - - if (tmp < 8000) - _coeffPerSbSelect = 0; - else if (tmp <= 16000) - _coeffPerSbSelect = 1; - else - _coeffPerSbSelect = 2; - - if (_fftOrder < 7 || _fftOrder > 9) - error("QDM2Stream::QDM2Stream() Unsupported fft_order: %d", _fftOrder); - - rdftInit(&_rdftCtx, _fftOrder, IRDFT); - - initVlc(); - ff_mpa_synth_init(ff_mpa_synth_window); - softclipTableInit(); - rndTableInit(); - initNoiseSamples(); - - _compressedData = new uint8[_packetSize]; -} - -QDM2Stream::~QDM2Stream() { - delete[] _compressedData; - delete _stream; -} - -static int qdm2_get_vlc(GetBitContext *gb, VLC *vlc, int flag, int depth) { - int value = getVlc2(gb, vlc->table, vlc->bits, depth); - - // stage-2, 3 bits exponent escape sequence - if (value-- == 0) - value = getBits(gb, getBits (gb, 3) + 1); - - // stage-3, optional - if (flag) { - int tmp = vlc_stage3_values[value]; - - if ((value & ~3) > 0) - tmp += getBits(gb, (value >> 2)); - value = tmp; - } - - return value; -} - -static int qdm2_get_se_vlc(VLC *vlc, GetBitContext *gb, int depth) -{ - int value = qdm2_get_vlc(gb, vlc, 0, depth); - - return (value & 1) ? ((value + 1) >> 1) : -(value >> 1); -} - -/** - * QDM2 checksum - * - * @param data pointer to data to be checksum'ed - * @param length data length - * @param value checksum value - * - * @return 0 if checksum is OK - */ -static uint16 qdm2_packet_checksum(const uint8 *data, int length, int value) { - int i; - - for (i = 0; i < length; i++) - value -= data[i]; - - return (uint16)(value & 0xffff); -} - -/** - * Fills a QDM2SubPacket structure with packet type, size, and data pointer. - * - * @param gb bitreader context - * @param sub_packet packet under analysis - */ -static void qdm2_decode_sub_packet_header(GetBitContext *gb, QDM2SubPacket *sub_packet) -{ - sub_packet->type = getBits (gb, 8); - - if (sub_packet->type == 0) { - sub_packet->size = 0; - sub_packet->data = NULL; - } else { - sub_packet->size = getBits (gb, 8); - - if (sub_packet->type & 0x80) { - sub_packet->size <<= 8; - sub_packet->size |= getBits (gb, 8); - sub_packet->type &= 0x7f; - } - - if (sub_packet->type == 0x7f) - sub_packet->type |= (getBits (gb, 8) << 8); - - sub_packet->data = &gb->buffer[getBitsCount(gb) / 8]; // FIXME: this depends on bitreader internal data - } -} - -/** - * Return node pointer to first packet of requested type in list. - * - * @param list list of subpackets to be scanned - * @param type type of searched subpacket - * @return node pointer for subpacket if found, else NULL - */ -static QDM2SubPNode* qdm2_search_subpacket_type_in_list(QDM2SubPNode *list, int type) -{ - while (list != NULL && list->packet != NULL) { - if (list->packet->type == type) - return list; - list = list->next; - } - return NULL; -} - -/** - * Replaces 8 elements with their average value. - * Called by qdm2_decode_superblock before starting subblock decoding. - */ -void QDM2Stream::average_quantized_coeffs(void) { - int i, j, n, ch, sum; - - n = coeff_per_sb_for_avg[_coeffPerSbSelect][QDM2_SB_USED(_subSampling) - 1] + 1; - - for (ch = 0; ch < _channels; ch++) { - for (i = 0; i < n; i++) { - sum = 0; - - for (j = 0; j < 8; j++) - sum += _quantizedCoeffs[ch][i][j]; - - sum /= 8; - if (sum > 0) - sum--; - - for (j = 0; j < 8; j++) - _quantizedCoeffs[ch][i][j] = sum; - } - } -} - -/** - * Build subband samples with noise weighted by q->tone_level. - * Called by synthfilt_build_sb_samples. - * - * @param sb subband index - */ -void QDM2Stream::build_sb_samples_from_noise(int sb) { - int ch, j; - - FIX_NOISE_IDX(_noiseIdx); - - if (!_channels) - return; - - for (ch = 0; ch < _channels; ch++) { - for (j = 0; j < 64; j++) { - _sbSamples[ch][j * 2][sb] = (int32)(SB_DITHERING_NOISE(sb, _noiseIdx) * _toneLevel[ch][sb][j] + .5); - _sbSamples[ch][j * 2 + 1][sb] = (int32)(SB_DITHERING_NOISE(sb, _noiseIdx) * _toneLevel[ch][sb][j] + .5); - } - } -} - -/** - * Called while processing data from subpackets 11 and 12. - * Used after making changes to coding_method array. - * - * @param sb subband index - * @param channels number of channels - * @param coding_method q->coding_method[0][0][0] - */ -void QDM2Stream::fix_coding_method_array(int sb, int channels, sb_int8_array coding_method) -{ - int j, k; - int ch; - int run, case_val; - int switchtable[23] = {0,5,1,5,5,5,5,5,2,5,5,5,5,5,5,5,3,5,5,5,5,5,4}; - - for (ch = 0; ch < channels; ch++) { - for (j = 0; j < 64; ) { - if((coding_method[ch][sb][j] - 8) > 22) { - run = 1; - case_val = 8; - } else { - switch (switchtable[coding_method[ch][sb][j]-8]) { - case 0: run = 10; case_val = 10; break; - case 1: run = 1; case_val = 16; break; - case 2: run = 5; case_val = 24; break; - case 3: run = 3; case_val = 30; break; - case 4: run = 1; case_val = 30; break; - case 5: run = 1; case_val = 8; break; - default: run = 1; case_val = 8; break; - } - } - for (k = 0; k < run; k++) - if (j + k < 128) - if (coding_method[ch][sb + (j + k) / 64][(j + k) % 64] > coding_method[ch][sb][j]) - if (k > 0) { - warning("QDM2 Untested Code: not debugged, almost never used"); - memset(&coding_method[ch][sb][j + k], case_val, k * sizeof(int8)); - memset(&coding_method[ch][sb][j + k], case_val, 3 * sizeof(int8)); - } - j += run; - } - } -} - -/** - * Related to synthesis filter - * Called by process_subpacket_10 - * - * @param flag 1 if called after getting data from subpacket 10, 0 if no subpacket 10 - */ -void QDM2Stream::fill_tone_level_array(int flag) { - int i, sb, ch, sb_used; - int tmp, tab; - - // This should never happen - if (_channels <= 0) - return; - - for (ch = 0; ch < _channels; ch++) { - for (sb = 0; sb < 30; sb++) { - for (i = 0; i < 8; i++) { - if ((tab=coeff_per_sb_for_dequant[_coeffPerSbSelect][sb]) < (last_coeff[_coeffPerSbSelect] - 1)) - tmp = _quantizedCoeffs[ch][tab + 1][i] * dequant_table[_coeffPerSbSelect][tab + 1][sb]+ - _quantizedCoeffs[ch][tab][i] * dequant_table[_coeffPerSbSelect][tab][sb]; - else - tmp = _quantizedCoeffs[ch][tab][i] * dequant_table[_coeffPerSbSelect][tab][sb]; - if(tmp < 0) - tmp += 0xff; - _toneLevelIdxBase[ch][sb][i] = (tmp / 256) & 0xff; - } - } - } - - sb_used = QDM2_SB_USED(_subSampling); - - if ((_superblocktype_2_3 != 0) && !flag) { - for (sb = 0; sb < sb_used; sb++) { - for (ch = 0; ch < _channels; ch++) { - for (i = 0; i < 64; i++) { - _toneLevelIdx[ch][sb][i] = _toneLevelIdxBase[ch][sb][i / 8]; - if (_toneLevelIdx[ch][sb][i] < 0) - _toneLevel[ch][sb][i] = 0; - else - _toneLevel[ch][sb][i] = fft_tone_level_table[0][_toneLevelIdx[ch][sb][i] & 0x3f]; - } - } - } - } else { - tab = _superblocktype_2_3 ? 0 : 1; - for (sb = 0; sb < sb_used; sb++) { - if ((sb >= 4) && (sb <= 23)) { - for (ch = 0; ch < _channels; ch++) { - for (i = 0; i < 64; i++) { - tmp = _toneLevelIdxBase[ch][sb][i / 8] - - _toneLevelIdxHi1[ch][sb / 8][i / 8][i % 8] - - _toneLevelIdxMid[ch][sb - 4][i / 8] - - _toneLevelIdxHi2[ch][sb - 4]; - _toneLevelIdx[ch][sb][i] = tmp & 0xff; - if ((tmp < 0) || (!_superblocktype_2_3 && !tmp)) - _toneLevel[ch][sb][i] = 0; - else - _toneLevel[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; - } - } - } else { - if (sb > 4) { - for (ch = 0; ch < _channels; ch++) { - for (i = 0; i < 64; i++) { - tmp = _toneLevelIdxBase[ch][sb][i / 8] - - _toneLevelIdxHi1[ch][2][i / 8][i % 8] - - _toneLevelIdxHi2[ch][sb - 4]; - _toneLevelIdx[ch][sb][i] = tmp & 0xff; - if ((tmp < 0) || (!_superblocktype_2_3 && !tmp)) - _toneLevel[ch][sb][i] = 0; - else - _toneLevel[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; - } - } - } else { - for (ch = 0; ch < _channels; ch++) { - for (i = 0; i < 64; i++) { - tmp = _toneLevelIdx[ch][sb][i] = _toneLevelIdxBase[ch][sb][i / 8]; - if ((tmp < 0) || (!_superblocktype_2_3 && !tmp)) - _toneLevel[ch][sb][i] = 0; - else - _toneLevel[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; - } - } - } - } - } - } -} - -/** - * Related to synthesis filter - * Called by process_subpacket_11 - * c is built with data from subpacket 11 - * Most of this function is used only if superblock_type_2_3 == 0, never seen it in samples - * - * @param tone_level_idx - * @param tone_level_idx_temp - * @param coding_method q->coding_method[0][0][0] - * @param nb_channels number of channels - * @param c coming from subpacket 11, passed as 8*c - * @param superblocktype_2_3 flag based on superblock packet type - * @param cm_table_select q->cm_table_select - */ -void QDM2Stream::fill_coding_method_array(sb_int8_array tone_level_idx, sb_int8_array tone_level_idx_temp, - sb_int8_array coding_method, int nb_channels, - int c, int superblocktype_2_3, int cm_table_select) { - int ch, sb, j; - int tmp, acc, esp_40, comp; - int add1, add2, add3, add4; - // TODO : Remove multres 64 bit variable necessity... - int64_t multres; - - // This should never happen - if (nb_channels <= 0) - return; - if (!superblocktype_2_3) { - warning("QDM2 This case is untested, no samples available"); - for (ch = 0; ch < nb_channels; ch++) - for (sb = 0; sb < 30; sb++) { - for (j = 1; j < 63; j++) { // The loop only iterates to 63 so the code doesn't overflow the buffer - add1 = tone_level_idx[ch][sb][j] - 10; - if (add1 < 0) - add1 = 0; - add2 = add3 = add4 = 0; - if (sb > 1) { - add2 = tone_level_idx[ch][sb - 2][j] + tone_level_idx_offset_table[sb][0] - 6; - if (add2 < 0) - add2 = 0; - } - if (sb > 0) { - add3 = tone_level_idx[ch][sb - 1][j] + tone_level_idx_offset_table[sb][1] - 6; - if (add3 < 0) - add3 = 0; - } - if (sb < 29) { - add4 = tone_level_idx[ch][sb + 1][j] + tone_level_idx_offset_table[sb][3] - 6; - if (add4 < 0) - add4 = 0; - } - tmp = tone_level_idx[ch][sb][j + 1] * 2 - add4 - add3 - add2 - add1; - if (tmp < 0) - tmp = 0; - tone_level_idx_temp[ch][sb][j + 1] = tmp & 0xff; - } - tone_level_idx_temp[ch][sb][0] = tone_level_idx_temp[ch][sb][1]; - } - acc = 0; - for (ch = 0; ch < nb_channels; ch++) - for (sb = 0; sb < 30; sb++) - for (j = 0; j < 64; j++) - acc += tone_level_idx_temp[ch][sb][j]; - - multres = 0x66666667 * (acc * 10); - esp_40 = (multres >> 32) / 8 + ((multres & 0xffffffff) >> 31); - for (ch = 0; ch < nb_channels; ch++) - for (sb = 0; sb < 30; sb++) - for (j = 0; j < 64; j++) { - comp = tone_level_idx_temp[ch][sb][j]* esp_40 * 10; - if (comp < 0) - comp += 0xff; - comp /= 256; // signed shift - switch(sb) { - case 0: - if (comp < 30) - comp = 30; - comp += 15; - break; - case 1: - if (comp < 24) - comp = 24; - comp += 10; - break; - case 2: - case 3: - case 4: - if (comp < 16) - comp = 16; - } - if (comp <= 5) - tmp = 0; - else if (comp <= 10) - tmp = 10; - else if (comp <= 16) - tmp = 16; - else if (comp <= 24) - tmp = -1; - else - tmp = 0; - coding_method[ch][sb][j] = ((tmp & 0xfffa) + 30 )& 0xff; - } - for (sb = 0; sb < 30; sb++) - fix_coding_method_array(sb, nb_channels, coding_method); - for (ch = 0; ch < nb_channels; ch++) - for (sb = 0; sb < 30; sb++) - for (j = 0; j < 64; j++) - if (sb >= 10) { - if (coding_method[ch][sb][j] < 10) - coding_method[ch][sb][j] = 10; - } else { - if (sb >= 2) { - if (coding_method[ch][sb][j] < 16) - coding_method[ch][sb][j] = 16; - } else { - if (coding_method[ch][sb][j] < 30) - coding_method[ch][sb][j] = 30; - } - } - } else { // superblocktype_2_3 != 0 - for (ch = 0; ch < nb_channels; ch++) - for (sb = 0; sb < 30; sb++) - for (j = 0; j < 64; j++) - coding_method[ch][sb][j] = coding_method_table[cm_table_select][sb]; - } -} - -/** - * - * Called by process_subpacket_11 to process more data from subpacket 11 with sb 0-8 - * Called by process_subpacket_12 to process data from subpacket 12 with sb 8-sb_used - * - * @param gb bitreader context - * @param length packet length in bits - * @param sb_min lower subband processed (sb_min included) - * @param sb_max higher subband processed (sb_max excluded) - */ -void QDM2Stream::synthfilt_build_sb_samples(GetBitContext *gb, int length, int sb_min, int sb_max) { - int sb, j, k, n, ch, run, channels; - int joined_stereo, zero_encoding, chs; - int type34_first; - float type34_div = 0; - float type34_predictor; - float samples[10], sign_bits[16]; - - if (length == 0) { - // If no data use noise - for (sb = sb_min; sb < sb_max; sb++) - build_sb_samples_from_noise(sb); - - return; - } - - for (sb = sb_min; sb < sb_max; sb++) { - FIX_NOISE_IDX(_noiseIdx); - - channels = _channels; - - if (_channels <= 1 || sb < 12) - joined_stereo = 0; - else if (sb >= 24) - joined_stereo = 1; - else - joined_stereo = (BITS_LEFT(length,gb) >= 1) ? getBits1 (gb) : 0; - - if (joined_stereo) { - if (BITS_LEFT(length,gb) >= 16) - for (j = 0; j < 16; j++) - sign_bits[j] = getBits1(gb); - - for (j = 0; j < 64; j++) - if (_codingMethod[1][sb][j] > _codingMethod[0][sb][j]) - _codingMethod[0][sb][j] = _codingMethod[1][sb][j]; - - fix_coding_method_array(sb, _channels, _codingMethod); - channels = 1; - } - - for (ch = 0; ch < channels; ch++) { - zero_encoding = (BITS_LEFT(length,gb) >= 1) ? getBits1(gb) : 0; - type34_predictor = 0.0; - type34_first = 1; - - for (j = 0; j < 128; ) { - switch (_codingMethod[ch][sb][j / 2]) { - case 8: - if (BITS_LEFT(length,gb) >= 10) { - if (zero_encoding) { - for (k = 0; k < 5; k++) { - if ((j + 2 * k) >= 128) - break; - samples[2 * k] = getBits1(gb) ? dequant_1bit[joined_stereo][2 * getBits1(gb)] : 0; - } - } else { - n = getBits(gb, 8); - for (k = 0; k < 5; k++) - samples[2 * k] = dequant_1bit[joined_stereo][_randomDequantIndex[n][k]]; - } - for (k = 0; k < 5; k++) - samples[2 * k + 1] = SB_DITHERING_NOISE(sb, _noiseIdx); - } else { - for (k = 0; k < 10; k++) - samples[k] = SB_DITHERING_NOISE(sb, _noiseIdx); - } - run = 10; - break; - - case 10: - if (BITS_LEFT(length,gb) >= 1) { - double f = 0.81; - - if (getBits1(gb)) - f = -f; - f -= _noiseSamples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0; - samples[0] = f; - } else { - samples[0] = SB_DITHERING_NOISE(sb, _noiseIdx); - } - run = 1; - break; - - case 16: - if (BITS_LEFT(length,gb) >= 10) { - if (zero_encoding) { - for (k = 0; k < 5; k++) { - if ((j + k) >= 128) - break; - samples[k] = (getBits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * getBits1(gb)]; - } - } else { - n = getBits (gb, 8); - for (k = 0; k < 5; k++) - samples[k] = dequant_1bit[joined_stereo][_randomDequantIndex[n][k]]; - } - } else { - for (k = 0; k < 5; k++) - samples[k] = SB_DITHERING_NOISE(sb, _noiseIdx); - } - run = 5; - break; - - case 24: - if (BITS_LEFT(length,gb) >= 7) { - n = getBits(gb, 7); - for (k = 0; k < 3; k++) - samples[k] = (_randomDequantType24[n][k] - 2.0) * 0.5; - } else { - for (k = 0; k < 3; k++) - samples[k] = SB_DITHERING_NOISE(sb, _noiseIdx); - } - run = 3; - break; - - case 30: - if (BITS_LEFT(length,gb) >= 4) - samples[0] = type30_dequant[qdm2_get_vlc(gb, &_vlcTabType30, 0, 1)]; - else - samples[0] = SB_DITHERING_NOISE(sb, _noiseIdx); - - run = 1; - break; - - case 34: - if (BITS_LEFT(length,gb) >= 7) { - if (type34_first) { - type34_div = (float)(1 << getBits(gb, 2)); - samples[0] = ((float)getBits(gb, 5) - 16.0) / 15.0; - type34_predictor = samples[0]; - type34_first = 0; - } else { - samples[0] = type34_delta[qdm2_get_vlc(gb, &_vlcTabType34, 0, 1)] / type34_div + type34_predictor; - type34_predictor = samples[0]; - } - } else { - samples[0] = SB_DITHERING_NOISE(sb, _noiseIdx); - } - run = 1; - break; - - default: - samples[0] = SB_DITHERING_NOISE(sb, _noiseIdx); - run = 1; - break; - } - - if (joined_stereo) { - float tmp[10][MPA_MAX_CHANNELS]; - - for (k = 0; k < run; k++) { - tmp[k][0] = samples[k]; - tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k]; - } - for (chs = 0; chs < _channels; chs++) - for (k = 0; k < run; k++) - if ((j + k) < 128) - _sbSamples[chs][j + k][sb] = (int32)(_toneLevel[chs][sb][((j + k)/2)] * tmp[k][chs] + .5); - } else { - for (k = 0; k < run; k++) - if ((j + k) < 128) - _sbSamples[ch][j + k][sb] = (int32)(_toneLevel[ch][sb][(j + k)/2] * samples[k] + .5); - } - - j += run; - } // j loop - } // channel loop - } // subband loop -} - -/** - * Init the first element of a channel in quantized_coeffs with data from packet 10 (quantized_coeffs[ch][0]). - * This is similar to process_subpacket_9, but for a single channel and for element [0] - * same VLC tables as process_subpacket_9 are used. - * - * @param quantized_coeffs pointer to quantized_coeffs[ch][0] - * @param gb bitreader context - * @param length packet length in bits - */ -void QDM2Stream::init_quantized_coeffs_elem0(int8 *quantized_coeffs, GetBitContext *gb, int length) { - int i, k, run, level, diff; - - if (BITS_LEFT(length,gb) < 16) - return; - level = qdm2_get_vlc(gb, &_vlcTabLevel, 0, 2); - - quantized_coeffs[0] = level; - - for (i = 0; i < 7; ) { - if (BITS_LEFT(length,gb) < 16) - break; - run = qdm2_get_vlc(gb, &_vlcTabRun, 0, 1) + 1; - - if (BITS_LEFT(length,gb) < 16) - break; - diff = qdm2_get_se_vlc(&_vlcTabDiff, gb, 2); - - for (k = 1; k <= run; k++) - quantized_coeffs[i + k] = (level + ((k * diff) / run)); - - level += diff; - i += run; - } -} - -/** - * Related to synthesis filter, process data from packet 10 - * Init part of quantized_coeffs via function init_quantized_coeffs_elem0 - * Init tone_level_idx_hi1, tone_level_idx_hi2, tone_level_idx_mid with data from packet 10 - * - * @param gb bitreader context - * @param length packet length in bits - */ -void QDM2Stream::init_tone_level_dequantization(GetBitContext *gb, int length) { - int sb, j, k, n, ch; - - for (ch = 0; ch < _channels; ch++) { - init_quantized_coeffs_elem0(_quantizedCoeffs[ch][0], gb, length); - - if (BITS_LEFT(length,gb) < 16) { - memset(_quantizedCoeffs[ch][0], 0, 8); - break; - } - } - - n = _subSampling + 1; - - for (sb = 0; sb < n; sb++) - for (ch = 0; ch < _channels; ch++) - for (j = 0; j < 8; j++) { - if (BITS_LEFT(length,gb) < 1) - break; - if (getBits1(gb)) { - for (k=0; k < 8; k++) { - if (BITS_LEFT(length,gb) < 16) - break; - _toneLevelIdxHi1[ch][sb][j][k] = qdm2_get_vlc(gb, &_vlcTabToneLevelIdxHi1, 0, 2); - } - } else { - for (k=0; k < 8; k++) - _toneLevelIdxHi1[ch][sb][j][k] = 0; - } - } - - n = QDM2_SB_USED(_subSampling) - 4; - - for (sb = 0; sb < n; sb++) - for (ch = 0; ch < _channels; ch++) { - if (BITS_LEFT(length,gb) < 16) - break; - _toneLevelIdxHi2[ch][sb] = qdm2_get_vlc(gb, &_vlcTabToneLevelIdxHi2, 0, 2); - if (sb > 19) - _toneLevelIdxHi2[ch][sb] -= 16; - else - for (j = 0; j < 8; j++) - _toneLevelIdxMid[ch][sb][j] = -16; - } - - n = QDM2_SB_USED(_subSampling) - 5; - - for (sb = 0; sb < n; sb++) { - for (ch = 0; ch < _channels; ch++) { - for (j = 0; j < 8; j++) { - if (BITS_LEFT(length,gb) < 16) - break; - _toneLevelIdxMid[ch][sb][j] = qdm2_get_vlc(gb, &_vlcTabToneLevelIdxMid, 0, 2) - 32; - } - } - } -} - -/** - * Process subpacket 9, init quantized_coeffs with data from it - * - * @param node pointer to node with packet - */ -void QDM2Stream::process_subpacket_9(QDM2SubPNode *node) { - GetBitContext gb; - int i, j, k, n, ch, run, level, diff; - - initGetBits(&gb, node->packet->data, node->packet->size*8); - - n = coeff_per_sb_for_avg[_coeffPerSbSelect][QDM2_SB_USED(_subSampling) - 1] + 1; // same as averagesomething function - - for (i = 1; i < n; i++) - for (ch = 0; ch < _channels; ch++) { - level = qdm2_get_vlc(&gb, &_vlcTabLevel, 0, 2); - _quantizedCoeffs[ch][i][0] = level; - - for (j = 0; j < (8 - 1); ) { - run = qdm2_get_vlc(&gb, &_vlcTabRun, 0, 1) + 1; - diff = qdm2_get_se_vlc(&_vlcTabDiff, &gb, 2); - - for (k = 1; k <= run; k++) - _quantizedCoeffs[ch][i][j + k] = (level + ((k*diff) / run)); - - level += diff; - j += run; - } - } - - for (ch = 0; ch < _channels; ch++) - for (i = 0; i < 8; i++) - _quantizedCoeffs[ch][0][i] = 0; -} - -/** - * Process subpacket 10 if not null, else - * - * @param node pointer to node with packet - * @param length packet length in bits - */ -void QDM2Stream::process_subpacket_10(QDM2SubPNode *node, int length) { - GetBitContext gb; - - initGetBits(&gb, ((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8)); - - if (length != 0) { - init_tone_level_dequantization(&gb, length); - fill_tone_level_array(1); - } else { - fill_tone_level_array(0); - } -} - -/** - * Process subpacket 11 - * - * @param node pointer to node with packet - * @param length packet length in bit - */ -void QDM2Stream::process_subpacket_11(QDM2SubPNode *node, int length) { - GetBitContext gb; - - initGetBits(&gb, ((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8)); - if (length >= 32) { - int c = getBits (&gb, 13); - - if (c > 3) - fill_coding_method_array(_toneLevelIdx, _toneLevelIdxTemp, _codingMethod, - _channels, 8*c, _superblocktype_2_3, _cmTableSelect); - } - - synthfilt_build_sb_samples(&gb, length, 0, 8); -} - -/** - * Process subpacket 12 - * - * @param node pointer to node with packet - * @param length packet length in bits - */ -void QDM2Stream::process_subpacket_12(QDM2SubPNode *node, int length) { - GetBitContext gb; - - initGetBits(&gb, ((node == NULL) ? _emptyBuffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8)); - synthfilt_build_sb_samples(&gb, length, 8, QDM2_SB_USED(_subSampling)); -} - -/* - * Process new subpackets for synthesis filter - * - * @param list list with synthesis filter packets (list D) - */ -void QDM2Stream::process_synthesis_subpackets(QDM2SubPNode *list) { - struct QDM2SubPNode *nodes[4]; - - nodes[0] = qdm2_search_subpacket_type_in_list(list, 9); - if (nodes[0] != NULL) - process_subpacket_9(nodes[0]); - - nodes[1] = qdm2_search_subpacket_type_in_list(list, 10); - if (nodes[1] != NULL) - process_subpacket_10(nodes[1], nodes[1]->packet->size << 3); - else - process_subpacket_10(NULL, 0); - - nodes[2] = qdm2_search_subpacket_type_in_list(list, 11); - if (nodes[0] != NULL && nodes[1] != NULL && nodes[2] != NULL) - process_subpacket_11(nodes[2], (nodes[2]->packet->size << 3)); - else - process_subpacket_11(NULL, 0); - - nodes[3] = qdm2_search_subpacket_type_in_list(list, 12); - if (nodes[0] != NULL && nodes[1] != NULL && nodes[3] != NULL) - process_subpacket_12(nodes[3], (nodes[3]->packet->size << 3)); - else - process_subpacket_12(NULL, 0); -} - -/* - * Decode superblock, fill packet lists. - * - */ -void QDM2Stream::qdm2_decode_super_block(void) { - GetBitContext gb; - struct QDM2SubPacket header, *packet; - int i, packet_bytes, sub_packet_size, subPacketsD; - unsigned int next_index = 0; - - memset(_toneLevelIdxHi1, 0, sizeof(_toneLevelIdxHi1)); - memset(_toneLevelIdxMid, 0, sizeof(_toneLevelIdxMid)); - memset(_toneLevelIdxHi2, 0, sizeof(_toneLevelIdxHi2)); - - _subPacketsB = 0; - subPacketsD = 0; - - average_quantized_coeffs(); // average elements in quantized_coeffs[max_ch][10][8] - - initGetBits(&gb, _compressedData, _packetSize*8); - qdm2_decode_sub_packet_header(&gb, &header); - - if (header.type < 2 || header.type >= 8) { - _hasErrors = true; - error("QDM2 : bad superblock type"); - return; - } - - _superblocktype_2_3 = (header.type == 2 || header.type == 3); - packet_bytes = (_packetSize - getBitsCount(&gb) / 8); - - initGetBits(&gb, header.data, header.size*8); - - if (header.type == 2 || header.type == 4 || header.type == 5) { - int csum = 257 * getBits(&gb, 8) + 2 * getBits(&gb, 8); - - csum = qdm2_packet_checksum(_compressedData, _packetSize, csum); - - if (csum != 0) { - _hasErrors = true; - error("QDM2 : bad packet checksum"); - return; - } - } - - _subPacketListB[0].packet = NULL; - _subPacketListD[0].packet = NULL; - - for (i = 0; i < 6; i++) - if (--_fftLevelExp[i] < 0) - _fftLevelExp[i] = 0; - - for (i = 0; packet_bytes > 0; i++) { - int j; - - _subPacketListA[i].next = NULL; - - if (i > 0) { - _subPacketListA[i - 1].next = &_subPacketListA[i]; - - // seek to next block - initGetBits(&gb, header.data, header.size*8); - skipBits(&gb, next_index*8); - - if (next_index >= header.size) - break; - } - - // decode subpacket - packet = &_subPackets[i]; - qdm2_decode_sub_packet_header(&gb, packet); - next_index = packet->size + getBitsCount(&gb) / 8; - sub_packet_size = ((packet->size > 0xff) ? 1 : 0) + packet->size + 2; - - if (packet->type == 0) - break; - - if (sub_packet_size > packet_bytes) { - if (packet->type != 10 && packet->type != 11 && packet->type != 12) - break; - packet->size += packet_bytes - sub_packet_size; - } - - packet_bytes -= sub_packet_size; - - // add subpacket to 'all subpackets' list - _subPacketListA[i].packet = packet; - - // add subpacket to related list - if (packet->type == 8) { - error("Unsupported packet type 8"); - return; - } else if (packet->type >= 9 && packet->type <= 12) { - // packets for MPEG Audio like Synthesis Filter - QDM2_LIST_ADD(_subPacketListD, subPacketsD, packet); - } else if (packet->type == 13) { - for (j = 0; j < 6; j++) - _fftLevelExp[j] = getBits(&gb, 6); - } else if (packet->type == 14) { - for (j = 0; j < 6; j++) - _fftLevelExp[j] = qdm2_get_vlc(&gb, &_fftLevelExpVlc, 0, 2); - } else if (packet->type == 15) { - error("Unsupported packet type 15"); - return; - } else if (packet->type >= 16 && packet->type < 48 && !fft_subpackets[packet->type - 16]) { - // packets for FFT - QDM2_LIST_ADD(_subPacketListB, _subPacketsB, packet); - } - } // Packet bytes loop - -// **************************************************************** - if (_subPacketListD[0].packet != NULL) { - process_synthesis_subpackets(_subPacketListD); - _doSynthFilter = 1; - } else if (_doSynthFilter) { - process_subpacket_10(NULL, 0); - process_subpacket_11(NULL, 0); - process_subpacket_12(NULL, 0); - } -// **************************************************************** -} - -void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, - int channel, int exp, int phase) { - if (_fftCoefsMinIndex[duration] < 0) - _fftCoefsMinIndex[duration] = _fftCoefsIndex; - - _fftCoefs[_fftCoefsIndex].sub_packet = ((sub_packet >= 16) ? (sub_packet - 16) : sub_packet); - _fftCoefs[_fftCoefsIndex].channel = channel; - _fftCoefs[_fftCoefsIndex].offset = offset; - _fftCoefs[_fftCoefsIndex].exp = exp; - _fftCoefs[_fftCoefsIndex].phase = phase; - _fftCoefsIndex++; -} - -void QDM2Stream::qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b) { - int channel, stereo, phase, exp; - int local_int_4, local_int_8, stereo_phase, local_int_10; - int local_int_14, stereo_exp, local_int_20, local_int_28; - int n, offset; - - local_int_4 = 0; - local_int_28 = 0; - local_int_20 = 2; - local_int_8 = (4 - duration); - local_int_10 = 1 << (_groupOrder - duration - 1); - offset = 1; - - while (1) { - if (_superblocktype_2_3) { - while ((n = qdm2_get_vlc(gb, &_vlcTabFftToneOffset[local_int_8], 1, 2)) < 2) { - offset = 1; - if (n == 0) { - local_int_4 += local_int_10; - local_int_28 += (1 << local_int_8); - } else { - local_int_4 += 8*local_int_10; - local_int_28 += (8 << local_int_8); - } - } - offset += (n - 2); - } else { - offset += qdm2_get_vlc(gb, &_vlcTabFftToneOffset[local_int_8], 1, 2); - while (offset >= (local_int_10 - 1)) { - offset += (1 - (local_int_10 - 1)); - local_int_4 += local_int_10; - local_int_28 += (1 << local_int_8); - } - } - - if (local_int_4 >= _blockSize) - return; - - local_int_14 = (offset >> local_int_8); - - if (_channels > 1) { - channel = getBits1(gb); - stereo = getBits1(gb); - } else { - channel = 0; - stereo = 0; - } - - exp = qdm2_get_vlc(gb, (b ? &_fftLevelExpVlc : &_fftLevelExpAltVlc), 0, 2); - exp += _fftLevelExp[fft_level_index_table[local_int_14]]; - exp = (exp < 0) ? 0 : exp; - - phase = getBits(gb, 3); - stereo_exp = 0; - stereo_phase = 0; - - if (stereo) { - stereo_exp = (exp - qdm2_get_vlc(gb, &_fftStereoExpVlc, 0, 1)); - stereo_phase = (phase - qdm2_get_vlc(gb, &_fftStereoPhaseVlc, 0, 1)); - if (stereo_phase < 0) - stereo_phase += 8; - } - - if (_frequencyRange > (local_int_14 + 1)) { - int sub_packet = (local_int_20 + local_int_28); - - qdm2_fft_init_coefficient(sub_packet, offset, duration, channel, exp, phase); - if (stereo) - qdm2_fft_init_coefficient(sub_packet, offset, duration, (1 - channel), stereo_exp, stereo_phase); - } - - offset++; - } -} - -void QDM2Stream::qdm2_decode_fft_packets(void) { - int i, j, min, max, value, type, unknown_flag; - GetBitContext gb; - - if (_subPacketListB[0].packet == NULL) - return; - - // reset minimum indexes for FFT coefficients - _fftCoefsIndex = 0; - for (i=0; i < 5; i++) - _fftCoefsMinIndex[i] = -1; - - // process subpackets ordered by type, largest type first - for (i = 0, max = 256; i < _subPacketsB; i++) { - QDM2SubPacket *packet= NULL; - - // find subpacket with largest type less than max - for (j = 0, min = 0; j < _subPacketsB; j++) { - value = _subPacketListB[j].packet->type; - if (value > min && value < max) { - min = value; - packet = _subPacketListB[j].packet; - } - } - - max = min; - - // check for errors (?) - if (!packet) - return; - - if (i == 0 && (packet->type < 16 || packet->type >= 48 || fft_subpackets[packet->type - 16])) - return; - - // decode FFT tones - initGetBits(&gb, packet->data, packet->size*8); - - if (packet->type >= 32 && packet->type < 48 && !fft_subpackets[packet->type - 16]) - unknown_flag = 1; - else - unknown_flag = 0; - - type = packet->type; - - if ((type >= 17 && type < 24) || (type >= 33 && type < 40)) { - int duration = _subSampling + 5 - (type & 15); - - if (duration >= 0 && duration < 4) { // TODO: Should be <= 4? - qdm2_fft_decode_tones(duration, &gb, unknown_flag); - } - } else if (type == 31) { - for (j=0; j < 4; j++) { - qdm2_fft_decode_tones(j, &gb, unknown_flag); - } - } else if (type == 46) { - for (j=0; j < 6; j++) - _fftLevelExp[j] = getBits(&gb, 6); - for (j=0; j < 4; j++) { - qdm2_fft_decode_tones(j, &gb, unknown_flag); - } - } - } // Loop on B packets - - // calculate maximum indexes for FFT coefficients - for (i = 0, j = -1; i < 5; i++) - if (_fftCoefsMinIndex[i] >= 0) { - if (j >= 0) - _fftCoefsMaxIndex[j] = _fftCoefsMinIndex[i]; - j = i; - } - if (j >= 0) - _fftCoefsMaxIndex[j] = _fftCoefsIndex; -} - -void QDM2Stream::qdm2_fft_generate_tone(FFTTone *tone) -{ - float level, f[6]; - int i; - QDM2Complex c; - const double iscale = 2.0 * PI / 512.0; - - tone->phase += tone->phase_shift; - - // calculate current level (maximum amplitude) of tone - level = fft_tone_envelope_table[tone->duration][tone->time_index] * tone->level; - c.im = level * sin(tone->phase*iscale); - c.re = level * cos(tone->phase*iscale); - - // generate FFT coefficients for tone - if (tone->duration >= 3 || tone->cutoff >= 3) { - tone->complex[0].im += c.im; - tone->complex[0].re += c.re; - tone->complex[1].im -= c.im; - tone->complex[1].re -= c.re; - } else { - f[1] = -tone->table[4]; - f[0] = tone->table[3] - tone->table[0]; - f[2] = 1.0 - tone->table[2] - tone->table[3]; - f[3] = tone->table[1] + tone->table[4] - 1.0; - f[4] = tone->table[0] - tone->table[1]; - f[5] = tone->table[2]; - for (i = 0; i < 2; i++) { - tone->complex[fft_cutoff_index_table[tone->cutoff][i]].re += c.re * f[i]; - tone->complex[fft_cutoff_index_table[tone->cutoff][i]].im += c.im *((tone->cutoff <= i) ? -f[i] : f[i]); - } - for (i = 0; i < 4; i++) { - tone->complex[i].re += c.re * f[i+2]; - tone->complex[i].im += c.im * f[i+2]; - } - } - - // copy the tone if it has not yet died out - if (++tone->time_index < ((1 << (5 - tone->duration)) - 1)) { - memcpy(&_fftTones[_fftToneEnd], tone, sizeof(FFTTone)); - _fftToneEnd = (_fftToneEnd + 1) % 1000; - } -} - -void QDM2Stream::qdm2_fft_tone_synthesizer(uint8 sub_packet) { - int i, j, ch; - const double iscale = 0.25 * PI; - - for (ch = 0; ch < _channels; ch++) { - memset(_fft.complex[ch], 0, _frameSize * sizeof(QDM2Complex)); - } - - // apply FFT tones with duration 4 (1 FFT period) - if (_fftCoefsMinIndex[4] >= 0) - for (i = _fftCoefsMinIndex[4]; i < _fftCoefsMaxIndex[4]; i++) { - float level; - QDM2Complex c; - - if (_fftCoefs[i].sub_packet != sub_packet) - break; - - ch = (_channels == 1) ? 0 : _fftCoefs[i].channel; - level = (_fftCoefs[i].exp < 0) ? 0.0 : fft_tone_level_table[_superblocktype_2_3 ? 0 : 1][_fftCoefs[i].exp & 63]; - - c.re = level * cos(_fftCoefs[i].phase * iscale); - c.im = level * sin(_fftCoefs[i].phase * iscale); - _fft.complex[ch][_fftCoefs[i].offset + 0].re += c.re; - _fft.complex[ch][_fftCoefs[i].offset + 0].im += c.im; - _fft.complex[ch][_fftCoefs[i].offset + 1].re -= c.re; - _fft.complex[ch][_fftCoefs[i].offset + 1].im -= c.im; - } - - // generate existing FFT tones - for (i = _fftToneEnd; i != _fftToneStart; ) { - qdm2_fft_generate_tone(&_fftTones[_fftToneStart]); - _fftToneStart = (_fftToneStart + 1) % 1000; - } - - // create and generate new FFT tones with duration 0 (long) to 3 (short) - for (i = 0; i < 4; i++) - if (_fftCoefsMinIndex[i] >= 0) { - for (j = _fftCoefsMinIndex[i]; j < _fftCoefsMaxIndex[i]; j++) { - int offset, four_i; - FFTTone tone; - - if (_fftCoefs[j].sub_packet != sub_packet) - break; - - four_i = (4 - i); - offset = _fftCoefs[j].offset >> four_i; - ch = (_channels == 1) ? 0 : _fftCoefs[j].channel; - - if (offset < _frequencyRange) { - if (offset < 2) - tone.cutoff = offset; - else - tone.cutoff = (offset >= 60) ? 3 : 2; - - tone.level = (_fftCoefs[j].exp < 0) ? 0.0 : fft_tone_level_table[_superblocktype_2_3 ? 0 : 1][_fftCoefs[j].exp & 63]; - tone.complex = &_fft.complex[ch][offset]; - tone.table = fft_tone_sample_table[i][_fftCoefs[j].offset - (offset << four_i)]; - tone.phase = 64 * _fftCoefs[j].phase - (offset << 8) - 128; - tone.phase_shift = (2 * _fftCoefs[j].offset + 1) << (7 - four_i); - tone.duration = i; - tone.time_index = 0; - - qdm2_fft_generate_tone(&tone); - } - } - _fftCoefsMinIndex[i] = j; - } -} - -void QDM2Stream::qdm2_calculate_fft(int channel) { - int i; - - _fft.complex[channel][0].re *= 2.0f; - _fft.complex[channel][0].im = 0.0f; - - rdftCalc(&_rdftCtx, (float *)_fft.complex[channel]); - - // add samples to output buffer - for (i = 0; i < ((_fftFrameSize + 15) & ~15); i++) - _outputBuffer[_channels * i + channel] += ((float *) _fft.complex[channel])[i]; -} - -/** - * @param index subpacket number - */ -void QDM2Stream::qdm2_synthesis_filter(uint8 index) -{ - int16 samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE]; - int i, k, ch, sb_used, sub_sampling, dither_state = 0; - - // copy sb_samples - sb_used = QDM2_SB_USED(_subSampling); - - for (ch = 0; ch < _channels; ch++) - for (i = 0; i < 8; i++) - for (k = sb_used; k < 32; k++) - _sbSamples[ch][(8 * index) + i][k] = 0; - - for (ch = 0; ch < _channels; ch++) { - int16 *samples_ptr = samples + ch; - - for (i = 0; i < 8; i++) { - ff_mpa_synth_filter(_synthBuf[ch], &(_synthBufOffset[ch]), - ff_mpa_synth_window, &dither_state, - samples_ptr, _channels, - _sbSamples[ch][(8 * index) + i]); - samples_ptr += 32 * _channels; - } - } - - // add samples to output buffer - sub_sampling = (4 >> _subSampling); - - for (ch = 0; ch < _channels; ch++) - for (i = 0; i < _sFrameSize; i++) - _outputBuffer[_channels * i + ch] += (float)(samples[_channels * sub_sampling * i + ch] >> (sizeof(int16)*8-16)); -} - -int QDM2Stream::qdm2_decodeFrame(Common::SeekableReadStream *in) { - debug(1, "QDM2Stream::qdm2_decodeFrame in->pos(): %d in->size(): %d", in->pos(), in->size()); - int ch, i; - const int frame_size = (_sFrameSize * _channels); - - // If we're in any packet but the first, seek back to the first - if (_subPacket == 0) - _superBlockStart = in->pos(); - else - in->seek(_superBlockStart); - - // select input buffer - if (in->eos() || in->pos() >= in->size()) { - debug(1, "QDM2Stream::qdm2_decodeFrame End of Input Stream"); - return 0; - } - - if ((in->size() - in->pos()) < _packetSize) { - debug(1, "QDM2Stream::qdm2_decodeFrame Insufficient Packet Data in Input Stream Found: %d Need: %d", in->size() - in->pos(), _packetSize); - return 0; - } - - if (!in->eos()) { - in->read(_compressedData, _packetSize); - debug(1, "QDM2Stream::qdm2_decodeFrame constructed input data"); - } - - // copy old block, clear new block of output samples - memmove(_outputBuffer, &_outputBuffer[frame_size], frame_size * sizeof(float)); - memset(&_outputBuffer[frame_size], 0, frame_size * sizeof(float)); - debug(1, "QDM2Stream::qdm2_decodeFrame cleared outputBuffer"); - - if (!in->eos()) { - // decode block of QDM2 compressed data - debug(1, "QDM2Stream::qdm2_decodeFrame decode block of QDM2 compressed data"); - if (_subPacket == 0) { - _hasErrors = false; // reset it for a new super block - debug(1, "QDM2 : Superblock follows"); - qdm2_decode_super_block(); - } - - // parse subpackets - debug(1, "QDM2Stream::qdm2_decodeFrame parse subpackets"); - if (!_hasErrors) { - if (_subPacket == 2) { - debug(1, "QDM2Stream::qdm2_decodeFrame qdm2_decode_fft_packets()"); - qdm2_decode_fft_packets(); - } - - debug(1, "QDM2Stream::qdm2_decodeFrame qdm2_fft_tone_synthesizer(%d)", _subPacket); - qdm2_fft_tone_synthesizer(_subPacket); - } - - // sound synthesis stage 1 (FFT) - debug(1, "QDM2Stream::qdm2_decodeFrame sound synthesis stage 1 (FFT)"); - for (ch = 0; ch < _channels; ch++) { - qdm2_calculate_fft(ch); - - if (!_hasErrors && _subPacketListC[0].packet != NULL) { - error("QDM2 : has errors, and C list is not empty"); - return 0; - } - } - - // sound synthesis stage 2 (MPEG audio like synthesis filter) - debug(1, "QDM2Stream::qdm2_decodeFrame sound synthesis stage 2 (MPEG audio like synthesis filter)"); - if (!_hasErrors && _doSynthFilter) - qdm2_synthesis_filter(_subPacket); - - _subPacket = (_subPacket + 1) % 16; - - if(_hasErrors) - warning("QDM2 Packet error..."); - - // clip and convert output float[] to 16bit signed samples - debug(1, "QDM2Stream::qdm2_decodeFrame clip and convert output float[] to 16bit signed samples"); - } - - for (i = 0; i < frame_size; i++) { - int value = (int)_outputBuffer[i]; - - if (value > SOFTCLIP_THRESHOLD) - value = (value > HARDCLIP_THRESHOLD) ? 32767 : _softclipTable[ value - SOFTCLIP_THRESHOLD]; - else if (value < -SOFTCLIP_THRESHOLD) - value = (value < -HARDCLIP_THRESHOLD) ? -32767 : -_softclipTable[-value - SOFTCLIP_THRESHOLD]; - - _outputSamples.push_back(value); - } - return frame_size; -} - -int QDM2Stream::readBuffer(int16 *buffer, const int numSamples) { - debug(1, "QDM2Stream::readBuffer numSamples: %d", numSamples); - int32 decodedSamples = _outputSamples.size(); - int32 i; - - while (decodedSamples < numSamples) { - i = qdm2_decodeFrame(_stream); - if (i == 0) - break; // Out Of Decode Frames... - decodedSamples += i; - } - - if (decodedSamples > numSamples) - decodedSamples = numSamples; - - for (i = 0; i < decodedSamples; i++) - buffer[i] = _outputSamples.remove_at(0); - - return decodedSamples; -} - -Audio::AudioStream *makeQDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadStream *extraData) { - return new QDM2Stream(stream, extraData); -} - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/qdm2.h b/graphics/video/codecs/qdm2.h deleted file mode 100644 index 9eb566d04d..0000000000 --- a/graphics/video/codecs/qdm2.h +++ /dev/null @@ -1,54 +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. - * - * $URL$ - * $Id$ - * - */ - -// Only compile if Mohawk is enabled or if we're building dynamic modules -#if defined(ENABLE_MOHAWK) || defined(DYNAMIC_MODULES) - -#ifndef GRAPHICS_QDM2_H -#define GRAPHICS_QDM2_H - -namespace Common { - class SeekableReadStream; -} - -namespace Audio { - class AudioStream; -} - -namespace Graphics { - -/** - * Create a new AudioStream from the QDM2 data in the given stream. - * - * @param stream the SeekableReadStream from which to read the FLAC data - * @param extraData the QuickTime extra data stream - * @return a new AudioStream, or NULL, if an error occurred - */ -Audio::AudioStream *makeQDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadStream *extraData); - -} // End of namespace Graphics - -#endif // GRAPHICS_QDM2_H -#endif // Mohawk/Plugins guard diff --git a/graphics/video/codecs/qdm2data.h b/graphics/video/codecs/qdm2data.h deleted file mode 100644 index 25ed102c4e..0000000000 --- a/graphics/video/codecs/qdm2data.h +++ /dev/null @@ -1,531 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_QDM2DATA_H -#define GRAPHICS_QDM2DATA_H - -#include "common/scummsys.h" - -namespace Graphics { - -/// VLC TABLES - -// values in this table range from -1..23; adjust retrieved value by -1 -static const uint16 vlc_tab_level_huffcodes[24] = { - 0x037c, 0x0004, 0x003c, 0x004c, 0x003a, 0x002c, 0x001c, 0x001a, - 0x0024, 0x0014, 0x0001, 0x0002, 0x0000, 0x0003, 0x0007, 0x0005, - 0x0006, 0x0008, 0x0009, 0x000a, 0x000c, 0x00fc, 0x007c, 0x017c -}; - -static const byte vlc_tab_level_huffbits[24] = { - 10, 6, 7, 7, 6, 6, 6, 6, 6, 5, 4, 4, 4, 3, 3, 3, 3, 4, 4, 5, 7, 8, 9, 10 -}; - -// values in this table range from -1..36; adjust retrieved value by -1 -static const uint16 vlc_tab_diff_huffcodes[37] = { - 0x1c57, 0x0004, 0x0000, 0x0001, 0x0003, 0x0002, 0x000f, 0x000e, - 0x0007, 0x0016, 0x0037, 0x0027, 0x0026, 0x0066, 0x0006, 0x0097, - 0x0046, 0x01c6, 0x0017, 0x0786, 0x0086, 0x0257, 0x00d7, 0x0357, - 0x00c6, 0x0386, 0x0186, 0x0000, 0x0157, 0x0c57, 0x0057, 0x0000, - 0x0b86, 0x0000, 0x1457, 0x0000, 0x0457 -}; - -static const byte vlc_tab_diff_huffbits[37] = { - 13, 3, 3, 2, 3, 3, 4, 4, 6, 5, 6, 6, 7, 7, 8, 8, - 8, 9, 8, 11, 9, 10, 8, 10, 9, 12, 10, 0, 10, 13, 11, 0, - 12, 0, 13, 0, 13 -}; - -// values in this table range from -1..5; adjust retrieved value by -1 -static const byte vlc_tab_run_huffcodes[6] = { - 0x1f, 0x00, 0x01, 0x03, 0x07, 0x0f -}; - -static const byte vlc_tab_run_huffbits[6] = { - 5, 1, 2, 3, 4, 5 -}; - -// values in this table range from -1..19; adjust retrieved value by -1 -static const uint16 vlc_tab_tone_level_idx_hi1_huffcodes[20] = { - 0x5714, 0x000c, 0x0002, 0x0001, 0x0000, 0x0004, 0x0034, 0x0054, - 0x0094, 0x0014, 0x0114, 0x0214, 0x0314, 0x0614, 0x0e14, 0x0f14, - 0x2714, 0x0714, 0x1714, 0x3714 -}; - -static const byte vlc_tab_tone_level_idx_hi1_huffbits[20] = { - 15, 4, 2, 1, 3, 5, 6, 7, 8, 10, 10, 11, 11, 12, 12, 12, 14, 14, 15, 14 -}; - -// values in this table range from -1..23; adjust retrieved value by -1 -static const uint16 vlc_tab_tone_level_idx_mid_huffcodes[24] = { - 0x0fea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x03ea, 0x00ea, 0x002a, 0x001a, - 0x0006, 0x0001, 0x0000, 0x0002, 0x000a, 0x006a, 0x01ea, 0x07ea -}; - -static const byte vlc_tab_tone_level_idx_mid_huffbits[24] = { - 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12 -}; - -// values in this table range from -1..23; adjust retrieved value by -1 -static const uint16 vlc_tab_tone_level_idx_hi2_huffcodes[24] = { - 0x0664, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0064, 0x00e4, - 0x00a4, 0x0068, 0x0004, 0x0008, 0x0014, 0x0018, 0x0000, 0x0001, - 0x0002, 0x0003, 0x000c, 0x0028, 0x0024, 0x0164, 0x0000, 0x0264 -}; - -static const byte vlc_tab_tone_level_idx_hi2_huffbits[24] = { - 11, 0, 0, 0, 0, 0, 10, 8, 8, 7, 6, 6, 5, 5, 4, 2, 2, 2, 4, 7, 8, 9, 0, 11 -}; - -// values in this table range from -1..8; adjust retrieved value by -1 -static const byte vlc_tab_type30_huffcodes[9] = { - 0x3c, 0x06, 0x00, 0x01, 0x03, 0x02, 0x04, 0x0c, 0x1c -}; - -static const byte vlc_tab_type30_huffbits[9] = { - 6, 3, 3, 2, 2, 3, 4, 5, 6 -}; - -// values in this table range from -1..9; adjust retrieved value by -1 -static const byte vlc_tab_type34_huffcodes[10] = { - 0x18, 0x00, 0x01, 0x04, 0x05, 0x07, 0x03, 0x02, 0x06, 0x08 -}; - -static const byte vlc_tab_type34_huffbits[10] = { - 5, 4, 3, 3, 3, 3, 3, 3, 3, 5 -}; - -// values in this table range from -1..22; adjust retrieved value by -1 -static const uint16 vlc_tab_fft_tone_offset_0_huffcodes[23] = { - 0x038e, 0x0001, 0x0000, 0x0022, 0x000a, 0x0006, 0x0012, 0x0002, - 0x001e, 0x003e, 0x0056, 0x0016, 0x000e, 0x0032, 0x0072, 0x0042, - 0x008e, 0x004e, 0x00f2, 0x002e, 0x0036, 0x00c2, 0x018e -}; - -static const byte vlc_tab_fft_tone_offset_0_huffbits[23] = { - 10, 1, 2, 6, 4, 5, 6, 7, 6, 6, 7, 7, 8, 7, 8, 8, 9, 7, 8, 6, 6, 8, 10 -}; - -// values in this table range from -1..27; adjust retrieved value by -1 -static const uint16 vlc_tab_fft_tone_offset_1_huffcodes[28] = { - 0x07a4, 0x0001, 0x0020, 0x0012, 0x001c, 0x0008, 0x0006, 0x0010, - 0x0000, 0x0014, 0x0004, 0x0032, 0x0070, 0x000c, 0x0002, 0x003a, - 0x001a, 0x002c, 0x002a, 0x0022, 0x0024, 0x000a, 0x0064, 0x0030, - 0x0062, 0x00a4, 0x01a4, 0x03a4 -}; - -static const byte vlc_tab_fft_tone_offset_1_huffbits[28] = { - 11, 1, 6, 6, 5, 4, 3, 6, 6, 5, 6, 6, 7, 6, 6, 6, - 6, 6, 6, 7, 8, 6, 7, 7, 7, 9, 10, 11 -}; - -// values in this table range from -1..31; adjust retrieved value by -1 -static const uint16 vlc_tab_fft_tone_offset_2_huffcodes[32] = { - 0x1760, 0x0001, 0x0000, 0x0082, 0x000c, 0x0006, 0x0003, 0x0007, - 0x0008, 0x0004, 0x0010, 0x0012, 0x0022, 0x001a, 0x0000, 0x0020, - 0x000a, 0x0040, 0x004a, 0x006a, 0x002a, 0x0042, 0x0002, 0x0060, - 0x00aa, 0x00e0, 0x00c2, 0x01c2, 0x0160, 0x0360, 0x0760, 0x0f60 -}; - -static const byte vlc_tab_fft_tone_offset_2_huffbits[32] = { - 13, 2, 0, 8, 4, 3, 3, 3, 4, 4, 5, 5, 6, 5, 7, 7, - 7, 7, 7, 7, 8, 8, 8, 9, 8, 8, 9, 9, 10, 11, 13, 12 -}; - -// values in this table range from -1..34; adjust retrieved value by -1 -static const uint16 vlc_tab_fft_tone_offset_3_huffcodes[35] = { - 0x33ea, 0x0005, 0x0000, 0x000c, 0x0000, 0x0006, 0x0003, 0x0008, - 0x0002, 0x0001, 0x0004, 0x0007, 0x001a, 0x000f, 0x001c, 0x002c, - 0x000a, 0x001d, 0x002d, 0x002a, 0x000d, 0x004c, 0x008c, 0x006a, - 0x00cd, 0x004d, 0x00ea, 0x020c, 0x030c, 0x010c, 0x01ea, 0x07ea, - 0x0bea, 0x03ea, 0x13ea -}; - -static const byte vlc_tab_fft_tone_offset_3_huffbits[35] = { - 14, 4, 0, 10, 4, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6, - 6, 5, 6, 7, 7, 7, 8, 8, 8, 8, 9, 10, 10, 10, 10, 11, - 12, 13, 14 -}; - -// values in this table range from -1..37; adjust retrieved value by -1 -static const uint16 vlc_tab_fft_tone_offset_4_huffcodes[38] = { - 0x5282, 0x0016, 0x0000, 0x0136, 0x0004, 0x0000, 0x0007, 0x000a, - 0x000e, 0x0003, 0x0001, 0x000d, 0x0006, 0x0009, 0x0012, 0x0005, - 0x0025, 0x0022, 0x0015, 0x0002, 0x0076, 0x0035, 0x0042, 0x00c2, - 0x0182, 0x00b6, 0x0036, 0x03c2, 0x0482, 0x01c2, 0x0682, 0x0882, - 0x0a82, 0x0082, 0x0282, 0x1282, 0x3282, 0x2282 -}; - -static const byte vlc_tab_fft_tone_offset_4_huffbits[38] = { - 15, 6, 0, 9, 3, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6, - 6, 6, 6, 8, 7, 6, 8, 9, 9, 8, 9, 10, 11, 10, 11, 12, - 12, 12, 14, 15, 14, 14 -}; - -/// FFT TABLES - -// values in this table range from -1..27; adjust retrieved value by -1 -static const uint16 fft_level_exp_alt_huffcodes[28] = { - 0x1ec6, 0x0006, 0x00c2, 0x0142, 0x0242, 0x0246, 0x00c6, 0x0046, - 0x0042, 0x0146, 0x00a2, 0x0062, 0x0026, 0x0016, 0x000e, 0x0005, - 0x0004, 0x0003, 0x0000, 0x0001, 0x000a, 0x0012, 0x0002, 0x0022, - 0x01c6, 0x02c6, 0x06c6, 0x0ec6 -}; - -static const byte fft_level_exp_alt_huffbits[28] = { - 13, 7, 8, 9, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, - 3, 2, 3, 3, 4, 5, 7, 8, 9, 11, 12, 13 -}; - -// values in this table range from -1..19; adjust retrieved value by -1 -static const uint16 fft_level_exp_huffcodes[20] = { - 0x0f24, 0x0001, 0x0002, 0x0000, 0x0006, 0x0005, 0x0007, 0x000c, - 0x000b, 0x0014, 0x0013, 0x0004, 0x0003, 0x0023, 0x0064, 0x00a4, - 0x0024, 0x0124, 0x0324, 0x0724 -}; - -static const byte fft_level_exp_huffbits[20] = { - 12, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12 -}; - -// values in this table range from -1..6; adjust retrieved value by -1 -static const byte fft_stereo_exp_huffcodes[7] = { - 0x3e, 0x01, 0x00, 0x02, 0x06, 0x0e, 0x1e -}; - -static const byte fft_stereo_exp_huffbits[7] = { - 6, 1, 2, 3, 4, 5, 6 -}; - -// values in this table range from -1..8; adjust retrieved value by -1 -static const byte fft_stereo_phase_huffcodes[9] = { - 0x35, 0x02, 0x00, 0x01, 0x0d, 0x15, 0x05, 0x09, 0x03 -}; - -static const byte fft_stereo_phase_huffbits[9] = { - 6, 2, 2, 4, 4, 6, 5, 4, 2 -}; - -static const int fft_cutoff_index_table[4][2] = { - { 1, 2 }, {-1, 0 }, {-1,-2 }, { 0, 0 } -}; - -static const int16 fft_level_index_table[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const byte last_coeff[3] = { - 4, 7, 10 -}; - -static const byte coeff_per_sb_for_avg[3][30] = { - { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, - { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9 } -}; - -static const uint32 dequant_table[3][10][30] = { - { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 256, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 51, 102, 154, 205, 256, 238, 219, 201, 183, 165, 146, 128, 110, 91, 73, 55, 37, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 18, 37, 55, 73, 91, 110, 128, 146, 165, 183, 201, 219, 238, 256, 228, 199, 171, 142, 114, 85, 57, 28 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 85, 171, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 85, 171, 256, 219, 183, 146, 110, 73, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 73, 110, 146, 183, 219, 256, 228, 199, 171, 142, 114, 85, 57, 28, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 57, 85, 114, 142, 171, 199, 228, 256, 213, 171, 128, 85, 43 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 256, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 85, 171, 256, 192, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 128, 192, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 102, 154, 205, 256, 213, 171, 128, 85, 43, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 85, 128, 171, 213, 256, 213, 171, 128, 85, 43 } } -}; - -static const byte coeff_per_sb_for_dequant[3][30] = { - { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6 }, - { 0, 1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9 } -}; - -// first index is subband, 2nd index is 0, 1 or 3 (2 is unused) -static const int8 tone_level_idx_offset_table[30][4] = { - { -50, -50, 0, -50 }, - { -50, -50, 0, -50 }, - { -50, -9, 0, -19 }, - { -16, -6, 0, -12 }, - { -11, -4, 0, -8 }, - { -8, -3, 0, -6 }, - { -7, -3, 0, -5 }, - { -6, -2, 0, -4 }, - { -5, -2, 0, -3 }, - { -4, -1, 0, -3 }, - { -4, -1, 0, -2 }, - { -3, -1, 0, -2 }, - { -3, -1, 0, -2 }, - { -3, -1, 0, -2 }, - { -2, -1, 0, -1 }, - { -2, -1, 0, -1 }, - { -2, -1, 0, -1 }, - { -2, 0, 0, -1 }, - { -2, 0, 0, -1 }, - { -1, 0, 0, -1 }, - { -1, 0, 0, -1 }, - { -1, 0, 0, -1 }, - { -1, 0, 0, -1 }, - { -1, 0, 0, -1 }, - { -1, 0, 0, -1 }, - { -1, 0, 0, -1 }, - { -1, 0, 0, 0 }, - { -1, 0, 0, 0 }, - { -1, 0, 0, 0 }, - { -1, 0, 0, 0 } -}; - -/* all my samples have 1st index 0 or 1 */ -/* second index is subband, only indexes 0-29 seem to be used */ -static const int8 coding_method_table[5][30] = { - { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 - }, - { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 - }, - { 34, 30, 30, 30, 24, 24, 16, 16, 16, 16, 16, 16, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 - }, - { 34, 34, 30, 30, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 10 - }, - { 34, 34, 30, 30, 30, 30, 30, 30, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 - }, -}; - -static const int vlc_stage3_values[60] = { - 0, 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 24, - 28, 36, 44, 52, 60, 76, 92, 108, 124, 156, 188, 220, - 252, 316, 380, 444, 508, 636, 764, 892, 1020, 1276, 1532, 1788, - 2044, 2556, 3068, 3580, 4092, 5116, 6140, 7164, 8188, 10236, 12284, 14332, - 16380, 20476, 24572, 28668, 32764, 40956, 49148, 57340, 65532, 81916, 98300,114684 -}; - -static const float fft_tone_sample_table[4][16][5] = { - { { .0100000000f,-.0037037037f,-.0020000000f,-.0069444444f,-.0018416207f }, - { .0416666667f, .0000000000f, .0000000000f,-.0208333333f,-.0123456791f }, - { .1250000000f, .0558035709f, .0330687836f,-.0164473690f,-.0097465888f }, - { .1562500000f, .0625000000f, .0370370370f,-.0062500000f,-.0037037037f }, - { .1996007860f, .0781250000f, .0462962948f, .0022727272f, .0013468013f }, - { .2000000000f, .0625000000f, .0370370373f, .0208333333f, .0074074073f }, - { .2127659619f, .0555555556f, .0329218097f, .0208333333f, .0123456791f }, - { .2173913121f, .0473484844f, .0280583613f, .0347222239f, .0205761325f }, - { .2173913121f, .0347222239f, .0205761325f, .0473484844f, .0280583613f }, - { .2127659619f, .0208333333f, .0123456791f, .0555555556f, .0329218097f }, - { .2000000000f, .0208333333f, .0074074073f, .0625000000f, .0370370370f }, - { .1996007860f, .0022727272f, .0013468013f, .0781250000f, .0462962948f }, - { .1562500000f,-.0062500000f,-.0037037037f, .0625000000f, .0370370370f }, - { .1250000000f,-.0164473690f,-.0097465888f, .0558035709f, .0330687836f }, - { .0416666667f,-.0208333333f,-.0123456791f, .0000000000f, .0000000000f }, - { .0100000000f,-.0069444444f,-.0018416207f,-.0037037037f,-.0020000000f } }, - - { { .0050000000f,-.0200000000f, .0125000000f,-.3030303030f, .0020000000f }, - { .1041666642f, .0400000000f,-.0250000000f, .0333333333f,-.0200000000f }, - { .1250000000f, .0100000000f, .0142857144f,-.0500000007f,-.0200000000f }, - { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f }, - { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f }, - { .1250000000f,-.0500000000f,-.0200000000f, .0100000000f, .0142857144f }, - { .1041666667f, .0333333333f,-.0200000000f, .0400000000f,-.0250000000f }, - { .0050000000f,-.3030303030f, .0020000001f,-.0200000000f, .0125000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } }, - - { { .1428571492f, .1250000000f,-.0285714287f,-.0357142873f, .0208333333f }, - { .1818181818f, .0588235296f, .0333333333f, .0212765951f, .0100000000f }, - { .1818181818f, .0212765951f, .0100000000f, .0588235296f, .0333333333f }, - { .1428571492f,-.0357142873f, .0208333333f, .1250000000f,-.0285714287f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } }, - - { { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, - { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } } -}; - -static const float fft_tone_level_table[2][64] = { { -// pow ~ (i > 46) ? 0 : (((((i & 1) ? 431 : 304) << (i >> 1))) / 1024.0); - 0.17677669f, 0.42677650f, 0.60355347f, 0.85355347f, - 1.20710683f, 1.68359375f, 2.37500000f, 3.36718750f, - 4.75000000f, 6.73437500f, 9.50000000f, 13.4687500f, - 19.0000000f, 26.9375000f, 38.0000000f, 53.8750000f, - 76.0000000f, 107.750000f, 152.000000f, 215.500000f, - 304.000000f, 431.000000f, 608.000000f, 862.000000f, - 1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f, - 4864.00000f, 6896.00000f, 9728.00000f, 13792.0000f, - 19456.0000f, 27584.0000f, 38912.0000f, 55168.0000f, - 77824.0000f, 110336.000f, 155648.000f, 220672.000f, - 311296.000f, 441344.000f, 622592.000f, 882688.000f, - 1245184.00f, 1765376.00f, 2490368.00f, 0.00000000f, - 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, - 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, - 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, - 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, - }, { -// pow = (i > 45) ? 0 : ((((i & 1) ? 431 : 304) << (i >> 1)) / 512.0); - 0.59375000f, 0.84179688f, 1.18750000f, 1.68359375f, - 2.37500000f, 3.36718750f, 4.75000000f, 6.73437500f, - 9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f, - 38.0000000f, 53.8750000f, 76.0000000f, 107.750000f, - 152.000000f, 215.500000f, 304.000000f, 431.000000f, - 608.000000f, 862.000000f, 1216.00000f, 1724.00000f, - 2432.00000f, 3448.00000f, 4864.00000f, 6896.00000f, - 9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f, - 38912.0000f, 55168.0000f, 77824.0000f, 110336.000f, - 155648.000f, 220672.000f, 311296.000f, 441344.000f, - 622592.000f, 882688.000f, 1245184.00f, 1765376.00f, - 2490368.00f, 3530752.00f, 0.00000000f, 0.00000000f, - 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, - 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, - 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, - 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f -} }; - -static const float fft_tone_envelope_table[4][31] = { - { .009607375f, .038060248f, .084265202f, .146446645f, .222214907f, .308658302f, - .402454883f, .500000060f, .597545207f, .691341758f, .777785182f, .853553414f, - .915734828f, .961939812f, .990392685f, 1.00000000f, .990392625f, .961939752f, - .915734768f, .853553295f, .777785063f, .691341639f, .597545087f, .500000000f, - .402454853f, .308658272f, .222214878f, .146446615f, .084265172f, .038060218f, - .009607345f }, - { .038060248f, .146446645f, .308658302f, .500000060f, .691341758f, .853553414f, - .961939812f, 1.00000000f, .961939752f, .853553295f, .691341639f, .500000000f, - .308658272f, .146446615f, .038060218f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f }, - { .146446645f, .500000060f, .853553414f, 1.00000000f, .853553295f, .500000000f, - .146446615f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f }, - { .500000060f, 1.00000000f, .500000000f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, - .000000000f } -}; - -static const float sb_noise_attenuation[32] = { - 0.0f, 0.0f, 0.3f, 0.4f, 0.5f, 0.7f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -}; - -static const byte fft_subpackets[32] = { - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 -}; - -// first index is joined_stereo, second index is 0 or 2 (1 is unused) -static const float dequant_1bit[2][3] = { - {-0.920000f, 0.000000f, 0.920000f }, - {-0.890000f, 0.000000f, 0.890000f } -}; - -static const float type30_dequant[8] = { - -1.0f,-0.625f,-0.291666656732559f,0.0f, - 0.25f,0.5f,0.75f,1.0f, -}; - -static const float type34_delta[10] = { // FIXME: covers 8 entries.. - -1.0f,-0.60947573184967f,-0.333333343267441f,-0.138071194291115f,0.0f, - 0.138071194291115f,0.333333343267441f,0.60947573184967f,1.0f,0.0f, -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/qtrle.cpp b/graphics/video/codecs/qtrle.cpp deleted file mode 100644 index 380b89903c..0000000000 --- a/graphics/video/codecs/qtrle.cpp +++ /dev/null @@ -1,421 +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. - * - * $URL$ - * $Id$ - * - */ - -// QuickTime RLE Decoder -// Based off ffmpeg's QuickTime RLE decoder (written by Mike Melanson) - -#include "graphics/video/codecs/qtrle.h" - -#include "common/scummsys.h" -#include "common/stream.h" -#include "common/system.h" -#include "graphics/colormasks.h" -#include "graphics/surface.h" - -namespace Graphics { - -QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Codec() { - _bitsPerPixel = bitsPerPixel; - _pixelFormat = g_system->getScreenFormat(); - - // We need to increase the surface size to a multiple of 4 - uint16 wMod = width % 4; - if(wMod != 0) - width += 4 - wMod; - - debug(2, "QTRLE corrected width: %d", width); - - _surface = new Surface(); - _surface->create(width, height, _bitsPerPixel <= 8 ? 1 : _pixelFormat.bytesPerPixel); -} - -#define CHECK_STREAM_PTR(n) \ - if ((stream->pos() + n) > stream->size()) { \ - warning ("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 ("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->pixels; - - 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->pixels; - 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); - - // FIXME: Is this right? - //stream_ptr += ((i & ((num_pixels>>2)-1)) == 0); - 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->pixels; - - 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; - OverlayColor *rgb = (OverlayColor *)_surface->pixels; - - 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--) { - // Convert from RGB555 to the format specified by the Overlay - byte r = 0, g = 0, b = 0; - colorToRGB >(rgb16, r, g, b); - rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b); - } - } else { - CHECK_STREAM_PTR(rleCode * 2); - CHECK_PIXEL_PTR(rleCode); - - // copy pixels directly to output - while (rleCode--) { - uint16 rgb16 = stream->readUint16BE(); - - // Convert from RGB555 to the format specified by the Overlay - byte r = 0, g = 0, b = 0; - colorToRGB >(rgb16, r, g, b); - rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b); - } - } - } - - rowPtr += _surface->w; - } -} - -void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { - uint32 pixelPtr = 0; - OverlayColor *rgb = (OverlayColor *)_surface->pixels; - - 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(); - - CHECK_PIXEL_PTR(rleCode); - - while (rleCode--) - rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b); - } 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++] = _pixelFormat.RGBToColor(r, g, b); - } - } - } - - rowPtr += _surface->w; - } -} - -void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { - uint32 pixelPtr = 0; - OverlayColor *rgb = (OverlayColor *)_surface->pixels; - - 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(); - - CHECK_PIXEL_PTR(rleCode); - - while (rleCode--) - rgb[pixelPtr++] = _pixelFormat.ARGBToColor(a, r, g, b); - } 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++] = _pixelFormat.ARGBToColor(a, r, g, b); - } - } - } - - rowPtr += _surface->w; - } -} - -const Surface *QTRLEDecoder::decodeImage(Common::SeekableReadStream *stream) { - uint16 start_line = 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; - start_line = stream->readUint16BE(); - stream->readUint16BE(); // Unknown - height = stream->readUint16BE(); - stream->readUint16BE(); // Unknown - } - - uint32 row_ptr = _surface->w * start_line; - - switch (_bitsPerPixel) { - case 1: - case 33: - decode1(stream, row_ptr, height); - break; - case 2: - case 34: - decode2_4(stream, row_ptr, height, 2); - break; - case 4: - case 36: - decode2_4(stream, row_ptr, height, 4); - break; - case 8: - case 40: - decode8(stream, row_ptr, height); - break; - case 16: - decode16(stream, row_ptr, height); - break; - case 24: - decode24(stream, row_ptr, height); - break; - case 32: - decode32(stream, row_ptr, height); - break; - default: - error ("Unsupported bits per pixel %d", _bitsPerPixel); - } - - return _surface; -} - -QTRLEDecoder::~QTRLEDecoder() { - _surface->free(); - delete _surface; -} - -} // End of namespace Graphics diff --git a/graphics/video/codecs/qtrle.h b/graphics/video/codecs/qtrle.h deleted file mode 100644 index f0d2587f30..0000000000 --- a/graphics/video/codecs/qtrle.h +++ /dev/null @@ -1,58 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_QTRLE_H -#define GRAPHICS_VIDEO_QTRLE_H - -#include "graphics/pixelformat.h" -#include "graphics/video/codecs/codec.h" - -namespace Graphics { - -class QTRLEDecoder : public Codec { -public: - QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel); - ~QTRLEDecoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const { return _pixelFormat; } - -private: - byte _bitsPerPixel; - - Surface *_surface; - PixelFormat _pixelFormat; - - 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 Graphics - -#endif diff --git a/graphics/video/codecs/rpza.cpp b/graphics/video/codecs/rpza.cpp deleted file mode 100644 index 6869eaca7d..0000000000 --- a/graphics/video/codecs/rpza.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. - * - * $URL$ - * $Id$ - * - */ - - // Based off ffmpeg's RPZA decoder - -#include "graphics/video/codecs/rpza.h" - -#include "common/system.h" -#include "common/stream.h" -#include "graphics/colormasks.h" - -namespace Graphics { - -RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Codec() { - _pixelFormat = g_system->getScreenFormat(); - - // We need to increase the surface size to a multiple of 4 - uint16 wMod = width % 4; - if(wMod != 0) - width += 4 - wMod; - - debug(2, "RPZA corrected width: %d", width); - - _surface = new Surface(); - _surface->create(width, height, _pixelFormat.bytesPerPixel); -} - -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("block counter just went negative (this should not happen)") \ - -// Convert from RGB555 to the format specified by the screen -#define PUT_PIXEL(color) \ - if ((int32)blockPtr < _surface->w * _surface->h) { \ - byte r = 0, g = 0, b = 0; \ - colorToRGB >(color, r, g, b); \ - if (_pixelFormat.bytesPerPixel == 2) \ - *((uint16 *)_surface->pixels + blockPtr) = _pixelFormat.RGBToColor(r, g, b); \ - else \ - *((uint32 *)_surface->pixels + blockPtr) = _pixelFormat.RGBToColor(r, g, b); \ - } \ - blockPtr++ - -const 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 Graphics diff --git a/graphics/video/codecs/rpza.h b/graphics/video/codecs/rpza.h deleted file mode 100644 index 8be9088bc3..0000000000 --- a/graphics/video/codecs/rpza.h +++ /dev/null @@ -1,49 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_RPZA_H -#define GRAPHICS_VIDEO_RPZA_H - -#include "graphics/pixelformat.h" -#include "graphics/video/codecs/codec.h" - -namespace Graphics { - -class RPZADecoder : public Codec { -public: - RPZADecoder(uint16 width, uint16 height); - ~RPZADecoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const { return _pixelFormat; } - -private: - Surface *_surface; - PixelFormat _pixelFormat; -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/smc.cpp b/graphics/video/codecs/smc.cpp deleted file mode 100644 index 1b92d3bf85..0000000000 --- a/graphics/video/codecs/smc.cpp +++ /dev/null @@ -1,391 +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. - * - * $URL$ - * $Id$ - * - */ - -// Based off ffmpeg's SMC decoder - -#include "graphics/video/codecs/smc.h" -#include "common/stream.h" - -namespace Graphics { - -#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, 1); -} - -SMCDecoder::~SMCDecoder() { - _surface->free(); - delete _surface; -} - -const Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { - byte *pixels = (byte *)_surface->pixels; - - 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 Graphics diff --git a/graphics/video/codecs/smc.h b/graphics/video/codecs/smc.h deleted file mode 100644 index 158cffbce8..0000000000 --- a/graphics/video/codecs/smc.h +++ /dev/null @@ -1,59 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_SMC_H -#define GRAPHICS_VIDEO_SMC_H - -#include "graphics/video/codecs/codec.h" - -namespace Graphics { - -enum { - CPAIR = 2, - CQUAD = 4, - COCTET = 8, - COLORS_PER_TABLE = 256 -}; - -class SMCDecoder : public Codec { -public: - SMCDecoder(uint16 width, uint16 height); - ~SMCDecoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } - -private: - 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 Graphics - -#endif diff --git a/graphics/video/codecs/truemotion1.cpp b/graphics/video/codecs/truemotion1.cpp deleted file mode 100644 index 6ea766ffe1..0000000000 --- a/graphics/video/codecs/truemotion1.cpp +++ /dev/null @@ -1,418 +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. - * - * $URL$ - * $Id$ - * - */ - -// Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg - -#include "common/scummsys.h" -#include "graphics/video/codecs/truemotion1.h" - -#ifdef GRAPHICS_TRUEMOTION1_H - -#include "graphics/video/codecs/truemotion1data.h" -#include "common/stream.h" - -namespace Graphics { - -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 { - int algorithm; - int blockWidth; // vres - int blockHeight; // hres - int blockType; -} static const 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 Surface(); - _width = width; - _height = height; - - _surface->create(width, height, 2); - - // 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(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(); - APPLY_C_PREDICTOR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - } else { - APPLY_C_PREDICTOR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - } - break; - case 1: - case 3: - // always apply 2 Y predictors on these iterations - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - break; - case 2: - // this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y - // depending on the macroblock type - if (_blockType == BLOCK_2x2) { - APPLY_C_PREDICTOR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - APPLY_C_PREDICTOR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - } else if (_blockType == BLOCK_4x2) { - APPLY_C_PREDICTOR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - } else { - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - } - break; - } - } else { - // skip (copy) four pixels, but reassign the horizontal - // predictor - *vertPred++ = *currentPixelPair++; - horizPred = *currentPixelPair - *vertPred; - *vertPred++ = *currentPixelPair++; - } - - if (!keyframe) { - mbChangeByteMask <<= 1; - - // next byte - if (!mbChangeByteMask) { - mbChangeByte = _mbChangeBits[mbChangeIndex++]; - mbChangeByteMask = 1; - } - } - } - - // next change row - if (((y + 1) & 3) == 0) - _mbChangeBits += _mbChangeBitsRowSize; - } -} - -const Surface *TrueMotion1Decoder::decodeImage(Common::SeekableReadStream *stream) { - decodeHeader(stream); - - if (compressionTypes[_header.compression].algorithm == ALGO_NOP) - return 0; - - if (compressionTypes[_header.compression].algorithm == ALGO_RGB24H) { - warning("Unhandled TrueMotion1 24bpp frame"); - return 0; - } else - decode16(); - - delete[] _buf; - - return _surface; -} - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/codecs/truemotion1.h b/graphics/video/codecs/truemotion1.h deleted file mode 100644 index ab8fb221f8..0000000000 --- a/graphics/video/codecs/truemotion1.h +++ /dev/null @@ -1,106 +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. - * - * $URL$ - * $Id$ - * - */ - -// Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg - -// Only compile if SCI32 is enabled or if we're building dynamic modules -#if defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES) - -#ifndef GRAPHICS_TRUEMOTION1_H -#define GRAPHICS_TRUEMOTION1_H - -#include "graphics/video/codecs/codec.h" - -namespace Graphics { - -class TrueMotion1Decoder : public Codec { -public: - TrueMotion1Decoder(uint16 width, uint16 height); - ~TrueMotion1Decoder(); - - const Surface *decodeImage(Common::SeekableReadStream *stream); - - // Always return RGB565 - PixelFormat getPixelFormat() const { return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); } - -private: - Surface *_surface; - - int _mbChangeBitsRowSize; - byte *_buf, *_mbChangeBits, *_indexStream; - int _indexStreamSize; - - uint16 _width, _height; - int _flags; - - struct PredictorTableEntry { - uint32 color; - bool getNextIndex; - }; - - PredictorTableEntry _yPredictorTable[1024]; - PredictorTableEntry _cPredictorTable[1024]; - - int _blockType; - int _blockWidth; - int _blockHeight; - - int16 _ydt[8]; - int16 _cdt[8]; - - int _lastDeltaset, _lastVectable; - - uint32 *_vertPred; - - struct { - byte headerSize; - byte compression; - byte deltaset; - byte vectable; - uint16 ysize; - uint16 xsize; - uint16 checksum; - byte version; - byte headerType; - byte flags; - byte control; - uint16 xoffset; - uint16 yoffset; - uint16 width; - uint16 height; - } _header; - - void selectDeltaTables(int deltaTableIndex); - void decodeHeader(Common::SeekableReadStream *stream); - void decode16(); - int makeYdt16Entry(int p1, int p2); - int makeCdt16Entry(int p1, int p2); - void genVectorTable16(const byte *selVectorTable); -}; - -} // End of namespace Graphics - -#endif // GRAPHICS_TRUEMOTION1_H -#endif // SCI32/Plugins guard diff --git a/graphics/video/codecs/truemotion1data.h b/graphics/video/codecs/truemotion1data.h deleted file mode 100644 index ce01178fd4..0000000000 --- a/graphics/video/codecs/truemotion1data.h +++ /dev/null @@ -1,832 +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. - * - * $URL$ - * $Id$ - * - */ - -// Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg -// These tables were originally part of VpVision from On2 - -#ifndef GRAPHICS_TRUEMOTION1DATA_H -#define GRAPHICS_TRUEMOTION1DATA_H - -#include "common/scummsys.h" - -namespace Graphics { - -// Y delta tables, skinny and fat -static const int16 ydt1[8] = { 0, -2, 2, -6, 6, -12, 12, -12 }; -static const int16 ydt2[8] = { 0, -2, 4, -6, 8, -12, 12, -12 }; -static const int16 ydt3[8] = { 4, -6, 20, -20, 46, -46, 94, -94 }; -static const int16 ydt4[8] = { 0, -4, 4, -16, 16, -36, 36, -80 }; - -// C delta tables, skinny and fat -static const int16 cdt1[8] = { 0, -1, 1, -2, 3, -4, 5, -4 }; -static const int16 cdt2[8] = { 0, -4, 3, -16, 20, -32, 36, -32 }; -static const int16 cdt3[8] = { 0, -2, 2, -8, 8, -18, 18, -40 }; - -// all the delta tables to choose from, at all 4 delta levels -static const int16 * const ydts[] = { ydt1, ydt2, ydt3, ydt4, NULL }; -static const int16 * const cdts[] = { cdt1, cdt1, cdt2, cdt3, NULL }; - -static const byte pc_tbl2[] = { - 0x8,0x00,0x00,0x00,0x00, - 0x8,0x00,0x00,0x00,0x00, - 0x8,0x10,0x00,0x00,0x00, - 0x8,0x01,0x00,0x00,0x00, - 0x8,0x00,0x10,0x00,0x00, - 0x8,0x00,0x01,0x00,0x00, - 0x8,0x00,0x00,0x10,0x00, - 0x8,0x00,0x00,0x01,0x00, - 0x8,0x00,0x00,0x00,0x10, - 0x8,0x00,0x00,0x00,0x01, - 0x6,0x00,0x00,0x00, - 0x6,0x10,0x00,0x00, - 0x6,0x01,0x00,0x00, - 0x6,0x00,0x10,0x00, - 0x6,0x00,0x01,0x00, - 0x6,0x00,0x00,0x01, - 0x6,0x00,0x00,0x10, - 0x6,0x00,0x00,0x02, - 0x6,0x00,0x00,0x20, - 0x6,0x20,0x10,0x00, - 0x6,0x00,0x02,0x01, - 0x6,0x00,0x20,0x10, - 0x6,0x02,0x01,0x00, - 0x6,0x11,0x00,0x00, - 0x6,0x00,0x20,0x00, - 0x6,0x00,0x02,0x00, - 0x6,0x20,0x00,0x00, - 0x6,0x01,0x10,0x00, - 0x6,0x02,0x00,0x00, - 0x6,0x01,0x00,0x02, - 0x6,0x10,0x00,0x20, - 0x6,0x00,0x01,0x02, - 0x6,0x10,0x01,0x00, - 0x6,0x00,0x10,0x20, - 0x6,0x10,0x10,0x00, - 0x6,0x10,0x00,0x01, - 0x6,0x20,0x00,0x10, - 0x6,0x02,0x00,0x01, - 0x6,0x01,0x01,0x00, - 0x6,0x01,0x00,0x10, - 0x6,0x00,0x11,0x00, - 0x6,0x10,0x00,0x02, - 0x6,0x00,0x01,0x10, - 0x6,0x00,0x00,0x11, - 0x6,0x10,0x00,0x10, - 0x6,0x01,0x00,0x01, - 0x6,0x00,0x00,0x22, - 0x6,0x02,0x01,0x01, - 0x6,0x10,0x20,0x10, - 0x6,0x01,0x02,0x01, - 0x6,0x20,0x10,0x10, - 0x6,0x01,0x00,0x20, - 0x6,0x00,0x10,0x01, - 0x6,0x21,0x10,0x00, - 0x6,0x10,0x02,0x01, - 0x6,0x12,0x01,0x00, - 0x6,0x01,0x20,0x10, - 0x6,0x01,0x02,0x00, - 0x6,0x10,0x20,0x00, - 0x6,0x00,0x10,0x02, - 0x6,0x00,0x01,0x20, - 0x6,0x00,0x02,0x21, - 0x6,0x00,0x02,0x20, - 0x6,0x00,0x00,0x12, - 0x6,0x00,0x00,0x21, - 0x6,0x20,0x11,0x00, - 0x6,0x00,0x01,0x01, - 0x6,0x11,0x10,0x00, - 0x6,0x00,0x20,0x12, - 0x6,0x00,0x20,0x11, - 0x6,0x20,0x10,0x02, - 0x6,0x02,0x01,0x20, - 0x6,0x00,0x22,0x11, - 0x6,0x00,0x10,0x10, - 0x6,0x02,0x11,0x00, - 0x6,0x00,0x21,0x10, - 0x6,0x00,0x02,0x03, - 0x6,0x20,0x10,0x01, - 0x6,0x00,0x12,0x01, - 0x4,0x11,0x00, - 0x4,0x00,0x22, - 0x4,0x20,0x00, - 0x4,0x01,0x10, - 0x4,0x02,0x20, - 0x4,0x00,0x20, - 0x4,0x02,0x00, - 0x4,0x10,0x01, - 0x4,0x00,0x11, - 0x4,0x02,0x01, - 0x4,0x02,0x21, - 0x4,0x00,0x02, - 0x4,0x20,0x02, - 0x4,0x01,0x01, - 0x4,0x10,0x10, - 0x4,0x10,0x02, - 0x4,0x22,0x00, - 0x4,0x10,0x00, - 0x4,0x01,0x00, - 0x4,0x21,0x00, - 0x4,0x12,0x00, - 0x4,0x00,0x10, - 0x4,0x20,0x12, - 0x4,0x01,0x11, - 0x4,0x00,0x01, - 0x4,0x01,0x02, - 0x4,0x11,0x02, - 0x4,0x11,0x01, - 0x4,0x10,0x20, - 0x4,0x20,0x01, - 0x4,0x22,0x11, - 0x4,0x00,0x12, - 0x4,0x20,0x10, - 0x4,0x22,0x01, - 0x4,0x01,0x20, - 0x4,0x00,0x21, - 0x4,0x10,0x11, - 0x4,0x21,0x10, - 0x4,0x10,0x22, - 0x4,0x02,0x03, - 0x4,0x12,0x01, - 0x4,0x20,0x11, - 0x4,0x11,0x10, - 0x4,0x20,0x30, - 0x4,0x11,0x20, - 0x4,0x02,0x10, - 0x4,0x22,0x10, - 0x4,0x11,0x11, - 0x4,0x30,0x20, - 0x4,0x30,0x00, - 0x4,0x01,0x22, - 0x4,0x01,0x12, - 0x4,0x02,0x11, - 0x4,0x03,0x02, - 0x4,0x03,0x00, - 0x4,0x10,0x21, - 0x4,0x12,0x20, - 0x4,0x00,0x00, - 0x4,0x12,0x21, - 0x4,0x21,0x11, - 0x4,0x02,0x22, - 0x4,0x10,0x12, - 0x4,0x31,0x00, - 0x4,0x20,0x20, - 0x4,0x00,0x03, - 0x4,0x02,0x02, - 0x4,0x22,0x20, - 0x4,0x01,0x21, - 0x4,0x21,0x02, - 0x4,0x21,0x12, - 0x4,0x11,0x22, - 0x4,0x00,0x30, - 0x4,0x12,0x11, - 0x4,0x20,0x22, - 0x4,0x31,0x20, - 0x4,0x21,0x30, - 0x4,0x22,0x02, - 0x4,0x22,0x22, - 0x4,0x20,0x31, - 0x4,0x13,0x02, - 0x4,0x03,0x10, - 0x4,0x11,0x12, - 0x4,0x00,0x13, - 0x4,0x21,0x01, - 0x4,0x12,0x03, - 0x4,0x13,0x00, - 0x4,0x13,0x10, - 0x4,0x02,0x13, - 0x4,0x30,0x01, - 0x4,0x12,0x10, - 0x4,0x22,0x13, - 0x4,0x03,0x12, - 0x4,0x31,0x01, - 0x4,0x30,0x22, - 0x4,0x00,0x31, - 0x4,0x01,0x31, - 0x4,0x02,0x23, - 0x4,0x01,0x30, - 0x4,0x11,0x21, - 0x4,0x22,0x21, - 0x4,0x01,0x13, - 0x4,0x10,0x03, - 0x4,0x22,0x03, - 0x4,0x30,0x21, - 0x4,0x21,0x31, - 0x4,0x33,0x00, - 0x4,0x13,0x12, - 0x4,0x11,0x31, - 0x4,0x30,0x02, - 0x4,0x12,0x02, - 0x4,0x11,0x13, - 0x4,0x12,0x22, - 0x4,0x20,0x32, - 0x4,0x10,0x13, - 0x4,0x22,0x31, - 0x4,0x21,0x20, - 0x4,0x01,0x33, - 0x4,0x33,0x10, - 0x4,0x20,0x13, - 0x4,0x31,0x22, - 0x4,0x13,0x30, - 0x4,0x01,0x03, - 0x4,0x11,0x33, - 0x4,0x20,0x21, - 0x4,0x13,0x31, - 0x4,0x03,0x22, - 0x4,0x31,0x02, - 0x4,0x00,0x24, - 0x2,0x00, - 0x2,0x10, - 0x2,0x20, - 0x2,0x30, - 0x2,0x40, - 0x2,0x50, - 0x2,0x60, - 0x2,0x01, - 0x2,0x11, - 0x2,0x21, - 0x2,0x31, - 0x2,0x41, - 0x2,0x51, - 0x2,0x61, - 0x2,0x02, - 0x2,0x12, - 0x2,0x22, - 0x2,0x32, - 0x2,0x42, - 0x2,0x52, - 0x2,0x62, - 0x2,0x03, - 0x2,0x13, - 0x2,0x23, - 0x2,0x33, - 0x2,0x43, - 0x2,0x53, - 0x2,0x63, - 0x2,0x04, - 0x2,0x14, - 0x2,0x24, - 0x2,0x34, - 0x2,0x44, - 0x2,0x54, - 0x2,0x64, - 0x2,0x05, - 0x2,0x15, - 0x2,0x25, - 0x2,0x35, - 0x2,0x45, - 0x2,0x55, - 0x2,0x65, - 0x2,0x06, - 0x2,0x16, - 0x2,0x26, - 0x2,0x36, - 0x2,0x46, - 0x2,0x56, - 0x2,0x66 -}; - -static const byte pc_tbl3[] = { - 0x6,0x00,0x00,0x00, - 0x6,0x00,0x00,0x00, - 0x6,0x00,0x00,0x01, - 0x6,0x00,0x00,0x10, - 0x6,0x00,0x00,0x11, - 0x6,0x00,0x01,0x00, - 0x6,0x00,0x01,0x01, - 0x6,0x00,0x01,0x10, - 0x6,0x00,0x01,0x11, - 0x6,0x00,0x10,0x00, - 0x6,0x00,0x10,0x01, - 0x6,0x00,0x10,0x10, - 0x6,0x00,0x10,0x11, - 0x6,0x00,0x11,0x00, - 0x6,0x00,0x11,0x01, - 0x6,0x00,0x11,0x10, - 0x6,0x00,0x11,0x11, - 0x6,0x01,0x00,0x00, - 0x6,0x01,0x00,0x01, - 0x6,0x01,0x00,0x10, - 0x6,0x01,0x00,0x11, - 0x6,0x01,0x01,0x00, - 0x6,0x01,0x01,0x01, - 0x6,0x01,0x01,0x10, - 0x6,0x01,0x01,0x11, - 0x6,0x01,0x10,0x00, - 0x6,0x01,0x10,0x01, - 0x6,0x01,0x10,0x10, - 0x6,0x01,0x10,0x11, - 0x6,0x01,0x11,0x00, - 0x6,0x01,0x11,0x01, - 0x6,0x01,0x11,0x10, - 0x6,0x01,0x11,0x11, - 0x6,0x10,0x00,0x00, - 0x6,0x10,0x00,0x01, - 0x6,0x10,0x00,0x10, - 0x6,0x10,0x00,0x11, - 0x6,0x10,0x01,0x00, - 0x6,0x10,0x01,0x01, - 0x6,0x10,0x01,0x10, - 0x6,0x10,0x01,0x11, - 0x6,0x10,0x10,0x00, - 0x6,0x10,0x10,0x01, - 0x6,0x10,0x10,0x10, - 0x6,0x10,0x10,0x11, - 0x6,0x10,0x11,0x00, - 0x6,0x10,0x11,0x01, - 0x6,0x10,0x11,0x10, - 0x6,0x10,0x11,0x11, - 0x6,0x11,0x00,0x00, - 0x6,0x11,0x00,0x01, - 0x6,0x11,0x00,0x10, - 0x6,0x11,0x00,0x11, - 0x6,0x11,0x01,0x00, - 0x6,0x11,0x01,0x01, - 0x6,0x11,0x01,0x10, - 0x6,0x11,0x01,0x11, - 0x6,0x11,0x10,0x00, - 0x6,0x11,0x10,0x01, - 0x6,0x11,0x10,0x10, - 0x6,0x11,0x10,0x11, - 0x6,0x11,0x11,0x00, - 0x6,0x11,0x11,0x01, - 0x6,0x11,0x11,0x10, - 0x4,0x00,0x00, - 0x4,0x00,0x01, - 0x4,0x00,0x02, - 0x4,0x00,0x03, - 0x4,0x00,0x10, - 0x4,0x00,0x11, - 0x4,0x00,0x12, - 0x4,0x00,0x13, - 0x4,0x00,0x20, - 0x4,0x00,0x21, - 0x4,0x00,0x22, - 0x4,0x00,0x23, - 0x4,0x00,0x30, - 0x4,0x00,0x31, - 0x4,0x00,0x32, - 0x4,0x00,0x33, - 0x4,0x01,0x00, - 0x4,0x01,0x01, - 0x4,0x01,0x02, - 0x4,0x01,0x03, - 0x4,0x01,0x10, - 0x4,0x01,0x11, - 0x4,0x01,0x12, - 0x4,0x01,0x13, - 0x4,0x01,0x20, - 0x4,0x01,0x21, - 0x4,0x01,0x22, - 0x4,0x01,0x23, - 0x4,0x01,0x30, - 0x4,0x01,0x31, - 0x4,0x01,0x32, - 0x4,0x01,0x33, - 0x4,0x02,0x00, - 0x4,0x02,0x01, - 0x4,0x02,0x02, - 0x4,0x02,0x03, - 0x4,0x02,0x10, - 0x4,0x02,0x11, - 0x4,0x02,0x12, - 0x4,0x02,0x13, - 0x4,0x02,0x20, - 0x4,0x02,0x21, - 0x4,0x02,0x22, - 0x4,0x02,0x23, - 0x4,0x02,0x30, - 0x4,0x02,0x31, - 0x4,0x02,0x32, - 0x4,0x02,0x33, - 0x4,0x03,0x00, - 0x4,0x03,0x01, - 0x4,0x03,0x02, - 0x4,0x03,0x03, - 0x4,0x03,0x10, - 0x4,0x03,0x11, - 0x4,0x03,0x12, - 0x4,0x03,0x13, - 0x4,0x03,0x20, - 0x4,0x03,0x21, - 0x4,0x03,0x22, - 0x4,0x03,0x23, - 0x4,0x03,0x30, - 0x4,0x03,0x31, - 0x4,0x03,0x32, - 0x4,0x03,0x33, - 0x4,0x10,0x00, - 0x4,0x10,0x01, - 0x4,0x10,0x02, - 0x4,0x10,0x03, - 0x4,0x10,0x10, - 0x4,0x10,0x11, - 0x4,0x10,0x12, - 0x4,0x10,0x13, - 0x4,0x10,0x20, - 0x4,0x10,0x21, - 0x4,0x10,0x22, - 0x4,0x10,0x23, - 0x4,0x10,0x30, - 0x4,0x10,0x31, - 0x4,0x10,0x32, - 0x4,0x10,0x33, - 0x4,0x11,0x00, - 0x4,0x11,0x01, - 0x4,0x11,0x02, - 0x4,0x11,0x03, - 0x4,0x11,0x10, - 0x4,0x11,0x11, - 0x4,0x11,0x12, - 0x4,0x11,0x13, - 0x4,0x11,0x20, - 0x4,0x11,0x21, - 0x4,0x11,0x22, - 0x4,0x11,0x23, - 0x4,0x11,0x30, - 0x4,0x11,0x31, - 0x4,0x11,0x32, - 0x4,0x11,0x33, - 0x4,0x12,0x00, - 0x4,0x12,0x01, - 0x4,0x12,0x02, - 0x4,0x12,0x03, - 0x4,0x12,0x10, - 0x4,0x12,0x11, - 0x4,0x12,0x12, - 0x4,0x12,0x13, - 0x4,0x12,0x20, - 0x4,0x12,0x21, - 0x4,0x12,0x22, - 0x4,0x12,0x23, - 0x4,0x12,0x30, - 0x4,0x12,0x31, - 0x4,0x12,0x32, - 0x4,0x12,0x33, - 0x4,0x13,0x00, - 0x4,0x13,0x01, - 0x4,0x13,0x02, - 0x4,0x13,0x03, - 0x4,0x13,0x10, - 0x4,0x13,0x11, - 0x4,0x13,0x12, - 0x4,0x13,0x13, - 0x4,0x13,0x20, - 0x4,0x13,0x21, - 0x4,0x13,0x22, - 0x4,0x13,0x23, - 0x4,0x13,0x30, - 0x4,0x13,0x31, - 0x4,0x13,0x32, - 0x4,0x13,0x33, - 0x2,0x00, - 0x2,0x10, - 0x2,0x20, - 0x2,0x30, - 0x2,0x40, - 0x2,0x50, - 0x2,0x60, - 0x2,0x70, - 0x2,0x01, - 0x2,0x11, - 0x2,0x21, - 0x2,0x31, - 0x2,0x41, - 0x2,0x51, - 0x2,0x61, - 0x2,0x71, - 0x2,0x02, - 0x2,0x12, - 0x2,0x22, - 0x2,0x32, - 0x2,0x42, - 0x2,0x52, - 0x2,0x62, - 0x2,0x72, - 0x2,0x03, - 0x2,0x13, - 0x2,0x23, - 0x2,0x33, - 0x2,0x43, - 0x2,0x53, - 0x2,0x63, - 0x2,0x73, - 0x2,0x04, - 0x2,0x14, - 0x2,0x24, - 0x2,0x34, - 0x2,0x44, - 0x2,0x54, - 0x2,0x64, - 0x2,0x74, - 0x2,0x05, - 0x2,0x15, - 0x2,0x25, - 0x2,0x35, - 0x2,0x45, - 0x2,0x55, - 0x2,0x65, - 0x2,0x75, - 0x2,0x06, - 0x2,0x16, - 0x2,0x26, - 0x2,0x36, - 0x2,0x46, - 0x2,0x56, - 0x2,0x66, - 0x2,0x76, - 0x2,0x07, - 0x2,0x17, - 0x2,0x27, - 0x2,0x37, - 0x2,0x47, - 0x2,0x57, - 0x2,0x67, - 0x2,0x77 -}; - -static const byte pc_tbl4[] = { - 0x8,0x00,0x00,0x00,0x00, - 0x8,0x00,0x00,0x00,0x00, - 0x8,0x20,0x00,0x00,0x00, - 0x8,0x00,0x00,0x00,0x01, - 0x8,0x10,0x00,0x00,0x00, - 0x8,0x00,0x00,0x00,0x02, - 0x8,0x01,0x00,0x00,0x00, - 0x8,0x00,0x00,0x00,0x10, - 0x8,0x02,0x00,0x00,0x00, - 0x6,0x00,0x00,0x00, - 0x6,0x20,0x00,0x00, - 0x6,0x00,0x00,0x01, - 0x6,0x10,0x00,0x00, - 0x6,0x00,0x00,0x02, - 0x6,0x00,0x10,0x00, - 0x6,0x00,0x20,0x00, - 0x6,0x00,0x02,0x00, - 0x6,0x00,0x01,0x00, - 0x6,0x01,0x00,0x00, - 0x6,0x00,0x00,0x20, - 0x6,0x02,0x00,0x00, - 0x6,0x00,0x00,0x10, - 0x6,0x10,0x00,0x20, - 0x6,0x01,0x00,0x02, - 0x6,0x20,0x00,0x10, - 0x6,0x02,0x00,0x01, - 0x6,0x20,0x10,0x00, - 0x6,0x00,0x12,0x00, - 0x6,0x00,0x02,0x01, - 0x6,0x02,0x01,0x00, - 0x6,0x00,0x21,0x00, - 0x6,0x00,0x01,0x02, - 0x6,0x00,0x20,0x10, - 0x6,0x00,0x00,0x21, - 0x6,0x00,0x00,0x12, - 0x6,0x00,0x01,0x20, - 0x6,0x12,0x00,0x00, - 0x6,0x00,0x10,0x20, - 0x6,0x01,0x20,0x00, - 0x6,0x02,0x10,0x00, - 0x6,0x10,0x20,0x00, - 0x6,0x01,0x02,0x00, - 0x6,0x21,0x00,0x00, - 0x6,0x00,0x02,0x10, - 0x6,0x20,0x01,0x00, - 0x6,0x00,0x22,0x00, - 0x6,0x10,0x02,0x00, - 0x6,0x00,0x10,0x02, - 0x6,0x11,0x00,0x00, - 0x6,0x00,0x11,0x00, - 0x6,0x22,0x00,0x00, - 0x6,0x20,0x00,0x02, - 0x6,0x10,0x00,0x01, - 0x6,0x00,0x20,0x01, - 0x6,0x02,0x20,0x00, - 0x6,0x01,0x10,0x00, - 0x6,0x01,0x00,0x20, - 0x6,0x00,0x20,0x02, - 0x6,0x01,0x20,0x02, - 0x6,0x10,0x01,0x00, - 0x6,0x02,0x00,0x10, - 0x6,0x00,0x10,0x01, - 0x6,0x10,0x01,0x20, - 0x6,0x20,0x02,0x10, - 0x6,0x00,0x00,0x22, - 0x6,0x10,0x00,0x02, - 0x6,0x00,0x02,0x20, - 0x6,0x20,0x02,0x00, - 0x6,0x00,0x00,0x11, - 0x6,0x02,0x10,0x01, - 0x6,0x00,0x01,0x10, - 0x6,0x00,0x02,0x11, - 0x4,0x01,0x02, - 0x4,0x02,0x01, - 0x4,0x01,0x00, - 0x4,0x10,0x20, - 0x4,0x20,0x10, - 0x4,0x20,0x00, - 0x4,0x11,0x00, - 0x4,0x02,0x00, - 0x4,0x12,0x00, - 0x4,0x00,0x21, - 0x4,0x22,0x00, - 0x4,0x00,0x12, - 0x4,0x21,0x00, - 0x4,0x02,0x11, - 0x4,0x00,0x01, - 0x4,0x10,0x02, - 0x4,0x02,0x20, - 0x4,0x20,0x11, - 0x4,0x01,0x10, - 0x4,0x21,0x10, - 0x4,0x10,0x00, - 0x4,0x10,0x22, - 0x4,0x20,0x20, - 0x4,0x00,0x22, - 0x4,0x01,0x22, - 0x4,0x20,0x01, - 0x4,0x02,0x02, - 0x4,0x00,0x20, - 0x4,0x00,0x10, - 0x4,0x00,0x11, - 0x4,0x22,0x01, - 0x4,0x11,0x20, - 0x4,0x12,0x01, - 0x4,0x12,0x20, - 0x4,0x11,0x02, - 0x4,0x10,0x10, - 0x4,0x01,0x01, - 0x4,0x02,0x21, - 0x4,0x20,0x12, - 0x4,0x01,0x12, - 0x4,0x22,0x11, - 0x4,0x21,0x12, - 0x4,0x22,0x10, - 0x4,0x21,0x02, - 0x4,0x20,0x02, - 0x4,0x10,0x01, - 0x4,0x00,0x02, - 0x4,0x10,0x21, - 0x4,0x01,0x20, - 0x4,0x11,0x22, - 0x4,0x12,0x21, - 0x4,0x22,0x20, - 0x4,0x02,0x10, - 0x4,0x02,0x22, - 0x4,0x11,0x10, - 0x4,0x22,0x02, - 0x4,0x20,0x21, - 0x4,0x01,0x11, - 0x4,0x11,0x01, - 0x4,0x10,0x12, - 0x4,0x02,0x12, - 0x4,0x20,0x22, - 0x4,0x21,0x20, - 0x4,0x01,0x21, - 0x4,0x12,0x02, - 0x4,0x21,0x11, - 0x4,0x12,0x22, - 0x4,0x12,0x10, - 0x4,0x22,0x21, - 0x4,0x10,0x11, - 0x4,0x21,0x01, - 0x4,0x11,0x12, - 0x4,0x12,0x11, - 0x4,0x66,0x66, - 0x4,0x22,0x22, - 0x4,0x11,0x21, - 0x4,0x11,0x11, - 0x4,0x21,0x22, - 0x4,0x00,0x00, - 0x4,0x22,0x12, - 0x4,0x12,0x12, - 0x4,0x21,0x21, - 0x4,0x42,0x00, - 0x4,0x00,0x04, - 0x4,0x40,0x00, - 0x4,0x30,0x00, - 0x4,0x31,0x00, - 0x4,0x00,0x03, - 0x4,0x00,0x14, - 0x4,0x00,0x13, - 0x4,0x01,0x24, - 0x4,0x20,0x13, - 0x4,0x01,0x42, - 0x4,0x14,0x20, - 0x4,0x42,0x02, - 0x4,0x13,0x00, - 0x4,0x00,0x24, - 0x4,0x31,0x20, - 0x4,0x22,0x13, - 0x4,0x11,0x24, - 0x4,0x12,0x66, - 0x4,0x30,0x01, - 0x4,0x02,0x13, - 0x4,0x12,0x42, - 0x4,0x40,0x10, - 0x4,0x40,0x02, - 0x4,0x01,0x04, - 0x4,0x24,0x00, - 0x4,0x42,0x10, - 0x4,0x21,0x13, - 0x4,0x13,0x12, - 0x4,0x31,0x21, - 0x4,0x21,0x24, - 0x4,0x00,0x40, - 0x4,0x10,0x24, - 0x4,0x10,0x42, - 0x4,0x32,0x01, - 0x4,0x11,0x42, - 0x4,0x20,0x31, - 0x4,0x12,0x40, - 0x2,0x00, - 0x2,0x10, - 0x2,0x20, - 0x2,0x30, - 0x2,0x40, - 0x2,0x50, - 0x2,0x60, - 0x2,0x70, - 0x2,0x01, - 0x2,0x11, - 0x2,0x21, - 0x2,0x31, - 0x2,0x41, - 0x2,0x51, - 0x2,0x61, - 0x2,0x71, - 0x2,0x02, - 0x2,0x12, - 0x2,0x22, - 0x2,0x32, - 0x2,0x42, - 0x2,0x52, - 0x2,0x62, - 0x2,0x72, - 0x2,0x03, - 0x2,0x13, - 0x2,0x23, - 0x2,0x33, - 0x2,0x43, - 0x2,0x53, - 0x2,0x63, - 0x2,0x73, - 0x2,0x04, - 0x2,0x14, - 0x2,0x24, - 0x2,0x34, - 0x2,0x44, - 0x2,0x54, - 0x2,0x64, - 0x2,0x74, - 0x2,0x05, - 0x2,0x15, - 0x2,0x25, - 0x2,0x35, - 0x2,0x45, - 0x2,0x55, - 0x2,0x65, - 0x2,0x75, - 0x2,0x06, - 0x2,0x16, - 0x2,0x26, - 0x2,0x36, - 0x2,0x46, - 0x2,0x56, - 0x2,0x66, - 0x2,0x76, - 0x2,0x07, - 0x2,0x17, - 0x2,0x27, - 0x2,0x37, - 0x2,0x47, - 0x2,0x57, - 0x2,0x67, - 0x2,0x77 -}; - -static const byte * const tables[] = { pc_tbl2, pc_tbl3, pc_tbl4 }; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp deleted file mode 100644 index fdb244ddf2..0000000000 --- a/graphics/video/coktel_decoder.cpp +++ /dev/null @@ -1,2757 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "common/scummsys.h" - -#include "graphics/video/coktel_decoder.h" - -#include "graphics/video/codecs/codec.h" -#include "graphics/video/codecs/indeo3.h" - -#ifdef GRAPHICS_VIDEO_COKTELDECODER_H - -#include "sound/audiostream.h" -#include "sound/decoders/raw.h" -#include "common/memstream.h" - -static const uint32 kVideoCodecIndeo3 = MKID_BE('iv32'); - -namespace Graphics { - -CoktelDecoder::State::State() : flags(0), speechId(0) { -} - - -CoktelDecoder::CoktelDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : - _mixer(mixer), _soundType(soundType), _width(0), _height(0), _x(0), _y(0), - _defaultX(0), _defaultY(0), _features(0), _frameCount(0), _paletteDirty(false), - _ownSurface(true), _frameRate(12), _hasSound(false), _soundEnabled(false), - _soundStage(kSoundNone), _audioStream(0) { - - assert(_mixer); - - memset(_palette, 0, 768); -} - -CoktelDecoder::~CoktelDecoder() { -} - -bool CoktelDecoder::evaluateSeekFrame(int32 &frame, int whence) const { - if (!isVideoLoaded()) - // Nothing to do - return false; - - // Find the frame to which to seek - if (whence == SEEK_CUR) - frame += _curFrame; - else if (whence == SEEK_END) - frame = _frameCount - frame - 1; - else if (whence == SEEK_SET) - frame--; - else - return false; - - if ((frame < -1) || (frame >= ((int32) _frameCount))) - // Out of range - return false; - - return true; -} - -void CoktelDecoder::setSurfaceMemory(void *mem, uint16 width, uint16 height, uint8 bpp) { - freeSurface(); - - if (!hasVideo()) - return; - - // Sanity checks - assert((width > 0) && (height > 0)); - assert(bpp == getPixelFormat().bytesPerPixel); - - // Create a surface over this memory - _surface.w = width; - _surface.h = height; - _surface.pitch = width * bpp; - _surface.pixels = mem; - _surface.bytesPerPixel = bpp; - - _ownSurface = false; -} - -void CoktelDecoder::setSurfaceMemory() { - freeSurface(); - createSurface(); - - _ownSurface = true; -} - -const Surface *CoktelDecoder::getSurface() const { - if (!isVideoLoaded()) - return 0; - - return &_surface; -} - -bool CoktelDecoder::hasSurface() { - return _surface.pixels != 0; -} - -void CoktelDecoder::createSurface() { - if (hasSurface()) - return; - - if (!hasVideo()) - return; - - if ((_width > 0) && (_height > 0)) - _surface.create(_width, _height, getPixelFormat().bytesPerPixel); - - _ownSurface = true; -} - -void CoktelDecoder::freeSurface() { - if (!_ownSurface) { - _surface.w = 0; - _surface.h = 0; - _surface.pitch = 0; - _surface.pixels = 0; - _surface.bytesPerPixel = 0; - } else - _surface.free(); - - _ownSurface = true; -} - -void CoktelDecoder::setXY(uint16 x, uint16 y) { - _x = x; - _y = y; -} - -void CoktelDecoder::setXY() { - setXY(_defaultX, _defaultY); -} - -void CoktelDecoder::setFrameRate(Common::Rational frameRate) { - _frameRate = frameRate; -} - -uint16 CoktelDecoder::getDefaultX() const { - return _defaultX; -} - -uint16 CoktelDecoder::getDefaultY() const { - return _defaultY; -} - -const Common::List &CoktelDecoder::getDirtyRects() const { - return _dirtyRects; -} - -bool CoktelDecoder::hasPalette() const { - return (_features & kFeaturesPalette) != 0; -} - -bool CoktelDecoder::hasVideo() const { - return true; -} - -bool CoktelDecoder::hasSound() const { - return _hasSound; -} - -bool CoktelDecoder::isSoundEnabled() const { - return _soundEnabled; -} - -bool CoktelDecoder::isSoundPlaying() const { - return _audioStream && _mixer->isSoundHandleActive(_audioHandle); -} - -void CoktelDecoder::enableSound() { - if (!hasSound() || isSoundEnabled()) - return; - - // Sanity check - if (_mixer->getOutputRate() == 0) - return; - - // Only possible on the first frame - if (_curFrame > -1) - return; - - _soundEnabled = true; -} - -void CoktelDecoder::disableSound() { - if (_audioStream) { - if ((_soundStage == kSoundPlaying) || (_soundStage == kSoundFinished)) { - _audioStream->finish(); - _mixer->stopHandle(_audioHandle); - } - - delete _audioStream; - } - - _soundEnabled = false; - _soundStage = kSoundNone; - - _audioStream = 0; -} - -void CoktelDecoder::colorModeChanged() { -} - -bool CoktelDecoder::getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) { - return false; -} - -bool CoktelDecoder::hasEmbeddedFiles() const { - return false; -} - -bool CoktelDecoder::hasEmbeddedFile(const Common::String &fileName) const { - return false; -} - -Common::SeekableReadStream *CoktelDecoder::getEmbeddedFile(const Common::String &fileName) const { - return 0; -} - -int32 CoktelDecoder::getSubtitleIndex() const { - return -1; -} - -bool CoktelDecoder::isPaletted() const { - return true; -} - -void CoktelDecoder::close() { - disableSound(); - freeSurface(); - - _x = 0; - _y = 0; - - _defaultX = 0; - _defaultY = 0; - - _features = 0; - - _frameCount = 0; - - _hasSound = false; -} - -uint16 CoktelDecoder::getWidth() const { - return _width; -} - -uint16 CoktelDecoder::getHeight() const { - return _height; -} - -uint32 CoktelDecoder::getFrameCount() const { - return _frameCount; -} - -const byte *CoktelDecoder::getPalette() { - return _palette; -} - -bool CoktelDecoder::hasDirtyPalette() const { - return (_features & kFeaturesPalette) && _paletteDirty; -} - -uint32 CoktelDecoder::deLZ77(byte *dest, const byte *src, uint32 srcSize, uint32 destSize) { - uint32 frameLength = READ_LE_UINT32(src); - if (frameLength > destSize) { - warning("CoktelDecoder::deLZ77(): Uncompressed size bigger than buffer size (%d > %d)", frameLength, destSize); - return 0; - } - - assert(srcSize >= 4); - - uint32 realSize = frameLength; - - src += 4; - srcSize -= 4; - - uint16 bufPos1; - bool mode; - if ((READ_LE_UINT16(src) == 0x1234) && (READ_LE_UINT16(src + 2) == 0x5678)) { - assert(srcSize >= 4); - - src += 4; - srcSize -= 4; - - bufPos1 = 273; - mode = 1; // 123Ch (cmp al, 12h) - } else { - bufPos1 = 4078; - mode = 0; // 275h (jnz +2) - } - - byte buf[4370]; - memset(buf, 32, bufPos1); - - uint8 chunkCount = 1; - uint8 chunkBitField = 0; - - while (frameLength > 0) { - chunkCount--; - - if (chunkCount == 0) { - chunkCount = 8; - chunkBitField = *src++; - } - - if (chunkBitField % 2) { - assert(srcSize >= 1); - - chunkBitField >>= 1; - buf[bufPos1] = *src; - *dest++ = *src++; - bufPos1 = (bufPos1 + 1) % 4096; - frameLength--; - srcSize--; - continue; - } - chunkBitField >>= 1; - - assert(srcSize >= 2); - - uint16 tmp = READ_LE_UINT16(src); - uint16 chunkLength = ((tmp & 0xF00) >> 8) + 3; - - src += 2; - srcSize -= 2; - - if ((mode && ((chunkLength & 0xFF) == 0x12)) || - (!mode && (chunkLength == 0))) { - assert(srcSize >= 1); - - chunkLength = *src++ + 0x12; - srcSize--; - } - - uint16 bufPos2 = (tmp & 0xFF) + ((tmp >> 4) & 0x0F00); - if (((tmp + chunkLength) >= 4096) || - ((chunkLength + bufPos1) >= 4096)) { - - for (int i = 0; i < chunkLength; i++, dest++) { - *dest = buf[bufPos2]; - buf[bufPos1] = buf[bufPos2]; - bufPos1 = (bufPos1 + 1) % 4096; - bufPos2 = (bufPos2 + 1) % 4096; - } - - } else if (((tmp + chunkLength) < bufPos1) || - ((chunkLength + bufPos1) < bufPos2)) { - - memcpy(dest, buf + bufPos2, chunkLength); - memmove(buf + bufPos1, buf + bufPos2, chunkLength); - - dest += chunkLength; - bufPos1 += chunkLength; - bufPos2 += chunkLength; - - } else { - - for (int i = 0; i < chunkLength; i++, dest++, bufPos1++, bufPos2++) { - *dest = buf[bufPos2]; - buf[bufPos1] = buf[bufPos2]; - } - - } - frameLength -= chunkLength; - - } - - return realSize; -} - -void CoktelDecoder::deRLE(byte *&destPtr, const byte *&srcPtr, int16 destLen, int16 srcLen) { - srcPtr++; - - if (srcLen & 1) { - byte data = *srcPtr++; - - if (destLen > 0) { - *destPtr++ = data; - destLen--; - } - } - - srcLen >>= 1; - - while (srcLen > 0) { - uint8 tmp = *srcPtr++; - if (tmp & 0x80) { // Verbatim copy - tmp &= 0x7F; - - int16 copyCount = MAX(0, MIN(destLen, tmp * 2)); - - memcpy(destPtr, srcPtr, copyCount); - - srcPtr += tmp * 2; - destPtr += copyCount; - destLen -= copyCount; - } else { // 2 bytes tmp times - for (int i = 0; (i < tmp) && (destLen > 0); i++) { - for (int j = 0; j < 2; j++) { - if (destLen <= 0) - break; - - *destPtr++ = srcPtr[j]; - destLen--; - } - } - srcPtr += 2; - } - srcLen -= tmp; - } -} - -// A whole, completely filled block -void CoktelDecoder::renderBlockWhole(Surface &dstSurf, const byte *src, Common::Rect &rect) { - Common::Rect srcRect = rect; - - rect.clip(dstSurf.w, dstSurf.h); - - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left * dstSurf.bytesPerPixel; - for (int i = 0; i < rect.height(); i++) { - memcpy(dst, src, rect.width() * dstSurf.bytesPerPixel); - - src += srcRect.width() * dstSurf.bytesPerPixel; - dst += dstSurf.pitch; - } -} - -// A quarter-wide whole, completely filled block -void CoktelDecoder::renderBlockWhole4X(Surface &dstSurf, const byte *src, Common::Rect &rect) { - Common::Rect srcRect = rect; - - rect.clip(dstSurf.w, dstSurf.h); - - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; - for (int i = 0; i < rect.height(); i++) { - byte *dstRow = dst; - const byte *srcRow = src; - - int16 count = rect.width(); - while (count >= 0) { - memset(dstRow, *srcRow, MIN(count, 4)); - - count -= 4; - dstRow += 4; - srcRow += 1; - } - - src += srcRect.width() / 4; - dst += dstSurf.pitch; - } -} - -// A half-high whole, completely filled block -void CoktelDecoder::renderBlockWhole2Y(Surface &dstSurf, const byte *src, Common::Rect &rect) { - Common::Rect srcRect = rect; - - rect.clip(dstSurf.w, dstSurf.h); - - int16 height = rect.height(); - - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; - while (height > 1) { - memcpy(dst , src, rect.width()); - memcpy(dst + dstSurf.pitch, src, rect.width()); - - height -= 2; - src += srcRect.width(); - dst += 2 * dstSurf.pitch; - } - - if (height == 1) - memcpy(dst, src, rect.width()); -} - -// A sparse block -void CoktelDecoder::renderBlockSparse(Surface &dstSurf, const byte *src, Common::Rect &rect) { - Common::Rect srcRect = rect; - - rect.clip(dstSurf.w, dstSurf.h); - - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; - for (int i = 0; i < rect.height(); i++) { - byte *dstRow = dst; - int16 pixWritten = 0; - - while (pixWritten < srcRect.width()) { - int16 pixCount = *src++; - - if (pixCount & 0x80) { // Data - int16 copyCount; - - pixCount = MIN((pixCount & 0x7F) + 1, srcRect.width() - pixWritten); - copyCount = CLIP(rect.width() - pixWritten, 0, pixCount); - memcpy(dstRow, src, copyCount); - - pixWritten += pixCount; - dstRow += pixCount; - src += pixCount; - } else { // "Hole" - pixWritten += pixCount + 1; - dstRow += pixCount + 1; - } - - } - - dst += dstSurf.pitch; - } -} - -// A half-high sparse block -void CoktelDecoder::renderBlockSparse2Y(Surface &dstSurf, const byte *src, Common::Rect &rect) { - warning("renderBlockSparse2Y"); - - Common::Rect srcRect = rect; - - rect.clip(dstSurf.w, dstSurf.h); - - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; - for (int i = 0; i < rect.height(); i += 2) { - byte *dstRow = dst; - int16 pixWritten = 0; - - while (pixWritten < srcRect.width()) { - int16 pixCount = *src++; - - if (pixCount & 0x80) { // Data - int16 copyCount; - - pixCount = MIN((pixCount & 0x7F) + 1, srcRect.width() - pixWritten); - copyCount = CLIP(rect.width() - pixWritten, 0, pixCount); - memcpy(dstRow , src, pixCount); - memcpy(dstRow + dstSurf.pitch, src, pixCount); - - pixWritten += pixCount; - dstRow += pixCount; - src += pixCount; - } else { // "Hole" - pixWritten += pixCount + 1; - dstRow += pixCount + 1; - } - - } - - dst += dstSurf.pitch; - } -} - -void CoktelDecoder::renderBlockRLE(Surface &dstSurf, const byte *src, Common::Rect &rect) { - Common::Rect srcRect = rect; - - rect.clip(dstSurf.w, dstSurf.h); - - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; - for (int i = 0; i < rect.height(); i++) { - byte *dstRow = dst; - int16 pixWritten = 0; - - while (pixWritten < srcRect.width()) { - int16 pixCount = *src++; - - if (pixCount & 0x80) { - int16 copyCount; - - pixCount = MIN((pixCount & 0x7F) + 1, srcRect.width() - pixWritten); - copyCount = CLIP(rect.width() - pixWritten, 0, pixCount); - - if (*src != 0xFF) { // Normal copy - - memcpy(dstRow, src, copyCount); - dstRow += copyCount; - src += pixCount; - } else - deRLE(dstRow, src, copyCount, pixCount); - - pixWritten += pixCount; - } else { // "Hole" - int16 copyCount = CLIP(rect.width() - pixWritten, 0, pixCount + 1); - - dstRow += copyCount; - pixWritten += pixCount + 1; - } - - } - - dst += dstSurf.pitch; - } -} - -Common::Rational CoktelDecoder::getFrameRate() const { - return _frameRate; -} - -uint32 CoktelDecoder::getStaticTimeToNextFrame() const { - return (1000 / _frameRate).toInt(); -} - -inline void CoktelDecoder::unsignedToSigned(byte *buffer, int length) { - while (length-- > 0) *buffer++ ^= 0x80; -} - - -PreIMDDecoder::PreIMDDecoder(uint16 width, uint16 height, - Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType), - _stream(0), _videoBuffer(0), _videoBufferSize(0) { - - _width = width; - _height = height; -} - -PreIMDDecoder::~PreIMDDecoder() { - close(); -} - -bool PreIMDDecoder::seek(int32 frame, int whence, bool restart) { - if (!evaluateSeekFrame(frame, whence)) - return false; - - if (frame == _curFrame) - // Nothing to do - return true; - - // Run through the frames - _curFrame = -1; - _stream->seek(2); - while (_curFrame != frame) { - uint16 frameSize = _stream->readUint16LE(); - - _stream->skip(frameSize + 2); - - _curFrame++; - } - - return true; -} - -bool PreIMDDecoder::load(Common::SeekableReadStream *stream) { - // Since PreIMDs don't have any width and height values stored, - // we need them to be specified in the constructor - assert((_width > 0) && (_height > 0)); - - close(); - - _stream = stream; - - _stream->seek(0); - - _frameCount = _stream->readUint16LE(); - - _videoBufferSize = _width * _height; - _videoBuffer = new byte[_videoBufferSize]; - - memset(_videoBuffer, 0, _videoBufferSize); - - return true; -} - -void PreIMDDecoder::close() { - reset(); - - CoktelDecoder::close(); - - delete _stream; - - delete[] _videoBuffer; - - _stream = 0; - - _videoBuffer = 0; - _videoBufferSize = 0; -} - -bool PreIMDDecoder::isVideoLoaded() const { - return _stream != 0; -} - -const Surface *PreIMDDecoder::decodeNextFrame() { - if (!isVideoLoaded() || endOfVideo()) - return 0; - - createSurface(); - - processFrame(); - renderFrame(); - - if (_curFrame == 0) - _startTime = g_system->getMillis(); - - return &_surface; -} - -void PreIMDDecoder::processFrame() { - _curFrame++; - - uint16 frameSize = _stream->readUint16LE(); - if (_stream->eos() || (frameSize == 0)) - return; - - uint32 nextFramePos = _stream->pos() + frameSize + 2; - - byte cmd; - - cmd = _stream->readByte(); - frameSize--; - - if (cmd == 0) { - // Palette. Ignored by Fascination, though. - - // NOTE: If we ever find another game using this format, - // palettes may need to be evaluated. - - _stream->skip(768); - - frameSize -= 769; - - cmd = _stream->readByte(); - } - - if (cmd != 2) { - // Partial frame data - - uint32 fSize = frameSize; - uint32 vidSize = _videoBufferSize; - - byte *vidBuffer = _videoBuffer; - - while ((fSize > 0) && (vidSize > 0)) { - uint32 n = _stream->readByte(); - fSize--; - - if ((n & 0x80) != 0) { - // Data - - n = MIN((n & 0x7F) + 1, MIN(fSize, vidSize)); - - _stream->read(vidBuffer, n); - - vidBuffer += n; - vidSize -= n; - fSize -= n; - - } else { - // Skip - - n = MIN(n + 1, vidSize); - - vidBuffer += n; - vidSize -= n; - } - } - - } else { - // Full direct frame - - uint32 vidSize = MIN(_videoBufferSize, frameSize); - - _stream->read(_videoBuffer, vidSize); - } - - _stream->seek(nextFramePos); -} - -// Just a simple blit -void PreIMDDecoder::renderFrame() { - _dirtyRects.clear(); - - uint16 w = CLIP(_surface.w - _x, 0, _width); - uint16 h = CLIP(_surface.h - _y, 0, _height); - - const byte *src = _videoBuffer; - byte *dst = (byte *)_surface.pixels + (_y * _surface.pitch) + _x; - - uint32 frameDataSize = _videoBufferSize; - - while (h-- > 0) { - uint32 n = MIN(w, frameDataSize); - - memcpy(dst, src, n); - - src += _width; - dst += _surface.pitch; - - frameDataSize -= n; - } - - _dirtyRects.push_back(Common::Rect(_x, _y, _x + _width, _y + _height)); -} - -PixelFormat PreIMDDecoder::getPixelFormat() const { - return PixelFormat::createFormatCLUT8(); -} - - -IMDDecoder::IMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType), - _stream(0), _version(0), _stdX(-1), _stdY(-1), _stdWidth(-1), _stdHeight(-1), - _flags(0), _firstFramePos(0), _framePos(0), _frameCoords(0), _videoBufferSize(0), - _soundFlags(0), _soundFreq(0), _soundSliceSize(0), _soundSlicesCount(0) { - - _videoBuffer [0] = 0; - _videoBuffer [1] = 0; - _videoBufferLen[0] = 0; - _videoBufferLen[1] = 0; -} - -IMDDecoder::~IMDDecoder() { - close(); -} - -bool IMDDecoder::seek(int32 frame, int whence, bool restart) { - if (!evaluateSeekFrame(frame, whence)) - return false; - - if (frame == _curFrame) - // Nothing to do - return true; - - // Try every possible way to find a file offset to that frame - uint32 framePos = 0; - if (frame == -1) { - // First frame, we know that position - - framePos = _firstFramePos; - - } else if (frame == 0) { - // Second frame, can be calculated from the first frame's position - - framePos = _firstFramePos; - _stream->seek(framePos); - framePos += _stream->readUint16LE() + 4; - - } else if (_framePos) { - // If we have an array of frame positions, use that - - framePos = _framePos[frame + 1]; - - } else if (restart && (_soundStage == kSoundNone)) { - // If we are asked to restart the video if necessary and have no - // audio to worry about, restart the video and run through the frames - - _curFrame = 0; - _stream->seek(_firstFramePos); - - for (int i = ((frame > _curFrame) ? _curFrame : 0); i <= frame; i++) - processFrame(); - - return true; - - } else { - // Not possible - - warning("IMDDecoder::seek(): Frame %d is not directly accessible", frame + 1); - return false; - } - - // Seek - _stream->seek(framePos); - _curFrame = frame; - - return true; -} - -void IMDDecoder::setXY(uint16 x, uint16 y) { - // Adjusting the standard coordinates - if (_stdX != -1) { - if (x != 0xFFFF) - _stdX = _stdX - _x + x; - if (y != 0xFFFF) - _stdY = _stdY - _y + y; - } - - // Going through the coordinate table as well - if (_frameCoords) { - for (uint32 i = 0; i < _frameCount; i++) { - if (_frameCoords[i].left != -1) { - if (x != 0xFFFF) { - _frameCoords[i].left = _frameCoords[i].left - _x + x; - _frameCoords[i].right = _frameCoords[i].right - _x + x; - } - if (y != 0xFFFF) { - _frameCoords[i].top = _frameCoords[i].top - _y + y; - _frameCoords[i].bottom = _frameCoords[i].bottom - _y + y; - } - } - } - } - - if (x != 0xFFFF) - _x = x; - if (y != 0xFFFF) - _y = y; -} - -bool IMDDecoder::load(Common::SeekableReadStream *stream) { - close(); - - _stream = stream; - - uint16 handle; - - handle = _stream->readUint16LE(); - _version = _stream->readByte(); - - // Version checking - if ((handle != 0) || (_version < 2)) { - warning("IMDDecoder::load(): Version incorrect (%d, 0x%X)", handle, _version); - close(); - return false; - } - - // Rest header - _features = _stream->readByte(); - _frameCount = _stream->readUint16LE(); - _defaultX = _stream->readSint16LE(); - _defaultY = _stream->readSint16LE(); - _width = _stream->readSint16LE(); - _height = _stream->readSint16LE(); - _flags = _stream->readUint16LE(); - _firstFramePos = _stream->readUint16LE(); - - _x = _defaultX; - _y = _defaultY; - - // IMDs always have video - _features |= kFeaturesVideo; - // IMDs always have palettes - _features |= kFeaturesPalette; - - // Palette - for (int i = 0; i < 768; i++) - _palette[i] = _stream->readByte() << 2; - - _paletteDirty = true; - - if (!loadCoordinates()) { - close(); - return false; - } - - uint32 framePosPos, frameCoordsPos; - if (!loadFrameTableOffsets(framePosPos, frameCoordsPos)) { - close(); - return false; - } - - if (!assessAudioProperties()) { - close(); - return false; - } - - if (!assessVideoProperties()) { - close(); - return false; - } - - if (!loadFrameTables(framePosPos, frameCoordsPos)) { - close(); - return false; - } - - // Seek to the first frame - _stream->seek(_firstFramePos); - - return true; -} - -bool IMDDecoder::loadCoordinates() { - // Standard coordinates - if (_version >= 3) { - uint16 count = _stream->readUint16LE(); - if (count > 1) { - warning("IMDDecoder::loadCoordinates(): More than one standard coordinate quad found (%d)", count); - return false; - } - - if (count != 0) { - _stdX = _stream->readSint16LE(); - _stdY = _stream->readSint16LE(); - _stdWidth = _stream->readSint16LE(); - _stdHeight = _stream->readSint16LE(); - _features |= kFeaturesStdCoords; - } else - _stdX = _stdY = _stdWidth = _stdHeight = -1; - - } else - _stdX = _stdY = _stdWidth = _stdHeight = -1; - - return true; -} - -bool IMDDecoder::loadFrameTableOffsets(uint32 &framePosPos, uint32 &frameCoordsPos) { - framePosPos = 0; - frameCoordsPos = 0; - - // Frame positions - if (_version >= 4) { - framePosPos = _stream->readUint32LE(); - if (framePosPos != 0) { - _framePos = new uint32[_frameCount]; - _features |= kFeaturesFramePos; - } - } - - // Frame coordinates - if (_features & kFeaturesFrameCoords) - frameCoordsPos = _stream->readUint32LE(); - - return true; -} - -bool IMDDecoder::assessVideoProperties() { - uint32 suggestedVideoBufferSize = 0; - - // Sizes of the frame data and extra video buffer - if (_features & kFeaturesDataSize) { - uint32 size1, size2; - - size1 = _stream->readUint16LE(); - if (size1 == 0) { - size1 = _stream->readUint32LE(); - size2 = _stream->readUint32LE(); - } else - size2 = _stream->readUint16LE(); - - suggestedVideoBufferSize = MAX(size1, size2); - } - - _videoBufferSize = _width * _height + 1000; - - if (suggestedVideoBufferSize > _videoBufferSize) { - warning("Suggested video buffer size greater than what should be needed (%d, %d, %dx%d", - suggestedVideoBufferSize, _videoBufferSize, _width, _height); - - _videoBufferSize = suggestedVideoBufferSize; - } - - for (int i = 0; i < 2; i++) { - _videoBuffer[i] = new byte[_videoBufferSize]; - memset(_videoBuffer[i], 0, _videoBufferSize); - } - - return true; -} - -bool IMDDecoder::assessAudioProperties() { - if (_features & kFeaturesSound) { - _soundFreq = _stream->readSint16LE(); - _soundSliceSize = _stream->readSint16LE(); - _soundSlicesCount = _stream->readSint16LE(); - - if (_soundFreq < 0) - _soundFreq = -_soundFreq; - - if (_soundSlicesCount < 0) - _soundSlicesCount = -_soundSlicesCount - 1; - - if (_soundSlicesCount > 40) { - warning("IMDDecoder::assessAudioProperties(): More than 40 sound slices found (%d)", _soundSlicesCount); - return false; - } - - _frameRate = Common::Rational(_soundFreq, _soundSliceSize); - - _hasSound = true; - _soundEnabled = true; - _soundStage = kSoundLoaded; - - _audioStream = Audio::makeQueuingAudioStream(_soundFreq, false); - } - - return true; -} - -bool IMDDecoder::loadFrameTables(uint32 framePosPos, uint32 frameCoordsPos) { - // Positions table - if (_framePos) { - _stream->seek(framePosPos); - for (uint32 i = 0; i < _frameCount; i++) - _framePos[i] = _stream->readUint32LE(); - } - - // Coordinates table - if (_features & kFeaturesFrameCoords) { - _stream->seek(frameCoordsPos); - _frameCoords = new Coord[_frameCount]; - assert(_frameCoords); - for (uint32 i = 0; i < _frameCount; i++) { - _frameCoords[i].left = _stream->readSint16LE(); - _frameCoords[i].top = _stream->readSint16LE(); - _frameCoords[i].right = _stream->readSint16LE(); - _frameCoords[i].bottom = _stream->readSint16LE(); - } - } - - return true; -} - -void IMDDecoder::close() { - reset(); - - CoktelDecoder::close(); - - delete _stream; - - delete[] _framePos; - delete[] _frameCoords; - - delete[] _videoBuffer[0]; - delete[] _videoBuffer[1]; - - _stream = 0; - - _version = 0; - - _stdX = -1; - _stdY = -1; - _stdWidth = -1; - _stdHeight = -1; - - _flags = 0; - - _firstFramePos = 0; - _framePos = 0; - _frameCoords = 0; - - _videoBufferSize = 0; - _videoBuffer [0] = 0; - _videoBuffer [1] = 0; - _videoBufferLen[0] = 0; - _videoBufferLen[1] = 0; - - _soundFlags = 0; - _soundFreq = 0; - _soundSliceSize = 0; - _soundSlicesCount = 0; - - _hasSound = false; - _soundEnabled = false; - _soundStage = kSoundNone; -} - -bool IMDDecoder::isVideoLoaded() const { - return _stream != 0; -} - -const Surface *IMDDecoder::decodeNextFrame() { - if (!isVideoLoaded() || endOfVideo()) - return 0; - - createSurface(); - - processFrame(); - - if (_curFrame == 0) - _startTime = g_system->getMillis(); - - return &_surface; -} - -void IMDDecoder::processFrame() { - _curFrame++; - - _dirtyRects.clear(); - - _paletteDirty = false; - - uint32 cmd = 0; - bool hasNextCmd = false; - bool startSound = false; - - do { - cmd = _stream->readUint16LE(); - - if ((cmd & kCommandBreakMask) == kCommandBreak) { - // Flow control - - if (cmd == kCommandBreak) { - _stream->skip(2); - cmd = _stream->readUint16LE(); - } - - // Break - if (cmd == kCommandBreakSkip0) { - continue; - } else if (cmd == kCommandBreakSkip16) { - cmd = _stream->readUint16LE(); - _stream->skip(cmd); - continue; - } else if (cmd == kCommandBreakSkip32) { - cmd = _stream->readUint32LE(); - _stream->skip(cmd); - continue; - } - } - - // Audio - if (cmd == kCommandNextSound) { - - nextSoundSlice(hasNextCmd); - cmd = _stream->readUint16LE(); - - } else if (cmd == kCommandStartSound) { - - startSound = initialSoundSlice(hasNextCmd); - cmd = _stream->readUint16LE(); - - } else - emptySoundSlice(hasNextCmd); - - // Set palette - if (cmd == kCommandPalette) { - _stream->skip(2); - - _paletteDirty = true; - - for (int i = 0; i < 768; i++) - _palette[i] = _stream->readByte() << 2; - - cmd = _stream->readUint16LE(); - } - - hasNextCmd = false; - - if (cmd == kCommandJump) { - // Jump to frame - - int16 frame = _stream->readSint16LE(); - if (_framePos) { - _curFrame = frame - 1; - _stream->seek(_framePos[frame]); - - hasNextCmd = true; - } - - } else if (cmd == kCommandVideoData) { - - _videoBufferLen[0] = _stream->readUint32LE() + 2; - _stream->read(_videoBuffer[0], _videoBufferLen[0]); - - Common::Rect rect = calcFrameCoords(_curFrame); - - if (renderFrame(rect)) - _dirtyRects.push_back(rect); - - } else if (cmd != 0) { - - _videoBufferLen[0] = cmd + 2; - _stream->read(_videoBuffer[0], _videoBufferLen[0]); - - Common::Rect rect = calcFrameCoords(_curFrame); - - if (renderFrame(rect)) - _dirtyRects.push_back(rect); - - } - - } while (hasNextCmd); - - // Start the audio stream if necessary - if (startSound && _soundEnabled) { - _mixer->playStream(_soundType, &_audioHandle, _audioStream, - -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); - _soundStage = kSoundPlaying; - } - - // End the audio stream if necessary - if ((_curFrame >= (int32)(_frameCount - 1)) && (_soundStage == kSoundPlaying)) { - _audioStream->finish(); - _soundStage = kSoundFinished; - } - -} - -Common::Rect IMDDecoder::calcFrameCoords(uint32 frame) { - Common::Rect rect; - - if (frame == 0) { - // First frame is always a full "keyframe" - - rect.left = _x; - rect.top = _y; - rect.right = _x + _width; - rect.bottom = _y + _height; - } else if (_frameCoords && ((_frameCoords[frame].left != -1))) { - // We have frame coordinates for that frame - - rect.left = _frameCoords[frame].left; - rect.top = _frameCoords[frame].top; - rect.right = _frameCoords[frame].right + 1; - rect.bottom = _frameCoords[frame].bottom + 1; - } else if (_stdX != -1) { - // We have standard coordinates - - rect.left = _stdX; - rect.top = _stdY; - rect.right = _stdX + _stdWidth; - rect.bottom = _stdY + _stdHeight; - } else { - // Otherwise, it must be a full "keyframe" - - rect.left = _x; - rect.top = _y; - rect.right = _x + _width; - rect.bottom = _y + _height; - } - - return rect; -} - -bool IMDDecoder::renderFrame(Common::Rect &rect) { - if (!rect.isValidRect()) - // Invalid rendering area - return false; - - // Clip the rendering area to the video's visible area - rect.clip(Common::Rect(_x, _y, _x + _width, _y + _height)); - if (!rect.isValidRect() || rect.isEmpty()) - // Result is empty => nothing to do - return false; - - byte *dataPtr = _videoBuffer[0]; - uint32 dataSize = _videoBufferLen[0] - 1; - - uint8 type = *dataPtr++; - - if (type & 0x10) { - // Palette data - - // One byte index - int index = *dataPtr++; - - int count = MIN((255 - index) * 3, 48); - for (int i = 0; i < count; i++) - _palette[index * 3 + i] = dataPtr[i] << 2; - - dataPtr += 48; - dataSize -= 49; - type ^= 0x10; - - _paletteDirty = true; - } - - if (type & 0x80) { - // Frame data is compressed - - type &= 0x7F; - - if ((type == 2) && (rect.width() == _surface.w) && (_x == 0)) { - // Directly uncompress onto the video surface - deLZ77((byte *)_surface.pixels + (_y * _surface.pitch), dataPtr, dataSize, - _surface.w * _surface.h * _surface.bytesPerPixel); - return true; - } - - _videoBufferLen[1] = deLZ77(_videoBuffer[1], dataPtr, dataSize, _videoBufferSize); - - dataPtr = _videoBuffer[1]; - dataSize = _videoBufferLen[1]; - } - - // Evaluate the block type - if (type == 0x01) - renderBlockSparse (_surface, dataPtr, rect); - else if (type == 0x02) - renderBlockWhole (_surface, dataPtr, rect); - else if (type == 0x42) - renderBlockWhole4X (_surface, dataPtr, rect); - else if ((type & 0x0F) == 0x02) - renderBlockWhole2Y (_surface, dataPtr, rect); - else - renderBlockSparse2Y(_surface, dataPtr, rect); - - return true; -} - -void IMDDecoder::nextSoundSlice(bool hasNextCmd) { - if (hasNextCmd || !_soundEnabled || !_audioStream) { - // Skip sound - - _stream->skip(_soundSliceSize); - return; - } - - // Read, convert, queue - - byte *soundBuf = (byte *)malloc(_soundSliceSize); - - _stream->read(soundBuf, _soundSliceSize); - unsignedToSigned(soundBuf, _soundSliceSize); - - _audioStream->queueBuffer(soundBuf, _soundSliceSize, DisposeAfterUse::YES, 0); -} - -bool IMDDecoder::initialSoundSlice(bool hasNextCmd) { - int dataLength = _soundSliceSize * _soundSlicesCount; - - if (hasNextCmd || !_soundEnabled) { - // Skip sound - - _stream->skip(dataLength); - return false; - } - - if (!_audioStream || (_soundStage == kSoundFinished)) { - delete _audioStream; - - _audioStream = Audio::makeQueuingAudioStream(_soundFreq, false); - _soundStage = kSoundLoaded; - } - - // Read, convert, queue - - byte *soundBuf = (byte *)malloc(dataLength); - - _stream->read(soundBuf, dataLength); - unsignedToSigned(soundBuf, dataLength); - - _audioStream->queueBuffer(soundBuf, dataLength, DisposeAfterUse::YES, 0); - - return _soundStage == kSoundLoaded; -} - -void IMDDecoder::emptySoundSlice(bool hasNextCmd) { - if (hasNextCmd || !_soundEnabled || !_audioStream) - return; - - // Create an empty sound buffer and queue it - - byte *soundBuf = (byte *)malloc(_soundSliceSize); - - memset(soundBuf, 0, _soundSliceSize); - - _audioStream->queueBuffer(soundBuf, _soundSliceSize, DisposeAfterUse::YES, 0); -} - -PixelFormat IMDDecoder::getPixelFormat() const { - return PixelFormat::createFormatCLUT8(); -} - - -VMDDecoder::File::File() { - offset = 0; - size = 0; - realSize = 0; -} - - -VMDDecoder::Part::Part() { - type = kPartTypeSeparator; - field_1 = 0; - field_E = 0; - size = 0; - left = 0; - top = 0; - right = 0; - bottom = 0; - id = 0; - flags = 0; -} - - -VMDDecoder::Frame::Frame() { - parts = 0; - offset = 0; -} - -VMDDecoder::Frame::~Frame() { - delete[] parts; -} - - -const uint16 VMDDecoder::_tableDPCM[128] = { - 0x0000, 0x0008, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050, 0x0060, 0x0070, 0x0080, - 0x0090, 0x00A0, 0x00B0, 0x00C0, 0x00D0, 0x00E0, 0x00F0, 0x0100, 0x0110, 0x0120, - 0x0130, 0x0140, 0x0150, 0x0160, 0x0170, 0x0180, 0x0190, 0x01A0, 0x01B0, 0x01C0, - 0x01D0, 0x01E0, 0x01F0, 0x0200, 0x0208, 0x0210, 0x0218, 0x0220, 0x0228, 0x0230, - 0x0238, 0x0240, 0x0248, 0x0250, 0x0258, 0x0260, 0x0268, 0x0270, 0x0278, 0x0280, - 0x0288, 0x0290, 0x0298, 0x02A0, 0x02A8, 0x02B0, 0x02B8, 0x02C0, 0x02C8, 0x02D0, - 0x02D8, 0x02E0, 0x02E8, 0x02F0, 0x02F8, 0x0300, 0x0308, 0x0310, 0x0318, 0x0320, - 0x0328, 0x0330, 0x0338, 0x0340, 0x0348, 0x0350, 0x0358, 0x0360, 0x0368, 0x0370, - 0x0378, 0x0380, 0x0388, 0x0390, 0x0398, 0x03A0, 0x03A8, 0x03B0, 0x03B8, 0x03C0, - 0x03C8, 0x03D0, 0x03D8, 0x03E0, 0x03E8, 0x03F0, 0x03F8, 0x0400, 0x0440, 0x0480, - 0x04C0, 0x0500, 0x0540, 0x0580, 0x05C0, 0x0600, 0x0640, 0x0680, 0x06C0, 0x0700, - 0x0740, 0x0780, 0x07C0, 0x0800, 0x0900, 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, - 0x0F00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x3000, 0x4000 -}; - -const int32 VMDDecoder::_tableADPCM[] = { - 7, 8, 9, 10, 11, 12, 13, 14, - 16, 17, 19, 21, 23, 25, 28, 31, - 34, 37, 41, 45, 50, 55, 60, 66, - 73, 80, 88, 97, 107, 118, 130, 143, - 157, 173, 190, 209, 230, 253, 279, 307, - 337, 371, 408, 449, 494, 544, 598, 658, - 724, 796, 876, 963, 1060, 1166, 1282, 1411, - 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, - 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, - 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, - 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, - 32767, 0 -}; - -const int32 VMDDecoder::_tableADPCMStep[] = { - -1, -1, -1, -1, 2, 4, 6, 8, - -1, -1, -1, -1, 2, 4, 6, 8 -}; - -VMDDecoder::VMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType), - _stream(0), _version(0), _flags(0), _frameInfoOffset(0), _partsPerFrame(0), _frames(0), - _soundFlags(0), _soundFreq(0), _soundSliceSize(0), _soundSlicesCount(0), - _soundBytesPerSample(0), _soundStereo(0), _soundHeaderSize(0), _soundDataSize(0), - _audioFormat(kAudioFormat8bitRaw), _hasVideo(false), _videoCodec(0), - _blitMode(0), _bytesPerPixel(0), _firstFramePos(0), _videoBufferSize(0), - _externalCodec(false), _codec(0), _subtitle(-1), _isPaletted(true) { - - _videoBuffer [0] = 0; - _videoBuffer [1] = 0; - _videoBuffer [2] = 0; - _videoBufferLen[0] = 0; - _videoBufferLen[1] = 0; - _videoBufferLen[2] = 0; -} - -VMDDecoder::~VMDDecoder() { - close(); -} - -bool VMDDecoder::seek(int32 frame, int whence, bool restart) { - if (!evaluateSeekFrame(frame, whence)) - return false; - - if (frame == _curFrame) - // Nothing to do - return true; - - // Restart sound - if (_hasSound && (frame == -1) && - ((_soundStage == kSoundNone) || (_soundStage == kSoundFinished))) { - - delete _audioStream; - - _soundStage = kSoundLoaded; - _audioStream = Audio::makeQueuingAudioStream(_soundFreq, _soundStereo != 0); - } - - _subtitle = -1; - - if ((_blitMode > 0) && (_flags & 0x4000)) { - if (_curFrame > frame) { - _stream->seek(_frames[0].offset); - _curFrame = -1; - } - - while (frame > _curFrame) - decodeNextFrame(); - - return true; - } - - // Seek - _stream->seek(_frames[frame + 1].offset); - _curFrame = frame; - _startTime = g_system->getMillis() - ((frame + 2) * getStaticTimeToNextFrame()); - - - return true; -} - -void VMDDecoder::setXY(uint16 x, uint16 y) { - uint16 curX = _x; - uint16 setX = x; - - if ((x != 0xFFFF) && (_blitMode == 1)) { - curX *= _bytesPerPixel; - setX *= _bytesPerPixel; - } - - for (uint32 i = 0; i < _frameCount; i++) { - for (int j = 0; j < _partsPerFrame; j++) { - - if (_frames[i].parts[j].type == kPartTypeVideo) { - if (x != 0xFFFF) { - _frames[i].parts[j].left = _frames[i].parts[j].left - curX + setX; - _frames[i].parts[j].right = _frames[i].parts[j].right - curX + setX; - } - if (y != 0xFFFF) { - _frames[i].parts[j].top = _frames[i].parts[j].top - _y + y; - _frames[i].parts[j].bottom = _frames[i].parts[j].bottom - _y + y; - } - } - - } - } - - if (x != 0xFFFF) - _x = x; - if (y != 0xFFFF) - _y = y; -} - -bool VMDDecoder::openExternalCodec() { - delete _codec; - _codec = 0; - - if (_externalCodec) { - if (_videoCodec == kVideoCodecIndeo3) { - _isPaletted = false; - -#ifdef USE_INDEO3 - _codec = new Indeo3Decoder(_width, _height); -#else - warning("VMDDecoder::openExternalCodec(): Indeo3 decoder not compiled in"); -#endif - - } else { - warning("VMDDecoder::openExternalCodec(): Unknown video codec FourCC \"%s\"", - tag2str(_videoCodec)); - return false; - } - } - - return true; -} - -void VMDDecoder::colorModeChanged() { - openExternalCodec(); -} - -bool VMDDecoder::load(Common::SeekableReadStream *stream) { - close(); - - _stream = stream; - - _stream->seek(0); - - uint16 headerLength; - uint16 handle; - - headerLength = _stream->readUint16LE(); - handle = _stream->readUint16LE(); - _version = _stream->readUint16LE(); - - // Version checking - if (headerLength == 50) { - // Newer version, used in Addy 5 upwards - warning("VMDDecoder::load(): TODO: Addy 5 videos"); - } else if (headerLength == 814) { - // Old version - _features |= kFeaturesPalette; - } else { - warning("VMDDecoder::load(): Version incorrect (%d, %d, %d)", headerLength, handle, _version); - close(); - return false; - } - - _frameCount = _stream->readUint16LE(); - - _defaultX = _stream->readSint16LE(); - _defaultY = _stream->readSint16LE(); - _width = _stream->readSint16LE(); - _height = _stream->readSint16LE(); - - _x = _defaultX; - _y = _defaultY; - - if ((_width != 0) && (_height != 0)) { - - _hasVideo = true; - _features |= kFeaturesVideo; - - } else - _hasVideo = false; - - _bytesPerPixel = 1; - if (_version & 4) - _bytesPerPixel = handle + 1; - - if (_bytesPerPixel > 3) { - warning("VMDDecoder::load(): Requested %d bytes per pixel (%d, %d, %d)", - _bytesPerPixel, headerLength, handle, _version); - close(); - return false; - } - - _flags = _stream->readUint16LE(); - - _partsPerFrame = _stream->readUint16LE(); - _firstFramePos = _stream->readUint32LE(); - - _videoCodec = _stream->readUint32BE(); - - if (_features & kFeaturesPalette) { - for (int i = 0; i < 768; i++) - _palette[i] = _stream->readByte() << 2; - - _paletteDirty = true; - } - - uint32 videoBufferSize1 = _stream->readUint32LE(); - uint32 videoBufferSize2 = _stream->readUint32LE(); - - _videoBufferSize = MAX(videoBufferSize1, videoBufferSize2); - - if (_hasVideo) { - if (!assessVideoProperties()) { - close(); - return false; - } - } - - _soundFreq = _stream->readSint16LE(); - _soundSliceSize = _stream->readSint16LE(); - _soundSlicesCount = _stream->readSint16LE(); - _soundFlags = _stream->readUint16LE(); - - _hasSound = (_soundFreq != 0); - - if (_hasSound) { - if (!assessAudioProperties()) { - close(); - return false; - } - } else - _frameRate = 12; - - _frameInfoOffset = _stream->readUint32LE(); - - int numFiles; - if (!readFrameTable(numFiles)) { - close(); - return false; - } - - _stream->seek(_firstFramePos); - - if (numFiles == 0) - return true; - - _files.reserve(numFiles); - if (!readFiles()) { - close(); - return false; - } - - _stream->seek(_firstFramePos); - return true; -} - -bool VMDDecoder::assessVideoProperties() { - _isPaletted = true; - - if ((_version & 2) && !(_version & 8)) { - _externalCodec = true; - _videoBufferSize = 0; - } else - _externalCodec = false; - - if (!openExternalCodec()) - return false; - - if (_externalCodec) - _blitMode = 0; - else if (_bytesPerPixel == 1) - _blitMode = 0; - else if ((_bytesPerPixel == 2) || (_bytesPerPixel == 3)) { - int n = (_flags & 0x80) ? 2 : 3; - - _blitMode = _bytesPerPixel - 1; - _bytesPerPixel = n; - - _isPaletted = false; - } - - if (_blitMode == 1) { - _width /= _bytesPerPixel; - _defaultX /= _bytesPerPixel; - _x /= _bytesPerPixel; - } - - if (_hasVideo) { - uint32 suggestedVideoBufferSize = _videoBufferSize; - - _videoBufferSize = _width * _height * _bytesPerPixel + 1000; - - if ((suggestedVideoBufferSize > _videoBufferSize) && (suggestedVideoBufferSize < 2097152)) { - warning("Suggested video buffer size greater than what should be needed (%d, %d, %dx%d", - suggestedVideoBufferSize, _videoBufferSize, _width, _height); - - _videoBufferSize = suggestedVideoBufferSize; - } - - for (int i = 0; i < 3; i++) { - _videoBuffer[i] = new byte[_videoBufferSize]; - memset(_videoBuffer[i], 0, _videoBufferSize); - - _8bppSurface[i].w = _width * _bytesPerPixel; - _8bppSurface[i].h = _height; - _8bppSurface[i].pitch = _width * _bytesPerPixel; - _8bppSurface[i].pixels = _videoBuffer[i]; - _8bppSurface[i].bytesPerPixel = 1; - } - } - - return true; -} - -bool VMDDecoder::assessAudioProperties() { - bool supportedFormat = true; - - _features |= kFeaturesSound; - - _soundStereo = (_soundFlags & 0x8000) ? 1 : ((_soundFlags & 0x200) ? 2 : 0); - - if (_soundSliceSize < 0) { - _soundBytesPerSample = 2; - _soundSliceSize = -_soundSliceSize; - - if (_soundFlags & 0x10) { - _audioFormat = kAudioFormat16bitADPCM; - _soundHeaderSize = 3; - _soundDataSize = _soundSliceSize >> 1; - - if (_soundStereo > 0) - supportedFormat = false; - - } else { - _audioFormat = kAudioFormat16bitDPCM; - _soundHeaderSize = 1; - _soundDataSize = _soundSliceSize; - - if (_soundStereo == 1) { - supportedFormat = false; - } else if (_soundStereo == 2) { - _soundDataSize = 2 * _soundDataSize + 2; - _soundHeaderSize = 4; - } - - } - } else { - _soundBytesPerSample = 1; - _audioFormat = kAudioFormat8bitRaw; - _soundHeaderSize = 0; - _soundDataSize = _soundSliceSize; - - if (_soundStereo > 0) - supportedFormat = false; - } - - if (!supportedFormat) { - warning("VMDDecoder::assessAudioProperties(): Unsupported audio format: %d bits, encoding %d, stereo %d", - _soundBytesPerSample * 8, _audioFormat, _soundStereo); - return false; - } - - _frameRate = Common::Rational(_soundFreq, _soundSliceSize); - - _hasSound = true; - _soundEnabled = true; - _soundStage = kSoundLoaded; - - _audioStream = Audio::makeQueuingAudioStream(_soundFreq, _soundStereo != 0); - - return true; -} - -bool VMDDecoder::readFrameTable(int &numFiles) { - numFiles = 0; - - _stream->seek(_frameInfoOffset); - _frames = new Frame[_frameCount]; - for (uint16 i = 0; i < _frameCount; i++) { - _frames[i].parts = new Part[_partsPerFrame]; - _stream->skip(2); // Unknown - _frames[i].offset = _stream->readUint32LE(); - } - - for (uint16 i = 0; i < _frameCount; i++) { - bool separator = false; - - for (uint16 j = 0; j < _partsPerFrame; j++) { - - _frames[i].parts[j].type = (PartType) _stream->readByte(); - _frames[i].parts[j].field_1 = _stream->readByte(); - _frames[i].parts[j].size = _stream->readUint32LE(); - - if (_frames[i].parts[j].type == kPartTypeAudio) { - - _frames[i].parts[j].flags = _stream->readByte(); - _stream->skip(9); // Unknown - - } else if (_frames[i].parts[j].type == kPartTypeVideo) { - - _frames[i].parts[j].left = _stream->readUint16LE(); - _frames[i].parts[j].top = _stream->readUint16LE(); - _frames[i].parts[j].right = _stream->readUint16LE(); - _frames[i].parts[j].bottom = _stream->readUint16LE(); - _frames[i].parts[j].field_E = _stream->readByte(); - _frames[i].parts[j].flags = _stream->readByte(); - - } else if (_frames[i].parts[j].type == kPartTypeSubtitle) { - _frames[i].parts[j].id = _stream->readUint16LE(); - // Speech text file name - _stream->skip(8); - } else if (_frames[i].parts[j].type == kPartTypeFile) { - if (!separator) - numFiles++; - _stream->skip(10); - } else if (_frames[i].parts[j].type == kPartTypeSeparator) { - separator = true; - _stream->skip(10); - } else { - // Unknown type - _stream->skip(10); - } - - } - } - - return true; -} - -bool VMDDecoder::readFiles() { - uint32 ssize = _stream->size(); - for (uint16 i = 0; i < _frameCount; i++) { - _stream->seek(_frames[i].offset); - - for (uint16 j = 0; j < _partsPerFrame; j++) { - if (_frames[i].parts[j].type == kPartTypeSeparator) - break; - - if (_frames[i].parts[j].type == kPartTypeFile) { - File file; - - file.offset = _stream->pos() + 20; - file.size = _frames[i].parts[j].size; - file.realSize = _stream->readUint32LE(); - - char name[16]; - - _stream->read(name, 16); - name[15] = '\0'; - - file.name = name; - - _stream->skip(_frames[i].parts[j].size - 20); - - if ((((uint32) file.realSize) >= ssize) || (file.name == "")) - continue; - - _files.push_back(file); - - } else - _stream->skip(_frames[i].parts[j].size); - } - } - - return true; -} - -void VMDDecoder::close() { - reset(); - - CoktelDecoder::close(); - - delete _stream; - - delete[] _frames; - - delete[] _videoBuffer[0]; - delete[] _videoBuffer[1]; - delete[] _videoBuffer[2]; - - delete _codec; - - _files.clear(); - - - _stream = 0; - - _version = 0; - _flags = 0; - - _frameInfoOffset = 0; - _partsPerFrame = 0; - _frames = 0; - - _soundFlags = 0; - _soundFreq = 0; - _soundSliceSize = 0; - _soundSlicesCount = 0; - _soundBytesPerSample = 0; - _soundStereo = 0; - _soundHeaderSize = 0; - _soundDataSize = 0; - _audioFormat = kAudioFormat8bitRaw; - - _hasVideo = false; - _videoCodec = 0; - _blitMode = 0; - _bytesPerPixel = 0; - - _firstFramePos = 0; - - _videoBufferSize = 0; - _videoBuffer [0] = 0; - _videoBuffer [1] = 0; - _videoBuffer [2] = 0; - _videoBufferLen[0] = 0; - _videoBufferLen[1] = 0; - _videoBufferLen[2] = 0; - - _externalCodec = false; - _codec = 0; - - _isPaletted = true; -} - -bool VMDDecoder::isVideoLoaded() const { - return _stream != 0; -} - -const Surface *VMDDecoder::decodeNextFrame() { - if (!isVideoLoaded() || endOfVideo()) - return 0; - - createSurface(); - - processFrame(); - - if (_curFrame == 0) - _startTime = g_system->getMillis(); - - return &_surface; -} - -void VMDDecoder::processFrame() { - _curFrame++; - - _dirtyRects.clear(); - - _paletteDirty = false; - _subtitle = -1; - - bool startSound = false; - - for (uint16 i = 0; i < _partsPerFrame; i++) { - uint32 pos = _stream->pos(); - - Part &part = _frames[_curFrame].parts[i]; - - if (part.type == kPartTypeAudio) { - - if (part.flags == 1) { - // Next sound slice data - - if (_soundEnabled) { - filledSoundSlice(part.size); - - if (_soundStage == kSoundLoaded) - startSound = true; - - } else - _stream->skip(part.size); - - } else if (part.flags == 2) { - // Initial sound data (all slices) - - if (_soundEnabled) { - uint32 mask = _stream->readUint32LE(); - filledSoundSlices(part.size - 4, mask); - - if (_soundStage == kSoundLoaded) - startSound = true; - - } else - _stream->skip(part.size); - - } else if (part.flags == 3) { - // Empty sound slice - - if (_soundEnabled) { - emptySoundSlice(_soundDataSize * _soundBytesPerSample); - - if (_soundStage == kSoundLoaded) - startSound = true; - } - - _stream->skip(part.size); - } else if (part.flags == 4) { - warning("VMDDecoder::processFrame(): TODO: Addy 5 sound type 4 (%d)", part.size); - disableSound(); - _stream->skip(part.size); - } else { - warning("VMDDecoder::processFrame(): Unknown sound type %d", part.flags); - _stream->skip(part.size); - } - - _stream->seek(pos + part.size); - - } else if ((part.type == kPartTypeVideo) && !_hasVideo) { - - warning("VMDDecoder::processFrame(): Header claims there's no video, but video found (%d)", part.size); - _stream->skip(part.size); - - } else if ((part.type == kPartTypeVideo) && _hasVideo) { - - uint32 size = part.size; - - // New palette - if (part.flags & 2) { - uint8 index = _stream->readByte(); - uint8 count = _stream->readByte(); - - for (int j = 0; j < ((count + 1) * 3); j++) - _palette[index * 3 + j] = _stream->readByte() << 2; - - _stream->skip((255 - count) * 3); - - _paletteDirty = true; - - size -= (768 + 2); - } - - _stream->read(_videoBuffer[0], size); - _videoBufferLen[0] = size; - - Common::Rect rect(part.left, part.top, part.right + 1, part.bottom + 1); - if (renderFrame(rect)) - _dirtyRects.push_back(rect); - - } else if (part.type == kPartTypeSeparator) { - - // Ignore - - } else if (part.type == kPartTypeFile) { - - // Ignore - _stream->skip(part.size); - - } else if (part.type == kPartType4) { - - // Unknown, ignore - _stream->skip(part.size); - - } else if (part.type == kPartTypeSubtitle) { - - _subtitle = part.id; - _stream->skip(part.size); - - } else { - - warning("VMDDecoder::processFrame(): Unknown frame part type %d, size %d (%d of %d)", - part.type, part.size, i + 1, _partsPerFrame); - - } - } - - if (startSound && _soundEnabled) { - if (_hasSound && _audioStream) { - _mixer->playStream(_soundType, &_audioHandle, _audioStream, - -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); - _soundStage = kSoundPlaying; - } else - _soundStage = kSoundNone; - } - - if (((uint32)_curFrame == (_frameCount - 1)) && (_soundStage == 2)) { - _audioStream->finish(); - _soundStage = kSoundFinished; - } -} - -bool VMDDecoder::renderFrame(Common::Rect &rect) { - Common::Rect realRect, fakeRect; - if (!getRenderRects(rect, realRect, fakeRect)) - return false; - - if (_externalCodec) { - if (!_codec) - return false; - - Common::MemoryReadStream frameStream(_videoBuffer[0], _videoBufferLen[0]); - const Surface *codecSurf = _codec->decodeImage(&frameStream); - if (!codecSurf) - return false; - - rect = Common::Rect(_x, _y, _x + codecSurf->w, _y + codecSurf->h); - rect.clip(Common::Rect(_x, _y, _x + _width, _y + _height)); - - renderBlockWhole(_surface, (const byte *) codecSurf->pixels, rect); - return true; - } - - uint8 srcBuffer = 0; - byte *dataPtr = _videoBuffer[srcBuffer]; - uint32 dataSize = _videoBufferLen[srcBuffer] - 1; - - uint8 type = *dataPtr++; - - if (type & 0x80) { - // Frame data is compressed - - type &= 0x7F; - - if ((type == 2) && (rect.width() == _surface.w) && (_x == 0) && (_blitMode == 0)) { - // Directly uncompress onto the video surface - deLZ77((byte *)_surface.pixels + (_y * _surface.pitch), dataPtr, dataSize, - _surface.w * _surface.h * _surface.bytesPerPixel); - return true; - } - - srcBuffer = 1; - _videoBufferLen[srcBuffer] = - deLZ77(_videoBuffer[srcBuffer], dataPtr, dataSize, _videoBufferSize); - - dataPtr = _videoBuffer[srcBuffer]; - dataSize = _videoBufferLen[srcBuffer]; - } - - Common::Rect *blockRect = &fakeRect; - Surface *surface = &_surface; - if (_blitMode == 0) { - *blockRect = Common::Rect(blockRect->left + _x, blockRect->top + _y, - blockRect->right + _x, blockRect->bottom + _y); - } else { - surface = &_8bppSurface[2]; - } - - // Evaluate the block type - if (type == 0x01) - renderBlockSparse (*surface, dataPtr, *blockRect); - else if (type == 0x02) - renderBlockWhole (*surface, dataPtr, *blockRect); - else if (type == 0x03) - renderBlockRLE (*surface, dataPtr, *blockRect); - else if (type == 0x42) - renderBlockWhole4X (*surface, dataPtr, *blockRect); - else if ((type & 0x0F) == 0x02) - renderBlockWhole2Y (*surface, dataPtr, *blockRect); - else - renderBlockSparse2Y(*surface, dataPtr, *blockRect); - - if (_blitMode > 0) { - if (_bytesPerPixel == 2) - blit16(*surface, *blockRect); - else if (_bytesPerPixel == 3) - blit24(*surface, *blockRect); - - *blockRect = Common::Rect(blockRect->left + _x, blockRect->top + _y, - blockRect->right + _x, blockRect->bottom + _y); - } - - rect = *blockRect; - return true; -} - -bool VMDDecoder::getRenderRects(const Common::Rect &rect, - Common::Rect &realRect, Common::Rect &fakeRect) { - - realRect = rect; - fakeRect = rect; - - if (_blitMode == 0) { - - realRect = Common::Rect(realRect.left - _x, realRect.top - _y, - realRect.right - _x, realRect.bottom - _y); - - fakeRect = Common::Rect(fakeRect.left - _x, fakeRect.top - _y, - fakeRect.right - _x, fakeRect.bottom - _y); - - } else if (_blitMode == 1) { - - realRect = Common::Rect(rect.left / _bytesPerPixel, rect.top, - rect.right / _bytesPerPixel, rect.bottom); - - realRect = Common::Rect(realRect.left - _x, realRect.top - _y, - realRect.right - _x, realRect.bottom - _y); - - fakeRect = Common::Rect(fakeRect.left - _x * _bytesPerPixel, fakeRect.top - _y, - fakeRect.right - _x * _bytesPerPixel, fakeRect.bottom - _y); - - } else if (_blitMode == 2) { - - fakeRect = Common::Rect(rect.left * _bytesPerPixel, rect.top, - rect.right * _bytesPerPixel, rect.bottom); - - realRect = Common::Rect(realRect.left - _x, realRect.top - _y, - realRect.right - _x, realRect.bottom - _y); - - fakeRect = Common::Rect(fakeRect.left - _x * _bytesPerPixel, fakeRect.top - _y, - fakeRect.right - _x * _bytesPerPixel, fakeRect.bottom - _y); - - } - - realRect.clip(Common::Rect(_surface.w, _surface.h)); - fakeRect.clip(Common::Rect(_surface.w * _bytesPerPixel, _surface.h)); - - if (!realRect.isValidRect() || realRect.isEmpty()) - return false; - if (!fakeRect.isValidRect() || realRect.isEmpty()) - return false; - - return true; -} - -void VMDDecoder::blit16(const Surface &srcSurf, Common::Rect &rect) { - rect = Common::Rect(rect.left / 2, rect.top, rect.right / 2, rect.bottom); - - Common::Rect srcRect = rect; - - rect.clip(_surface.w, _surface.h); - - PixelFormat pixelFormat = getPixelFormat(); - - const byte *src = (byte *)srcSurf.pixels + - (srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel; - byte *dst = (byte *)_surface.pixels + - ((_y + rect.top) * _surface.pitch) + (_x + rect.left) * _surface.bytesPerPixel; - - for (int i = 0; i < rect.height(); i++) { - const byte *srcRow = src; - byte *dstRow = dst; - - for (int j = 0; j < rect.width(); j++, srcRow += 2, dstRow += _surface.bytesPerPixel) { - uint16 data = READ_LE_UINT16(srcRow); - - byte r = ((data & 0x7C00) >> 10) << 3; - byte g = ((data & 0x03E0) >> 5) << 3; - byte b = ((data & 0x001F) >> 0) << 3; - - uint32 c = pixelFormat.RGBToColor(r, g, b); - if ((r == 0) && (g == 0) && (b == 0)) - c = 0; - - if (_surface.bytesPerPixel == 2) - *((uint16 *)dstRow) = (uint16) c; - } - - src += srcSurf .pitch; - dst += _surface.pitch; - } -} - -void VMDDecoder::blit24(const Surface &srcSurf, Common::Rect &rect) { - rect = Common::Rect(rect.left / 3, rect.top, rect.right / 3, rect.bottom); - - Common::Rect srcRect = rect; - - rect.clip(_surface.w, _surface.h); - - PixelFormat pixelFormat = getPixelFormat(); - - const byte *src = (byte *)srcSurf.pixels + - (srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel; - byte *dst = (byte *)_surface.pixels + - ((_y + rect.top) * _surface.pitch) + (_x + rect.left) * _surface.bytesPerPixel; - - for (int i = 0; i < rect.height(); i++) { - const byte *srcRow = src; - byte *dstRow = dst; - - for (int j = 0; j < rect.width(); j++, srcRow += 3, dstRow += _surface.bytesPerPixel) { - byte r = srcRow[2]; - byte g = srcRow[1]; - byte b = srcRow[0]; - - uint32 c = pixelFormat.RGBToColor(r, g, b); - if ((r == 0) && (g == 0) && (b == 0)) - c = 0; - - if (_surface.bytesPerPixel == 2) - *((uint16 *)dstRow) = (uint16) c; - } - - src += srcSurf .pitch; - dst += _surface.pitch; - } -} - -void VMDDecoder::emptySoundSlice(uint32 size) { - byte *sound = soundEmpty(size); - - if (sound) { - uint32 flags = 0; - flags |= (_soundBytesPerSample == 2) ? Audio::FLAG_16BITS : 0; - flags |= (_soundStereo > 0) ? Audio::FLAG_STEREO : 0; - - _audioStream->queueBuffer(sound, size, DisposeAfterUse::YES, flags); - } -} - -void VMDDecoder::filledSoundSlice(uint32 size) { - byte *sound = 0; - if (_audioFormat == kAudioFormat8bitRaw) - sound = sound8bitRaw(size); - else if (_audioFormat == kAudioFormat16bitDPCM) - sound = sound16bitDPCM(size); - else if (_audioFormat == kAudioFormat16bitADPCM) - sound = sound16bitADPCM(size); - - if (sound) { - uint32 flags = 0; - flags |= (_soundBytesPerSample == 2) ? Audio::FLAG_16BITS : 0; - flags |= (_soundStereo > 0) ? Audio::FLAG_STEREO : 0; - - _audioStream->queueBuffer(sound, size, DisposeAfterUse::YES, flags); - } -} - -void VMDDecoder::filledSoundSlices(uint32 size, uint32 mask) { - bool fillInfo[32]; - - uint8 max; - uint8 n = evaluateMask(mask, fillInfo, max); - - int32 extraSize; - - extraSize = size - n * _soundDataSize; - - if (_soundSlicesCount > 32) - extraSize -= (_soundSlicesCount - 32) * _soundDataSize; - - if (n > 0) - extraSize /= n; - - for (uint8 i = 0; i < max; i++) - if (fillInfo[i]) - filledSoundSlice(_soundDataSize + extraSize); - else - emptySoundSlice(_soundDataSize * _soundBytesPerSample); - - if (_soundSlicesCount > 32) - filledSoundSlice((_soundSlicesCount - 32) * _soundDataSize + _soundHeaderSize); -} - -uint8 VMDDecoder::evaluateMask(uint32 mask, bool *fillInfo, uint8 &max) { - max = MIN(_soundSlicesCount - 1, 31); - - uint8 n = 0; - for (int i = 0; i < max; i++) { - - if (!(mask & 1)) { - n++; - *fillInfo++ = true; - } else - *fillInfo++ = false; - - mask >>= 1; - } - - return n; -} - -byte *VMDDecoder::soundEmpty(uint32 &size) { - if (!_audioStream) - return 0; - - byte *soundBuf = (byte *)malloc(size); - memset(soundBuf, 0, size); - - return soundBuf; -} - -byte *VMDDecoder::sound8bitRaw(uint32 &size) { - if (!_audioStream) { - _stream->skip(size); - return 0; - } - - byte *soundBuf = (byte *)malloc(size); - _stream->read(soundBuf, size); - unsignedToSigned(soundBuf, size); - - return soundBuf; -} - -byte *VMDDecoder::sound16bitDPCM(uint32 &size) { - if (!_audioStream) { - _stream->skip(size); - return 0; - } - - int32 init[2]; - - init[0] = _stream->readSint16LE(); - size -= 2; - - if (_soundStereo > 0) { - init[1] = _stream->readSint16LE(); - size -= 2; - } - - byte *data = new byte[size]; - byte *sound = 0; - - if (_stream->read(data, size) == size) - sound = deDPCM(data, size, init); - - delete[] data; - - return sound; -} - -byte *VMDDecoder::sound16bitADPCM(uint32 &size) { - if (!_audioStream) { - _stream->skip(size); - return 0; - } - - int32 init = _stream->readSint16LE(); - size -= 2; - - int32 index = _stream->readByte(); - size--; - - byte *data = new byte[size]; - byte *sound = 0; - - if (_stream->read(data, size) == size) - sound = deADPCM(data, size, init, index); - - delete[] data; - - return sound; -} - -byte *VMDDecoder::deDPCM(const byte *data, uint32 &size, int32 init[2]) { - if (!data || (size == 0)) - return 0; - - int channels = (_soundStereo > 0) ? 2 : 1; - - uint32 inSize = size; - uint32 outSize = size + channels; - - int16 *out = (int16 *)malloc(outSize * 2); - byte *sound = (byte *)out; - - if (!out) - return 0; - - int channel = 0; - - for (int i = 0; i < channels; i++) { - *out++ = TO_BE_16(init[channel]); - - channel = (channel + 1) % channels; - } - - while (inSize-- > 0) { - if (*data & 0x80) - init[channel] -= _tableDPCM[*data++ & 0x7F]; - else - init[channel] += _tableDPCM[*data++]; - - init[channel] = CLIP(init[channel], -32768, 32767); - *out++ = TO_BE_16(init[channel]); - - channel = (channel + 1) % channels; - } - - size = outSize * 2; - return sound; -} - -// Yet another IMA ADPCM variant -byte *VMDDecoder::deADPCM(const byte *data, uint32 &size, int32 init, int32 index) { - if (!data || (size == 0)) - return 0; - - uint32 outSize = size * 2; - - int16 *out = (int16 *)malloc(outSize * 2); - byte *sound = (byte *) out; - - index = CLIP(index, 0, 88); - - int32 predictor = _tableADPCM[index]; - - uint32 dataByte = 0; - bool newByte = true; - - size *= 2; - while (size -- > 0) { - byte code = 0; - - if (newByte) { - dataByte = *data++; - code = (dataByte >> 4) & 0xF; - } else - code = dataByte & 0xF; - - newByte = !newByte; - - index += _tableADPCMStep[code]; - index = CLIP(index, 0, 88); - - int32 value = predictor / 8; - - if (code & 4) - value += predictor; - if (code & 2) - value += predictor / 2; - if (code & 1) - value += predictor / 4; - - if (code & 8) - init -= value; - else - init += value; - - init = CLIP(init, -32768, 32767); - - predictor = _tableADPCM[index]; - - *out++ = TO_BE_16(init); - } - - size = outSize * 2; - return sound; -} - -PixelFormat VMDDecoder::getPixelFormat() const { - if (_externalCodec) { - if (_codec) - return _codec->getPixelFormat(); - - // If we don't have the needed codec, just assume it's in the - // current screen format - return g_system->getScreenFormat(); - } - - if (_blitMode > 0) - return g_system->getScreenFormat(); - - return PixelFormat::createFormatCLUT8(); -} - -bool VMDDecoder::getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height) { - if (frame >= ((int32) _frameCount)) - return false; - - Frame &f = _frames[frame]; - - // Look for a part matching the requested type, stopping at a separator - Part *part = 0; - for (int i = 0; i < _partsPerFrame; i++) { - Part &p = f.parts[i]; - - if ((p.type == kPartTypeSeparator) || (p.type == type)) { - part = &p; - break; - } - } - - if (!part) - return false; - - x = part->left; - y = part->top; - width = part->right - part->left + 1; - height = part->bottom - part->top + 1; - - return true; -} - -bool VMDDecoder::getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) { - return getPartCoords(frame, kPartTypeVideo, x, y, width, height); -} - -bool VMDDecoder::hasEmbeddedFiles() const { - return !_files.empty(); -} - -bool VMDDecoder::hasEmbeddedFile(const Common::String &fileName) const { - for (Common::Array::const_iterator file = _files.begin(); file != _files.end(); ++file) - if (!file->name.compareToIgnoreCase(fileName)) - return true; - - return false; -} - -Common::SeekableReadStream *VMDDecoder::getEmbeddedFile(const Common::String &fileName) const { - const File *file = 0; - - for (Common::Array::const_iterator it = _files.begin(); it != _files.end(); ++it) - if (!it->name.compareToIgnoreCase(fileName)) { - file = &*it; - break; - } - - if (!file) - return 0; - - if ((file->size - 20) != file->realSize) { - warning("VMDDecoder::getEmbeddedFile(): Sizes for \"%s\" differ! (%d, %d)", - fileName.c_str(), (file->size - 20), file->realSize); - return 0; - } - - if (!_stream->seek(file->offset)) { - warning("VMDDecoder::getEmbeddedFile(): Can't seek to offset %d to (file \"%s\")", - file->offset, fileName.c_str()); - return 0; - } - - byte *data = (byte *) malloc(file->realSize); - if (_stream->read(data, file->realSize) != file->realSize) { - free(data); - warning("VMDDecoder::getEmbeddedFile(): Couldn't read %d bytes (file \"%s\")", - file->realSize, fileName.c_str()); - return 0; - } - - Common::MemoryReadStream *stream = - new Common::MemoryReadStream(data, file->realSize, DisposeAfterUse::YES); - - return stream; -} - -int32 VMDDecoder::getSubtitleIndex() const { - return _subtitle; -} - -bool VMDDecoder::hasVideo() const { - return _hasVideo; -} - -bool VMDDecoder::isPaletted() const { - return _isPaletted; -} - -} // End of namespace Graphics - -#endif // GRAPHICS_VIDEO_COKTELDECODER_H diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h deleted file mode 100644 index e0c91533a3..0000000000 --- a/graphics/video/coktel_decoder.h +++ /dev/null @@ -1,520 +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. - * - * $URL$ - * $Id$ - * - */ - -// Currently, only GOB and SCI32 games play IMDs and VMDs, so skip compiling if GOB and SCI32 is disabled. -#if !(defined(ENABLE_GOB) || defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES)) - -// Do not compile the CoktelDecoder code - -#else - -#ifndef GRAPHICS_VIDEO_COKTELDECODER_H -#define GRAPHICS_VIDEO_COKTELDECODER_H - -#include "common/list.h" -#include "common/array.h" -#include "common/rect.h" - -#include "graphics/video/video_decoder.h" - -#include "sound/mixer.h" - -namespace Audio { - class QueuingAudioStream; -} - -namespace Graphics { - -class Codec; - -/** - * Decoder for Coktel videos. - * - * Video decoder used in engines: - * - gob - * - sci - */ -class CoktelDecoder : public FixedRateVideoDecoder { -public: - struct State { - /** Set accordingly to what was done. */ - uint32 flags; - /** The id of the spoken words. */ - uint16 speechId; - - State(); - }; - - CoktelDecoder(Audio::Mixer *mixer, - Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - ~CoktelDecoder(); - - virtual bool seek(int32 frame, int whence = SEEK_SET, bool restart = false) = 0; - - /** Draw directly onto the specified video memory. */ - void setSurfaceMemory(void *mem, uint16 width, uint16 height, uint8 bpp); - /** Reset the video memory. */ - void setSurfaceMemory(); - - const Surface *getSurface() const; - - /** Draw the video starting at this position within the video memory. */ - virtual void setXY(uint16 x, uint16 y); - /** Draw the video at the default position. */ - void setXY(); - - /** Override the video's frame rate. */ - void setFrameRate(Common::Rational frameRate); - - /** Get the video's default X position. */ - uint16 getDefaultX() const; - /** Get the video's default Y position. */ - uint16 getDefaultY() const; - - /** Return a list of rectangles that changed in the last frame. */ - const Common::List &getDirtyRects() const; - - bool hasPalette() const; - virtual bool hasVideo() const; - - bool hasSound() const; - bool isSoundEnabled() const; - bool isSoundPlaying() const; - - void enableSound(); - void disableSound(); - - virtual void colorModeChanged(); - - /** Return the coordinates of the specified frame. */ - virtual bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height); - - /** Return whether that video has any embedded files. */ - virtual bool hasEmbeddedFiles() const; - - /** Return whether that embedded file exists. */ - virtual bool hasEmbeddedFile(const Common::String &fileName) const; - - /** Return that embedded file. */ - virtual Common::SeekableReadStream *getEmbeddedFile(const Common::String &fileName) const; - - /** Return the current subtitle index. */ - virtual int32 getSubtitleIndex() const; - - /** Is the video paletted or true color? */ - virtual bool isPaletted() const; - - - // VideoDecoder interface - - void close(); - - uint16 getWidth() const; - uint16 getHeight() const; - - uint32 getFrameCount() const; - - const byte *getPalette(); - bool hasDirtyPalette() const; - - uint32 getStaticTimeToNextFrame() const; - -protected: - enum SoundStage { - kSoundNone = 0, ///< No sound. - kSoundLoaded = 1, ///< Sound loaded. - kSoundPlaying = 2, ///< Sound is playing. - kSoundFinished = 3 ///< No more new sound data. - }; - - enum Features { - kFeaturesNone = 0x0000, - kFeaturesPalette = 0x0008, ///< Has an own palette. - kFeaturesDataSize = 0x0020, ///< Suggests a data size. - kFeaturesSound = 0x0040, ///< Has sound. - kFeaturesFrameCoords = 0x0080, ///< Has specific frame coordinates. - kFeaturesStdCoords = 0x0100, ///< Has general standard coordinates. - kFeaturesFramePos = 0x0200, ///< Has a frame positions table. - kFeaturesVideo = 0x0400 ///< Has video. - }; - - Audio::Mixer *_mixer; - Audio::Mixer::SoundType _soundType; - - uint16 _width; - uint16 _height; - - uint16 _x; - uint16 _y; - - uint16 _defaultX; - uint16 _defaultY; - - uint32 _features; - - uint32 _frameCount; - - byte _palette[768]; - bool _paletteDirty; - - bool _ownSurface; - Surface _surface; - - Common::List _dirtyRects; - - Common::Rational _frameRate; - - // Current sound state - bool _hasSound; - bool _soundEnabled; - SoundStage _soundStage; - - Audio::QueuingAudioStream *_audioStream; - Audio::SoundHandle _audioHandle; - - bool evaluateSeekFrame(int32 &frame, int whence) const; - - // Surface management - bool hasSurface(); - void createSurface(); - void freeSurface(); - - // Decompression - uint32 deLZ77(byte *dest, const byte *src, uint32 srcSize, uint32 destSize); - void deRLE(byte *&destPtr, const byte *&srcPtr, int16 destLen, int16 srcLen); - - // Block rendering - void renderBlockWhole (Surface &dstSurf, const byte *src, Common::Rect &rect); - void renderBlockWhole4X (Surface &dstSurf, const byte *src, Common::Rect &rect); - void renderBlockWhole2Y (Surface &dstSurf, const byte *src, Common::Rect &rect); - void renderBlockSparse (Surface &dstSurf, const byte *src, Common::Rect &rect); - void renderBlockSparse2Y(Surface &dstSurf, const byte *src, Common::Rect &rect); - void renderBlockRLE (Surface &dstSurf, const byte *src, Common::Rect &rect); - - // Sound helper functions - inline void unsignedToSigned(byte *buffer, int length); - - - // FixedRateVideoDecoder interface - - Common::Rational getFrameRate() const; -}; - -class PreIMDDecoder : public CoktelDecoder { -public: - PreIMDDecoder(uint16 width, uint16 height, Audio::Mixer *mixer, - Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - ~PreIMDDecoder(); - - bool seek(int32 frame, int whence = SEEK_SET, bool restart = false); - - - // VideoDecoder interface - - bool load(Common::SeekableReadStream *stream); - void close(); - - bool isVideoLoaded() const; - - const Surface *decodeNextFrame(); - - PixelFormat getPixelFormat() const; - -private: - Common::SeekableReadStream *_stream; - - // Buffer for processed frame data - byte *_videoBuffer; - uint32 _videoBufferSize; - - // Frame decoding - void processFrame(); - void renderFrame(); -}; - -class IMDDecoder : public CoktelDecoder { -public: - IMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - ~IMDDecoder(); - - bool seek(int32 frame, int whence = SEEK_SET, bool restart = false); - - void setXY(uint16 x, uint16 y); - - - // VideoDecoder interface - - bool load(Common::SeekableReadStream *stream); - void close(); - - bool isVideoLoaded() const; - - const Surface *decodeNextFrame(); - - PixelFormat getPixelFormat() const; - -private: - enum Command { - kCommandNextSound = 0xFF00, - kCommandStartSound = 0xFF01, - - kCommandBreak = 0xFFF0, - kCommandBreakSkip0 = 0xFFF1, - kCommandBreakSkip16 = 0xFFF2, - kCommandBreakSkip32 = 0xFFF3, - kCommandBreakMask = 0xFFF8, - - kCommandPalette = 0xFFF4, - kCommandVideoData = 0xFFFC, - - kCommandJump = 0xFFFD - }; - - struct Coord { - int16 left; - int16 top; - int16 right; - int16 bottom; - }; - - Common::SeekableReadStream *_stream; - - byte _version; - - // Standard coordinates gives by the header - int16 _stdX; - int16 _stdY; - int16 _stdWidth; - int16 _stdHeight; - - uint32 _flags; - - uint32 _firstFramePos; ///< Position of the first frame's data within the stream. - uint32 *_framePos; ///< Positions of all frames. - Coord *_frameCoords; ///< Coordinates of all frames. - - uint32 _videoBufferSize; ///< Size of the video buffers. - byte *_videoBuffer[2]; ///< Video buffers. - uint32 _videoBufferLen[2]; ///< Size of the video buffers filled. - - // Sound properties - uint16 _soundFlags; - int16 _soundFreq; - int16 _soundSliceSize; - int16 _soundSlicesCount; - - // Loading helper functions - bool loadCoordinates(); - bool loadFrameTableOffsets(uint32 &framePosPos, uint32 &frameCoordsPos); - bool assessVideoProperties(); - bool assessAudioProperties(); - bool loadFrameTables(uint32 framePosPos, uint32 frameCoordsPos); - - // Frame decoding - void processFrame(); - Common::Rect calcFrameCoords(uint32 frame); - - // Video - bool renderFrame(Common::Rect &rect); - - // Sound - void nextSoundSlice(bool hasNextCmd); - bool initialSoundSlice(bool hasNextCmd); - void emptySoundSlice(bool hasNextCmd); -}; - -class VMDDecoder : public CoktelDecoder { -public: - VMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - ~VMDDecoder(); - - bool seek(int32 frame, int whence = SEEK_SET, bool restart = false); - - void setXY(uint16 x, uint16 y); - - void colorModeChanged(); - - bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height); - - bool hasEmbeddedFiles() const; - bool hasEmbeddedFile(const Common::String &fileName) const; - Common::SeekableReadStream *getEmbeddedFile(const Common::String &fileName) const; - - int32 getSubtitleIndex() const; - - bool hasVideo() const; - bool isPaletted() const; - - - // VideoDecoder interface - - bool load(Common::SeekableReadStream *stream); - void close(); - - bool isVideoLoaded() const; - - const Surface *decodeNextFrame(); - - PixelFormat getPixelFormat() const; - -private: - enum PartType { - kPartTypeSeparator = 0, - kPartTypeAudio = 1, - kPartTypeVideo = 2, - kPartTypeFile = 3, - kPartType4 = 4, - kPartTypeSubtitle = 5 - }; - - enum AudioFormat { - kAudioFormat8bitRaw = 0, - kAudioFormat16bitDPCM = 1, - kAudioFormat16bitADPCM = 2 - }; - - struct File { - Common::String name; - - uint32 offset; - uint32 size; - uint32 realSize; - - File(); - }; - - struct Part { - PartType type; - byte field_1; - byte field_E; - uint32 size; - int16 left; - int16 top; - int16 right; - int16 bottom; - uint16 id; - byte flags; - - Part(); - }; - - struct Frame { - uint32 offset; - Part *parts; - - Frame(); - ~Frame(); - }; - - // Tables for the audio decompressors - static const uint16 _tableDPCM[128]; - static const int32 _tableADPCM[]; - static const int32 _tableADPCMStep[]; - - Common::SeekableReadStream *_stream; - - byte _version; - uint32 _flags; - - uint32 _frameInfoOffset; - uint16 _partsPerFrame; - Frame *_frames; - - Common::Array _files; - - // Sound properties - uint16 _soundFlags; - int16 _soundFreq; - int16 _soundSliceSize; - int16 _soundSlicesCount; - byte _soundBytesPerSample; - byte _soundStereo; // (0: mono, 1: old-style stereo, 2: new-style stereo) - uint32 _soundHeaderSize; - uint32 _soundDataSize; - AudioFormat _audioFormat; - - // Video properties - bool _hasVideo; - uint32 _videoCodec; - byte _blitMode; - byte _bytesPerPixel; - - uint32 _firstFramePos; ///< Position of the first frame's data within the stream. - - uint32 _videoBufferSize; ///< Size of the video buffers. - byte *_videoBuffer[3]; ///< Video buffers. - uint32 _videoBufferLen[3]; ///< Size of the video buffers filled. - - Surface _8bppSurface[3]; ///< Fake 8bpp surfaces over the video buffers. - - bool _externalCodec; - Codec *_codec; - - int32 _subtitle; - - bool _isPaletted; - - // Loading helper functions - bool assessVideoProperties(); - bool assessAudioProperties(); - bool openExternalCodec(); - bool readFrameTable(int &numFiles); - bool readFiles(); - - // Frame decoding - void processFrame(); - - // Video - bool renderFrame(Common::Rect &rect); - bool getRenderRects(const Common::Rect &rect, - Common::Rect &realRect, Common::Rect &fakeRect); - void blit16(const Surface &srcSurf, Common::Rect &rect); - void blit24(const Surface &srcSurf, Common::Rect &rect); - - // Sound - void emptySoundSlice (uint32 size); - void filledSoundSlice (uint32 size); - void filledSoundSlices(uint32 size, uint32 mask); - - uint8 evaluateMask(uint32 mask, bool *fillInfo, uint8 &max); - - // Generating sound slices - byte *soundEmpty (uint32 &size); - byte *sound8bitRaw (uint32 &size); - byte *sound16bitDPCM (uint32 &size); - byte *sound16bitADPCM(uint32 &size); - - // Sound decompression - byte *deDPCM (const byte *data, uint32 &size, int32 init[2]); - byte *deADPCM(const byte *data, uint32 &size, int32 init, int32 index); - - bool getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height); -}; - -} // End of namespace Graphics - -#endif // GRAPHICS_VIDEO_COKTELDECODER_H - -#endif // Engine and dynamic plugins guard diff --git a/graphics/video/dxa_decoder.cpp b/graphics/video/dxa_decoder.cpp deleted file mode 100644 index 3c52c0fc58..0000000000 --- a/graphics/video/dxa_decoder.cpp +++ /dev/null @@ -1,562 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "common/debug.h" -#include "common/endian.h" -#include "common/archive.h" -#include "common/system.h" -#include "common/stream.h" -#include "common/util.h" - -#include "graphics/video/dxa_decoder.h" - -#ifdef USE_ZLIB - #include "common/zlib.h" -#endif - -namespace Graphics { - -DXADecoder::DXADecoder() { - _fileStream = 0; - _surface = 0; - _dirtyPalette = false; - - _frameBuffer1 = 0; - _frameBuffer2 = 0; - _scaledBuffer = 0; - - _inBuffer = 0; - _inBufferSize = 0; - - _decompBuffer = 0; - _decompBufferSize = 0; - - _width = 0; - _height = 0; - - _frameSize = 0; - _frameCount = 0; - _frameRate = 0; - - _scaleMode = S_NONE; -} - -DXADecoder::~DXADecoder() { - close(); -} - -bool DXADecoder::load(Common::SeekableReadStream *stream) { - close(); - - _fileStream = stream; - - uint32 tag = _fileStream->readUint32BE(); - assert(tag == MKID_BE('DEXA')); - - uint8 flags = _fileStream->readByte(); - _frameCount = _fileStream->readUint16BE(); - int32 frameRate = _fileStream->readSint32BE(); - - if (frameRate > 0) - _frameRate = 1000 / frameRate; - else if (frameRate < 0) - _frameRate = 100000 / (-frameRate); - else - _frameRate = 10; - - _width = _fileStream->readUint16BE(); - _height = _fileStream->readUint16BE(); - - if (flags & 0x80) { - _scaleMode = S_INTERLACED; - _curHeight = _height / 2; - } else if (flags & 0x40) { - _scaleMode = S_DOUBLE; - _curHeight = _height / 2; - } else { - _scaleMode = S_NONE; - _curHeight = _height; - } - - _surface = new Graphics::Surface(); - _surface->bytesPerPixel = 1; - - debug(2, "flags 0x0%x framesCount %d width %d height %d rate %d", flags, getFrameCount(), getWidth(), getHeight(), getFrameRate().toInt()); - - _frameSize = _width * _height; - _decompBufferSize = _frameSize; - _frameBuffer1 = (uint8 *)malloc(_frameSize); - memset(_frameBuffer1, 0, _frameSize); - _frameBuffer2 = (uint8 *)malloc(_frameSize); - memset(_frameBuffer2, 0, _frameSize); - if (!_frameBuffer1 || !_frameBuffer2) - error("DXADecoder: Error allocating frame buffers (size %u)", _frameSize); - - _scaledBuffer = 0; - if (_scaleMode != S_NONE) { - _scaledBuffer = (uint8 *)malloc(_frameSize); - memset(_scaledBuffer, 0, _frameSize); - if (!_scaledBuffer) - error("Error allocating scale buffer (size %u)", _frameSize); - } - -#ifdef DXA_EXPERIMENT_MAXD - // Check for an extended header - if (flags & 1) { - uint32 size; - - do { - tag = _fileStream->readUint32BE(); - - if (tag != 0) - size = _fileStream->readUint32BE(); - - switch (tag) { - case 0: // No more tags - break; - case MKID_BE('MAXD'): - assert(size == 4); - _decompBufferSize = _fileStream->readUint32BE(); - break; - default: // Unknown tag - skip it. - while (size > 0) { - byte dummy = _fileStream->readByte(); - size--; - } - break; - } - } while (tag != 0); - } -#endif - - // Read the sound header - _soundTag = _fileStream->readUint32BE(); - - return true; -} - -void DXADecoder::close() { - if (!_fileStream) - return; - - delete _fileStream; - _fileStream = 0; - - delete _surface; - _surface = 0; - - free(_frameBuffer1); - free(_frameBuffer2); - free(_scaledBuffer); - free(_inBuffer); - free(_decompBuffer); - - _inBuffer = 0; - _decompBuffer = 0; - - reset(); -} - -void DXADecoder::decodeZlib(byte *data, int size, int totalSize) { -#ifdef USE_ZLIB - unsigned long dstLen = totalSize; - Common::uncompress(data, &dstLen, _inBuffer, size); -#endif -} - -#define BLOCKW 4 -#define BLOCKH 4 - -void DXADecoder::decode12(int size) { -#ifdef USE_ZLIB - if (_decompBuffer == NULL) { - _decompBuffer = (byte *)malloc(_decompBufferSize); - memset(_decompBuffer, 0, _decompBufferSize); - if (_decompBuffer == NULL) - error("Error allocating decomp buffer (size %u)", _decompBufferSize); - } - /* decompress the input data */ - decodeZlib(_decompBuffer, size, _decompBufferSize); - - byte *dat = _decompBuffer; - - memcpy(_frameBuffer2, _frameBuffer1, _frameSize); - - for (uint32 by = 0; by < _height; by += BLOCKH) { - for (uint32 bx = 0; bx < _width; bx += BLOCKW) { - byte type = *dat++; - byte *b2 = _frameBuffer1 + bx + by * _width; - - switch (type) { - case 0: - break; - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 1: { - unsigned short diffMap; - if (type >= 10 && type <= 15) { - static const struct { uint8 sh1, sh2; } shiftTbl[6] = { - {0, 0}, {8, 0}, {8, 8}, {8, 4}, {4, 0}, {4, 4} - }; - diffMap = ((*dat & 0xF0) << shiftTbl[type-10].sh1) | - ((*dat & 0x0F) << shiftTbl[type-10].sh2); - dat++; - } else { - diffMap = *(unsigned short*)dat; - dat += 2; - } - - for (int yc = 0; yc < BLOCKH; yc++) { - for (int xc = 0; xc < BLOCKW; xc++) { - if (diffMap & 0x8000) { - b2[xc] = *dat++; - } - diffMap <<= 1; - } - b2 += _width; - } - break; - } - case 2: { - byte color = *dat++; - - for (int yc = 0; yc < BLOCKH; yc++) { - for (int xc = 0; xc < BLOCKW; xc++) { - b2[xc] = color; - } - b2 += _width; - } - break; - } - case 3: { - for (int yc = 0; yc < BLOCKH; yc++) { - for (int xc = 0; xc < BLOCKW; xc++) { - b2[xc] = *dat++; - } - b2 += _width; - } - break; - } - case 4: { - byte mbyte = *dat++; - int mx = (mbyte >> 4) & 0x07; - if (mbyte & 0x80) - mx = -mx; - int my = mbyte & 0x07; - if (mbyte & 0x08) - my = -my; - byte *b1 = _frameBuffer2 + (bx+mx) + (by+my) * _width; - for (int yc = 0; yc < BLOCKH; yc++) { - memcpy(b2, b1, BLOCKW); - b1 += _width; - b2 += _width; - } - break; - } - case 5: - break; - default: - error("decode12: Unknown type %d", type); - } - } - } -#endif -} - -void DXADecoder::decode13(int size) { -#ifdef USE_ZLIB - uint8 *codeBuf, *dataBuf, *motBuf, *maskBuf; - - if (_decompBuffer == NULL) { - _decompBuffer = (byte *)malloc(_decompBufferSize); - memset(_decompBuffer, 0, _decompBufferSize); - if (_decompBuffer == NULL) - error("Error allocating decomp buffer (size %u)", _decompBufferSize); - } - - /* decompress the input data */ - decodeZlib(_decompBuffer, size, _decompBufferSize); - - memcpy(_frameBuffer2, _frameBuffer1, _frameSize); - - int codeSize = _width * _curHeight / 16; - int dataSize, motSize, maskSize; - - dataSize = READ_BE_UINT32(&_decompBuffer[0]); - motSize = READ_BE_UINT32(&_decompBuffer[4]); - maskSize = READ_BE_UINT32(&_decompBuffer[8]); - - codeBuf = &_decompBuffer[12]; - dataBuf = &codeBuf[codeSize]; - motBuf = &dataBuf[dataSize]; - maskBuf = &motBuf[motSize]; - - for (uint32 by = 0; by < _curHeight; by += BLOCKH) { - for (uint32 bx = 0; bx < _width; bx += BLOCKW) { - uint8 type = *codeBuf++; - uint8 *b2 = (uint8*)_frameBuffer1 + bx + by * _width; - - switch (type) { - case 0: - break; - - case 1: { - uint16 diffMap = READ_BE_UINT16(maskBuf); - maskBuf += 2; - - for (int yc = 0; yc < BLOCKH; yc++) { - for (int xc = 0; xc < BLOCKW; xc++) { - if (diffMap & 0x8000) { - b2[xc] = *dataBuf++; - } - diffMap <<= 1; - } - b2 += _width; - } - break; - } - case 2: { - uint8 color = *dataBuf++; - - for (int yc = 0; yc < BLOCKH; yc++) { - for (int xc = 0; xc < BLOCKW; xc++) { - b2[xc] = color; - } - b2 += _width; - } - break; - } - case 3: { - for (int yc = 0; yc < BLOCKH; yc++) { - for (int xc = 0; xc < BLOCKW; xc++) { - b2[xc] = *dataBuf++; - } - b2 += _width; - } - break; - } - case 4: { - uint8 mbyte = *motBuf++; - - int mx = (mbyte >> 4) & 0x07; - if (mbyte & 0x80) - mx = -mx; - int my = mbyte & 0x07; - if (mbyte & 0x08) - my = -my; - - uint8 *b1 = (uint8*)_frameBuffer2 + (bx+mx) + (by+my) * _width; - for (int yc = 0; yc < BLOCKH; yc++) { - memcpy(b2, b1, BLOCKW); - b1 += _width; - b2 += _width; - } - break; - } - case 8: { - static const int subX[4] = {0, 2, 0, 2}; - static const int subY[4] = {0, 0, 2, 2}; - - uint8 subMask = *maskBuf++; - - for (int subBlock = 0; subBlock < 4; subBlock++) { - int sx = bx + subX[subBlock], sy = by + subY[subBlock]; - b2 = (uint8*)_frameBuffer1 + sx + sy * _width; - switch (subMask & 0xC0) { - // 00: skip - case 0x00: - break; - // 01: solid color - case 0x40: { - uint8 subColor = *dataBuf++; - for (int yc = 0; yc < BLOCKH / 2; yc++) { - for (int xc = 0; xc < BLOCKW / 2; xc++) { - b2[xc] = subColor; - } - b2 += _width; - } - break; - } - // 02: motion vector - case 0x80: { - uint8 mbyte = *motBuf++; - - int mx = (mbyte >> 4) & 0x07; - if (mbyte & 0x80) - mx = -mx; - - int my = mbyte & 0x07; - if (mbyte & 0x08) - my = -my; - - uint8 *b1 = (uint8*)_frameBuffer2 + (sx+mx) + (sy+my) * _width; - for (int yc = 0; yc < BLOCKH / 2; yc++) { - memcpy(b2, b1, BLOCKW / 2); - b1 += _width; - b2 += _width; - } - break; - } - // 03: raw - case 0xC0: - for (int yc = 0; yc < BLOCKH / 2; yc++) { - for (int xc = 0; xc < BLOCKW / 2; xc++) { - b2[xc] = *dataBuf++; - } - b2 += _width; - } - break; - } - subMask <<= 2; - } - break; - } - case 32: - case 33: - case 34: { - int count = type - 30; - uint8 pixels[4]; - - memcpy(pixels, dataBuf, count); - dataBuf += count; - - if (count == 2) { - uint16 code = READ_BE_UINT16(maskBuf); - maskBuf += 2; - for (int yc = 0; yc < BLOCKH; yc++) { - for (int xc = 0; xc < BLOCKW; xc++) { - b2[xc] = pixels[code & 1]; - code >>= 1; - } - b2 += _width; - } - } else { - uint32 code = READ_BE_UINT32(maskBuf); - maskBuf += 4; - for (int yc = 0; yc < BLOCKH; yc++) { - for (int xc = 0; xc < BLOCKW; xc++) { - b2[xc] = pixels[code & 3]; - code >>= 2; - } - b2 += _width; - } - } - break; - } - default: - error("decode13: Unknown type %d", type); - } - } - } -#endif -} - -const Surface *DXADecoder::decodeNextFrame() { - uint32 tag = _fileStream->readUint32BE(); - if (tag == MKID_BE('CMAP')) { - _fileStream->read(_palette, 256 * 3); - _dirtyPalette = true; - } - - tag = _fileStream->readUint32BE(); - if (tag == MKID_BE('FRAM')) { - byte type = _fileStream->readByte(); - uint32 size = _fileStream->readUint32BE(); - if ((_inBuffer == NULL) || (_inBufferSize < size)) { - free(_inBuffer); - _inBuffer = (byte *)malloc(size); - memset(_inBuffer, 0, size); - if (_inBuffer == NULL) - error("Error allocating input buffer (size %u)", size); - _inBufferSize = size; - } - - _fileStream->read(_inBuffer, size); - - switch (type) { - case 2: - decodeZlib(_frameBuffer1, size, _frameSize); - break; - case 3: - decodeZlib(_frameBuffer2, size, _frameSize); - break; - case 12: - decode12(size); - break; - case 13: - decode13(size); - break; - default: - error("decodeFrame: Unknown compression type %d", type); - } - - if (type == 3) { - for (uint32 j = 0; j < _curHeight; ++j) { - for (uint32 i = 0; i < _width; ++i) { - const int offs = j * _width + i; - _frameBuffer1[offs] ^= _frameBuffer2[offs]; - } - } - } - } - - switch (_scaleMode) { - case S_INTERLACED: - for (int cy = 0; cy < _curHeight; cy++) { - memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width); - memset(&_scaledBuffer[((2 * cy) + 1) * _width], 0, _width); - } - _surface->pixels = _scaledBuffer; - break; - case S_DOUBLE: - for (int cy = 0; cy < _curHeight; cy++) { - memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width); - memcpy(&_scaledBuffer[((2 * cy) + 1) * _width], &_frameBuffer1[cy * _width], _width); - } - _surface->pixels = _scaledBuffer; - break; - case S_NONE: - _surface->pixels = _frameBuffer1; - break; - } - - // Copy in the relevant info to the Surface - _surface->w = getWidth(); - _surface->h = getHeight(); - _surface->pitch = getWidth(); - - _curFrame++; - - if (_curFrame == 0) - _startTime = g_system->getMillis(); - - return _surface; -} - -} // End of namespace Graphics diff --git a/graphics/video/dxa_decoder.h b/graphics/video/dxa_decoder.h deleted file mode 100644 index a9a656e46d..0000000000 --- a/graphics/video/dxa_decoder.h +++ /dev/null @@ -1,101 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_DXA_PLAYER_H -#define GRAPHICS_VIDEO_DXA_PLAYER_H - -#include "graphics/video/video_decoder.h" - -namespace Graphics { - -/** - * Decoder for DXA videos. - * - * Video decoder used in engines: - * - agos - * - sword1 - * - sword2 - */ -class DXADecoder : public FixedRateVideoDecoder { -public: - DXADecoder(); - virtual ~DXADecoder(); - - bool load(Common::SeekableReadStream *stream); - void close(); - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _width; } - uint16 getHeight() const { return _height; } - uint32 getFrameCount() const { return _frameCount; } - const Surface *decodeNextFrame(); - PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } - - /** - * Get the sound chunk tag of the loaded DXA file - */ - uint32 getSoundTag() { return _soundTag; } - -protected: - Common::Rational getFrameRate() const { return _frameRate; } - - Common::SeekableReadStream *_fileStream; - -private: - void decodeZlib(byte *data, int size, int totalSize); - void decode12(int size); - void decode13(int size); - - enum ScaleMode { - S_NONE, - S_INTERLACED, - S_DOUBLE - }; - - Graphics::Surface *_surface; - byte _palette[256 * 3]; - bool _dirtyPalette; - - byte *_frameBuffer1; - byte *_frameBuffer2; - byte *_scaledBuffer; - byte *_inBuffer; - uint32 _inBufferSize; - byte *_decompBuffer; - uint32 _decompBufferSize; - uint16 _curHeight; - uint32 _frameSize; - ScaleMode _scaleMode; - uint32 _soundTag; - uint16 _width, _height; - uint32 _frameRate; - uint32 _frameCount; -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/flic_decoder.cpp b/graphics/video/flic_decoder.cpp deleted file mode 100644 index 51c487861e..0000000000 --- a/graphics/video/flic_decoder.cpp +++ /dev/null @@ -1,323 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "graphics/video/flic_decoder.h" -#include "common/archive.h" -#include "common/stream.h" -#include "common/endian.h" -#include "common/system.h" - -namespace Graphics { - -FlicDecoder::FlicDecoder() { - _paletteChanged = false; - _fileStream = 0; - _surface = 0; -} - -FlicDecoder::~FlicDecoder() { - close(); -} - -bool FlicDecoder::load(Common::SeekableReadStream *stream) { - close(); - - _fileStream = stream; - - /* uint32 frameSize = */ _fileStream->readUint32LE(); - uint16 frameType = _fileStream->readUint16LE(); - - // Check FLC magic number - if (frameType != 0xAF12) { - warning("FlicDecoder::FlicDecoder(): attempted to load non-FLC data (type = 0x%04X)", frameType); - delete _fileStream; - _fileStream = 0; - return false; - } - - - _frameCount = _fileStream->readUint16LE(); - uint16 width = _fileStream->readUint16LE(); - uint16 height = _fileStream->readUint16LE(); - uint16 colorDepth = _fileStream->readUint16LE(); - if (colorDepth != 8) { - warning("FlicDecoder::FlicDecoder(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", frameType); - delete _fileStream; - _fileStream = 0; - return false; - } - - _fileStream->readUint16LE(); // flags - // Note: The normal delay is a 32-bit integer (dword), whereas the overridden delay is a 16-bit integer (word) - // the frame delay is the FLIC "speed", in milliseconds. - _frameRate = Common::Rational(1000, _fileStream->readUint32LE()); - - _fileStream->seek(80); - _offsetFrame1 = _fileStream->readUint32LE(); - _offsetFrame2 = _fileStream->readUint32LE(); - - _surface = new Graphics::Surface(); - _surface->create(width, height, 1); - _palette = (byte *)malloc(3 * 256); - memset(_palette, 0, 3 * 256); - _paletteChanged = false; - - // Seek to the first frame - _fileStream->seek(_offsetFrame1); - return true; -} - -void FlicDecoder::close() { - if (!_fileStream) - return; - - delete _fileStream; - _fileStream = 0; - - _surface->free(); - delete _surface; - _surface = 0; - - free(_palette); - _dirtyRects.clear(); - - reset(); -} - -void FlicDecoder::decodeByteRun(uint8 *data) { - byte *ptr = (byte *)_surface->pixels; - while ((int32)(ptr - (byte *)_surface->pixels) < (getWidth() * getHeight())) { - int chunks = *data++; - while (chunks--) { - int count = (int8)*data++; - if (count > 0) { - memset(ptr, *data++, count); - } else { - count = -count; - memcpy(ptr, data, count); - data += count; - } - ptr += count; - } - } - - // Redraw - _dirtyRects.clear(); - _dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight())); -} - -#define OP_PACKETCOUNT 0 -#define OP_UNDEFINED 1 -#define OP_LASTPIXEL 2 -#define OP_LINESKIPCOUNT 3 - -void FlicDecoder::decodeDeltaFLC(uint8 *data) { - uint16 linesInChunk = READ_LE_UINT16(data); data += 2; - uint16 currentLine = 0; - uint16 packetCount = 0; - - while (linesInChunk--) { - uint16 opcode; - - // First process all the opcodes. - do { - opcode = READ_LE_UINT16(data); data += 2; - - switch ((opcode >> 14) & 3) { - case OP_PACKETCOUNT: - packetCount = opcode; - break; - case OP_UNDEFINED: - break; - case OP_LASTPIXEL: - *((byte *)_surface->pixels + currentLine * getWidth() + getWidth() - 1) = (opcode & 0xFF); - _dirtyRects.push_back(Common::Rect(getWidth() - 1, currentLine, getWidth(), currentLine + 1)); - break; - case OP_LINESKIPCOUNT: - currentLine += -(int16)opcode; - break; - } - } while (((opcode >> 14) & 3) != OP_PACKETCOUNT); - - uint16 column = 0; - - // Now interpret the RLE data - while (packetCount--) { - column += *data++; - int rleCount = (int8)*data++; - if (rleCount > 0) { - memcpy((byte *)_surface->pixels + (currentLine * getWidth()) + column, data, rleCount * 2); - data += rleCount * 2; - _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1)); - } else if (rleCount < 0) { - rleCount = -rleCount; - uint16 dataWord = READ_UINT16(data); data += 2; - for (int i = 0; i < rleCount; ++i) { - WRITE_UINT16((byte *)_surface->pixels + currentLine * getWidth() + column + i * 2, dataWord); - } - _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1)); - } else { // End of cutscene ? - return; - } - column += rleCount * 2; - } - - currentLine++; - } -} - -#define FLI_SETPAL 4 -#define FLI_SS2 7 -#define FLI_BRUN 15 -#define PSTAMP 18 -#define FRAME_TYPE 0xF1FA - -const Surface *FlicDecoder::decodeNextFrame() { - // Read chunk - uint32 frameSize = _fileStream->readUint32LE(); - uint16 frameType = _fileStream->readUint16LE(); - uint16 chunkCount = 0; - - switch (frameType) { - case FRAME_TYPE: - { - // FIXME: FLIC should be switched over to a variable frame rate VideoDecoder to handle - // this properly. - - chunkCount = _fileStream->readUint16LE(); - // Note: The overridden delay is a 16-bit integer (word), whereas the normal delay is a 32-bit integer (dword) - // the frame delay is the FLIC "speed", in milliseconds. - uint16 newFrameDelay = _fileStream->readUint16LE(); // "speed", in milliseconds - if (newFrameDelay > 0) - _frameRate = Common::Rational(1000, newFrameDelay); - - _fileStream->readUint16LE(); // reserved, always 0 - uint16 newWidth = _fileStream->readUint16LE(); - uint16 newHeight = _fileStream->readUint16LE(); - - if ((newWidth != 0) && (newHeight != 0)) { - if (newWidth == 0) - newWidth = _surface->w; - if (newHeight == 0) - newHeight = _surface->h; - - _surface->free(); - delete _surface; - _surface = new Graphics::Surface(); - _surface->create(newWidth, newHeight, 1); - } - } - break; - default: - error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType); - break; - } - - // Read subchunks - if (frameType == FRAME_TYPE) { - for (uint32 i = 0; i < chunkCount; ++i) { - frameSize = _fileStream->readUint32LE(); - frameType = _fileStream->readUint16LE(); - uint8 *data = new uint8[frameSize - 6]; - _fileStream->read(data, frameSize - 6); - switch (frameType) { - case FLI_SETPAL: - unpackPalette(data); - _paletteChanged = true; - break; - case FLI_SS2: - decodeDeltaFLC(data); - break; - case FLI_BRUN: - decodeByteRun(data); - break; - case PSTAMP: - /* PSTAMP - skip for now */ - break; - default: - error("FlicDecoder::decodeNextFrame(): unknown subchunk type (type = 0x%02X)", frameType); - break; - } - - delete[] data; - } - } - - _curFrame++; - - // If we just processed the ring frame, set the next frame - if (_curFrame == (int32)_frameCount) { - _curFrame = 0; - _fileStream->seek(_offsetFrame2); - } - - if (_curFrame == 0) - _startTime = g_system->getMillis(); - - return _surface; -} - -void FlicDecoder::reset() { - VideoDecoder::reset(); - if (_fileStream) - _fileStream->seek(_offsetFrame1); -} - -void FlicDecoder::unpackPalette(uint8 *data) { - uint16 numPackets = READ_LE_UINT16(data); data += 2; - - if (0 == READ_LE_UINT16(data)) { //special case - data += 2; - for (int i = 0; i < 256; ++i) { - memcpy(_palette + i * 3, data + i * 3, 3); - } - } else { - uint8 palPos = 0; - - while (numPackets--) { - palPos += *data++; - uint8 change = *data++; - - for (int i = 0; i < change; ++i) { - memcpy(_palette + (palPos + i) * 3, data + i * 3, 3); - } - - palPos += change; - data += (change * 3); - } - } -} - -void FlicDecoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) { - for (Common::List::const_iterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) { - for (int y = (*it).top; y < (*it).bottom; ++y) { - const int x = (*it).left; - memcpy(dst + y * pitch + x, (byte *)_surface->pixels + y * getWidth() + x, (*it).right - x); - } - } - _dirtyRects.clear(); -} - -} // End of namespace Graphics diff --git a/graphics/video/flic_decoder.h b/graphics/video/flic_decoder.h deleted file mode 100644 index e403ff212a..0000000000 --- a/graphics/video/flic_decoder.h +++ /dev/null @@ -1,101 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_FLICDECODER_H -#define GRAPHICS_VIDEO_FLICDECODER_H - -#include "graphics/video/video_decoder.h" -#include "common/list.h" -#include "common/rect.h" - -namespace Common { - class SeekableReadStream; -} - -namespace Graphics { - -/** - * Decoder for FLIC videos. - * - * Video decoder used in engines: - * - tucker - */ -class FlicDecoder : public FixedRateVideoDecoder { -public: - FlicDecoder(); - virtual ~FlicDecoder(); - - /** - * Load a video file - * @param stream the stream to load - */ - bool load(Common::SeekableReadStream *stream); - void close(); - - /** - * Decode the next frame and return the frame's surface - * @note the return surface should *not* be freed - * @note this may return 0, in which case the last frame should be kept on screen - */ - const Surface *decodeNextFrame(); - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _surface->w; } - uint16 getHeight() const { return _surface->h; } - uint32 getFrameCount() const { return _frameCount; } - PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } - - const Common::List *getDirtyRects() const { return &_dirtyRects; } - void clearDirtyRects() { _dirtyRects.clear(); } - void copyDirtyRectsToBuffer(uint8 *dst, uint pitch); - - const byte *getPalette() { _paletteChanged = false; return _palette; } - bool hasDirtyPalette() const { return _paletteChanged; } - void reset(); - -protected: - Common::Rational getFrameRate() const { return _frameRate; } - -private: - uint16 _offsetFrame1; - uint16 _offsetFrame2; - byte *_palette; - bool _paletteChanged; - - void decodeByteRun(uint8 *data); - void decodeDeltaFLC(uint8 *data); - void unpackPalette(uint8 *mem); - - Common::SeekableReadStream *_fileStream; - Surface *_surface; - uint32 _frameCount; - Common::Rational _frameRate; - - Common::List _dirtyRects; -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/mpeg_player.cpp b/graphics/video/mpeg_player.cpp deleted file mode 100644 index ea1fa4ec1c..0000000000 --- a/graphics/video/mpeg_player.cpp +++ /dev/null @@ -1,625 +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. - * - * $URL$ - * $Id$ - * - */ - -// The YUV to RGB conversion code is derived from SDL's YUV overlay code, which -// in turn appears to be derived from mpeg_play. The following copyright -// notices have been included in accordance with the original license. Please -// note that the term "software" in this context only applies to the -// buildLookup() and plotYUV*() functions below. - -// Copyright (c) 1995 The Regents of the University of California. -// All rights reserved. -// -// Permission to use, copy, modify, and distribute this software and its -// documentation for any purpose, without fee, and without written agreement is -// hereby granted, provided that the above copyright notice and the following -// two paragraphs appear in all copies of this software. -// -// IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT -// OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF -// CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -// ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO -// PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -// Copyright (c) 1995 Erik Corry -// All rights reserved. -// -// Permission to use, copy, modify, and distribute this software and its -// documentation for any purpose, without fee, and without written agreement is -// hereby granted, provided that the above copyright notice and the following -// two paragraphs appear in all copies of this software. -// -// IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF -// THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED -// OF THE POSSIBILITY OF SUCH DAMAGE. -// -// ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" -// BASIS, AND ERIK CORRY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, -// UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -// Portions of this software Copyright (c) 1995 Brown University. -// All rights reserved. -// -// Permission to use, copy, modify, and distribute this software and its -// documentation for any purpose, without fee, and without written agreement -// is hereby granted, provided that the above copyright notice and the -// following two paragraphs appear in all copies of this software. -// -// IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR -// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT -// OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN -// UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" -// BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, -// SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -#include "graphics/video/mpeg_player.h" -#include "common/file.h" -#include "common/system.h" -#include "common/util.h" - -namespace Graphics { - -BaseAnimationState::BaseAnimationState(OSystem *sys, int width, int height) - : _movieWidth(width), _movieHeight(height), _frameWidth(width), _frameHeight(height), _sys(sys) { -#ifndef BACKEND_8BIT - const int screenW = _sys->getOverlayWidth(); - const int screenH = _sys->getOverlayHeight(); - - _movieScale = MIN(screenW / _movieWidth, screenH / _movieHeight); - - assert(_movieScale >= 1); - if (_movieScale > 3) - _movieScale = 3; - - _colorTab = NULL; - _rgbToPix = NULL; - memset(&_overlayFormat, 0, sizeof(_overlayFormat)); -#endif -} - -BaseAnimationState::~BaseAnimationState() { -#ifdef USE_MPEG2 - if (_mpegDecoder) - mpeg2_close(_mpegDecoder); - delete _mpegFile; -#ifndef BACKEND_8BIT - _sys->hideOverlay(); - free(_overlay); - free(_colorTab); - free(_rgbToPix); -#endif -#endif -} - - -bool BaseAnimationState::init(const char *name) { -#ifdef USE_MPEG2 - char tempFile[512]; - - _mpegDecoder = NULL; - _mpegFile = NULL; - -#ifdef BACKEND_8BIT - - uint i, p; - - // Load lookup palettes - sprintf(tempFile, "%s.pal", name); - - Common::File f; - - if (!f.open(tempFile)) { - warning("Cutscene: %s palette missing", tempFile); - return false; - } - - p = 0; - while (!f.eos()) { - _palettes[p].end = f.readUint16LE(); - _palettes[p].cnt = f.readUint16LE(); - - for (i = 0; i < _palettes[p].cnt; i++) { - _palettes[p].pal[4 * i] = f.readByte(); - _palettes[p].pal[4 * i + 1] = f.readByte(); - _palettes[p].pal[4 * i + 2] = f.readByte(); - _palettes[p].pal[4 * i + 3] = 0; - } - for (; i < 256; i++) { - _palettes[p].pal[4 * i] = 0; - _palettes[p].pal[4 * i + 1] = 0; - _palettes[p].pal[4 * i + 2] = 0; - _palettes[p].pal[4 * i + 3] = 0; - } - - p++; - } - - f.close(); - - _palNum = 0; - _maxPalNum = p; - setPalette(_palettes[_palNum].pal); - _lut = _lut2 = _yuvLookup[0]; - _curPal = -1; - _cr = 0; - buildLookup(_palNum, 256); - _lut2 = _yuvLookup[1]; - _lutCalcNum = (BITDEPTH + _palettes[_palNum].end + 2) / (_palettes[_palNum].end + 2); -#else - buildLookup(); - _overlay = (OverlayColor *)calloc(_movieScale * _movieWidth * _movieScale * _movieHeight, sizeof(OverlayColor)); - _sys->showOverlay(); -#endif - - // Open MPEG2 stream - _mpegFile = new Common::File(); - sprintf(tempFile, "%s.mp2", name); - if (!_mpegFile->open(tempFile)) { - warning("Cutscene: Could not open %s", tempFile); - return false; - } - - // Load and configure decoder - _mpegDecoder = mpeg2_init(); - if (_mpegDecoder == NULL) { - warning("Cutscene: Could not allocate an MPEG2 decoder"); - return false; - } - - _mpegInfo = mpeg2_info(_mpegDecoder); - _frameNum = 0; - - return true; -#else /* USE_MPEG2 */ - return false; -#endif -} - -bool BaseAnimationState::decodeFrame() { -#ifdef USE_MPEG2 - mpeg2_state_t state; - const mpeg2_sequence_t *sequence_i; - size_t size = (size_t) -1; - static byte buf[BUFFER_SIZE]; - - do { - state = mpeg2_parse(_mpegDecoder); - sequence_i = _mpegInfo->sequence; - - switch (state) { - case STATE_BUFFER: - size = _mpegFile->read(buf, BUFFER_SIZE); - mpeg2_buffer(_mpegDecoder, buf, buf + size); - break; - - case STATE_SLICE: - case STATE_END: - if (_mpegInfo->display_fbuf) { - checkPaletteSwitch(); - drawYUV(sequence_i->width, sequence_i->height, _mpegInfo->display_fbuf->buf); -#ifdef BACKEND_8BIT - buildLookup(_palNum + 1, _lutCalcNum); -#endif - - _frameNum++; - return true; - } - break; - - default: - break; - } - } while (size); -#endif - return false; -} - -bool BaseAnimationState::checkPaletteSwitch() { -#ifdef BACKEND_8BIT - // if we have reached the last image with this palette, switch to new one - if (_frameNum == _palettes[_palNum].end) { - unsigned char *l = _lut2; - _palNum++; - setPalette(_palettes[_palNum].pal); - _lutCalcNum = (BITDEPTH + _palettes[_palNum].end - (_frameNum + 1) + 2) / (_palettes[_palNum].end - (_frameNum + 1) + 2); - _lut2 = _lut; - _lut = l; - return true; - } -#endif - - return false; -} - -void BaseAnimationState::handleScreenChanged() { -#ifndef BACKEND_8BIT - const int screenW = _sys->getOverlayWidth(); - const int screenH = _sys->getOverlayHeight(); - - int newScale = MIN(screenW / _movieWidth, screenH / _movieHeight); - - assert(newScale >= 1); - if (newScale > 3) - newScale = 3; - - if (newScale != _movieScale) { - // HACK: Since frames generally do not cover the entire screen, - // We need to undraw the old frame. This is a very hacky - // way of doing that. - OverlayColor *buf = (OverlayColor *)calloc(screenW * screenH, sizeof(OverlayColor)); - _sys->copyRectToOverlay(buf, screenW, 0, 0, screenW, screenH); - free(buf); - - free(_overlay); - _movieScale = newScale; - _overlay = (OverlayColor *)calloc(_movieScale * _movieWidth * _movieScale * _movieHeight, sizeof(OverlayColor)); - } - - buildLookup(); -#endif -} - -#ifdef BACKEND_8BIT - -/** - * Build 'Best-Match' RGB lookup table - */ -void BaseAnimationState::buildLookup(int p, int lines) { - int y, cb; - int r, g, b, ii; - - if (p >= _maxPalNum) - return; - - if (p != _curPal) { - _curPal = p; - _cr = 0; - _pos = 0; - } - - if (_cr > BITDEPTH) - return; - - for (ii = 0; ii < lines; ii++) { - r = (-16 * 256 + (int) (256 * 1.596) * ((_cr << SHIFT) - 128)) / 256; - for (cb = 0; cb <= BITDEPTH; cb++) { - g = (-16 * 256 - (int) (0.813 * 256) * ((_cr << SHIFT) - 128) - (int) (0.391 * 256) * ((cb << SHIFT) - 128)) / 256; - b = (-16 * 256 + (int) (2.018 * 256) * ((cb << SHIFT) - 128)) / 256; - - for (y = 0; y <= BITDEPTH; y++) { - int idx, bst = 0; - int dis = 2 * SQR(r - _palettes[p].pal[0]) + 4 * SQR(g - _palettes[p].pal[1]) + SQR(b - _palettes[p].pal[2]); - - for (idx = 1; idx < 256; idx++) { - long d2 = 2 * SQR(r - _palettes[p].pal[4 * idx]) + 4 * SQR(g - _palettes[p].pal[4 * idx + 1]) + SQR(b - _palettes[p].pal[4 * idx + 2]); - if (d2 < dis) { - bst = idx; - dis = d2; - } - } - _lut2[_pos++] = bst; - - r += (1 << SHIFT); - g += (1 << SHIFT); - b += (1 << SHIFT); - } - r -= (BITDEPTH + 1) * (1 << SHIFT); - } - _cr++; - if (_cr > BITDEPTH) - return; - } -} - -#else - -void BaseAnimationState::buildLookup() { - // Do we already have lookup tables for this bit format? - Graphics::PixelFormat format = _sys->getOverlayFormat(); - if (format == _overlayFormat && _colorTab && _rgbToPix) - return; - - free(_colorTab); - free(_rgbToPix); - - _colorTab = (int16 *)malloc(4 * 256 * sizeof(int16)); - - int16 *Cr_r_tab = &_colorTab[0 * 256]; - int16 *Cr_g_tab = &_colorTab[1 * 256]; - int16 *Cb_g_tab = &_colorTab[2 * 256]; - int16 *Cb_b_tab = &_colorTab[3 * 256]; - - _rgbToPix = (OverlayColor *)malloc(3 * 768 * sizeof(OverlayColor)); - - OverlayColor *r_2_pix_alloc = &_rgbToPix[0 * 768]; - OverlayColor *g_2_pix_alloc = &_rgbToPix[1 * 768]; - OverlayColor *b_2_pix_alloc = &_rgbToPix[2 * 768]; - - int16 CR, CB; - int i; - - // Generate the tables for the display surface - - for (i = 0; i < 256; i++) { - // Gamma correction (luminescence table) and chroma correction - // would be done here. See the Berkeley mpeg_play sources. - - CR = CB = (i - 128); - Cr_r_tab[i] = (int16) ( (0.419 / 0.299) * CR) + 0 * 768 + 256; - Cr_g_tab[i] = (int16) (-(0.299 / 0.419) * CR) + 1 * 768 + 256; - Cb_g_tab[i] = (int16) (-(0.114 / 0.331) * CB); - Cb_b_tab[i] = (int16) ( (0.587 / 0.331) * CB) + 2 * 768 + 256; - } - - // Set up entries 0-255 in rgb-to-pixel value tables. - for (i = 0; i < 256; i++) { - r_2_pix_alloc[i + 256] = format.RGBToColor(i, 0, 0); - g_2_pix_alloc[i + 256] = format.RGBToColor(0, i, 0); - b_2_pix_alloc[i + 256] = format.RGBToColor(0, 0, i); - } - - // Spread out the values we have to the rest of the array so that we do - // not need to check for overflow. - for (i = 0; i < 256; i++) { - r_2_pix_alloc[i] = r_2_pix_alloc[256]; - r_2_pix_alloc[i + 512] = r_2_pix_alloc[511]; - g_2_pix_alloc[i] = g_2_pix_alloc[256]; - g_2_pix_alloc[i + 512] = g_2_pix_alloc[511]; - b_2_pix_alloc[i] = b_2_pix_alloc[256]; - b_2_pix_alloc[i + 512] = b_2_pix_alloc[511]; - } - - _overlayFormat = format; -} - -void BaseAnimationState::plotYUV(int width, int height, byte *const *dat) { - switch (_movieScale) { - case 1: - plotYUV1x(width, height, dat); - break; - case 2: - plotYUV2x(width, height, dat); - break; - case 3: - plotYUV3x(width, height, dat); - break; - } -} - -void BaseAnimationState::plotYUV1x(int width, int height, byte *const *dat) { - byte *lum = dat[0]; - byte *cr = dat[2]; - byte *cb = dat[1]; - - byte *lum2 = lum + width; - - int16 cr_r; - int16 crb_g; - int16 cb_b; - - OverlayColor *row1 = _overlay; - OverlayColor *row2 = row1 + _movieWidth; - - int x; - - for (; height > 0; height -= 2) { - OverlayColor *r1 = row1; - OverlayColor *r2 = row2; - - for (x = width; x > 0; x -= 2) { - register OverlayColor *L; - - cr_r = _colorTab[*cr + 0 * 256]; - crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256]; - cb_b = _colorTab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = &_rgbToPix[*lum++]; - *r1++ = L[cr_r] | L[crb_g] | L[cb_b]; - - L = &_rgbToPix[*lum++]; - *r1++ = L[cr_r] | L[crb_g] | L[cb_b]; - - // Now, do second row. - - L = &_rgbToPix[*lum2++]; - *r2++ = L[cr_r] | L[crb_g] | L[cb_b]; - - L = &_rgbToPix[*lum2++]; - *r2++ = L[cr_r] | L[crb_g] | L[cb_b]; - } - - lum += width; - lum2 += width; - row1 += 2 * _movieWidth; - row2 += 2 * _movieWidth; - } -} - -void BaseAnimationState::plotYUV2x(int width, int height, byte *const *dat) { - byte *lum = dat[0]; - byte *cr = dat[2]; - byte *cb = dat[1]; - - byte *lum2 = lum + width; - - int16 cr_r; - int16 crb_g; - int16 cb_b; - - OverlayColor *row1 = _overlay; - OverlayColor *row2 = row1 + 2 * 2 * _movieWidth; - - int x; - - for (; height > 0; height -= 2) { - OverlayColor *r1 = row1; - OverlayColor *r2 = row2; - - for (x = width; x > 0; x -= 2) { - register OverlayColor *L; - register OverlayColor C; - - cr_r = _colorTab[*cr + 0 * 256]; - crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256]; - cb_b = _colorTab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = &_rgbToPix[*lum++]; - C = L[cr_r] | L[crb_g] | L[cb_b]; - *r1++ = C; - *r1++ = C; - - L = &_rgbToPix[*lum++]; - C = L[cr_r] | L[crb_g] | L[cb_b]; - *r1++ = C; - *r1++ = C; - - // Now, do second row. - - L = &_rgbToPix[*lum2++]; - C = L[cr_r] | L[crb_g] | L[cb_b]; - *r2++ = C; - *r2++ = C; - - L = &_rgbToPix[*lum2++]; - C = L[cr_r] | L[crb_g] | L[cb_b]; - *r2++ = C; - *r2++ = C; - } - - memcpy(row1 + 2 * _movieWidth, row1, 2 * _movieWidth * sizeof(OverlayColor)); - memcpy(row2 + 2 * _movieWidth, row2, 2 * _movieWidth * sizeof(OverlayColor)); - - lum += width; - lum2 += width; - row1 += 4 * 2 * _movieWidth; - row2 += 4 * 2 * _movieWidth; - } -} - -void BaseAnimationState::plotYUV3x(int width, int height, byte *const *dat) { - byte *lum = dat[0]; - byte *cr = dat[2]; - byte *cb = dat[1]; - - byte *lum2 = lum + width; - - int16 cr_r; - int16 crb_g; - int16 cb_b; - - OverlayColor *row1 = _overlay; - OverlayColor *row2 = row1 + 3 * 3 * _movieWidth; - - int x; - - for (; height > 0; height -= 2) { - OverlayColor *r1 = row1; - OverlayColor *r2 = row2; - - for (x = width; x > 0; x -= 2) { - register OverlayColor *L; - register OverlayColor C; - - cr_r = _colorTab[*cr + 0 * 256]; - crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256]; - cb_b = _colorTab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = &_rgbToPix[*lum++]; - C = L[cr_r] | L[crb_g] | L[cb_b]; - *r1++ = C; - *r1++ = C; - *r1++ = C; - - L = &_rgbToPix[*lum++]; - C = L[cr_r] | L[crb_g] | L[cb_b]; - *r1++ = C; - *r1++ = C; - *r1++ = C; - - // Now, do second row. - - L = &_rgbToPix[*lum2++]; - C = L[cr_r] | L[crb_g] | L[cb_b]; - *r2++ = C; - *r2++ = C; - *r2++ = C; - - L = &_rgbToPix[*lum2++]; - C = L[cr_r] | L[crb_g] | L[cb_b]; - *r2++ = C; - *r2++ = C; - *r2++ = C; - } - - memcpy(row1 + 3 * _movieWidth, row1, 3 * _movieWidth * sizeof(OverlayColor)); - memcpy(row1 + 2 * 3 * _movieWidth, row1, 3 * _movieWidth * sizeof(OverlayColor)); - memcpy(row2 + 3 * _movieWidth, row2, 3 * _movieWidth * sizeof(OverlayColor)); - memcpy(row2 + 2 * 3 * _movieWidth, row2, 3 * _movieWidth * sizeof(OverlayColor)); - - lum += width; - lum2 += width; - row1 += 6 * 3 * _movieWidth; - row2 += 6 * 3 * _movieWidth; - } -} - -#endif - -void BaseAnimationState::updateScreen() { -#ifndef BACKEND_8BIT - int width = _movieScale * _frameWidth; - int height = _movieScale * _frameHeight; - int pitch = _movieScale * _movieWidth; - - const int screenW = _sys->getOverlayWidth(); - const int screenH = _sys->getOverlayHeight(); - - int x = (screenW - _movieScale * _frameWidth) / 2; - int y = (screenH - _movieScale * _frameHeight) / 2; - - _sys->copyRectToOverlay(_overlay, pitch, x, y, width, height); -#endif - _sys->updateScreen(); -} - -} // End of namespace Graphics diff --git a/graphics/video/mpeg_player.h b/graphics/video/mpeg_player.h deleted file mode 100644 index 4dedf12f57..0000000000 --- a/graphics/video/mpeg_player.h +++ /dev/null @@ -1,172 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_MPEG_PLAYER_H -#define GRAPHICS_VIDEO_MPEG_PLAYER_H - -#include "common/scummsys.h" -#include "graphics/pixelformat.h" - -// Uncomment this if you are using libmpeg2 0.3.1. -// #define USE_MPEG2_0_3_1 - -#ifdef USE_MPEG2 - -#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) - 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 -#endif - -extern "C" { - #include -} - -#ifdef USE_MPEG2_0_3_1 -typedef int mpeg2_state_t; -typedef sequence_t mpeg2_sequence_t; -#define STATE_BUFFER -1 -#endif - -#endif - -#ifdef BACKEND_8BIT -#define SQR(x) ((x) * (x)) -#define SHIFT 3 -#else -#define SHIFT 1 -#endif - -#define BITDEPTH (1 << (8 - SHIFT)) -#define ROUNDADD (1 << (SHIFT - 1)) - -#define BUFFER_SIZE 4096 - -namespace Common { - class File; -} - -class OSystem; - -namespace Graphics { - -class BaseAnimationState { -protected: - const int _movieWidth; - const int _movieHeight; - - int _frameWidth; - int _frameHeight; - -#ifndef BACKEND_8BIT - int _movieScale; -#endif - - OSystem *_sys; - - uint _frameNum; - -#ifdef USE_MPEG2 - mpeg2dec_t *_mpegDecoder; - const mpeg2_info_t *_mpegInfo; -#endif - - Common::File *_mpegFile; - -#ifdef BACKEND_8BIT - int _palNum; - int _maxPalNum; - - byte _yuvLookup[2][(BITDEPTH+1) * (BITDEPTH+1) * (BITDEPTH+1)]; - byte *_lut; - byte *_lut2; - int _lutCalcNum; - - int _curPal; - int _cr; - int _pos; - - struct { - uint cnt; - uint end; - byte pal[4 * 256]; - } _palettes[50]; -#else - OverlayColor *_overlay; - Graphics::PixelFormat _overlayFormat; - int16 *_colorTab; - OverlayColor *_rgbToPix; -#endif - -public: - BaseAnimationState(OSystem *sys, int width, int height); - virtual ~BaseAnimationState(); - - bool init(const char *name); - bool decodeFrame(); - void handleScreenChanged(); - void updateScreen(); - -#ifndef BACKEND_8BIT - void buildLookup(); -#endif - - int getFrameWidth() { return _frameWidth; } - int getFrameHeight() { return _frameHeight; } - -protected: - bool checkPaletteSwitch(); - virtual void drawYUV(int width, int height, byte *const *dat) = 0; - -#ifdef BACKEND_8BIT - void buildLookup(int p, int lines); - virtual void setPalette(byte *pal) = 0; -#else - void plotYUV(int width, int height, byte *const *dat); - void plotYUV1x(int width, int height, byte *const *dat); - void plotYUV2x(int width, int height, byte *const *dat); - void plotYUV3x(int width, int height, byte *const *dat); -#endif -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/qt_decoder.cpp b/graphics/video/qt_decoder.cpp deleted file mode 100644 index 9329966652..0000000000 --- a/graphics/video/qt_decoder.cpp +++ /dev/null @@ -1,1488 +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. - * - * $URL$ - * $Id$ - * - */ - -// -// Heavily based on ffmpeg code. -// -// Copyright (c) 2001 Fabrice Bellard. -// First version by Francois Revol revol@free.fr -// Seek function by Gael Chardon gael.dev@4now.net -// - -#include "graphics/video/qt_decoder.h" - -#include "common/debug.h" -#include "common/endian.h" -#include "common/macresman.h" -#include "common/memstream.h" -#include "common/util.h" -#include "common/zlib.h" - -// Audio codecs -#include "sound/decoders/adpcm.h" -#include "sound/decoders/raw.h" -#include "graphics/video/codecs/qdm2.h" - -// Video codecs -#include "graphics/video/codecs/cinepak.h" -#include "graphics/video/codecs/mjpeg.h" -#include "graphics/video/codecs/qtrle.h" -#include "graphics/video/codecs/rpza.h" -#include "graphics/video/codecs/smc.h" -#include "graphics/video/codecs/cdtoons.h" - -namespace Graphics { - -//////////////////////////////////////////// -// QuickTimeDecoder -//////////////////////////////////////////// - -QuickTimeDecoder::QuickTimeDecoder() : VideoDecoder() { - _audStream = NULL; - _beginOffset = 0; - _curFrame = -1; - _startTime = _nextFrameStartTime = 0; - _audHandle = Audio::SoundHandle(); - _numStreams = 0; - _fd = 0; - _scaledSurface = 0; - _scaleFactorX = 1; - _scaleFactorY = 1; - _dirtyPalette = false; - _resFork = new Common::MacResManager(); - _palette = 0; - - initParseTable(); -} - -QuickTimeDecoder::~QuickTimeDecoder() { - close(); - delete _resFork; -} - -uint16 QuickTimeDecoder::getWidth() const { - if (_videoStreamIndex < 0) - return 0; - - return (Common::Rational(_streams[_videoStreamIndex]->width) / getScaleFactorX()).toInt(); -} - -uint16 QuickTimeDecoder::getHeight() const { - if (_videoStreamIndex < 0) - return 0; - - return (Common::Rational(_streams[_videoStreamIndex]->height) / getScaleFactorY()).toInt(); -} - -uint32 QuickTimeDecoder::getFrameCount() const { - if (_videoStreamIndex < 0) - return 0; - - return _streams[_videoStreamIndex]->nb_frames; -} - -Common::Rational QuickTimeDecoder::getScaleFactorX() const { - if (_videoStreamIndex < 0) - return 1; - - return (_scaleFactorX * _streams[_videoStreamIndex]->scaleFactorX); -} - -Common::Rational QuickTimeDecoder::getScaleFactorY() const { - if (_videoStreamIndex < 0) - return 1; - - return (_scaleFactorY * _streams[_videoStreamIndex]->scaleFactorY); -} - -uint32 QuickTimeDecoder::getFrameDuration() { - if (_videoStreamIndex < 0) - return 0; - - uint32 curFrameIndex = 0; - for (int32 i = 0; i < _streams[_videoStreamIndex]->stts_count; i++) { - curFrameIndex += _streams[_videoStreamIndex]->stts_data[i].count; - if ((uint32)_curFrame < curFrameIndex) { - // Ok, now we have what duration this frame has. - return _streams[_videoStreamIndex]->stts_data[i].duration; - } - } - - // This should never occur - error ("Cannot find duration for frame %d", _curFrame); - return 0; -} - -PixelFormat QuickTimeDecoder::getPixelFormat() const { - Codec *codec = findDefaultVideoCodec(); - - if (!codec) - return PixelFormat::createFormatCLUT8(); - - return codec->getPixelFormat(); -} - -uint32 QuickTimeDecoder::findKeyFrame(uint32 frame) const { - for (int i = _streams[_videoStreamIndex]->keyframe_count - 1; i >= 0; i--) - if (_streams[_videoStreamIndex]->keyframes[i] <= frame) - return _streams[_videoStreamIndex]->keyframes[i]; - - // If none found, we'll assume the requested frame is a key frame - return frame; -} - -void QuickTimeDecoder::seekToFrame(uint32 frame) { - assert(_videoStreamIndex >= 0); - assert(frame < _streams[_videoStreamIndex]->nb_frames); - - // Stop all audio (for now) - stopAudio(); - - // Track down the keyframe - _curFrame = findKeyFrame(frame) - 1; - while (_curFrame < (int32)frame - 1) - decodeNextFrame(); - - // Map out the starting point - _nextFrameStartTime = 0; - uint32 curFrame = 0; - - for (int32 i = 0; i < _streams[_videoStreamIndex]->stts_count && curFrame < frame; i++) { - for (int32 j = 0; j < _streams[_videoStreamIndex]->stts_data[i].count && curFrame < frame; j++) { - curFrame++; - _nextFrameStartTime += _streams[_videoStreamIndex]->stts_data[i].duration; - } - } - - // Adjust the video starting point - _startTime = g_system->getMillis() - Graphics::VideoTimestamp(_nextFrameStartTime, _streams[_videoStreamIndex]->time_scale).getUnitsInScale(1000); - resetPauseStartTime(); - - // Adjust the audio starting point - if (_audioStreamIndex >= 0) { - _audioStartOffset = VideoTimestamp(_nextFrameStartTime, _streams[_videoStreamIndex]->time_scale); - - // Re-create the audio stream - STSDEntry *entry = &_streams[_audioStreamIndex]->stsdEntries[0]; - _audStream = Audio::makeQueuingAudioStream(entry->sampleRate, entry->channels == 2); - - // First, we need to track down what audio sample we need - uint32 curTime = 0; - uint sample = 0; - bool done = false; - for (int32 i = 0; i < _streams[_audioStreamIndex]->stts_count && !done; i++) { - for (int32 j = 0; j < _streams[_audioStreamIndex]->stts_data[i].count; j++) { - curTime += _streams[_audioStreamIndex]->stts_data[i].duration; - - if (curTime > Graphics::VideoTimestamp(_nextFrameStartTime, _streams[_videoStreamIndex]->time_scale).getUnitsInScale(_streams[_audioStreamIndex]->time_scale)) { - done = true; - break; - } - - sample++; - } - } - - // Now to track down what chunk it's in - _curAudioChunk = 0; - uint32 totalSamples = 0; - for (uint32 i = 0; i < _streams[_audioStreamIndex]->sample_to_chunk_sz; i++, _curAudioChunk++) { - int sampleToChunkIndex = -1; - - for (uint32 j = 0; j < _streams[_audioStreamIndex]->sample_to_chunk_sz; j++) - if (i >= _streams[_audioStreamIndex]->sample_to_chunk[j].first) - sampleToChunkIndex = j; - - assert(sampleToChunkIndex >= 0); - - totalSamples += _streams[_audioStreamIndex]->sample_to_chunk[sampleToChunkIndex].count; - - if (sample < totalSamples) { - totalSamples -= _streams[_audioStreamIndex]->sample_to_chunk[sampleToChunkIndex].count; - break; - } - } - - // Reposition the audio stream - readNextAudioChunk(); - if (sample != totalSamples) { - // HACK: Skip a certain amount of samples from the stream - // (There's got to be a better way to do this!) - int16 *tempBuffer = new int16[sample - totalSamples]; - _audStream->readBuffer(tempBuffer, sample - totalSamples); - delete[] tempBuffer; - debug(3, "Skipping %d audio samples", sample - totalSamples); - } - - // Restart the audio - startAudio(); - } -} - -void QuickTimeDecoder::seekToTime(VideoTimestamp time) { - // TODO: Audio-only seeking (or really, have QuickTime sounds) - if (_videoStreamIndex < 0) - error("Audio-only seeking not supported"); - - // Convert to the local time scale - uint32 localTime = time.getUnitsInScale(_streams[_videoStreamIndex]->time_scale); - - // Try to find the last frame that should have been decoded - uint32 frame = 0; - uint32 totalDuration = 0; - bool done = false; - - for (int32 i = 0; i < _streams[_videoStreamIndex]->stts_count && !done; i++) { - for (int32 j = 0; j < _streams[_videoStreamIndex]->stts_data[i].count; j++) { - totalDuration += _streams[_videoStreamIndex]->stts_data[i].duration; - if (localTime < totalDuration) { - done = true; - break; - } - frame++; - } - } - - seekToFrame(frame); -} - -Codec *QuickTimeDecoder::createCodec(uint32 codecTag, byte bitsPerPixel) { - if (codecTag == MKID_BE('cvid')) { - // 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); - } else if (codecTag == MKID_BE('rpza')) { - // Apple Video ("Road Pizza"): Used by some Myst videos. - return new RPZADecoder(getWidth(), getHeight()); - } else if (codecTag == MKID_BE('rle ')) { - // QuickTime RLE: Used by some Myst ME videos. - return new QTRLEDecoder(getWidth(), getHeight(), bitsPerPixel); - } else if (codecTag == MKID_BE('smc ')) { - // Apple SMC: Used by some Myst videos. - return new SMCDecoder(getWidth(), getHeight()); - } else if (codecTag == MKID_BE('SVQ1')) { - // Sorenson Video 1: Used by some Myst ME videos. - warning("Sorenson Video 1 not yet supported"); - } else if (codecTag == MKID_BE('SVQ3')) { - // Sorenson Video 3: Used by some Myst ME videos. - warning("Sorenson Video 3 not yet supported"); - } else if (codecTag == MKID_BE('jpeg')) { - // Motion JPEG: Used by some Myst ME 10th Anniversary videos. - return new JPEGDecoder(); - } else if (codecTag == MKID_BE('QkBk')) { - // CDToons: Used by most of the Broderbund games. - return new CDToonsDecoder(getWidth(), getHeight()); - } else { - warning("Unsupported codec \'%s\'", tag2str(codecTag)); - } - - return NULL; -} - -void QuickTimeDecoder::startAudio() { - if (_audStream) { // No audio/audio not supported - updateAudioBuffer(); - g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream); - } -} - -void QuickTimeDecoder::stopAudio() { - if (_audStream) { - g_system->getMixer()->stopHandle(_audHandle); - _audStream = NULL; // the mixer automatically frees the stream - } -} - -void QuickTimeDecoder::pauseVideoIntern(bool pause) { - if (_audStream) - g_system->getMixer()->pauseHandle(_audHandle, pause); -} - -Codec *QuickTimeDecoder::findDefaultVideoCodec() const { - if (_videoStreamIndex < 0 || !_streams[_videoStreamIndex]->stsdEntryCount) - return 0; - - return _streams[_videoStreamIndex]->stsdEntries[0].videoCodec; -} - -const Surface *QuickTimeDecoder::decodeNextFrame() { - if (_videoStreamIndex < 0 || _curFrame >= (int32)getFrameCount() - 1) - return 0; - - if (_startTime == 0) - _startTime = g_system->getMillis(); - - _curFrame++; - _nextFrameStartTime += getFrameDuration(); - - // Update the audio while we're at it - updateAudioBuffer(); - - // Get the next packet - uint32 descId; - Common::SeekableReadStream *frameData = getNextFramePacket(descId); - - if (!frameData || !descId || descId > _streams[_videoStreamIndex]->stsdEntryCount) - return 0; - - // Find which video description entry we want - STSDEntry *entry = &_streams[_videoStreamIndex]->stsdEntries[descId - 1]; - - if (!entry->videoCodec) - return 0; - - const Surface *frame = entry->videoCodec->decodeImage(frameData); - delete frameData; - - // Update the palette - if (entry->videoCodec->containsPalette()) { - // The codec itself contains a palette - if (entry->videoCodec->hasDirtyPalette()) { - _palette = entry->videoCodec->getPalette(); - _dirtyPalette = true; - } - } else { - // Check if the video description has been updated - byte *palette = entry->palette; - - if (palette != _palette) { - _palette = palette; - _dirtyPalette = true; - } - } - - return scaleSurface(frame); -} - -const Surface *QuickTimeDecoder::scaleSurface(const Surface *frame) { - if (getScaleFactorX() == 1 && getScaleFactorY() == 1) - return frame; - - assert(_scaledSurface); - - for (int32 j = 0; j < _scaledSurface->h; j++) - for (int32 k = 0; k < _scaledSurface->w; k++) - memcpy(_scaledSurface->getBasePtr(k, j), frame->getBasePtr((k * getScaleFactorX()).toInt() , (j * getScaleFactorY()).toInt()), frame->bytesPerPixel); - - return _scaledSurface; -} - -bool QuickTimeDecoder::endOfVideo() const { - return (!_audStream || _audStream->endOfData()) && (!findDefaultVideoCodec() || VideoDecoder::endOfVideo()); -} - -uint32 QuickTimeDecoder::getElapsedTime() const { - if (_audStream) - return g_system->getMixer()->getSoundElapsedTime(_audHandle) + _audioStartOffset.getUnitsInScale(1000); - - return VideoDecoder::getElapsedTime(); -} - -uint32 QuickTimeDecoder::getTimeToNextFrame() const { - if (endOfVideo() || _curFrame < 0) - return 0; - - // Convert from the QuickTime rate base to 1000 - uint32 nextFrameStartTime = _nextFrameStartTime * 1000 / _streams[_videoStreamIndex]->time_scale; - uint32 elapsedTime = getElapsedTime(); - - if (nextFrameStartTime <= elapsedTime) - return 0; - - return nextFrameStartTime - elapsedTime; -} - -bool QuickTimeDecoder::loadFile(const Common::String &filename) { - if (!_resFork->open(filename) || !_resFork->hasDataFork()) - return false; - - _foundMOOV = false; - _numStreams = 0; - _videoStreamIndex = _audioStreamIndex = -1; - _startTime = 0; - - MOVatom atom = { 0, 0, 0xffffffff }; - - if (_resFork->hasResFork()) { - // Search for a 'moov' resource - Common::MacResIDArray idArray = _resFork->getResIDArray(MKID_BE('moov')); - - if (!idArray.empty()) - _fd = _resFork->getResource(MKID_BE('moov'), idArray[0]); - - if (_fd) { - atom.size = _fd->size(); - if (readDefault(atom) < 0 || !_foundMOOV) - return false; - } - delete _fd; - - atom.type = 0; - atom.offset = 0; - atom.size = 0xffffffff; - } - - _fd = _resFork->getDataFork(); - - if (readDefault(atom) < 0 || !_foundMOOV) - return false; - - init(); - return true; -} - -bool QuickTimeDecoder::load(Common::SeekableReadStream *stream) { - _fd = stream; - _foundMOOV = false; - _numStreams = 0; - _videoStreamIndex = _audioStreamIndex = -1; - _startTime = 0; - - MOVatom atom = { 0, 0, 0xffffffff }; - - if (readDefault(atom) < 0 || !_foundMOOV) { - _fd = 0; - return false; - } - - init(); - return true; -} - -void QuickTimeDecoder::init() { - // Remove non-Video/Audio streams - for (uint32 i = 0; i < _numStreams;) { - if (_streams[i]->codec_type == CODEC_TYPE_MOV_OTHER) { - delete _streams[i]; - for (uint32 j = i + 1; j < _numStreams; j++) - _streams[j - 1] = _streams[j]; - _numStreams--; - } else - i++; - } - - // Adjust time/duration - for (uint32 i = 0; i < _numStreams; i++) { - MOVStreamContext *sc = _streams[i]; - - if (!sc->time_rate) - sc->time_rate = 1; - - if (!sc->time_scale) - sc->time_scale = _timeScale; - - sc->duration /= sc->time_rate; - - if (sc->codec_type == CODEC_TYPE_VIDEO && _videoStreamIndex < 0) - _videoStreamIndex = i; - else if (sc->codec_type == CODEC_TYPE_AUDIO && _audioStreamIndex < 0) - _audioStreamIndex = i; - } - - // Initialize audio, if present - if (_audioStreamIndex >= 0) { - STSDEntry *entry = &_streams[_audioStreamIndex]->stsdEntries[0]; - - if (checkAudioCodecSupport(entry->codecTag)) { - _audStream = Audio::makeQueuingAudioStream(entry->sampleRate, entry->channels == 2); - _curAudioChunk = 0; - - // Make sure the bits per sample transfers to the sample size - if (entry->codecTag == MKID_BE('raw ') || entry->codecTag == MKID_BE('twos')) - _streams[_audioStreamIndex]->sample_size = (entry->bitsPerSample / 8) * entry->channels; - - startAudio(); - } - - _audioStartOffset = VideoTimestamp(0); - } - - // Initialize video, if present - if (_videoStreamIndex >= 0) { - for (uint32 i = 0; i < _streams[_videoStreamIndex]->stsdEntryCount; i++) { - STSDEntry *entry = &_streams[_videoStreamIndex]->stsdEntries[i]; - entry->videoCodec = createCodec(entry->codecTag, entry->bitsPerSample & 0x1F); - } - - if (getScaleFactorX() != 1 || getScaleFactorY() != 1) { - // We have to initialize the scaled surface - _scaledSurface = new Surface(); - _scaledSurface->create(getWidth(), getHeight(), getPixelFormat().bytesPerPixel); - } - } -} - -void QuickTimeDecoder::initParseTable() { - static const ParseTable p[] = { - { &QuickTimeDecoder::readDefault, MKID_BE('dinf') }, - { &QuickTimeDecoder::readLeaf, MKID_BE('dref') }, - { &QuickTimeDecoder::readDefault, MKID_BE('edts') }, - { &QuickTimeDecoder::readELST, MKID_BE('elst') }, - { &QuickTimeDecoder::readHDLR, MKID_BE('hdlr') }, - { &QuickTimeDecoder::readDefault, MKID_BE('mdat') }, - { &QuickTimeDecoder::readMDHD, MKID_BE('mdhd') }, - { &QuickTimeDecoder::readDefault, MKID_BE('mdia') }, - { &QuickTimeDecoder::readDefault, MKID_BE('minf') }, - { &QuickTimeDecoder::readMOOV, MKID_BE('moov') }, - { &QuickTimeDecoder::readMVHD, MKID_BE('mvhd') }, - { &QuickTimeDecoder::readLeaf, MKID_BE('smhd') }, - { &QuickTimeDecoder::readDefault, MKID_BE('stbl') }, - { &QuickTimeDecoder::readSTCO, MKID_BE('stco') }, - { &QuickTimeDecoder::readSTSC, MKID_BE('stsc') }, - { &QuickTimeDecoder::readSTSD, MKID_BE('stsd') }, - { &QuickTimeDecoder::readSTSS, MKID_BE('stss') }, - { &QuickTimeDecoder::readSTSZ, MKID_BE('stsz') }, - { &QuickTimeDecoder::readSTTS, MKID_BE('stts') }, - { &QuickTimeDecoder::readTKHD, MKID_BE('tkhd') }, - { &QuickTimeDecoder::readTRAK, MKID_BE('trak') }, - { &QuickTimeDecoder::readLeaf, MKID_BE('udta') }, - { &QuickTimeDecoder::readLeaf, MKID_BE('vmhd') }, - { &QuickTimeDecoder::readCMOV, MKID_BE('cmov') }, - { &QuickTimeDecoder::readWAVE, MKID_BE('wave') }, - { 0, 0 } - }; - - _parseTable = p; -} - -int QuickTimeDecoder::readDefault(MOVatom atom) { - uint32 total_size = 0; - MOVatom a; - int err = 0; - - a.offset = atom.offset; - - while(((total_size + 8) < atom.size) && !_fd->eos() && _fd->pos() < _fd->size() && !err) { - a.size = atom.size; - a.type = 0; - - if (atom.size >= 8) { - a.size = _fd->readUint32BE(); - a.type = _fd->readUint32BE(); - - // Some QuickTime videos with resource forks have mdat chunks - // that are of size 0. Adjust it so it's the correct size. - if (a.type == MKID_BE('mdat') && a.size == 0) - a.size = _fd->size(); - } - - total_size += 8; - a.offset += 8; - debug(4, "type: %08x %.4s sz: %x %x %x", a.type, tag2str(a.type), a.size, atom.size, total_size); - - if (a.size == 1) { // 64 bit extended size - warning("64 bit extended size is not supported in QuickTime"); - return -1; - } - - if (a.size == 0) { - a.size = atom.size - total_size; - if (a.size <= 8) - break; - } - - uint32 i = 0; - - for (; _parseTable[i].type != 0 && _parseTable[i].type != a.type; i++) - // empty; - - if (a.size < 8) - break; - - a.size -= 8; - - if (_parseTable[i].type == 0) { // skip leaf atoms data - debug(0, ">>> Skipped [%s]", tag2str(a.type)); - - _fd->seek(a.size, SEEK_CUR); - } else { - uint32 start_pos = _fd->pos(); - err = (this->*_parseTable[i].func)(a); - - uint32 left = a.size - _fd->pos() + start_pos; - - if (left > 0) // skip garbage at atom end - _fd->seek(left, SEEK_CUR); - } - - a.offset += a.size; - total_size += a.size; - } - - if (!err && total_size < atom.size) - _fd->seek(atom.size - total_size, SEEK_SET); - - return err; -} - -int QuickTimeDecoder::readLeaf(MOVatom atom) { - if (atom.size > 1) - _fd->seek(atom.size, SEEK_SET); - - return 0; -} - -int QuickTimeDecoder::readMOOV(MOVatom atom) { - if (readDefault(atom) < 0) - return -1; - - // We parsed the 'moov' atom, so we don't need anything else - _foundMOOV = true; - return 1; -} - -int QuickTimeDecoder::readCMOV(MOVatom atom) { -#ifdef USE_ZLIB - // Read in the dcom atom - _fd->readUint32BE(); - if (_fd->readUint32BE() != MKID_BE('dcom')) - return -1; - if (_fd->readUint32BE() != MKID_BE('zlib')) { - warning("Unknown cmov compression type"); - return -1; - } - - // Read in the cmvd atom - uint32 compressedSize = _fd->readUint32BE() - 12; - if (_fd->readUint32BE() != MKID_BE('cmvd')) - return -1; - uint32 uncompressedSize = _fd->readUint32BE(); - - // Read in data - byte *compressedData = (byte *)malloc(compressedSize); - _fd->read(compressedData, compressedSize); - - // Create uncompressed stream - byte *uncompressedData = (byte *)malloc(uncompressedSize); - - // Uncompress the data - unsigned long dstLen = uncompressedSize; - if (!Common::uncompress(uncompressedData, &dstLen, compressedData, compressedSize)) { - warning ("Could not uncompress cmov chunk"); - free(compressedData); - free(uncompressedData); - return -1; - } - - // Load data into a new MemoryReadStream and assign _fd to be that - Common::SeekableReadStream *oldStream = _fd; - _fd = new Common::MemoryReadStream(uncompressedData, uncompressedSize, DisposeAfterUse::YES); - - // Read the contents of the uncompressed data - MOVatom a = { MKID_BE('moov'), 0, uncompressedSize }; - int err = readDefault(a); - - // Assign the file handle back to the original handle - free(compressedData); - delete _fd; - _fd = oldStream; - - return err; -#else - warning ("zlib not found, cannot read QuickTime cmov atom"); - return -1; -#endif -} - -int QuickTimeDecoder::readMVHD(MOVatom atom) { - byte version = _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - - if (version == 1) { - warning("QuickTime version 1"); - _fd->readUint32BE(); _fd->readUint32BE(); - _fd->readUint32BE(); _fd->readUint32BE(); - } else { - _fd->readUint32BE(); // creation time - _fd->readUint32BE(); // modification time - } - - _timeScale = _fd->readUint32BE(); // time scale - debug(0, "time scale = %i\n", _timeScale); - - // duration - _duration = (version == 1) ? (_fd->readUint32BE(), _fd->readUint32BE()) : _fd->readUint32BE(); - _fd->readUint32BE(); // preferred scale - - _fd->readUint16BE(); // preferred volume - - _fd->seek(10, SEEK_CUR); // reserved - - // We only need two values from the movie display matrix. Most of the values are just - // skipped. xMod and yMod are 16:16 fixed point numbers, the last part of the 3x3 matrix - // is 2:30. - uint32 xMod = _fd->readUint32BE(); - _fd->skip(12); - uint32 yMod = _fd->readUint32BE(); - _fd->skip(16); - - _scaleFactorX = Common::Rational(0x10000, xMod); - _scaleFactorY = Common::Rational(0x10000, yMod); - - _scaleFactorX.debugPrint(1, "readMVHD(): scaleFactorX ="); - _scaleFactorY.debugPrint(1, "readMVHD(): scaleFactorY ="); - - _fd->readUint32BE(); // preview time - _fd->readUint32BE(); // preview duration - _fd->readUint32BE(); // poster time - _fd->readUint32BE(); // selection time - _fd->readUint32BE(); // selection duration - _fd->readUint32BE(); // current time - _fd->readUint32BE(); // next track ID - - return 0; -} - -int QuickTimeDecoder::readTRAK(MOVatom atom) { - MOVStreamContext *sc = new MOVStreamContext(); - - if (!sc) - return -1; - - sc->codec_type = CODEC_TYPE_MOV_OTHER; - sc->start_time = 0; // XXX: check - _streams[_numStreams++] = sc; - - return readDefault(atom); -} - -int QuickTimeDecoder::readTKHD(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - byte version = _fd->readByte(); - - _fd->readByte(); _fd->readByte(); - _fd->readByte(); // flags - // - //MOV_TRACK_ENABLED 0x0001 - //MOV_TRACK_IN_MOVIE 0x0002 - //MOV_TRACK_IN_PREVIEW 0x0004 - //MOV_TRACK_IN_POSTER 0x0008 - // - - if (version == 1) { - _fd->readUint32BE(); _fd->readUint32BE(); - _fd->readUint32BE(); _fd->readUint32BE(); - } else { - _fd->readUint32BE(); // creation time - _fd->readUint32BE(); // modification time - } - - /* st->id = */_fd->readUint32BE(); // track id (NOT 0 !) - _fd->readUint32BE(); // reserved - //st->start_time = 0; // check - (version == 1) ? (_fd->readUint32BE(), _fd->readUint32BE()) : _fd->readUint32BE(); // highlevel (considering edits) duration in movie timebase - _fd->readUint32BE(); // reserved - _fd->readUint32BE(); // reserved - - _fd->readUint16BE(); // layer - _fd->readUint16BE(); // alternate group - _fd->readUint16BE(); // volume - _fd->readUint16BE(); // reserved - - // We only need the two values from the displacement matrix for a track. - // See readMVHD() for more information. - uint32 xMod = _fd->readUint32BE(); - _fd->skip(12); - uint32 yMod = _fd->readUint32BE(); - _fd->skip(16); - - st->scaleFactorX = Common::Rational(0x10000, xMod); - st->scaleFactorY = Common::Rational(0x10000, yMod); - - st->scaleFactorX.debugPrint(1, "readTKHD(): scaleFactorX ="); - st->scaleFactorY.debugPrint(1, "readTKHD(): scaleFactorY ="); - - // these are fixed-point, 16:16 - // uint32 tkWidth = _fd->readUint32BE() >> 16; // track width - // uint32 tkHeight = _fd->readUint32BE() >> 16; // track height - - return 0; -} - -// edit list atom -int QuickTimeDecoder::readELST(MOVatom atom) { - _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - uint32 editCount = _streams[_numStreams - 1]->edit_count = _fd->readUint32BE(); // entries - - for (uint32 i = 0; i < editCount; i++){ - _fd->readUint32BE(); // Track duration - _fd->readUint32BE(); // Media time - _fd->readUint32BE(); // Media rate - } - - debug(0, "track[%i].edit_count = %i", _numStreams - 1, _streams[_numStreams - 1]->edit_count); - - if (editCount != 1) - warning("Multiple edit list entries. Things may go awry"); - - return 0; -} - -int QuickTimeDecoder::readHDLR(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - - _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - - // component type - uint32 ctype = _fd->readUint32LE(); - uint32 type = _fd->readUint32BE(); // component subtype - - debug(0, "ctype= %s (0x%08lx)", tag2str(ctype), (long)ctype); - debug(0, "stype= %s", tag2str(type)); - - if(ctype == MKID_BE('mhlr')) // MOV - debug(0, "MOV detected"); - else if(ctype == 0) { - warning("MP4 streams are not supported"); - return -1; - } - - if (type == MKID_BE('vide')) - st->codec_type = CODEC_TYPE_VIDEO; - else if (type == MKID_BE('soun')) - st->codec_type = CODEC_TYPE_AUDIO; - - _fd->readUint32BE(); // component manufacture - _fd->readUint32BE(); // component flags - _fd->readUint32BE(); // component flags mask - - if (atom.size <= 24) - return 0; // nothing left to read - - // .mov: PASCAL string - byte len = _fd->readByte(); - _fd->seek(len, SEEK_CUR); - - _fd->seek(atom.size - (_fd->pos() - atom.offset), SEEK_CUR); - - return 0; -} - -int QuickTimeDecoder::readMDHD(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - byte version = _fd->readByte(); - - if (version > 1) - return 1; // unsupported - - _fd->readByte(); _fd->readByte(); - _fd->readByte(); // flags - - if (version == 1) { - _fd->readUint32BE(); _fd->readUint32BE(); - _fd->readUint32BE(); _fd->readUint32BE(); - } else { - _fd->readUint32BE(); // creation time - _fd->readUint32BE(); // modification time - } - - st->time_scale = _fd->readUint32BE(); - st->duration = (version == 1) ? (_fd->readUint32BE(), _fd->readUint32BE()) : _fd->readUint32BE(); // duration - - _fd->readUint16BE(); // language - _fd->readUint16BE(); // quality - - return 0; -} - -int QuickTimeDecoder::readSTSD(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - - _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - - st->stsdEntryCount = _fd->readUint32BE(); - st->stsdEntries = new STSDEntry[st->stsdEntryCount]; - - for (uint32 i = 0; i < st->stsdEntryCount; i++) { // Parsing Sample description table - STSDEntry *entry = &st->stsdEntries[i]; - - MOVatom a = { 0, 0, 0 }; - uint32 start_pos = _fd->pos(); - int size = _fd->readUint32BE(); // size - uint32 format = _fd->readUint32BE(); // data format - - _fd->readUint32BE(); // reserved - _fd->readUint16BE(); // reserved - _fd->readUint16BE(); // index - - debug(0, "size=%d 4CC= %s codec_type=%d", size, tag2str(format), st->codec_type); - - entry->codecTag = format; - - if (st->codec_type == CODEC_TYPE_VIDEO) { - debug(0, "Video Codec FourCC: \'%s\'", tag2str(format)); - - _fd->readUint16BE(); // version - _fd->readUint16BE(); // revision level - _fd->readUint32BE(); // vendor - _fd->readUint32BE(); // temporal quality - _fd->readUint32BE(); // spacial quality - - uint16 width = _fd->readUint16BE(); // width - uint16 height = _fd->readUint16BE(); // height - - // The width is most likely invalid for entries after the first one - // so only set the overall width if it is not zero here. - if (width) - st->width = width; - - if (height) - st->height = height; - - _fd->readUint32BE(); // horiz resolution - _fd->readUint32BE(); // vert resolution - _fd->readUint32BE(); // data size, always 0 - _fd->readUint16BE(); // frames per samples - - byte codec_name[32]; - _fd->read(codec_name, 32); // codec name, pascal string (FIXME: true for mp4?) - if (codec_name[0] <= 31) { - memcpy(entry->codecName, &codec_name[1], codec_name[0]); - entry->codecName[codec_name[0]] = 0; - } - - entry->bitsPerSample = _fd->readUint16BE(); // depth - entry->colorTableId = _fd->readUint16BE(); // colortable id - - // figure out the palette situation - byte colorDepth = entry->bitsPerSample & 0x1F; - bool colorGreyscale = (entry->bitsPerSample & 0x20) != 0; - - debug(0, "color depth: %d", colorDepth); - - // if the depth is 2, 4, or 8 bpp, file is palettized - if (colorDepth == 2 || colorDepth == 4 || colorDepth == 8) { - // Initialize the palette - entry->palette = new byte[256 * 3]; - memset(entry->palette, 0, 256 * 3); - - if (colorGreyscale) { - debug(0, "Greyscale palette"); - - // compute the greyscale palette - uint16 colorCount = 1 << colorDepth; - int16 colorIndex = 255; - byte colorDec = 256 / (colorCount - 1); - for (byte j = 0; j < colorCount; j++) { - entry->palette[j * 3] = entry->palette[j * 3 + 1] = entry->palette[j * 3 + 2] = colorIndex; - colorIndex -= colorDec; - if (colorIndex < 0) - colorIndex = 0; - } - } else if (entry->colorTableId & 0x08) { - // if flag bit 3 is set, use the default palette - //uint16 colorCount = 1 << colorDepth; - - warning("Predefined palette! %dbpp", colorDepth); - } else { - debug(0, "Palette from file"); - - // load the palette from the file - uint32 colorStart = _fd->readUint32BE(); - /* uint16 colorCount = */ _fd->readUint16BE(); - uint16 colorEnd = _fd->readUint16BE(); - for (uint32 j = colorStart; j <= colorEnd; j++) { - // each R, G, or B component is 16 bits; - // only use the top 8 bits; skip alpha bytes - // up front - _fd->readByte(); - _fd->readByte(); - entry->palette[j * 3] = _fd->readByte(); - _fd->readByte(); - entry->palette[j * 3 + 1] = _fd->readByte(); - _fd->readByte(); - entry->palette[j * 3 + 2] = _fd->readByte(); - _fd->readByte(); - } - } - } - } else if (st->codec_type == CODEC_TYPE_AUDIO) { - debug(0, "Audio Codec FourCC: \'%s\'", tag2str(format)); - - uint16 stsdVersion = _fd->readUint16BE(); - _fd->readUint16BE(); // revision level - _fd->readUint32BE(); // vendor - - entry->channels = _fd->readUint16BE(); // channel count - entry->bitsPerSample = _fd->readUint16BE(); // sample size - - _fd->readUint16BE(); // compression id = 0 - _fd->readUint16BE(); // packet size = 0 - - entry->sampleRate = (_fd->readUint32BE() >> 16); - - debug(0, "stsd version =%d", stsdVersion); - if (stsdVersion == 0) { - // Not used, except in special cases. See below. - entry->samplesPerFrame = entry->bytesPerFrame = 0; - } else if (stsdVersion == 1) { - // Read QT version 1 fields. In version 0 these dont exist. - entry->samplesPerFrame = _fd->readUint32BE(); - debug(0, "stsd samples_per_frame =%d",entry->samplesPerFrame); - _fd->readUint32BE(); // bytes per packet - entry->bytesPerFrame = _fd->readUint32BE(); - debug(0, "stsd bytes_per_frame =%d", entry->bytesPerFrame); - _fd->readUint32BE(); // bytes per sample - } else { - warning("Unsupported QuickTime STSD audio version %d", stsdVersion); - return 1; - } - - // Version 0 videos (such as the Riven ones) don't have this set, - // but we need it later on. Add it in here. - if (format == MKID_BE('ima4')) { - entry->samplesPerFrame = 64; - entry->bytesPerFrame = 34 * entry->channels; - } - - if (entry->sampleRate == 0 && st->time_scale > 1) - entry->sampleRate = st->time_scale; - } else { - // other codec type, just skip (rtp, mp4s, tmcd ...) - _fd->seek(size - (_fd->pos() - start_pos), SEEK_CUR); - } - - // this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) - a.size = size - (_fd->pos() - start_pos); - if (a.size > 8) - readDefault(a); - else if (a.size > 0) - _fd->seek(a.size, SEEK_CUR); - } - - return 0; -} - -int QuickTimeDecoder::readSTSC(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - - _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - - st->sample_to_chunk_sz = _fd->readUint32BE(); - - debug(0, "track[%i].stsc.entries = %i", _numStreams - 1, st->sample_to_chunk_sz); - - st->sample_to_chunk = new MOVstsc[st->sample_to_chunk_sz]; - - if (!st->sample_to_chunk) - return -1; - - for (uint32 i = 0; i < st->sample_to_chunk_sz; i++) { - st->sample_to_chunk[i].first = _fd->readUint32BE() - 1; - st->sample_to_chunk[i].count = _fd->readUint32BE(); - st->sample_to_chunk[i].id = _fd->readUint32BE(); - //warning("Sample to Chunk[%d]: First = %d, Count = %d", i, st->sample_to_chunk[i].first, st->sample_to_chunk[i].count); - } - - return 0; -} - -int QuickTimeDecoder::readSTSS(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - - _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - - st->keyframe_count = _fd->readUint32BE(); - - debug(0, "keyframe_count = %d", st->keyframe_count); - - st->keyframes = new uint32[st->keyframe_count]; - - if (!st->keyframes) - return -1; - - for (uint32 i = 0; i < st->keyframe_count; i++) { - st->keyframes[i] = _fd->readUint32BE() - 1; // Adjust here, the frames are based on 1 - debug(6, "keyframes[%d] = %d", i, st->keyframes[i]); - - } - return 0; -} - -int QuickTimeDecoder::readSTSZ(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - - _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - - st->sample_size = _fd->readUint32BE(); - st->sample_count = _fd->readUint32BE(); - - debug(5, "sample_size = %d sample_count = %d", st->sample_size, st->sample_count); - - if (st->sample_size) - return 0; // there isn't any table following - - st->sample_sizes = new uint32[st->sample_count]; - - if (!st->sample_sizes) - return -1; - - for(uint32 i = 0; i < st->sample_count; i++) { - st->sample_sizes[i] = _fd->readUint32BE(); - debug(6, "sample_sizes[%d] = %d", i, st->sample_sizes[i]); - } - - return 0; -} - -static uint32 ff_gcd(uint32 a, uint32 b) { - return b ? ff_gcd(b, a % b) : a; -} - -int QuickTimeDecoder::readSTTS(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - uint32 duration = 0; - uint32 total_sample_count = 0; - - _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - - st->stts_count = _fd->readUint32BE(); - st->stts_data = new MOVstts[st->stts_count]; - - debug(0, "track[%i].stts.entries = %i", _numStreams - 1, st->stts_count); - - st->time_rate = 0; - - for (int32 i = 0; i < st->stts_count; i++) { - int sample_duration; - int sample_count; - - sample_count = _fd->readUint32BE(); - sample_duration = _fd->readUint32BE(); - st->stts_data[i].count = sample_count; - st->stts_data[i].duration = sample_duration; - - st->time_rate = ff_gcd(st->time_rate, sample_duration); - - debug(0, "sample_count=%d, sample_duration=%d", sample_count, sample_duration); - - duration += sample_duration * sample_count; - total_sample_count += sample_count; - } - - st->nb_frames = total_sample_count; - - if (duration) - st->duration = duration; - - return 0; -} - -int QuickTimeDecoder::readSTCO(MOVatom atom) { - MOVStreamContext *st = _streams[_numStreams - 1]; - - _fd->readByte(); // version - _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - - st->chunk_count = _fd->readUint32BE(); - st->chunk_offsets = new uint32[st->chunk_count]; - - if (!st->chunk_offsets) - return -1; - - for (uint32 i = 0; i < st->chunk_count; i++) { - // WORKAROUND/HACK: The offsets in Riven videos (ones inside the Mohawk archives themselves) - // have offsets relative to the archive and not the video. This is quite nasty. We subtract - // the initial offset of the stream to get the correct value inside of the stream. - st->chunk_offsets[i] = _fd->readUint32BE() - _beginOffset; - } - - return 0; -} - -int QuickTimeDecoder::readWAVE(MOVatom atom) { - if (_numStreams < 1) - return 0; - - MOVStreamContext *st = _streams[_numStreams - 1]; - - if (atom.size > (1 << 30)) - return -1; - - if (st->stsdEntries[0].codecTag == MKID_BE('QDM2')) // Read extradata for QDM2 - st->extradata = _fd->readStream(atom.size - 8); - else if (atom.size > 8) - return readDefault(atom); - else - _fd->skip(atom.size); - - return 0; -} - -void QuickTimeDecoder::close() { - stopAudio(); - - for (uint32 i = 0; i < _numStreams; i++) - delete _streams[i]; - - delete _fd; - _fd = 0; - - if (_scaledSurface) { - _scaledSurface->free(); - delete _scaledSurface; - _scaledSurface = 0; - } - - // The audio stream is deleted automatically - _audStream = NULL; - - VideoDecoder::reset(); -} - -Common::SeekableReadStream *QuickTimeDecoder::getNextFramePacket(uint32 &descId) { - if (_videoStreamIndex < 0) - return NULL; - - // First, we have to track down which chunk holds the sample and which sample in the chunk contains the frame we are looking for. - int32 totalSampleCount = 0; - int32 sampleInChunk = 0; - int32 actualChunk = -1; - - for (uint32 i = 0; i < _streams[_videoStreamIndex]->chunk_count; i++) { - int32 sampleToChunkIndex = -1; - - for (uint32 j = 0; j < _streams[_videoStreamIndex]->sample_to_chunk_sz; j++) - if (i >= _streams[_videoStreamIndex]->sample_to_chunk[j].first) - sampleToChunkIndex = j; - - if (sampleToChunkIndex < 0) - error("This chunk (%d) is imaginary", sampleToChunkIndex); - - totalSampleCount += _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].count; - - if (totalSampleCount > getCurFrame()) { - actualChunk = i; - descId = _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].id; - sampleInChunk = _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].count - totalSampleCount + getCurFrame(); - break; - } - } - - if (actualChunk < 0) { - warning ("Could not find data for frame %d", getCurFrame()); - return NULL; - } - - // Next seek to that frame - _fd->seek(_streams[_videoStreamIndex]->chunk_offsets[actualChunk]); - - // Then, if the chunk holds more than one frame, seek to where the frame we want is located - for (int32 i = getCurFrame() - sampleInChunk; i < getCurFrame(); i++) { - if (_streams[_videoStreamIndex]->sample_size != 0) - _fd->skip(_streams[_videoStreamIndex]->sample_size); - else - _fd->skip(_streams[_videoStreamIndex]->sample_sizes[i]); - } - - // Finally, read in the raw data for the frame - //printf ("Frame Data[%d]: Offset = %d, Size = %d\n", getCurFrame(), _fd->pos(), _streams[_videoStreamIndex]->sample_sizes[getCurFrame()]); - - if (_streams[_videoStreamIndex]->sample_size != 0) - return _fd->readStream(_streams[_videoStreamIndex]->sample_size); - - return _fd->readStream(_streams[_videoStreamIndex]->sample_sizes[getCurFrame()]); -} - -bool QuickTimeDecoder::checkAudioCodecSupport(uint32 tag) { - // Check if the codec is a supported codec - if (tag == MKID_BE('twos') || tag == MKID_BE('raw ') || tag == MKID_BE('ima4')) - return true; - -#ifdef GRAPHICS_QDM2_H - if (tag == MKID_BE('QDM2')) - return true; -#endif - - warning("Audio Codec Not Supported: \'%s\'", tag2str(tag)); - - return false; -} - -Audio::AudioStream *QuickTimeDecoder::createAudioStream(Common::SeekableReadStream *stream) { - if (!stream || _audioStreamIndex < 0) - return NULL; - - STSDEntry *entry = &_streams[_audioStreamIndex]->stsdEntries[0]; - - if (entry->codecTag == MKID_BE('twos') || entry->codecTag == MKID_BE('raw ')) { - // Fortunately, most of the audio used in Myst videos is raw... - uint16 flags = 0; - if (entry->codecTag == MKID_BE('raw ')) - flags |= Audio::FLAG_UNSIGNED; - if (entry->channels == 2) - flags |= Audio::FLAG_STEREO; - if (entry->bitsPerSample == 16) - flags |= Audio::FLAG_16BITS; - uint32 dataSize = stream->size(); - byte *data = (byte *)malloc(dataSize); - stream->read(data, dataSize); - delete stream; - return Audio::makeRawStream(data, dataSize, entry->sampleRate, flags); - } else if (entry->codecTag == MKID_BE('ima4')) { - // Riven uses this codec (as do some Myst ME videos) - return Audio::makeADPCMStream(stream, DisposeAfterUse::YES, stream->size(), Audio::kADPCMApple, entry->sampleRate, entry->channels, 34); -#ifdef GRAPHICS_QDM2_H - } else if (entry->codecTag == MKID_BE('QDM2')) { - // Several Myst ME videos use this codec - return makeQDM2Stream(stream, _streams[_audioStreamIndex]->extradata); -#endif - } - - error("Unsupported audio codec"); - - return NULL; -} - -uint32 QuickTimeDecoder::getAudioChunkSampleCount(uint chunk) { - if (_audioStreamIndex < 0) - return 0; - - uint32 sampleCount = 0; - - for (uint32 j = 0; j < _streams[_audioStreamIndex]->sample_to_chunk_sz; j++) - if (chunk >= _streams[_audioStreamIndex]->sample_to_chunk[j].first) - sampleCount = _streams[_audioStreamIndex]->sample_to_chunk[j].count; - - return sampleCount; -} - -void QuickTimeDecoder::readNextAudioChunk() { - STSDEntry *entry = &_streams[_audioStreamIndex]->stsdEntries[0]; - Common::MemoryWriteStreamDynamic *wStream = new Common::MemoryWriteStreamDynamic(); - - _fd->seek(_streams[_audioStreamIndex]->chunk_offsets[_curAudioChunk]); - - // First, we have to get the sample count - uint32 sampleCount = getAudioChunkSampleCount(_curAudioChunk); - assert(sampleCount); - - // Then calculate the right sizes - while (sampleCount > 0) { - uint32 samples = 0, size = 0; - - if (entry->samplesPerFrame >= 160) { - samples = entry->samplesPerFrame; - size = entry->bytesPerFrame; - } else if (entry->samplesPerFrame > 1) { - samples = MIN((1024 / entry->samplesPerFrame) * entry->samplesPerFrame, sampleCount); - size = (samples / entry->samplesPerFrame) * entry->bytesPerFrame; - } else { - samples = MIN(1024, sampleCount); - size = samples * _streams[_audioStreamIndex]->sample_size; - } - - // Now, we read in the data for this data and output it - byte *data = (byte *)malloc(size); - _fd->read(data, size); - wStream->write(data, size); - free(data); - sampleCount -= samples; - } - - // Now queue the buffer - _audStream->queueAudioStream(createAudioStream(new Common::MemoryReadStream(wStream->getData(), wStream->size(), DisposeAfterUse::YES))); - delete wStream; - - _curAudioChunk++; -} - -void QuickTimeDecoder::updateAudioBuffer() { - if (!_audStream) - return; - - uint32 numberOfChunksNeeded = 0; - - if (_curFrame == (int32)_streams[_videoStreamIndex]->nb_frames - 1) { - // If we're on the last frame, make sure all audio remaining is buffered - numberOfChunksNeeded = _streams[_audioStreamIndex]->chunk_count; - } else { - STSDEntry *entry = &_streams[_audioStreamIndex]->stsdEntries[0]; - - // Calculate the amount of chunks we need in memory until the next frame - uint32 timeToNextFrame = getTimeToNextFrame(); - uint32 timeFilled = 0; - uint32 curAudioChunk = _curAudioChunk - _audStream->numQueuedStreams(); - - for (; timeFilled < timeToNextFrame && curAudioChunk < _streams[_audioStreamIndex]->chunk_count; numberOfChunksNeeded++, curAudioChunk++) { - uint32 sampleCount = getAudioChunkSampleCount(curAudioChunk); - assert(sampleCount); - - timeFilled += sampleCount * 1000 / entry->sampleRate; - } - - // Add a couple extra to ensure we don't underrun - numberOfChunksNeeded += 3; - } - - // Keep three streams in buffer so that if/when the first two end, it goes right into the next - while (_audStream->numQueuedStreams() < numberOfChunksNeeded && _curAudioChunk < _streams[_audioStreamIndex]->chunk_count) - readNextAudioChunk(); -} - -QuickTimeDecoder::STSDEntry::STSDEntry() { - codecTag = 0; - bitsPerSample = 0; - memset(codecName, 0, 32); - colorTableId = 0; - palette = 0; - videoCodec = 0; - channels = 0; - sampleRate = 0; - samplesPerFrame = 0; - bytesPerFrame = 0; -} - -QuickTimeDecoder::STSDEntry::~STSDEntry() { - delete[] palette; - delete videoCodec; -} - -QuickTimeDecoder::MOVStreamContext::MOVStreamContext() { - // FIXME: Setting all members to 0 via memset is a hack -- it works - // because the only non-POD member of MOVStreamContext is of type - // Common::Rational, and that luckily has no virtual methods nor - // does it keep internal pointers or anything like that. But watch - // out if you ever extend MOVStreamContext! - memset(this, 0, sizeof(MOVStreamContext)); -} - -QuickTimeDecoder::MOVStreamContext::~MOVStreamContext() { - delete[] chunk_offsets; - delete[] stts_data; - delete[] sample_to_chunk; - delete[] sample_sizes; - delete[] keyframes; - delete[] stsdEntries; - delete extradata; -} - -} // End of namespace Graphics diff --git a/graphics/video/qt_decoder.h b/graphics/video/qt_decoder.h deleted file mode 100644 index 186e257553..0000000000 --- a/graphics/video/qt_decoder.h +++ /dev/null @@ -1,278 +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. - * - * $URL$ - * $Id$ - * - */ - -// -// Heavily based on ffmpeg code. -// -// Copyright (c) 2001 Fabrice Bellard. -// First version by Francois Revol revol@free.fr -// Seek function by Gael Chardon gael.dev@4now.net -// - -#ifndef GRAPHICS_QT_DECODER_H -#define GRAPHICS_QT_DECODER_H - -#include "common/scummsys.h" -#include "common/queue.h" -#include "common/rational.h" - -#include "graphics/video/video_decoder.h" -#include "graphics/video/codecs/codec.h" - -#include "sound/audiostream.h" -#include "sound/mixer.h" - -namespace Common { - class File; - class MacResManager; -} - -namespace Graphics { - -/** - * Decoder for QuickTime videos. - * - * Video decoder used in engines: - * - mohawk - * - sci - */ -class QuickTimeDecoder : public SeekableVideoDecoder { -public: - QuickTimeDecoder(); - virtual ~QuickTimeDecoder(); - - /** - * Returns the width of the video - * @return the width of the video - */ - uint16 getWidth() const; - - /** - * Returns the height of the video - * @return the height of the video - */ - uint16 getHeight() const; - - /** - * Returns the amount of frames in the video - * @return the amount of frames in the video - */ - uint32 getFrameCount() const; - - /** - * Load a video file - * @param filename the filename to load - */ - bool loadFile(const Common::String &filename); - - /** - * Load a QuickTime video file from a SeekableReadStream - * @param stream the stream to load - */ - bool load(Common::SeekableReadStream *stream); - - /** - * Close a QuickTime encoded video file - */ - void close(); - - /** - * Returns the palette of the video - * @return the palette of the video - */ - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } - - /** - * Set the beginning offset of the video so we can modify the offsets in the stco - * atom of videos inside the Mohawk archives - * @param the beginning offset of the video - */ - void setChunkBeginOffset(uint32 offset) { _beginOffset = offset; } - - bool isVideoLoaded() const { return _fd != 0; } - const Surface *decodeNextFrame(); - bool endOfVideo() const; - uint32 getElapsedTime() const; - uint32 getTimeToNextFrame() const; - PixelFormat getPixelFormat() const; - - // SeekableVideoDecoder API - void seekToFrame(uint32 frame); - void seekToTime(VideoTimestamp time); - -private: - // This is the file handle from which data is read from. It can be the actual file handle or a decompressed stream. - Common::SeekableReadStream *_fd; - - struct MOVatom { - uint32 type; - uint32 offset; - uint32 size; - }; - - struct ParseTable { - int (QuickTimeDecoder::*func)(MOVatom atom); - uint32 type; - }; - - struct MOVstts { - int count; - int duration; - }; - - struct MOVstsc { - uint32 first; - uint32 count; - uint32 id; - }; - - struct STSDEntry { - STSDEntry(); - ~STSDEntry(); - - uint32 codecTag; - uint16 bitsPerSample; - - // Video - char codecName[32]; - uint16 colorTableId; - byte *palette; - Codec *videoCodec; - - // Audio - uint16 channels; - uint32 sampleRate; - uint32 samplesPerFrame; - uint32 bytesPerFrame; - }; - - enum CodecType { - CODEC_TYPE_MOV_OTHER, - CODEC_TYPE_VIDEO, - CODEC_TYPE_AUDIO - }; - - struct MOVStreamContext { - MOVStreamContext(); - ~MOVStreamContext(); - - uint32 chunk_count; - uint32 *chunk_offsets; - int stts_count; - MOVstts *stts_data; - int edit_count; /* number of 'edit' (elst atom) */ - uint32 sample_to_chunk_sz; - MOVstsc *sample_to_chunk; - uint32 sample_size; - uint32 sample_count; - uint32 *sample_sizes; - uint32 keyframe_count; - uint32 *keyframes; - int32 time_scale; - int time_rate; - - uint16 width; - uint16 height; - CodecType codec_type; - - uint32 stsdEntryCount; - STSDEntry *stsdEntries; - - Common::SeekableReadStream *extradata; - - uint32 nb_frames; - uint32 duration; - uint32 start_time; - Common::Rational scaleFactorX; - Common::Rational scaleFactorY; - }; - - const ParseTable *_parseTable; - bool _foundMOOV; - uint32 _timeScale; - uint32 _duration; - uint32 _numStreams; - Common::Rational _scaleFactorX; - Common::Rational _scaleFactorY; - MOVStreamContext *_streams[20]; - const byte *_palette; - bool _dirtyPalette; - uint32 _beginOffset; - Common::MacResManager *_resFork; - - void initParseTable(); - Audio::AudioStream *createAudioStream(Common::SeekableReadStream *stream); - bool checkAudioCodecSupport(uint32 tag); - Common::SeekableReadStream *getNextFramePacket(uint32 &descId); - uint32 getFrameDuration(); - void init(); - - Audio::QueuingAudioStream *_audStream; - void startAudio(); - void stopAudio(); - void updateAudioBuffer(); - void readNextAudioChunk(); - uint32 getAudioChunkSampleCount(uint chunk); - int8 _audioStreamIndex; - uint _curAudioChunk; - Audio::SoundHandle _audHandle; - VideoTimestamp _audioStartOffset; - - Codec *createCodec(uint32 codecTag, byte bitsPerPixel); - Codec *findDefaultVideoCodec() const; - uint32 _nextFrameStartTime; - int8 _videoStreamIndex; - uint32 findKeyFrame(uint32 frame) const; - - Surface *_scaledSurface; - const Surface *scaleSurface(const Surface *frame); - Common::Rational getScaleFactorX() const; - Common::Rational getScaleFactorY() const; - - void pauseVideoIntern(bool pause); - - int readDefault(MOVatom atom); - int readLeaf(MOVatom atom); - int readELST(MOVatom atom); - int readHDLR(MOVatom atom); - int readMDHD(MOVatom atom); - int readMOOV(MOVatom atom); - int readMVHD(MOVatom atom); - int readTKHD(MOVatom atom); - int readTRAK(MOVatom atom); - int readSTCO(MOVatom atom); - int readSTSC(MOVatom atom); - int readSTSD(MOVatom atom); - int readSTSS(MOVatom atom); - int readSTSZ(MOVatom atom); - int readSTTS(MOVatom atom); - int readCMOV(MOVatom atom); - int readWAVE(MOVatom atom); -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/smk_decoder.cpp b/graphics/video/smk_decoder.cpp deleted file mode 100644 index e4d577acd2..0000000000 --- a/graphics/video/smk_decoder.cpp +++ /dev/null @@ -1,902 +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. - * - * $URL$ - * $Id$ - * - */ - -// Based on http://wiki.multimedia.cx/index.php?title=Smacker -// and the FFmpeg Smacker decoder (libavcodec/smacker.c), revision 16143 -// http://git.ffmpeg.org/?p=ffmpeg;a=blob;f=libavcodec/smacker.c;hb=b8437a00a2f14d4a437346455d624241d726128e - -#include "graphics/video/smk_decoder.h" - -#include "common/archive.h" -#include "common/endian.h" -#include "common/util.h" -#include "common/stream.h" -#include "common/system.h" - -#include "sound/audiostream.h" -#include "sound/mixer.h" -#include "sound/decoders/raw.h" - -namespace Graphics { - -enum SmkBlockTypes { - SMK_BLOCK_MONO = 0, - SMK_BLOCK_FULL = 1, - SMK_BLOCK_SKIP = 2, - SMK_BLOCK_FILL = 3 -}; - -/* - * class BitStream - * Little-endian bit stream provider. - */ - -class BitStream { -public: - BitStream(byte *buf, uint32 length) - : _buf(buf), _end(buf+length), _bitCount(8) { - _curByte = *_buf++; - } - - bool getBit(); - byte getBits8(); - - byte peek8() const; - void skip(int n); - -private: - byte *_buf; - byte *_end; - byte _curByte; - byte _bitCount; -}; - -bool BitStream::getBit() { - if (_bitCount == 0) { - assert(_buf < _end); - _curByte = *_buf++; - _bitCount = 8; - } - - bool v = _curByte & 1; - - _curByte >>= 1; - --_bitCount; - - return v; -} - -byte BitStream::getBits8() { - assert(_buf < _end); - - byte v = (*_buf << _bitCount) | _curByte; - _curByte = *_buf++ >> (8 - _bitCount); - - return v; -} - -byte BitStream::peek8() const { - if (_buf == _end) - return _curByte; - - assert(_buf < _end); - return (*_buf << _bitCount) | _curByte; -} - -void BitStream::skip(int n) { - assert(n <= 8); - _curByte >>= n; - - if (_bitCount >= n) { - _bitCount -= n; - } else { - assert(_buf < _end); - _bitCount = _bitCount + 8 - n; - _curByte = *_buf++ >> (8 - _bitCount); - } -} - -/* - * class SmallHuffmanTree - * A Huffman-tree to hold 8-bit values. - */ - -class SmallHuffmanTree { -public: - SmallHuffmanTree(BitStream &bs); - - uint16 getCode(BitStream &bs); -private: - enum { - SMK_NODE = 0x8000 - }; - - uint16 decodeTree(uint32 prefix, int length); - - uint16 _treeSize; - uint16 _tree[511]; - - uint16 _prefixtree[256]; - byte _prefixlength[256]; - - BitStream &_bs; -}; - -SmallHuffmanTree::SmallHuffmanTree(BitStream &bs) - : _treeSize(0), _bs(bs) { - uint32 bit = _bs.getBit(); - assert(bit); - - for (uint16 i = 0; i < 256; ++i) - _prefixtree[i] = _prefixlength[i] = 0; - - decodeTree(0, 0); - - bit = _bs.getBit(); - assert(!bit); -} - -uint16 SmallHuffmanTree::decodeTree(uint32 prefix, int length) { - if (!_bs.getBit()) { // Leaf - _tree[_treeSize] = _bs.getBits8(); - - if (length <= 8) { - for (int i = 0; i < 256; i += (1 << length)) { - _prefixtree[prefix | i] = _treeSize; - _prefixlength[prefix | i] = length; - } - } - ++_treeSize; - - return 1; - } - - uint16 t = _treeSize++; - - if (length == 8) { - _prefixtree[prefix] = t; - _prefixlength[prefix] = 8; - } - - uint16 r1 = decodeTree(prefix, length + 1); - - _tree[t] = (SMK_NODE | r1); - - uint16 r2 = decodeTree(prefix | (1 << length), length + 1); - - return r1+r2+1; -} - -uint16 SmallHuffmanTree::getCode(BitStream &bs) { - byte peek = bs.peek8(); - uint16 *p = &_tree[_prefixtree[peek]]; - bs.skip(_prefixlength[peek]); - - while (*p & SMK_NODE) { - if (bs.getBit()) - p += *p & ~SMK_NODE; - p++; - } - - return *p; -} - -/* - * class BigHuffmanTree - * A Huffman-tree to hold 16-bit values. - */ - -class BigHuffmanTree { -public: - BigHuffmanTree(BitStream &bs, int allocSize); - ~BigHuffmanTree(); - - void reset(); - uint32 getCode(BitStream &bs); -private: - enum { - SMK_NODE = 0x80000000 - }; - - uint32 decodeTree(uint32 prefix, int length); - - uint32 _treeSize; - uint32 *_tree; - uint32 _last[3]; - - uint32 _prefixtree[256]; - byte _prefixlength[256]; - - /* Used during construction */ - BitStream &_bs; - uint32 _markers[3]; - SmallHuffmanTree *_loBytes; - SmallHuffmanTree *_hiBytes; -}; - -BigHuffmanTree::BigHuffmanTree(BitStream &bs, int allocSize) - : _bs(bs) { - uint32 bit = _bs.getBit(); - if (!bit) { - _tree = new uint32[1]; - _tree[0] = 0; - _last[0] = _last[1] = _last[2] = 0; - return; - } - - for (uint32 i = 0; i < 256; ++i) - _prefixtree[i] = _prefixlength[i] = 0; - - _loBytes = new SmallHuffmanTree(_bs); - _hiBytes = new SmallHuffmanTree(_bs); - - _markers[0] = _bs.getBits8(); - _markers[0] |= (_bs.getBits8() << 8); - _markers[1] = _bs.getBits8(); - _markers[1] |= (_bs.getBits8() << 8); - _markers[2] = _bs.getBits8(); - _markers[2] |= (_bs.getBits8() << 8); - - _last[0] = _last[1] = _last[2] = 0xffffffff; - - _treeSize = 0; - _tree = new uint32[allocSize / 4]; - decodeTree(0, 0); - bit = _bs.getBit(); - assert(!bit); - - for (uint32 i = 0; i < 3; ++i) { - if (_last[i] == 0xffffffff) { - _last[i] = _treeSize; - _tree[_treeSize++] = 0; - } - } - - delete _loBytes; - delete _hiBytes; -} - -BigHuffmanTree::~BigHuffmanTree() -{ - delete[] _tree; -} - -void BigHuffmanTree::reset() { - _tree[_last[0]] = _tree[_last[1]] = _tree[_last[2]] = 0; -} - -uint32 BigHuffmanTree::decodeTree(uint32 prefix, int length) { - uint32 bit = _bs.getBit(); - - if (!bit) { // Leaf - uint32 lo = _loBytes->getCode(_bs); - uint32 hi = _hiBytes->getCode(_bs); - - uint32 v = (hi << 8) | lo; - - _tree[_treeSize] = v; - - if (length <= 8) { - for (int i = 0; i < 256; i += (1 << length)) { - _prefixtree[prefix | i] = _treeSize; - _prefixlength[prefix | i] = length; - } - } - - for (int i = 0; i < 3; ++i) { - if (_markers[i] == v) { - _last[i] = _treeSize; - _tree[_treeSize] = 0; - } - } - ++_treeSize; - - return 1; - } - - uint32 t = _treeSize++; - - if (length == 8) { - _prefixtree[prefix] = t; - _prefixlength[prefix] = 8; - } - - uint32 r1 = decodeTree(prefix, length + 1); - - _tree[t] = SMK_NODE | r1; - - uint32 r2 = decodeTree(prefix | (1 << length), length + 1); - return r1+r2+1; -} - -uint32 BigHuffmanTree::getCode(BitStream &bs) { - byte peek = bs.peek8(); - uint32 *p = &_tree[_prefixtree[peek]]; - bs.skip(_prefixlength[peek]); - - while (*p & SMK_NODE) { - if (bs.getBit()) - p += (*p) & ~SMK_NODE; - p++; - } - - uint32 v = *p; - if (v != _tree[_last[0]]) { - _tree[_last[2]] = _tree[_last[1]]; - _tree[_last[1]] = _tree[_last[0]]; - _tree[_last[0]] = v; - } - - return v; -} - -SmackerDecoder::SmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) - : _audioStarted(false), _audioStream(0), _mixer(mixer), _soundType(soundType) { - _surface = 0; - _fileStream = 0; - _dirtyPalette = false; -} - -SmackerDecoder::~SmackerDecoder() { - close(); -} - -uint32 SmackerDecoder::getElapsedTime() const { - if (_audioStream && _audioStarted) - return _mixer->getSoundElapsedTime(_audioHandle); - - return VideoDecoder::getElapsedTime(); -} - -bool SmackerDecoder::load(Common::SeekableReadStream *stream) { - close(); - - _fileStream = stream; - - // Seek to the first frame - _header.signature = _fileStream->readUint32BE(); - - // No BINK support available - if (_header.signature == MKID_BE('BIKi')) { - delete _fileStream; - _fileStream = 0; - return false; - } - - assert(_header.signature == MKID_BE('SMK2') || _header.signature == MKID_BE('SMK4')); - - uint32 width = _fileStream->readUint32LE(); - uint32 height = _fileStream->readUint32LE(); - _frameCount = _fileStream->readUint32LE(); - int32 frameRate = _fileStream->readSint32LE(); - - // framerate contains 2 digits after the comma, so 1497 is actually 14.97 fps - if (frameRate > 0) - _frameRate = Common::Rational(1000, frameRate); - else if (frameRate < 0) - _frameRate = Common::Rational(100000, -frameRate); - else - _frameRate = 1000; - - // Flags are determined by which bit is set, which can be one of the following: - // 0 - set to 1 if file contains a ring frame. - // 1 - set to 1 if file is Y-interlaced - // 2 - set to 1 if file is Y-doubled - // If bits 1 or 2 are set, the frame should be scaled to twice its height - // before it is displayed. - _header.flags = _fileStream->readUint32LE(); - - // TODO: should we do any extra processing for Smacker files with ring frames? - - // TODO: should we do any extra processing for Y-doubled videos? Are they the - // same as Y-interlaced videos? - - uint32 i; - for (i = 0; i < 7; ++i) - _header.audioSize[i] = _fileStream->readUint32LE(); - - _header.treesSize = _fileStream->readUint32LE(); - _header.mMapSize = _fileStream->readUint32LE(); - _header.mClrSize = _fileStream->readUint32LE(); - _header.fullSize = _fileStream->readUint32LE(); - _header.typeSize = _fileStream->readUint32LE(); - - for (i = 0; i < 7; ++i) { - // AudioRate - Frequency and format information for each sound track, up to 7 audio tracks. - // The 32 constituent bits have the following meaning: - // * bit 31 - indicates Huffman + DPCM compression - // * bit 30 - indicates that audio data is present for this track - // * bit 29 - 1 = 16-bit audio; 0 = 8-bit audio - // * bit 28 - 1 = stereo audio; 0 = mono audio - // * bit 27 - indicates Bink RDFT compression - // * bit 26 - indicates Bink DCT compression - // * bits 25-24 - unused - // * bits 23-0 - audio sample rate - uint32 audioInfo = _fileStream->readUint32LE(); - _header.audioInfo[i].hasAudio = audioInfo & 0x40000000; - _header.audioInfo[i].is16Bits = audioInfo & 0x20000000; - _header.audioInfo[i].isStereo = audioInfo & 0x10000000; - _header.audioInfo[i].sampleRate = audioInfo & 0xFFFFFF; - - if (audioInfo & 0x8000000) - _header.audioInfo[i].compression = kCompressionRDFT; - else if (audioInfo & 0x4000000) - _header.audioInfo[i].compression = kCompressionDCT; - else if (audioInfo & 0x80000000) - _header.audioInfo[i].compression = kCompressionDPCM; - else - _header.audioInfo[i].compression = kCompressionNone; - - if (_header.audioInfo[i].hasAudio) { - if (_header.audioInfo[i].compression == kCompressionRDFT || _header.audioInfo[i].compression == kCompressionDCT) - warning("Unhandled Smacker v2 audio compression"); - - if (i == 0) - _audioStream = Audio::makeQueuingAudioStream(_header.audioInfo[0].sampleRate, _header.audioInfo[0].isStereo); - } - } - - _header.dummy = _fileStream->readUint32LE(); - - _frameSizes = new uint32[_frameCount]; - for (i = 0; i < _frameCount; ++i) - _frameSizes[i] = _fileStream->readUint32LE(); - - _frameTypes = new byte[_frameCount]; - for (i = 0; i < _frameCount; ++i) - _frameTypes[i] = _fileStream->readByte(); - - byte *huffmanTrees = new byte[_header.treesSize]; - _fileStream->read(huffmanTrees, _header.treesSize); - - BitStream bs(huffmanTrees, _header.treesSize); - - _MMapTree = new BigHuffmanTree(bs, _header.mMapSize); - _MClrTree = new BigHuffmanTree(bs, _header.mClrSize); - _FullTree = new BigHuffmanTree(bs, _header.fullSize); - _TypeTree = new BigHuffmanTree(bs, _header.typeSize); - - delete[] huffmanTrees; - - _surface = new Graphics::Surface(); - - // Height needs to be doubled if we have flags (Y-interlaced or Y-doubled) - _surface->create(width, height * (_header.flags ? 2 : 1), 1); - - _palette = (byte *)malloc(3 * 256); - memset(_palette, 0, 3 * 256); - return true; -} - -void SmackerDecoder::close() { - if (!_fileStream) - return; - - if (_audioStarted && _audioStream) { - _mixer->stopHandle(_audioHandle); - _audioStream = 0; - _audioStarted = false; - } - - delete _fileStream; - _fileStream = 0; - - _surface->free(); - delete _surface; - _surface = 0; - - delete _MMapTree; - delete _MClrTree; - delete _FullTree; - delete _TypeTree; - - delete[] _frameSizes; - delete[] _frameTypes; - free(_palette); - - reset(); -} - -const Surface *SmackerDecoder::decodeNextFrame() { - uint i; - uint32 chunkSize = 0; - uint32 dataSizeUnpacked = 0; - - uint32 startPos = _fileStream->pos(); - - _curFrame++; - - // Check if we got a frame with palette data, and - // call back the virtual setPalette function to set - // the current palette - if (_frameTypes[_curFrame] & 1) { - unpackPalette(); - _dirtyPalette = true; - } - - // Load audio tracks - for (i = 0; i < 7; ++i) { - if (!(_frameTypes[_curFrame] & (2 << i))) - continue; - - chunkSize = _fileStream->readUint32LE(); - chunkSize -= 4; // subtract the first 4 bytes (chunk size) - - if (_header.audioInfo[i].compression == kCompressionNone) { - dataSizeUnpacked = chunkSize; - } else { - dataSizeUnpacked = _fileStream->readUint32LE(); - chunkSize -= 4; // subtract the next 4 bytes (unpacked data size) - } - - handleAudioTrack(i, chunkSize, dataSizeUnpacked); - } - - uint32 frameSize = _frameSizes[_curFrame] & ~3; -// uint32 remainder = _frameSizes[_curFrame] & 3; - - if (_fileStream->pos() - startPos > frameSize) - error("Smacker actual frame size exceeds recorded frame size"); - - uint32 frameDataSize = frameSize - (_fileStream->pos() - startPos); - - _frameData = (byte *)malloc(frameDataSize); - _fileStream->read(_frameData, frameDataSize); - - BitStream bs(_frameData, frameDataSize); - - _MMapTree->reset(); - _MClrTree->reset(); - _FullTree->reset(); - _TypeTree->reset(); - - // Height needs to be doubled if we have flags (Y-interlaced or Y-doubled) - uint doubleY = _header.flags ? 2 : 1; - - uint bw = getWidth() / 4; - uint bh = getHeight() / doubleY / 4; - uint stride = getWidth(); - uint block = 0, blocks = bw*bh; - - byte *out; - uint type, run, j, mode; - uint32 p1, p2, clr, map; - byte hi, lo; - - while (block < blocks) { - type = _TypeTree->getCode(bs); - run = getBlockRun((type >> 2) & 0x3f); - - switch (type & 3) { - case SMK_BLOCK_MONO: - while (run-- && block < blocks) { - clr = _MClrTree->getCode(bs); - map = _MMapTree->getCode(bs); - out = (byte *)_surface->pixels + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; - hi = clr >> 8; - lo = clr & 0xff; - for (i = 0; i < 4; i++) { - for (j = 0; j < doubleY; j++) { - out[0] = (map & 1) ? hi : lo; - out[1] = (map & 2) ? hi : lo; - out[2] = (map & 4) ? hi : lo; - out[3] = (map & 8) ? hi : lo; - out += stride; - } - map >>= 4; - } - ++block; - } - break; - case SMK_BLOCK_FULL: - // Smacker v2 has one mode, Smacker v4 has three - if (_header.signature == MKID_BE('SMK2')) { - mode = 0; - } else { - // 00 - mode 0 - // 10 - mode 1 - // 01 - mode 2 - mode = 0; - if (bs.getBit()) { - mode = 1; - } else if (bs.getBit()) { - mode = 2; - } - } - - while (run-- && block < blocks) { - out = (byte *)_surface->pixels + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; - switch (mode) { - case 0: - for (i = 0; i < 4; ++i) { - p1 = _FullTree->getCode(bs); - p2 = _FullTree->getCode(bs); - for (j = 0; j < doubleY; ++j) { - out[2] = p1 & 0xff; - out[3] = p1 >> 8; - out[0] = p2 & 0xff; - out[1] = p2 >> 8; - out += stride; - } - } - break; - case 1: - p1 = _FullTree->getCode(bs); - out[0] = out[1] = p1 & 0xFF; - out[2] = out[3] = p1 >> 8; - out += stride; - out[0] = out[1] = p1 & 0xFF; - out[2] = out[3] = p1 >> 8; - out += stride; - p2 = _FullTree->getCode(bs); - out[0] = out[1] = p2 & 0xFF; - out[2] = out[3] = p2 >> 8; - out += stride; - out[0] = out[1] = p2 & 0xFF; - out[2] = out[3] = p2 >> 8; - out += stride; - break; - case 2: - for (i = 0; i < 2; i++) { - // We first get p2 and then p1 - // Check ffmpeg thread "[PATCH] Smacker video decoder bug fix" - // http://article.gmane.org/gmane.comp.video.ffmpeg.devel/78768 - p2 = _FullTree->getCode(bs); - p1 = _FullTree->getCode(bs); - for (j = 0; j < doubleY; ++j) { - out[0] = p1 & 0xff; - out[1] = p1 >> 8; - out[2] = p2 & 0xff; - out[3] = p2 >> 8; - out += stride; - } - for (j = 0; j < doubleY; ++j) { - out[0] = p1 & 0xff; - out[1] = p1 >> 8; - out[2] = p2 & 0xff; - out[3] = p2 >> 8; - out += stride; - } - } - break; - } - ++block; - } - break; - case SMK_BLOCK_SKIP: - while (run-- && block < blocks) - block++; - break; - case SMK_BLOCK_FILL: - uint32 col; - mode = type >> 8; - while (run-- && block < blocks) { - out = (byte *)_surface->pixels + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; - col = mode * 0x01010101; - for (i = 0; i < 4 * doubleY; ++i) { - out[0] = out[1] = out[2] = out[3] = col; - out += stride; - } - ++block; - } - break; - } - } - - _fileStream->seek(startPos + frameSize); - - free(_frameData); - - if (_curFrame == 0) - _startTime = g_system->getMillis(); - - return _surface; -} - -void SmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize) { - if (_header.audioInfo[track].hasAudio && chunkSize > 0 && track == 0) { - // If it's track 0, play the audio data - byte *soundBuffer = (byte *)malloc(chunkSize); - - _fileStream->read(soundBuffer, chunkSize); - - if (_header.audioInfo[track].compression == kCompressionRDFT || _header.audioInfo[track].compression == kCompressionDCT) { - // TODO: Compressed audio (Bink RDFT/DCT encoded) - free(soundBuffer); - return; - } else if (_header.audioInfo[track].compression == kCompressionDPCM) { - // Compressed audio (Huffman DPCM encoded) - queueCompressedBuffer(soundBuffer, chunkSize, unpackedSize, track); - free(soundBuffer); - } else { - // Uncompressed audio (PCM) - byte flags = 0; - if (_header.audioInfo[track].is16Bits) - flags = flags | Audio::FLAG_16BITS; - if (_header.audioInfo[track].isStereo) - flags = flags | Audio::FLAG_STEREO; - - _audioStream->queueBuffer(soundBuffer, chunkSize, DisposeAfterUse::YES, flags); - // The sound buffer will be deleted by QueuingAudioStream - } - - if (!_audioStarted) { - _mixer->playStream(_soundType, &_audioHandle, _audioStream, -1, 255); - _audioStarted = true; - } - } else { - // Ignore the rest of the audio tracks, if they exist - // TODO: Are there any Smacker videos with more than one audio stream? - // If yes, we should play the rest of the audio streams as well - if (chunkSize > 0) - _fileStream->skip(chunkSize); - } -} - -void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize, - uint32 unpackedSize, int streamNum) { - - BitStream audioBS(buffer, bufferSize); - bool dataPresent = audioBS.getBit(); - - if (!dataPresent) - return; - - bool isStereo = audioBS.getBit(); - assert(isStereo == _header.audioInfo[streamNum].isStereo); - bool is16Bits = audioBS.getBit(); - assert(is16Bits == _header.audioInfo[streamNum].is16Bits); - - int numBytes = 1 * (isStereo ? 2 : 1) * (is16Bits ? 2 : 1); - - byte *unpackedBuffer = (byte *)malloc(unpackedSize); - byte *curPointer = unpackedBuffer; - uint32 curPos = 0; - - SmallHuffmanTree *audioTrees[4]; - for (int k = 0; k < numBytes; k++) - audioTrees[k] = new SmallHuffmanTree(audioBS); - - // Base values, stored as big endian - - int32 bases[2]; - - if (isStereo) { - if (is16Bits) { - byte hi = audioBS.getBits8(); - byte lo = audioBS.getBits8(); - bases[1] = (int16) ((hi << 8) | lo); - } else { - bases[1] = audioBS.getBits8(); - } - } - - if (is16Bits) { - byte hi = audioBS.getBits8(); - byte lo = audioBS.getBits8(); - bases[0] = (int16) ((hi << 8) | lo); - } else { - bases[0] = audioBS.getBits8(); - } - - // The bases are the first samples, too - for (int i = 0; i < (isStereo ? 2 : 1); i++, curPointer += (is16Bits ? 2 : 1), curPos += (is16Bits ? 2 : 1)) { - if (is16Bits) - WRITE_BE_UINT16(curPointer, bases[i]); - else - *curPointer = (bases[i] & 0xFF) ^ 0x80; - } - - // Next follow the deltas, which are added to the corresponding base values and - // are stored as little endian - // We store the unpacked bytes in big endian format - - while (curPos < unpackedSize) { - // If the sample is stereo, the data is stored for the left and right channel, respectively - // (the exact opposite to the base values) - if (!is16Bits) { - for (int k = 0; k < (isStereo ? 2 : 1); k++) { - bases[k] += (int8) ((int16) audioTrees[k]->getCode(audioBS)); - *curPointer++ = CLIP(bases[k], 0, 255) ^ 0x80; - curPos++; - } - } else { - for (int k = 0; k < (isStereo ? 2 : 1); k++) { - byte lo = audioTrees[k * 2]->getCode(audioBS); - byte hi = audioTrees[k * 2 + 1]->getCode(audioBS); - bases[k] += (int16) (lo | (hi << 8)); - - WRITE_BE_UINT16(curPointer, bases[k]); - curPointer += 2; - curPos += 2; - } - } - - } - - for (int k = 0; k < numBytes; k++) - delete audioTrees[k]; - - byte flags = 0; - if (_header.audioInfo[0].is16Bits) - flags = flags | Audio::FLAG_16BITS; - if (_header.audioInfo[0].isStereo) - flags = flags | Audio::FLAG_STEREO; - _audioStream->queueBuffer(unpackedBuffer, unpackedSize, DisposeAfterUse::YES, flags); - // unpackedBuffer will be deleted by QueuingAudioStream -} - -void SmackerDecoder::unpackPalette() { - uint startPos = _fileStream->pos(); - uint32 len = 4 * _fileStream->readByte(); - - byte *chunk = (byte *)malloc(len); - _fileStream->read(&chunk[0], len); - byte *p = &chunk[0]; - - byte oldPalette[3*256]; - memcpy(oldPalette, _palette, 3 * 256); - - byte *pal = _palette; - - int sz = 0; - byte b0; - while (sz < 256) { - b0 = *p++; - if (b0 & 0x80) { // if top bit is 1 (0x80 = 10000000) - sz += (b0 & 0x7f) + 1; // get lower 7 bits + 1 (0x7f = 01111111) - pal += 3 * ((b0 & 0x7f) + 1); - } else if (b0 & 0x40) { // if top 2 bits are 01 (0x40 = 01000000) - byte c = (b0 & 0x3f) + 1; // get lower 6 bits + 1 (0x3f = 00111111) - uint s = 3 * *p++; - sz += c; - - while (c--) { - *pal++ = oldPalette[s + 0]; - *pal++ = oldPalette[s + 1]; - *pal++ = oldPalette[s + 2]; - s += 3; - } - } else { // top 2 bits are 00 - sz++; - // get the lower 6 bits for each component (0x3f = 00111111) - byte b = b0 & 0x3f; - byte g = (*p++) & 0x3f; - byte r = (*p++) & 0x3f; - - assert(g < 0xc0 && b < 0xc0); - - // upscale to full 8-bit color values by multiplying by 4 - *pal++ = b * 4; - *pal++ = g * 4; - *pal++ = r * 4; - } - } - - _fileStream->seek(startPos + len); - free(chunk); -} - -} // End of namespace Graphics diff --git a/graphics/video/smk_decoder.h b/graphics/video/smk_decoder.h deleted file mode 100644 index b441d1d64d..0000000000 --- a/graphics/video/smk_decoder.h +++ /dev/null @@ -1,143 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_SMK_PLAYER_H -#define GRAPHICS_VIDEO_SMK_PLAYER_H - -#include "graphics/video/video_decoder.h" -#include "sound/mixer.h" - -namespace Audio { - class QueuingAudioStream; -} - -namespace Graphics { - -class BigHuffmanTree; - -/** - * Decoder for Smacker v2/v4 videos. - * - * Based on http://wiki.multimedia.cx/index.php?title=Smacker - * and the FFmpeg Smacker decoder (libavcodec/smacker.c), revision 16143 - * http://svn.ffmpeg.org/ffmpeg/trunk/libavcodec/smacker.c?revision=16143&view=markup - * - * Video decoder used in engines: - * - agos - * - saga - * - scumm (he) - * - sword1 - * - sword2 - * - toon - */ -class SmackerDecoder : public FixedRateVideoDecoder { -public: - SmackerDecoder(Audio::Mixer *mixer, - Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType); - virtual ~SmackerDecoder(); - - bool load(Common::SeekableReadStream *stream); - void close(); - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _surface->w; } - uint16 getHeight() const { return _surface->h; } - uint32 getFrameCount() const { return _frameCount; } - uint32 getElapsedTime() const; - const Surface *decodeNextFrame(); - PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } - virtual void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize); - -protected: - Common::Rational getFrameRate() const { return _frameRate; } - Common::SeekableReadStream *_fileStream; - -protected: - void unpackPalette(); - // Possible runs of blocks - uint getBlockRun(int index) { return (index <= 58) ? index + 1 : 128 << (index - 59); } - void queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize, int streamNum); - - enum AudioCompression { - kCompressionNone, - kCompressionDPCM, - kCompressionRDFT, - kCompressionDCT - }; - - struct AudioInfo { - AudioCompression compression; - bool hasAudio; - bool is16Bits; - bool isStereo; - uint32 sampleRate; - }; - - struct { - uint32 signature; - uint32 flags; - uint32 audioSize[7]; - uint32 treesSize; - uint32 mMapSize; - uint32 mClrSize; - uint32 fullSize; - uint32 typeSize; - AudioInfo audioInfo[7]; - uint32 dummy; - } _header; - - uint32 *_frameSizes; - // The FrameTypes section of a Smacker file contains an array of bytes, where - // the 8 bits of each byte describe the contents of the corresponding frame. - // The highest 7 bits correspond to audio frames (bit 7 is track 6, bit 6 track 5 - // and so on), so there can be up to 7 different audio tracks. When the lowest bit - // (bit 0) is set, it denotes a frame that contains a palette record - byte *_frameTypes; - byte *_frameData; - // The RGB palette - byte *_palette; - bool _dirtyPalette; - - Common::Rational _frameRate; - uint32 _frameCount; - Surface *_surface; - - Audio::Mixer::SoundType _soundType; - Audio::Mixer *_mixer; - bool _audioStarted; - Audio::QueuingAudioStream *_audioStream; - Audio::SoundHandle _audioHandle; - - BigHuffmanTree *_MMapTree; - BigHuffmanTree *_MClrTree; - BigHuffmanTree *_FullTree; - BigHuffmanTree *_TypeTree; -}; - -} // End of namespace Graphics - -#endif diff --git a/graphics/video/video_decoder.cpp b/graphics/video/video_decoder.cpp deleted file mode 100644 index 81a8aecb30..0000000000 --- a/graphics/video/video_decoder.cpp +++ /dev/null @@ -1,141 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "graphics/video/video_decoder.h" - -#include "common/file.h" -#include "common/system.h" - -namespace Graphics { - -VideoDecoder::VideoDecoder() { - reset(); -} - -bool VideoDecoder::loadFile(const Common::String &filename) { - Common::File *file = new Common::File(); - - if (!file->open(filename)) { - delete file; - return false; - } - - return load(file); -} - -uint32 VideoDecoder::getElapsedTime() const { - return g_system->getMillis() - _startTime; -} - -void VideoDecoder::setSystemPalette() { - const byte *vidPalette = getPalette(); - byte *sysPalette = new byte[256 * 4]; - - for (uint16 i = 0; i < 256; i++) { - sysPalette[i * 4] = vidPalette[i * 3]; - sysPalette[i * 4 + 1] = vidPalette[i * 3 + 1]; - sysPalette[i * 4 + 2] = vidPalette[i * 3 + 2]; - sysPalette[i * 4 + 3] = 0; - } - - g_system->setPalette(sysPalette, 0, 256); - delete[] sysPalette; -} - -bool VideoDecoder::needsUpdate() const { - return !endOfVideo() && getTimeToNextFrame() == 0; -} - -void VideoDecoder::reset() { - _curFrame = -1; - _startTime = 0; - _pauseLevel = 0; -} - -bool VideoDecoder::endOfVideo() const { - return !isVideoLoaded() || (getCurFrame() >= (int32)getFrameCount() - 1); -} - -void VideoDecoder::pauseVideo(bool pause) { - if (pause) { - _pauseLevel++; - - // We can't go negative - } else if (_pauseLevel) { - _pauseLevel--; - - // Do nothing - } else { - return; - } - - if (_pauseLevel == 1 && pause) { - _pauseStartTime = g_system->getMillis(); // Store the starting time from pausing to keep it for later - pauseVideoIntern(true); - } else if (_pauseLevel == 0) { - pauseVideoIntern(false); - addPauseTime(g_system->getMillis() - _pauseStartTime); - } -} - -void VideoDecoder::resetPauseStartTime() { - if (isPaused()) - _pauseStartTime = g_system->getMillis(); -} - -uint32 FixedRateVideoDecoder::getTimeToNextFrame() const { - if (endOfVideo() || _curFrame < 0) - return 0; - - uint32 elapsedTime = getElapsedTime(); - uint32 nextFrameStartTime = getFrameBeginTime(_curFrame + 1); - - // If the time that the next frame should be shown has past - // the frame should be shown ASAP. - if (nextFrameStartTime <= elapsedTime) - return 0; - - return nextFrameStartTime - elapsedTime; -} - -uint32 FixedRateVideoDecoder::getFrameBeginTime(uint32 frame) const { - Common::Rational beginTime = frame * 1000; - beginTime /= getFrameRate(); - return beginTime.toInt(); -} - -VideoTimestamp::VideoTimestamp() : _units(0), _scale(1) { -} - -VideoTimestamp::VideoTimestamp(uint units, uint scale) : _units(units), _scale(scale) { - assert(_scale); -} - -uint VideoTimestamp::getUnitsInScale(uint scale) const { - assert(scale); - return (_scale == scale) ? _units : _units * scale / _scale; -} - -} // End of namespace Graphics diff --git a/graphics/video/video_decoder.h b/graphics/video/video_decoder.h deleted file mode 100644 index 402bcfe751..0000000000 --- a/graphics/video/video_decoder.h +++ /dev/null @@ -1,290 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GRAPHICS_VIDEO_DECODER_H -#define GRAPHICS_VIDEO_DECODER_H - -#include "common/events.h" -#include "common/list.h" -#include "common/rational.h" - -#include "graphics/surface.h" -#include "graphics/pixelformat.h" - -namespace Common { - class SeekableReadStream; -} - -namespace Graphics { - -/** - * Implementation of a generic video decoder - */ -class VideoDecoder { -public: - VideoDecoder(); - virtual ~VideoDecoder() {} - - /** - * Returns the width of the video - * @return the width of the video - */ - virtual uint16 getWidth() const = 0; - - /** - * Returns the height of the video - * @return the height of the video - */ - virtual uint16 getHeight() const = 0; - - /** - * Returns the current frame number of the video - * @return the last frame decoded by the video - */ - virtual int32 getCurFrame() const { return _curFrame; } - - /** - * Returns the amount of frames in the video - * @return the amount of frames in the video - */ - virtual uint32 getFrameCount() const = 0; - - /** - * Returns the time (in ms) that the video has been running - */ - virtual uint32 getElapsedTime() const; - - /** - * Returns whether a frame should be decoded or not - * @return whether a frame should be decoded or not - */ - virtual bool needsUpdate() const; - - /** - * Load a video file - * @param filename the filename to load - */ - virtual bool loadFile(const Common::String &filename); - - /** - * Load a video file - * @param stream the stream to load - */ - virtual bool load(Common::SeekableReadStream *stream) = 0; - - /** - * Close a video file - */ - virtual void close() = 0; - - /** - * Returns if a video file is loaded or not - */ - virtual bool isVideoLoaded() const = 0; - - /** - * Decode the next frame and return the frame's surface - * @note the return surface should *not* be freed - * @note this may return 0, in which case the last frame should be kept on screen - */ - virtual const Surface *decodeNextFrame() = 0; - - /** - * Get the pixel format of the video - */ - virtual PixelFormat getPixelFormat() const = 0; - - /** - * Get the palette for the video in RGB format (if 8bpp or less) - */ - virtual const byte *getPalette() { return 0; } - - /** - * Returns if the palette is dirty or not - */ - virtual bool hasDirtyPalette() const { return false; } - - /** - * Returns if the video is finished or not - */ - virtual bool endOfVideo() const; - - /** - * Set the current palette to the system palette - */ - void setSystemPalette(); - - /** - * Return the time until the next frame (in ms) - */ - virtual uint32 getTimeToNextFrame() const = 0; - - /** - * Pause or resume the video. This should stop/resume any audio playback - * and other stuff. The initial pause time is kept so that any timing - * variables can be updated appropriately. - * - * This is a convenience tracker which automatically keeps track on how - * often the video has been paused, ensuring that after pausing an video - * e.g. twice, it has to be unpaused twice before actuallying resuming. - * - * @param pause true to pause the video, false to resume it - */ - void pauseVideo(bool pause); - - /** - * Return whether the video is currently paused or not. - */ - bool isPaused() const { return _pauseLevel != 0; } - -protected: - /** - * Resets _curFrame and _startTime. Should be called from every close() function. - */ - void reset(); - - /** - * Actual implementation of pause by subclasses. See pause() - * for details. - */ - virtual void pauseVideoIntern(bool pause) {} - - /** - * Add the time the video has been paused to maintain sync - */ - virtual void addPauseTime(uint32 ms) { _startTime += ms; } - - /** - * Reset the pause start time (which should be called when seeking) - */ - void resetPauseStartTime(); - - int32 _curFrame; - int32 _startTime; - -private: - uint32 _pauseLevel; - uint32 _pauseStartTime; -}; - -/** - * A VideoDecoder wrapper that implements getTimeToNextFrame() based on getFrameRate(). - */ -class FixedRateVideoDecoder : public virtual VideoDecoder { -public: - uint32 getTimeToNextFrame() const; - -protected: - /** - * Return the frame rate in frames per second - * This returns a Rational because videos can have rates that are not integers and - * there are some videos with frame rates < 1. - */ - virtual Common::Rational getFrameRate() const = 0; - -private: - uint32 getFrameBeginTime(uint32 frame) const; -}; - -/** - * A VideoDecoder that can rewind back to the beginning. - */ -class RewindableVideoDecoder : public virtual VideoDecoder { -public: - /** - * Rewind to the beginning of the video. - */ - virtual void rewind() = 0; -}; - -/** - * A simple video timestamp that holds time according to a specific scale. - * - * The scale is in terms of 1/x. For example, if you set units to 1 and the scale to - * 1000, the timestamp will hold the value of 1/1000s or 1ms. - */ -class VideoTimestamp { -public: - VideoTimestamp(); - VideoTimestamp(uint units, uint scale = 1000); - - /** - * Get the units in terms of _scale - */ - uint getUnits() const { return _units; } - - /** - * Get the scale of this timestamp - */ - uint getScale() const { return _scale; } - - /** - * Get the value of the units in terms of the specified scale - */ - uint getUnitsInScale(uint scale) const; - - // TODO: Simple comparisons (<, <=, >, >=, ==, !=) - -private: - uint _units, _scale; -}; - -/** - * A VideoDecoder that can seek to a frame or point in time. - */ -class SeekableVideoDecoder : public virtual RewindableVideoDecoder { -public: - /** - * Seek to the frame specified - * If seekToFrame(0) is called, frame 0 will be decoded next in decodeNextFrame() - */ - virtual void seekToFrame(uint32 frame) = 0; - - /** - * Seek to the time specified - * - * This will round to the previous frame showing. If the time would happen to - * land while a frame is showing, this function will seek to the beginning of that - * frame. In other words, there is *no* subframe accuracy. This may change in a - * later revision of the API. - */ - virtual void seekToTime(VideoTimestamp time) = 0; - - /** - * Seek to the frame specified (in ms) - * - * See seekToTime(VideoTimestamp) - */ - void seekToTime(uint32 time) { seekToTime(VideoTimestamp(time)); } - - /** - * Implementation of RewindableVideoDecoder::rewind() - */ - virtual void rewind() { seekToTime(0); } -}; - -} // End of namespace Graphics - -#endif -- cgit v1.2.3