[Scummvm-cvs-logs] SF.net SVN: scummvm:[35391] scummvm/trunk
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Dec 16 10:56:21 CET 2008
Revision: 35391
http://scummvm.svn.sourceforge.net/scummvm/?rev=35391&view=rev
Author: thebluegr
Date: 2008-12-16 09:56:21 +0000 (Tue, 16 Dec 2008)
Log Message:
-----------
- Added some comments
- Removed _paletteDidChange, as the virtual setPalette() function is called back on every palette change
- Some cleanup
- Removed unused/unneeded functions and variables
- Changed _frameTypes to hold bytes instead of 32-bit integers (since frame types are held within a byte)
Modified Paths:
--------------
scummvm/trunk/engines/scumm/he/animation_he.cpp
scummvm/trunk/graphics/smk_player.cpp
scummvm/trunk/graphics/smk_player.h
Modified: scummvm/trunk/engines/scumm/he/animation_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/animation_he.cpp 2008-12-16 08:37:24 UTC (rev 35390)
+++ scummvm/trunk/engines/scumm/he/animation_he.cpp 2008-12-16 09:56:21 UTC (rev 35391)
@@ -92,7 +92,7 @@
_vm->markRectAsDirty(kMainVirtScreen, 0, 0, getWidth(), getHeight());
}
- if (getCurFrame() == _framesCount) {
+ if (getCurFrame() == getFrameCount()) {
closeFile();
}
}
Modified: scummvm/trunk/graphics/smk_player.cpp
===================================================================
--- scummvm/trunk/graphics/smk_player.cpp 2008-12-16 08:37:24 UTC (rev 35390)
+++ scummvm/trunk/graphics/smk_player.cpp 2008-12-16 09:56:21 UTC (rev 35391)
@@ -138,7 +138,7 @@
int SmallHuffmanTree::decodeTree(int length) {
if (!_bs.getBit()) { // Leaf
- uint16 v = _bs.getBits8(); // was uint32
+ uint16 v = _bs.getBits8();
_tree.push_back(v);
return 1;
@@ -340,7 +340,7 @@
int32 SMKPlayer::getFrameCount() {
if (!_fileStream)
return 0;
- return _framesCount;
+ return _header.frames;
}
int32 SMKPlayer::getFrameRate() {
@@ -372,7 +372,6 @@
_header.width = _fileStream->readUint32LE();
_header.height = _fileStream->readUint32LE();
_header.frames = _fileStream->readUint32LE();
- _framesCount = _header.frames;
_header.frameRate = (int32)_fileStream->readUint32LE();
_header.flags = _fileStream->readUint32LE();
@@ -395,7 +394,7 @@
for (i = 0; i < _header.frames; ++i)
_frameSizes[i] = _fileStream->readUint32LE();
- _frameTypes = (uint32 *)malloc(_header.frames * sizeof(uint32));
+ _frameTypes = (byte *)malloc(_header.frames);
for (i = 0; i < _header.frames; ++i)
_frameTypes[i] = _fileStream->readByte();
@@ -455,10 +454,11 @@
uint32 startPos = _fileStream->pos();
- _paletteDidChange = false;
+ // Check if we got a frame with palette data, and
+ // call back the virtual setPalette function to set
+ // the current palette
if (_frameTypes[_currentSMKFrame] & 1) {
unpackPalette();
- _paletteDidChange = true;
setPalette(_palette);
}
@@ -511,7 +511,7 @@
while (run-- && block < blocks) {
clr = _MClrTree->getCode(bs);
map = _MMapTree->getCode(bs);
- out = getCurSMKImage() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4;
+ out = _image + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4;
hi = clr >> 8;
lo = clr & 0xff;
for (i = 0; i < 4; i++) {
@@ -544,7 +544,7 @@
}
while (run-- && block < blocks) {
- out = getCurSMKImage() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4;
+ out = _image + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4;
switch (mode) {
case 0:
for (i = 0; i < 4; ++i) {
@@ -578,7 +578,7 @@
case 2:
for(i = 0; i < 2; i++) {
// We first get p2 and then p1
- // Check thread "[PATCH] Smacker video decoder bug fix"
+ // 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);
@@ -610,7 +610,7 @@
uint32 col;
mode = type >> 8;
while (run-- && block < blocks) {
- out = getCurSMKImage() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4;
+ out = _image + (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;
Modified: scummvm/trunk/graphics/smk_player.h
===================================================================
--- scummvm/trunk/graphics/smk_player.h 2008-12-16 08:37:24 UTC (rev 35390)
+++ scummvm/trunk/graphics/smk_player.h 2008-12-16 09:56:21 UTC (rev 35391)
@@ -110,12 +110,6 @@
*/
bool decodeNextFrame();
- byte *getCurSMKImage() { return _image; }
- bool paletteDidChange() { return _paletteDidChange; }
- byte *palette() { return _palette; }
-
- uint16 _framesCount;
-
Common::SeekableReadStream *_fileStream;
private:
@@ -141,7 +135,12 @@
} _header;
uint32 *_frameSizes;
- uint32 *_frameTypes;
+ // 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;
BigHuffmanTree *_MMapTree;
BigHuffmanTree *_MClrTree;
@@ -151,7 +150,6 @@
byte *_frameData;
byte *_image;
- bool _paletteDidChange;
byte *_palette;
// Possible runs of blocks
uint getBlockRun(int index) { return (index <= 58) ? index + 1 : 128 << (index - 59); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list