aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo
diff options
context:
space:
mode:
authorColin Snover2017-08-20 11:15:42 -0500
committerColin Snover2017-08-24 20:34:16 -0500
commit085ec30b49fedb032bd9b09cb5dc1729ffc54c0f (patch)
tree7104879f9066b85691b5bcece40216f1685ee06a /image/codecs/indeo
parent9512cf46b739b2ca37c0e101fa440ece5072b722 (diff)
downloadscummvm-rg350-085ec30b49fedb032bd9b09cb5dc1729ffc54c0f.tar.gz
scummvm-rg350-085ec30b49fedb032bd9b09cb5dc1729ffc54c0f.tar.bz2
scummvm-rg350-085ec30b49fedb032bd9b09cb5dc1729ffc54c0f.zip
IMAGE: Add support for Indeo4 transparency plane
This is used by TITANIC for most of the furniture in the SGT stateroom and Titania's parts.
Diffstat (limited to 'image/codecs/indeo')
-rw-r--r--image/codecs/indeo/indeo.cpp24
-rw-r--r--image/codecs/indeo/indeo.h3
2 files changed, 16 insertions, 11 deletions
diff --git a/image/codecs/indeo/indeo.cpp b/image/codecs/indeo/indeo.cpp
index f420069139..6b6e3557fe 100644
--- a/image/codecs/indeo/indeo.cpp
+++ b/image/codecs/indeo/indeo.cpp
@@ -491,6 +491,8 @@ IndeoDecoderBase::~IndeoDecoderBase() {
IVIPlaneDesc::freeBuffers(_ctx._planes);
if (_ctx._mbVlc._custTab._table)
_ctx._mbVlc._custTab.freeVlc();
+ if (_ctx._transVlc._custTab._table)
+ _ctx._transVlc._custTab.freeVlc();
delete _ctx._pFrame;
}
@@ -575,11 +577,23 @@ int IndeoDecoderBase::decodeIndeoFrame() {
outputPlane(&_ctx._planes[2], frame->_data[1], frame->_linesize[1]);
outputPlane(&_ctx._planes[1], frame->_data[2], frame->_linesize[2]);
+ // Merge the planes into the final surface
+ Graphics::Surface s = _surface->getSubArea(Common::Rect(0, 0, _surface->w, _surface->h));
+ YUVToRGBMan.convert410(&s, Graphics::YUVToRGBManager::kScaleITU,
+ frame->_data[0], frame->_data[1], frame->_data[2], frame->_width, frame->_height,
+ frame->_width, frame->_width);
+
+ if (_ctx._hasTransp)
+ decodeTransparency();
+
// If the bidirectional mode is enabled, next I and the following P
// frame will be sent together. Unfortunately the approach below seems
// to be the only way to handle the B-frames mode.
// That's exactly the same Intel decoders do.
if (_ctx._isIndeo4 && _ctx._frameType == IVI4_FRAMETYPE_INTRA) {
+ // TODO: It appears from the reference decoder that this should be
+ // aligning GetBits to a 32-bit boundary before reading again?
+
int left;
// skip version string
@@ -595,19 +609,9 @@ int IndeoDecoderBase::decodeIndeoFrame() {
}
}
- // Merge the planes into the final surface
- Graphics::Surface s = _surface->getSubArea(Common::Rect(0, 0, _surface->w, _surface->h));
- YUVToRGBMan.convert410(&s, Graphics::YUVToRGBManager::kScaleITU,
- frame->_data[0], frame->_data[1], frame->_data[2], frame->_width, frame->_height,
- frame->_width, frame->_width);
-
// Free the now un-needed frame data
frame->freeFrame();
- // If there's any transparency data, decode it
- if (_ctx._hasTransp)
- decodeTransparency();
-
return 0;
}
diff --git a/image/codecs/indeo/indeo.h b/image/codecs/indeo/indeo.h
index dcb7330318..962d06817d 100644
--- a/image/codecs/indeo/indeo.h
+++ b/image/codecs/indeo/indeo.h
@@ -398,6 +398,7 @@ public:
IVIHuffTab _mbVlc; ///< current macroblock table descriptor
IVIHuffTab _blkVlc; ///< current block table descriptor
+ IVIHuffTab _transVlc; ///< current transparency table descriptor
uint8 _rvmapSel;
bool _inImf;
@@ -566,7 +567,7 @@ protected:
/**
* Decodes optional transparency data within Indeo frames
*/
- virtual void decodeTransparency() {}
+ virtual int decodeTransparency() { return -1; }
/**
* Decodes the Indeo frame from the bit reader already