aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/smush
diff options
context:
space:
mode:
authorMax Horn2011-04-13 11:40:47 +0200
committerMax Horn2011-04-13 11:49:25 +0200
commitb52b6b8d2b5f038717c008362a9e11009dbf88d8 (patch)
tree005a6b5be4a471d133dfa736b157876b74ce6188 /engines/scumm/smush
parent29962bfc73879845da8c58e31f75d53ff51bd10b (diff)
downloadscummvm-rg350-b52b6b8d2b5f038717c008362a9e11009dbf88d8.tar.gz
scummvm-rg350-b52b6b8d2b5f038717c008362a9e11009dbf88d8.tar.bz2
scummvm-rg350-b52b6b8d2b5f038717c008362a9e11009dbf88d8.zip
SCUMM: Resolve some code duplication
Diffstat (limited to 'engines/scumm/smush')
-rw-r--r--engines/scumm/smush/imuse_channel.cpp23
1 files changed, 3 insertions, 20 deletions
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) {