aboutsummaryrefslogtreecommitdiff
path: root/video/bink_decoder.cpp
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-09-07 16:29:00 +0200
committerEinar Johan Trøan Sømåen2012-09-07 16:29:00 +0200
commitd6be917808b6e6fabb40b6a78c7811b7673d0eb5 (patch)
treefcb7f0aed0c28c41ab7bdf13478682649d6626de /video/bink_decoder.cpp
parent80b51481b9dc3e70e2e55f16c853d6a1e6711522 (diff)
downloadscummvm-rg350-d6be917808b6e6fabb40b6a78c7811b7673d0eb5.tar.gz
scummvm-rg350-d6be917808b6e6fabb40b6a78c7811b7673d0eb5.tar.bz2
scummvm-rg350-d6be917808b6e6fabb40b6a78c7811b7673d0eb5.zip
VIDEO: Add support for odd-sized Bink-videos
Diffstat (limited to 'video/bink_decoder.cpp')
-rw-r--r--video/bink_decoder.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp
index 620316806f..30632cdd6c 100644
--- a/video/bink_decoder.cpp
+++ b/video/bink_decoder.cpp
@@ -260,7 +260,23 @@ BinkDecoder::BinkVideoTrack::BinkVideoTrack(uint32 width, uint32 height, const G
_colHighHuffman[i].symbols[j] = j;
}
- _surface.create(width, height, format);
+ // Make the surface even-sized:
+ _surfaceHeight = height;
+ _surfaceWidth = width;
+
+ if (height & 1) {
+ _surfaceHeight++;
+ }
+ if (width & 1) {
+ _surfaceWidth++;
+ }
+
+ _surface.create(_surfaceWidth, _surfaceHeight, format);
+ // Since we over-allocate to make surfaces even-sized
+ // we need to set the actual VIDEO size back into the
+ // surface.
+ _surface.h = height;
+ _surface.w = width;
// Give the planes a bit extra space
width = _surface.w + 32;
@@ -329,9 +345,11 @@ void BinkDecoder::BinkVideoTrack::decodePacket(VideoFrame &frame) {
// Convert the YUV data we have to our format
// We're ignoring alpha for now
+ // The width used here is the surface-width, and not the video-width
+ // to allow for odd-sized videos.
assert(_curPlanes[0] && _curPlanes[1] && _curPlanes[2]);
Graphics::convertYUV420ToRGB(&_surface, _curPlanes[0], _curPlanes[1], _curPlanes[2],
- _surface.w, _surface.h, _surface.w, _surface.w >> 1);
+ _surfaceWidth, _surfaceHeight, _surfaceWidth, _surfaceWidth >> 1);
// And swap the planes with the reference planes
for (int i = 0; i < 4; i++)