[Scummvm-cvs-logs] scummvm master -> d6be917808b6e6fabb40b6a78c7811b7673d0eb5

somaen einarjohan at somadalen.com
Fri Sep 7 16:30:36 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d6be917808 VIDEO: Add support for odd-sized Bink-videos


Commit: d6be917808b6e6fabb40b6a78c7811b7673d0eb5
    https://github.com/scummvm/scummvm/commit/d6be917808b6e6fabb40b6a78c7811b7673d0eb5
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2012-09-07T07:29:00-07:00

Commit Message:
VIDEO: Add support for odd-sized Bink-videos

Changed paths:
    video/bink_decoder.cpp
    video/bink_decoder.h



diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp
index 6203168..30632cd 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++)
diff --git a/video/bink_decoder.h b/video/bink_decoder.h
index 150e91a..27d3aa3 100644
--- a/video/bink_decoder.h
+++ b/video/bink_decoder.h
@@ -231,6 +231,8 @@ private:
 		int _frameCount;
 
 		Graphics::Surface _surface;
+		int _surfaceWidth; ///< The actual surface width
+		int _surfaceHeight; ///< The actual surface height
 
 		uint32 _id; ///< The BIK FourCC.
 






More information about the Scummvm-git-logs mailing list