[Scummvm-cvs-logs] CVS: scummvm/scumm/smush codec1.cpp,1.7,1.8 codec1.h,1.5,1.6 codec37.cpp,1.16,1.17 codec37.h,1.9,1.10 codec44.cpp,1.8,1.9 codec44.h,1.7,1.8 codec47.cpp,1.42,1.43 codec47.h,1.12,1.13 decoder.h,1.7,1.8 player.cpp,1.42,1.43
Max Horn
fingolfin at users.sourceforge.net
Wed Mar 12 17:25:05 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/common scummsys.h,1.17,1.18
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush brenderer.cpp,1.5,1.6 brenderer.h,1.8,1.9 frenderer.cpp,1.16,1.17 frenderer.h,1.11,1.12 player.h,1.14,1.15 renderer.h,1.7,1.8 scumm_renderer.cpp,1.28,1.29 scumm_renderer.h,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory sc8-pr-cvs1:/tmp/cvs-serv24291
Modified Files:
codec1.cpp codec1.h codec37.cpp codec37.h codec44.cpp
codec44.h codec47.cpp codec47.h decoder.h player.cpp
Log Message:
changed decoder API to take a memory block as source, not a Chunk
Index: codec1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec1.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- codec1.cpp 13 Mar 2003 00:37:02 -0000 1.7
+++ codec1.cpp 13 Mar 2003 01:24:02 -0000 1.8
@@ -21,31 +21,31 @@
#include <stdafx.h>
#include "codec1.h"
-#include "chunk.h"
Codec1Decoder::~Codec1Decoder() {
}
-bool Codec1Decoder::decode(byte *dst, Chunk &src) {
+bool Codec1Decoder::decode(byte *dst, const byte *src, int) {
byte val;
int32 size_line;
int32 code, length;
int32 h, height = getRect().height();
for(h = 0; h < height; h++) {
- size_line = src.getWord(); // size of compressed line !
+ size_line = READ_LE_UINT16(src); // size of compressed line !
+ src += 2;
#ifdef DEBUG_CODEC1
debug(7, "codec1 : h == %d, size_line == %d", h, size_line);
#endif
while(size_line > 0) {
- code = src.getByte();
+ code = *src++;
size_line--;
length = (code >> 1) + 1;
#ifdef DEBUG_CODEC1
debug(7, "codec1 : length == %d", length);
#endif
if(code & 1) {
- val = src.getByte();
+ val = *src++;
size_line--;
if (val)
memset(dst, val, length);
@@ -59,7 +59,7 @@
debug(7, "codec1 : blitting %d entries", length);
#endif
while(length--) {
- val = src.getByte();
+ val = *src++;
if (val)
*dst = val;
dst++;
@@ -67,11 +67,5 @@
}
}
}
-#ifdef DEBUG_CODEC1
- if(!src.eof()) {
- int32 len = src.getSize() - src.tell();
- debug(7, "codec1: remaining length after decode == %d", len);
- }
-#endif
return true;
}
Index: codec1.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec1.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- codec1.h 13 Mar 2003 00:37:02 -0000 1.5
+++ codec1.h 13 Mar 2003 01:24:02 -0000 1.6
@@ -42,7 +42,7 @@
class Codec1Decoder : public Decoder {
public:
virtual ~Codec1Decoder();
- bool decode(byte *dst, Chunk &);
+ bool decode(byte *dst, const byte *src, int length);
};
#endif
Index: codec37.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec37.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- codec37.cpp 13 Mar 2003 00:37:02 -0000 1.16
+++ codec37.cpp 13 Mar 2003 01:24:02 -0000 1.17
@@ -21,7 +21,6 @@
#include <stdafx.h>
#include "codec37.h"
-#include "chunk.h"
#include "common/engine.h"
@@ -258,7 +257,7 @@
}
}
-void Codec37Decoder::bompDecode(byte *dst, byte *src, int32 len) {
+void Codec37Decoder::bompDecode(byte *dst, const byte *src, int len) {
byte code;
byte color;
int32 num;
@@ -369,7 +368,7 @@
dst += 4; \
} while(0)
-void Codec37Decoder::proc3WithFDFE(byte *dst, byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) {
+void Codec37Decoder::proc3WithFDFE(byte *dst, const byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) {
do {
int32 i = bw;
do {
@@ -389,7 +388,7 @@
} while (--bh);
}
-void Codec37Decoder::proc3WithoutFDFE(byte *dst, byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) {
+void Codec37Decoder::proc3WithoutFDFE(byte *dst, const byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) {
do {
int32 i = bw;
do {
@@ -405,7 +404,7 @@
} while (--bh);
}
-void Codec37Decoder::proc4WithFDFE(byte *dst, byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) {
+void Codec37Decoder::proc4WithFDFE(byte *dst, const byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) {
do {
int32 i = bw;
do {
@@ -441,7 +440,7 @@
} while (--bh);
}
-void Codec37Decoder::proc4WithoutFDFE(byte *dst, byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) {
+void Codec37Decoder::proc4WithoutFDFE(byte *dst, const byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) {
do {
int32 i = bw;
do {
@@ -473,23 +472,19 @@
} while (--bh);
}
-bool Codec37Decoder::decode(byte *dst, Chunk & src) {
+bool Codec37Decoder::decode(byte *dst, const byte *src, int length) {
int32 width = getRect().width();
int32 height = getRect().height();
int32 bw = (width + 3) >> 2, bh = (height + 3) >> 2;
int32 pitch = bw << 2;
- int32 chunk_size = src.getSize() - 14;
- byte *chunk_buffer = (byte *)malloc(chunk_size);
- src.read(chunk_buffer, chunk_size);
-
- int16 seq_nb = READ_LE_UINT16(chunk_buffer + 2);
- int32 decoded_size = READ_LE_UINT32(chunk_buffer + 4);
- byte mask_flags = chunk_buffer[12];
- maketable(pitch, chunk_buffer[1]);
+ int16 seq_nb = READ_LE_UINT16(src + 2);
+ int32 decoded_size = READ_LE_UINT32(src + 4);
+ byte mask_flags = src[12];
+ maketable(pitch, src[1]);
int32 tmp;
- switch(chunk_buffer[0]) {
+ switch(src[0]) {
case 0:
if ((_deltaBufs[_curtable] - _deltaBuf) > 0) {
memset(_deltaBuf, 0, _deltaBufs[_curtable] - _deltaBuf);
@@ -498,13 +493,13 @@
if (tmp > 0) {
memset(_deltaBufs[_curtable] + decoded_size, 0, tmp);
}
- memcpy(_deltaBufs[_curtable], chunk_buffer + 16, decoded_size);
+ memcpy(_deltaBufs[_curtable], src + 16, decoded_size);
break;
case 1:
error("codec37: missing opcode 1");
break;
case 2:
- bompDecode(_deltaBufs[_curtable], chunk_buffer + 16, decoded_size);
+ bompDecode(_deltaBufs[_curtable], src + 16, decoded_size);
if ((_deltaBufs[_curtable] - _deltaBuf) > 0) {
memset(_deltaBuf, 0, _deltaBufs[_curtable] - _deltaBuf);
}
@@ -519,11 +514,11 @@
}
if((mask_flags & 4) != 0) {
- proc3WithFDFE(_deltaBufs[_curtable], chunk_buffer + 16,
+ proc3WithFDFE(_deltaBufs[_curtable], src + 16,
_deltaBufs[_curtable ^ 1] - _deltaBufs[_curtable], bw, bh,
pitch, _offsetTable);
} else {
- proc3WithoutFDFE(_deltaBufs[_curtable], chunk_buffer + 16,
+ proc3WithoutFDFE(_deltaBufs[_curtable], src + 16,
_deltaBufs[_curtable ^ 1] - _deltaBufs[_curtable], bw, bh,
pitch, _offsetTable);
}
@@ -534,11 +529,11 @@
}
if((mask_flags & 4) != 0) {
- proc4WithFDFE(_deltaBufs[_curtable], chunk_buffer + 16,
+ proc4WithFDFE(_deltaBufs[_curtable], src + 16,
_deltaBufs[_curtable ^ 1] - _deltaBufs[_curtable], bw, bh,
pitch, _offsetTable);
} else {
- proc4WithoutFDFE(_deltaBufs[_curtable], chunk_buffer + 16,
+ proc4WithoutFDFE(_deltaBufs[_curtable], src + 16,
_deltaBufs[_curtable ^ 1] - _deltaBufs[_curtable], bw, bh,
pitch, _offsetTable);
}
@@ -550,7 +545,6 @@
memcpy(dst, _deltaBufs[_curtable], width * height);
- free(chunk_buffer);
return true;
}
Index: codec37.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec37.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- codec37.h 13 Mar 2003 00:37:02 -0000 1.9
+++ codec37.h 13 Mar 2003 01:24:02 -0000 1.10
@@ -42,13 +42,13 @@
virtual ~Codec37Decoder();
protected:
void maketable(int32, int32);
- void bompDecode(byte *dst, byte *src, int32 len);
- void proc3WithFDFE(byte *, byte *, int32, int32, int32, int32, int16 *);
- void proc3WithoutFDFE(byte *, byte *, int32, int32, int32, int32, int16 *);
- void proc4WithFDFE(byte *, byte *, int32, int32, int32, int32, int16 *);
- void proc4WithoutFDFE(byte *, byte *, int32, int32, int32, int32, int16 *);
+ void bompDecode(byte *dst, const byte *src, int len);
+ void proc3WithFDFE(byte *dst, const byte *src, int32, int32, int32, int32, int16 *);
+ void proc3WithoutFDFE(byte *dst, const byte *src, int32, int32, int32, int32, int16 *);
+ void proc4WithFDFE(byte *dst, const byte *src, int32, int32, int32, int32, int16 *);
+ void proc4WithoutFDFE(byte *dst, const byte *src, int32, int32, int32, int32, int16 *);
public:
- bool decode(byte *dst, Chunk &);
+ bool decode(byte *dst, const byte *src, int length);
};
#endif
Index: codec44.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec44.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- codec44.cpp 13 Mar 2003 00:37:02 -0000 1.8
+++ codec44.cpp 13 Mar 2003 01:24:02 -0000 1.9
@@ -21,16 +21,12 @@
#include <stdafx.h>
#include "codec44.h"
-#include "chunk.h"
-bool Codec44Decoder::decode(byte *dst, Chunk & src) {
+bool Codec44Decoder::decode(byte *dst, const byte *src, int length) {
int32 size_line, num;
- int32 length = src.getSize() - 14;
int32 width = getRect().width();
int32 height = getRect().height();
- byte *src2 = (byte *)malloc(length);
- byte *org_src2 = src2;
- src.read(src2, length);
+ const byte *src2 = src;
byte *dst2 = _buffer;
byte val;
@@ -61,8 +57,6 @@
} while (length > 1);
memcpy(dst, _buffer, width * height);
-
- free(org_src2);
return true;
}
Index: codec44.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec44.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- codec44.h 13 Mar 2003 00:37:02 -0000 1.7
+++ codec44.h 13 Mar 2003 01:24:02 -0000 1.8
@@ -28,7 +28,7 @@
byte _buffer[1000];
public:
- bool decode(byte *dst, Chunk &src);
+ bool decode(byte *dst, const byte *src, int length);
};
#endif
Index: codec47.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec47.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- codec47.cpp 13 Mar 2003 00:37:02 -0000 1.42
+++ codec47.cpp 13 Mar 2003 01:24:02 -0000 1.43
@@ -20,10 +20,9 @@
*/
#include <stdafx.h>
-#include "scumm/scumm.h"
-#include "engine.h"
#include "codec47.h"
-#include "chunk.h"
+
+#include "common/engine.h"
static int32 codec37_table[] = {
0, 1, 2, 3, 3, 3,
@@ -427,7 +426,7 @@
} while (c < 32768);
}
-void Codec47Decoder::bompDecode(byte *dst, byte *src, int32 len) {
+void Codec47Decoder::bompDecode(byte *dst, const byte *src, int len) {
byte code;
byte color;
int32 num;
@@ -602,7 +601,7 @@
}
}
-void Codec47Decoder::decode2(byte *dst, byte *src, int32 width, int32 height, byte *param_ptr) {
+void Codec47Decoder::decode2(byte *dst, const byte *src, int32 width, int32 height, const byte *param_ptr) {
_d_src = src;
_paramPtr = param_ptr - 0xf8;
int32 bw = (width + 7) >> 3;
@@ -663,33 +662,29 @@
clean();
}
-bool Codec47Decoder::decode(byte *dst, Chunk &src) {
+bool Codec47Decoder::decode(byte *dst, const byte *src, int length) {
int32 width = getRect().width();
int32 height = getRect().height();
_offset1 = _deltaBufs[1] - _curBuf;
_offset2 = _deltaBufs[0] - _curBuf;
- int32 chunk_size = src.getSize() - 14;
- byte *chunk_buffer = (byte *)malloc(chunk_size);
- src.read(chunk_buffer, chunk_size);
-
- int32 seq_nb = READ_LE_UINT16(chunk_buffer + 0);
+ int32 seq_nb = READ_LE_UINT16(src + 0);
- byte *gfx_data = chunk_buffer + 26;
+ const byte *gfx_data = src + 26;
byte *tmp_ptr;
if (seq_nb == 0) {
makeTables47(width);
- memset(_deltaBufs[0], chunk_buffer[12], width * height);
- memset(_deltaBufs[1], chunk_buffer[13], width * height);
+ memset(_deltaBufs[0], src[12], width * height);
+ memset(_deltaBufs[1], src[13], width * height);
_prevSeqNb = -1;
}
- if ((chunk_buffer[4] & 1) != 0) {
+ if ((src[4] & 1) != 0) {
gfx_data += 32896;
}
- switch(chunk_buffer[2]) {
+ switch(src[2]) {
case 0:
memcpy(_curBuf, gfx_data, width * height);
break;
@@ -698,7 +693,7 @@
break;
case 2:
if (seq_nb == _prevSeqNb + 1) {
- decode2(_curBuf, gfx_data, width, height, chunk_buffer + 8);
+ decode2(_curBuf, gfx_data, width, height, src + 8);
}
break;
case 3:
@@ -708,18 +703,18 @@
memcpy(_curBuf, _deltaBufs[0], width * height);
break;
case 5:
- bompDecode(_curBuf, gfx_data, READ_LE_UINT32(chunk_buffer + 14));
+ bompDecode(_curBuf, gfx_data, READ_LE_UINT32(src + 14));
break;
}
memcpy(dst, _curBuf, width * height);
if (seq_nb == _prevSeqNb + 1) {
- if (chunk_buffer[3] == 1) {
+ if (src[3] == 1) {
tmp_ptr = _curBuf;
_curBuf = _deltaBufs[1];
_deltaBufs[1] = tmp_ptr;
- } else if (chunk_buffer[3] == 2) {
+ } else if (src[3] == 2) {
tmp_ptr = _deltaBufs[0];
_deltaBufs[0] = _deltaBufs[1];
_deltaBufs[1] = _curBuf;
@@ -727,8 +722,6 @@
}
}
_prevSeqNb = seq_nb;
-
- free(chunk_buffer);
return true;
}
Index: codec47.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec47.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- codec47.h 13 Mar 2003 00:37:03 -0000 1.12
+++ codec47.h 13 Mar 2003 01:24:02 -0000 1.13
@@ -34,7 +34,7 @@
byte *_curBuf;
int32 _prevSeqNb;
int32 _lastTableWidth;
- byte *_d_src, *_paramPtr;
+ const byte *_d_src, *_paramPtr;
int32 _d_pitch;
int32 _offset1, _offset2;
byte _tableBig[99328];
@@ -43,18 +43,18 @@
void makeTables47(int32 width);
void makeTables37(int32 param);
- void bompDecode(byte *dst, byte *src, int32 len);
+ void bompDecode(byte *dst, const byte *src, int len);
void level1(byte *d_dst);
void level2(byte *d_dst);
void level3(byte *d_dst);
- void decode2(byte *dst, byte *src, int32 width, int32 height, byte *param_ptr);
+ void decode2(byte *dst, const byte *src, int32 width, int32 height, const byte *param_ptr);
public:
Codec47Decoder();
virtual ~Codec47Decoder();
bool initSize(const Point &, const Rect &);
void clean();
- bool decode(byte *dst, Chunk &);
+ bool decode(byte *dst, const byte *src, int length);
};
#endif
Index: decoder.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/decoder.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- decoder.h 13 Mar 2003 00:37:03 -0000 1.7
+++ decoder.h 13 Mar 2003 01:24:02 -0000 1.8
@@ -28,8 +28,6 @@
using ScummVM::Point;
using ScummVM::Rect;
-class Blitter;
-class Chunk;
/*! @brief base class for codec decompression.
@@ -47,7 +45,7 @@
Decoder() {};
virtual ~Decoder() {};
virtual bool initSize(const Point &p, const Rect &r) { _p = p; _r = r; return true; };
- virtual bool decode(byte *dst, Chunk &src) = 0;
+ virtual bool decode(byte *dst, const byte *src, int length) = 0;
};
#endif
Index: player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/player.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- player.cpp 13 Mar 2003 00:37:03 -0000 1.42
+++ player.cpp 13 Mar 2003 01:24:02 -0000 1.43
@@ -605,9 +605,16 @@
updatePalette();
}
-void SmushPlayer::decodeCodec(Chunk &b, const Rect &r, Decoder &codec) {
+void SmushPlayer::decodeCodec(Chunk &src, const Rect &r, Decoder &codec) {
assert(_curBuffer);
- codec.decode((byte *)_curBuffer, b);
+
+ int32 chunk_size = src.getSize() - 14;
+ byte *chunk_buffer = (byte *)malloc(chunk_size);
+ assert(chunk_buffer);
+ src.read(chunk_buffer, chunk_size);
+ codec.decode((byte *)_curBuffer, chunk_buffer, chunk_size);
+ free(chunk_buffer);
+
if (_storeFrame == true) {
if (_frameBuffer == NULL) {
_frameBuffer = (byte *)malloc(_frameSize.getX() * _frameSize.getY());
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/common scummsys.h,1.17,1.18
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush brenderer.cpp,1.5,1.6 brenderer.h,1.8,1.9 frenderer.cpp,1.16,1.17 frenderer.h,1.11,1.12 player.h,1.14,1.15 renderer.h,1.7,1.8 scumm_renderer.cpp,1.28,1.29 scumm_renderer.h,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list