aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/coktelvideo.cpp
diff options
context:
space:
mode:
authorSven Hesse2008-12-11 03:06:43 +0000
committerSven Hesse2008-12-11 03:06:43 +0000
commitc7fa7f888ac8d3dac31bba9ff93bb54f917ea9fe (patch)
treef93a5bf2535809ef184770e55deaad992862c477 /engines/gob/coktelvideo.cpp
parentc7094e20df6b4dfb497e16e5d1d06456f82e01d0 (diff)
downloadscummvm-rg350-c7fa7f888ac8d3dac31bba9ff93bb54f917ea9fe.tar.gz
scummvm-rg350-c7fa7f888ac8d3dac31bba9ff93bb54f917ea9fe.tar.bz2
scummvm-rg350-c7fa7f888ac8d3dac31bba9ff93bb54f917ea9fe.zip
On second thought, an octree only works if the color to look up is in the palette.
So using a table-based approach to find the nearest color now, using only the upper 6 bits to stop the table from getting too large. It still takes noticeable time to build it. :/ But as a result, the video actually looks okay now... svn-id: r35298
Diffstat (limited to 'engines/gob/coktelvideo.cpp')
-rw-r--r--engines/gob/coktelvideo.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp
index aa265432a7..555ce1612c 100644
--- a/engines/gob/coktelvideo.cpp
+++ b/engines/gob/coktelvideo.cpp
@@ -72,7 +72,6 @@ bool Imd::load(Common::SeekableReadStream &stream) {
// Palette
_stream->read((byte *) _palette, 768);
- notifyChangedPalette();
// Standard coordinates
if (_version >= 3) {
@@ -198,11 +197,6 @@ void Imd::setFrameRate(int16 frameRate) {
_frameLength = 1000 / _frameRate;
}
-void Imd::setPalette(const byte *palette) {
- memcpy(_palette, palette, 768);
- notifyChangedPalette();
-}
-
void Imd::setXY(int16 x, int16 y) {
// Adjusting the standard coordinates
if (_stdX != -1) {
@@ -588,8 +582,6 @@ CoktelVideo::State Imd::processFrame(uint16 frame) {
state.flags |= kStatePalette;
_stream->read(_palette, 768);
- notifyChangedPalette();
-
cmd = _stream->readUint16LE();
}
@@ -681,7 +673,6 @@ uint32 Imd::renderFrame(int16 left, int16 top, int16 right, int16 bottom) {
int index = *dataPtr++;
// 16 entries with each 3 bytes (RGB)
memcpy(_palette + index * 3, dataPtr, MIN((255 - index) * 3, 48));
- notifyChangedPalette();
retVal = kStatePalette;
dataPtr += 48;
@@ -879,7 +870,7 @@ const uint16 Vmd::_tableDPCM[128] = {
0x0F00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x3000, 0x4000
};
-Vmd::Vmd() {
+Vmd::Vmd(PaletteLUT *palLUT) : _palLUT(palLUT) {
clear(false);
}
@@ -924,7 +915,8 @@ bool Vmd::load(Common::SeekableReadStream &stream) {
if ((_width != 0) && (_height != 0)) {
_hasVideo = true;
_features |= kFeaturesVideo;
- _codecIndeo3 = new Indeo3(_width, _height);
+ if (_features & kFeaturesFullColor)
+ _codecIndeo3 = new Indeo3(_width, _height, _palLUT);
} else
_hasVideo = false;
@@ -955,7 +947,6 @@ bool Vmd::load(Common::SeekableReadStream &stream) {
// 0x1A (26)
_stream->read((byte *) _palette, 768);
- notifyChangedPalette();
// 0x31A (794)
@@ -1255,8 +1246,6 @@ CoktelVideo::State Vmd::processFrame(uint16 frame) {
uint8 count = _stream->readByte();
_stream->read(_palette + index * 3, (count + 1) * 3);
- notifyChangedPalette();
-
_stream->skip((255 - count) * 3);
state.flags |= kStatePalette;
@@ -1628,9 +1617,4 @@ Common::MemoryReadStream *Vmd::getExtraData(const char *fileName) {
return stream;
}
-void Vmd::notifyChangedPalette() {
- if (_codecIndeo3)
- _codecIndeo3->setPalette(_palette);
-}
-
} // End of namespace Gob