[Scummvm-git-logs] scummvm master -> c7a8dfaf3b30711d532b459ee1599441e19df132

bluegr noreply at scummvm.org
Mon Mar 3 05:30:27 UTC 2025


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

Summary:
1a3a290ce7 IMAGE: Improve default implementation of setOutputPixelFormat()
f60a41b244 IMAGE: Fix calling JPEGDecoder::getPixelFormat() before loading the frame
d7d38b867c VIDEO: Set the output pixel format for all QuickTime samples
c7a8dfaf3b TESTBED: Miscellaneous improvements to the video player


Commit: 1a3a290ce7902ea5bfc70a4f408baf1accf989a7
    https://github.com/scummvm/scummvm/commit/1a3a290ce7902ea5bfc70a4f408baf1accf989a7
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-03-03T07:30:22+02:00

Commit Message:
IMAGE: Improve default implementation of setOutputPixelFormat()

Changed paths:
    image/codecs/cinepak.cpp
    image/codecs/codec.h
    video/video_decoder.h


diff --git a/image/codecs/cinepak.cpp b/image/codecs/cinepak.cpp
index fda0329312e..9920e266dde 100644
--- a/image/codecs/cinepak.cpp
+++ b/image/codecs/cinepak.cpp
@@ -649,7 +649,7 @@ void CinepakDecoder::decodeVectors24(Common::SeekableReadStream &stream, uint16
 
 bool CinepakDecoder::setOutputPixelFormat(const Graphics::PixelFormat &format) {
 	if (_bitsPerPixel == 8)
-		return false;
+		return format.isCLUT8();
 
 	if (format.bytesPerPixel != 2 && format.bytesPerPixel != 4)
 		return false;
diff --git a/image/codecs/codec.h b/image/codecs/codec.h
index 0540dda82fb..a8dd7107a3a 100644
--- a/image/codecs/codec.h
+++ b/image/codecs/codec.h
@@ -91,7 +91,7 @@ public:
 	 * Select the preferred format to use, for codecs where this is faster than converting
 	 * the image afterwards. Returns true if supported, and false otherwise.
 	 */
-	virtual bool setOutputPixelFormat(const Graphics::PixelFormat &format) { return false; }
+	virtual bool setOutputPixelFormat(const Graphics::PixelFormat &format) { return format == getPixelFormat(); }
 
 	/**
 	 * Can this codec's frames contain a palette?
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 81fc3e234c3..05262931c2d 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -612,7 +612,7 @@ protected:
 		/**
 		 * Set the default high color format for videos that convert from YUV.
 		 */
-		virtual bool setOutputPixelFormat(const Graphics::PixelFormat &format) { return false; }
+		virtual bool setOutputPixelFormat(const Graphics::PixelFormat &format) { return format == getPixelFormat(); }
 
 		/**
 		 * Set the image codec accuracy


Commit: f60a41b2446dfd036fc8a163ab0e07c2eeec2082
    https://github.com/scummvm/scummvm/commit/f60a41b2446dfd036fc8a163ab0e07c2eeec2082
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-03-03T07:30:22+02:00

Commit Message:
IMAGE: Fix calling JPEGDecoder::getPixelFormat() before loading the frame

Changed paths:
    image/jpeg.cpp


diff --git a/image/jpeg.cpp b/image/jpeg.cpp
index e1340054ea6..b02dd260828 100644
--- a/image/jpeg.cpp
+++ b/image/jpeg.cpp
@@ -83,7 +83,9 @@ void JPEGDecoder::setCodecAccuracy(CodecAccuracy accuracy) {
 }
 
 Graphics::PixelFormat JPEGDecoder::getPixelFormat() const {
-	return _surface.format;
+	if (_surface.getPixels())
+		return _surface.format;
+	return _requestedPixelFormat;
 }
 
 #ifdef USE_JPEG


Commit: d7d38b867c0bc8f41086235a142eb8077bf8fe83
    https://github.com/scummvm/scummvm/commit/d7d38b867c0bc8f41086235a142eb8077bf8fe83
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-03-03T07:30:22+02:00

Commit Message:
VIDEO: Set the output pixel format for all QuickTime samples

Changed paths:
    video/qt_decoder.cpp


diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 3f909bec2d2..ca9239ae28e 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -498,6 +498,7 @@ Graphics::PixelFormat QuickTimeDecoder::VideoTrackHandler::getPixelFormat() cons
 	if (_forcedDitherPalette)
 		return Graphics::PixelFormat::createFormatCLUT8();
 
+	// TODO: What should happen if there are multiple codecs with different formats?
 	return ((VideoSampleDesc *)_parent->sampleDescs[0])->_videoCodec->getPixelFormat();
 }
 
@@ -505,7 +506,15 @@ bool QuickTimeDecoder::VideoTrackHandler::setOutputPixelFormat(const Graphics::P
 	if (_forcedDitherPalette)
 		return false;
 
-	return ((VideoSampleDesc *)_parent->sampleDescs[0])->_videoCodec->setOutputPixelFormat(format);
+	bool success = true;
+
+	for (uint i = 0; i < _parent->sampleDescs.size(); i++) {
+		VideoSampleDesc *desc = (VideoSampleDesc *)_parent->sampleDescs[i];
+
+		success = success && desc->_videoCodec->setOutputPixelFormat(format);
+	}
+
+	return success;
 }
 
 int QuickTimeDecoder::VideoTrackHandler::getFrameCount() const {


Commit: c7a8dfaf3b30711d532b459ee1599441e19df132
    https://github.com/scummvm/scummvm/commit/c7a8dfaf3b30711d532b459ee1599441e19df132
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-03-03T07:30:22+02:00

Commit Message:
TESTBED: Miscellaneous improvements to the video player

Changed paths:
    engines/testbed/video.cpp


diff --git a/engines/testbed/video.cpp b/engines/testbed/video.cpp
index 61358b11e71..69332415870 100644
--- a/engines/testbed/video.cpp
+++ b/engines/testbed/video.cpp
@@ -77,6 +77,8 @@ Common::Error Videotests::videoTest(Common::SeekableReadStream *stream, const Co
 	} else {
 		if (pixelformat.isCLUT8() && video->setDitheringPalette(Video::quickTimeDefaultPalette256)) {
 			pixelformat = Graphics::PixelFormat::createFormatCLUT8();
+		} else if (video->setOutputPixelFormats(supportedFormatsList)) {
+			pixelformat = video->getPixelFormat();
 		} else {
 			pixelformat = supportedFormatsList.front();
 		}
@@ -86,6 +88,8 @@ Common::Error Videotests::videoTest(Common::SeekableReadStream *stream, const Co
 
 #ifdef __DS__
 	int w = 256, h = 192;
+#elif defined(__3DS__)
+	int w = 320, h = 240;
 #elif defined(USE_HIGHRES)
 	int w = 640, h = 480;
 #else
@@ -108,7 +112,7 @@ Common::Error Videotests::videoTest(Common::SeekableReadStream *stream, const Co
 			debug(5, "video time: %d", pos);
 
 			if (pixelformat.isCLUT8() && video->hasDirtyPalette()) {
-				g_system->getPaletteManager()->setPalette(Video::quickTimeDefaultPalette256, 0, 256);
+				g_system->getPaletteManager()->setPalette(video->getPalette(), 0, 256);
 			}
 
 			const Graphics::Surface *frame = video->decodeNextFrame();
@@ -126,10 +130,11 @@ Common::Error Videotests::videoTest(Common::SeekableReadStream *stream, const Co
 				mw = surf->w;
 				mh = surf->h;
 
-				if (surf->w < w && surf->h < h) {
+				if (surf->w < w)
 					x = (w - surf->w) >> 1;
+				if (surf->h < h)
 					y = (h - surf->h) >> 1;
-				}
+
 				g_system->copyRectToScreen(surf->getPixels(), surf->pitch, x, y, MIN<uint16>(surf->w, w), MIN<uint16>(surf->h, h));
 
 				if (conv) {




More information about the Scummvm-git-logs mailing list