diff options
author | Thomas Fach-Pedersen | 2013-05-28 00:58:10 +0200 |
---|---|---|
committer | Thomas Fach-Pedersen | 2013-05-28 00:58:10 +0200 |
commit | c3de517fb427c681415680daa0e3c5b4f087e095 (patch) | |
tree | d46b5792ba03d4382b8330b5ce54f5c347146a3a /video/smk_decoder.cpp | |
parent | d409d07677162878ae1c44f8d6ca8995896a72ac (diff) | |
download | scummvm-rg350-c3de517fb427c681415680daa0e3c5b4f087e095.tar.gz scummvm-rg350-c3de517fb427c681415680daa0e3c5b4f087e095.tar.bz2 scummvm-rg350-c3de517fb427c681415680daa0e3c5b4f087e095.zip |
VIDEO: Wrap 8-bit smacker audio properly
The accumulator 'bases' is 16-bit but when used in 8-bit audio we need to
wrap as if 'bases' is 8-bit. Clipping on output is no longer required.
This fixes noise in The Neverhood's in-game "making of" videos,
particularly the section called "Construction, powertools & painting",
hash 0x21080009.
The intro video in The Neverhood is 16-bit audio and was not affected by
this bug. No other videos or games have been tested.
Diffstat (limited to 'video/smk_decoder.cpp')
-rw-r--r-- | video/smk_decoder.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp index 4e18268e72..b622a0ab61 100644 --- a/video/smk_decoder.cpp +++ b/video/smk_decoder.cpp @@ -821,8 +821,9 @@ void SmackerDecoder::SmackerAudioTrack::queueCompressedBuffer(byte *buffer, uint // (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<int>(bases[k], 0, 255) ^ 0x80; + int8 delta = (int8) ((int16) audioTrees[k]->getCode(audioBS)); + bases[k] = (bases[k] + delta) & 0xFF; + *curPointer++ = bases[k] ^ 0x80; curPos++; } } else { |