diff options
-rw-r--r-- | engines/scumm/imuse_digi/dimuse.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_bndmgr.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_bndmgr.h | 8 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_codecs.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_codecs.h | 42 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 3 | ||||
-rw-r--r-- | engines/scumm/smush/imuse_channel.cpp | 23 |
7 files changed, 50 insertions, 29 deletions
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index 516a0497fa..3831689def 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -31,6 +31,7 @@ #include "scumm/sound.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_codecs.h" #include "scumm/imuse_digi/dimuse_track.h" #include "audio/audiostream.h" diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp index 1e526aa6d1..cb894d77cc 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -28,6 +28,7 @@ #include "scumm/util.h" #include "scumm/file.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_codecs.h" namespace Scumm { diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.h b/engines/scumm/imuse_digi/dimuse_bndmgr.h index a78697a854..bed1ac6549 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.h @@ -107,14 +107,6 @@ public: int32 decompressSampleByCurIndex(int32 offset, int32 size, byte **compFinal, int headerSize, bool headerOutside); }; -namespace BundleCodecs { - -uint32 decode12BitsSample(const byte *src, byte **dst, uint32 size); -void initializeImcTables(); -int32 decompressCodec(int32 codec, byte *compInput, byte *compOutput, int32 inputSize); - -} // End of namespace BundleCodecs - } // End of namespace Scumm #endif diff --git a/engines/scumm/imuse_digi/dimuse_codecs.cpp b/engines/scumm/imuse_digi/dimuse_codecs.cpp index 99fff4e4c3..df4c9d97dc 100644 --- a/engines/scumm/imuse_digi/dimuse_codecs.cpp +++ b/engines/scumm/imuse_digi/dimuse_codecs.cpp @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/endian.h" #include "common/util.h" +#include "scumm/imuse_digi/dimuse_codecs.h" namespace Scumm { diff --git a/engines/scumm/imuse_digi/dimuse_codecs.h b/engines/scumm/imuse_digi/dimuse_codecs.h new file mode 100644 index 0000000000..81158fafc9 --- /dev/null +++ b/engines/scumm/imuse_digi/dimuse_codecs.h @@ -0,0 +1,42 @@ +/* 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 SCUMM_IMUSE_DIGI_CODECS_H +#define SCUMM_IMUSE_DIGI_CODECS_H + +#include "common/scummsys.h" + +namespace Scumm { + +namespace BundleCodecs { + +uint32 decode12BitsSample(const byte *src, byte **dst, uint32 size); +void initializeImcTables(); +int32 decompressCodec(int32 codec, byte *compInput, byte *compOutput, int32 inputSize); + +} // End of namespace BundleCodecs + +} // End of namespace Scumm + +#endif diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 3fcfc62810..13f8a60332 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -34,8 +34,9 @@ #include "scumm/scumm.h" #include "scumm/util.h" #include "scumm/imuse_digi/dimuse.h" -#include "scumm/imuse_digi/dimuse_sndmgr.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_codecs.h" +#include "scumm/imuse_digi/dimuse_sndmgr.h" namespace Scumm { diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp index 5af3c9ee8e..32fa99a870 100644 --- a/engines/scumm/smush/imuse_channel.cpp +++ b/engines/scumm/smush/imuse_channel.cpp @@ -29,6 +29,7 @@ #include "scumm/scumm.h" // For DEBUG_SMUSH #include "scumm/util.h" #include "scumm/smush/channel.h" +#include "scumm/imuse_digi/dimuse_codecs.h" // for decode12BitsSample namespace Scumm { @@ -171,28 +172,10 @@ void ImuseChannel::decode() { } } - // FIXME: Code duplication! See decode12BitsSample() in imuse_digi/dimuse_codecs.cpp - - int loop_size = _sbufferSize / 3; - int new_size = loop_size * 4; - byte *keep, *decoded; - uint32 value; - keep = decoded = (byte *)malloc(new_size); - assert(keep); - unsigned char * source = _sbuffer; - - while (loop_size--) { - byte v1 = *source++; - byte v2 = *source++; - byte v3 = *source++; - value = ((((v2 & 0x0f) << 8) | v1) << 4) - 0x8000; - WRITE_BE_UINT16(decoded, value); decoded += 2; - value = ((((v2 & 0xf0) << 4) | v3) << 4) - 0x8000; - WRITE_BE_UINT16(decoded, value); decoded += 2; - } + byte *keep; + _sbufferSize = BundleCodecs::decode12BitsSample(_sbuffer, &keep, _sbufferSize); free(_sbuffer); _sbuffer = (byte *)keep; - _sbufferSize = new_size; } bool ImuseChannel::handleSubTags(int32 &offset) { |