diff options
author | Gregory Montoir | 2007-01-30 20:36:03 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-01-30 20:36:03 +0000 |
commit | cb258bee24b1d725b1cc7e17727498094fa8aacf (patch) | |
tree | 67c147a42bbf57b62fcbe781b9c1851e17e6fe8a /engines/scumm/smush/codec47.cpp | |
parent | ccde018e85319ba6e6c430706624b1ad94ad5726 (diff) | |
download | scummvm-rg350-cb258bee24b1d725b1cc7e17727498094fa8aacf.tar.gz scummvm-rg350-cb258bee24b1d725b1cc7e17727498094fa8aacf.tar.bz2 scummvm-rg350-cb258bee24b1d725b1cc7e17727498094fa8aacf.zip |
added deinitialisation of codecs at the end of smush playback. This allows to save a bit of memory (about 1Mb for CMI) during gameplay.
svn-id: r25287
Diffstat (limited to 'engines/scumm/smush/codec47.cpp')
-rw-r--r-- | engines/scumm/smush/codec47.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp index 44a4328e22..ba09609c75 100644 --- a/engines/scumm/smush/codec47.cpp +++ b/engines/scumm/smush/codec47.cpp @@ -513,6 +513,8 @@ void Codec47Decoder::init(int width, int height) { deinit(); _width = width; _height = height; + _tableBig = (byte *)malloc(256 * 388); + _tableSmall = (byte *)malloc(256 * 128); makeTablesInterpolation(4); makeTablesInterpolation(8); @@ -525,12 +527,20 @@ void Codec47Decoder::init(int width, int height) { } Codec47Decoder::Codec47Decoder() { - _tableBig = (byte *)malloc(99328); - _tableSmall = (byte *)malloc(32768); + _tableBig = NULL; + _tableSmall = NULL; _deltaBuf = NULL; } void Codec47Decoder::deinit() { + if (_tableBig) { + free(_tableBig); + _tableBig = NULL; + } + if (_tableSmall) { + free(_tableSmall); + _tableSmall = NULL; + } _lastTableWidth = -1; if (_deltaBuf) { free(_deltaBuf); @@ -542,14 +552,6 @@ void Codec47Decoder::deinit() { } Codec47Decoder::~Codec47Decoder() { - if (_tableBig) { - free(_tableBig); - _tableBig = NULL; - } - if (_tableSmall) { - free(_tableSmall); - _tableSmall = NULL; - } deinit(); } |