[Scummvm-cvs-logs] SF.net SVN: scummvm:[54841] scummvm/trunk/graphics/video

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Thu Dec 9 21:48:09 CET 2010


Revision: 54841
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54841&view=rev
Author:   mthreepwood
Date:     2010-12-09 20:48:08 +0000 (Thu, 09 Dec 2010)

Log Message:
-----------
VIDEO: Allow for 8bpp Cinepak videos

Modified Paths:
--------------
    scummvm/trunk/graphics/video/avi_decoder.cpp
    scummvm/trunk/graphics/video/codecs/cinepak.cpp
    scummvm/trunk/graphics/video/codecs/cinepak.h
    scummvm/trunk/graphics/video/qt_decoder.cpp

Modified: scummvm/trunk/graphics/video/avi_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/avi_decoder.cpp	2010-12-09 19:59:26 UTC (rev 54840)
+++ scummvm/trunk/graphics/video/avi_decoder.cpp	2010-12-09 20:48:08 UTC (rev 54841)
@@ -401,7 +401,7 @@
 		case ID_RLE:
 			return new MSRLEDecoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount);
 		case ID_CVID:
-			return new CinepakDecoder();
+			return new CinepakDecoder(_bmInfo.bitCount);
 #ifdef USE_INDEO3
 		case ID_IV32:
 			return new Indeo3Decoder(_bmInfo.width, _bmInfo.height);

Modified: scummvm/trunk/graphics/video/codecs/cinepak.cpp
===================================================================
--- scummvm/trunk/graphics/video/codecs/cinepak.cpp	2010-12-09 19:59:26 UTC (rev 54840)
+++ scummvm/trunk/graphics/video/codecs/cinepak.cpp	2010-12-09 20:48:08 UTC (rev 54841)
@@ -39,17 +39,24 @@
 }
 
 #define PUT_PIXEL(offset, lum, u, v) \
-	CPYUV2RGB(lum, u, v, r, g, b); \
-	if (_pixelFormat.bytesPerPixel == 2) \
-		*((uint16 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \
-	else \
-		*((uint32 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b)
+	if (_pixelFormat.bytesPerPixel != 1) { \
+		CPYUV2RGB(lum, u, v, r, g, b); \
+		if (_pixelFormat.bytesPerPixel == 2) \
+			*((uint16 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \
+		else \
+			*((uint32 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \
+	} else \
+		*((byte *)_curFrame.surface->pixels + offset) = lum
 
-CinepakDecoder::CinepakDecoder() : Codec() {
+CinepakDecoder::CinepakDecoder(int bitsPerPixel) : Codec() {
 	_curFrame.surface = NULL;
 	_curFrame.strips = NULL;
 	_y = 0;
-	_pixelFormat = g_system->getScreenFormat();
+
+	if (bitsPerPixel == 8)
+		_pixelFormat = PixelFormat::createFormatCLUT8();
+	else
+		_pixelFormat = g_system->getScreenFormat();
 }
 
 CinepakDecoder::~CinepakDecoder() {
@@ -181,8 +188,8 @@
 				codebook[i].v  = stream->readByte() + 128;
 			} else {
 				// This codebook type indicates either greyscale or
-				// palettized video. We don't handle palettized video
-				// currently.
+				// palettized video. For greyscale, default us to
+				// 128 for both u and v.
 				codebook[i].u  = 128;
 				codebook[i].v  = 128;
 			}

Modified: scummvm/trunk/graphics/video/codecs/cinepak.h
===================================================================
--- scummvm/trunk/graphics/video/codecs/cinepak.h	2010-12-09 19:59:26 UTC (rev 54840)
+++ scummvm/trunk/graphics/video/codecs/cinepak.h	2010-12-09 20:48:08 UTC (rev 54841)
@@ -61,7 +61,7 @@
 
 class CinepakDecoder : public Codec {
 public:
-	CinepakDecoder();
+	CinepakDecoder(int bitsPerPixel = 24);
 	~CinepakDecoder();
 
 	Surface *decodeImage(Common::SeekableReadStream *stream);

Modified: scummvm/trunk/graphics/video/qt_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/qt_decoder.cpp	2010-12-09 19:59:26 UTC (rev 54840)
+++ scummvm/trunk/graphics/video/qt_decoder.cpp	2010-12-09 20:48:08 UTC (rev 54841)
@@ -161,7 +161,7 @@
 Codec *QuickTimeDecoder::createCodec(uint32 codecTag, byte bitsPerPixel) {
 	if (codecTag == MKID_BE('cvid')) {
 		// Cinepak: As used by most Myst and all Riven videos as well as some Myst ME videos. "The Chief" videos also use this.
-		return new CinepakDecoder();
+		return new CinepakDecoder(bitsPerPixel);
 	} else if (codecTag == MKID_BE('rpza')) {
 		// Apple Video ("Road Pizza"): Used by some Myst videos.
 		return new RPZADecoder(getWidth(), getHeight());


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list