[Scummvm-git-logs] scummvm master -> 81bbf1cf4b6aba08f04b0b99148cdd57d745c86d

sev- noreply at scummvm.org
Tue Feb 4 22:28:13 UTC 2025


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

Summary:
7ea27b3a40 VIDEO: Exposed number of tracks in VideoDecoder
b00992c0d4 COMMON: FORMATS: Added target track number to QT Track struct
d627668529 VIDEO: QTVR: Encapsulated panorama construction into PanoTrackHandler
e70bfa4d45 VIDEO: QTVR: Correctly construct panorama image
81bbf1cf4b VIDEO: QTVR: Construct Panorama Hotspot mosaic


Commit: 7ea27b3a40ce3979843d40830ffba67f20ed729b
    https://github.com/scummvm/scummvm/commit/7ea27b3a40ce3979843d40830ffba67f20ed729b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-04T23:28:04+01:00

Commit Message:
VIDEO: Exposed number of tracks in VideoDecoder

Changed paths:
    video/video_decoder.h


diff --git a/video/video_decoder.h b/video/video_decoder.h
index 036c4e28dc0..f924220c949 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -980,6 +980,8 @@ protected:
 	 */
 	virtual AudioTrack *getAudioTrack(int index) { return 0; }
 
+	uint getNumTracks() { return _tracks.size(); }
+
 private:
 	// Tracks owned by this VideoDecoder
 	TrackList _tracks;


Commit: b00992c0d4c4a501b0526b26a5473f1e11e07a24
    https://github.com/scummvm/scummvm/commit/b00992c0d4c4a501b0526b26a5473f1e11e07a24
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-04T23:28:04+01:00

Commit Message:
COMMON: FORMATS: Added target track number to QT Track struct

Changed paths:
    common/formats/quicktime.cpp
    common/formats/quicktime.h


diff --git a/common/formats/quicktime.cpp b/common/formats/quicktime.cpp
index 16bc59b62d8..d56ca045c57 100644
--- a/common/formats/quicktime.cpp
+++ b/common/formats/quicktime.cpp
@@ -1296,6 +1296,7 @@ QuickTimeParser::Track::Track() {
 	graphicsMode = GraphicsMode::COPY;
 	opcolor[0] = opcolor[1] = opcolor[2] = 0;
 	soundBalance = 0;
+	targetTrack = 0;
 }
 
 String QuickTimeParser::PanoStringTable::getString(int32 offset) const {
diff --git a/common/formats/quicktime.h b/common/formats/quicktime.h
index 18433c71223..24c5316b17e 100644
--- a/common/formats/quicktime.h
+++ b/common/formats/quicktime.h
@@ -321,6 +321,8 @@ protected:
 		uint16 opcolor[3];         // RGB values used in the transfer mode specified by graphicsMode.
 
 		uint16 soundBalance; // Controls the sound mix between the computer's two speakers, usually set to 0.
+
+		uint targetTrack;
 	};
 
 	enum class MovieType {


Commit: d627668529653c98b838022261724f0f30f64474
    https://github.com/scummvm/scummvm/commit/d627668529653c98b838022261724f0f30f64474
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-04T23:28:04+01:00

Commit Message:
VIDEO: QTVR: Encapsulated panorama construction into PanoTrackHandler

Changed paths:
    video/qt_decoder.cpp
    video/qt_decoder.h
    video/qtvr_decoder.cpp


diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 29445a2e0dd..024665c1e91 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -244,16 +244,21 @@ void QuickTimeDecoder::init() {
 				((VideoSampleDesc *)tracks[i]->sampleDescs[j])->initCodec();
 
 			addTrack(new VideoTrackHandler(this, tracks[i]));
+
+			tracks[i]->targetTrack = getNumTracks() - 1;
 		}
 
-		if (tracks[i]->codecType == CODEC_TYPE_PANO)
+		if (tracks[i]->codecType == CODEC_TYPE_PANO) {
 			addTrack(new PanoTrackHandler(this, tracks[i]));
+
+			tracks[i]->targetTrack = getNumTracks() - 1;
+		}
 	}
 
 	if (_qtvrType == QTVRType::PANORAMA) {
 		for (uint32 i = 0; i < Common::QuickTimeParser::_tracks.size(); i++) {
 			if (Common::QuickTimeParser::_tracks[i]->codecType == CODEC_TYPE_PANO) {
-				constructPanorama(i);
+				((PanoTrackHandler *)getTrack(Common::QuickTimeParser::_tracks[i]->targetTrack))->constructPanorama();
 			}
 		}
 	}
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 3b4ae477ccc..95ddffead65 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -132,8 +132,6 @@ private:
 	void cleanupCursors();
 	void computeInteractivityZones();
 
-	void constructPanorama(int trackNum);
-
 	uint16 _width, _height;
 
 	uint16 _prevMouseX, _prevMouseY;
@@ -314,6 +312,8 @@ private:
 		Common::Rational getScaledWidth() const;
 		Common::Rational getScaledHeight() const;
 
+		void constructPanorama();
+
 	private:
 		QuickTimeDecoder *_decoder;
 		Common::QuickTimeParser::Track *_parent;
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 7f96eb50a45..c9741c8e30c 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -78,8 +78,6 @@ Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readPanoSampleDesc(Common
 
 	PanoSampleDesc *entry = new PanoSampleDesc(track, format);
 
-	uint32 pos = (uint32)_fd->pos();
-
 	entry->_majorVersion      = _fd->readSint16BE(); // must be zero, also observed to be 1
 	entry->_minorVersion      = _fd->readSint16BE();
 	entry->_sceneTrackID      = _fd->readSint32BE();
@@ -345,17 +343,24 @@ const Graphics::Surface *QuickTimeDecoder::PanoTrackHandler::bufferNextFrame() {
 	return nullptr;
 }
 
-void QuickTimeDecoder::constructPanorama(int trackNum) {
-	PanoSampleDesc *desc = (PanoSampleDesc *)(Common::QuickTimeParser::_tracks[trackNum]->sampleDescs[0]);
+void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
+	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+
 	warning("scene: %d (%d x %d) hotspots: %d (%d x %d)", desc->_sceneTrackID, desc->_sceneSizeX, desc->_sceneSizeY,
 			desc->_hotSpotTrackID, desc->_hotSpotSizeX, desc->_hotSpotSizeY);
 
-#if 0
-	int16 totalWidth = getHeight() * _parent->frameCount;
-	int16 totalHeight = getWidth();
+	warning("sceneNumFrames: %d x %d sceneColorDepth: %d", desc->_sceneNumFramesX, desc->_sceneNumFramesY, desc->_sceneColorDepth);
+	warning("targetTrackID: %d", _parent->targetTrack);
+
+	//PanoTrackHandler *panoTrack = (PanoTrackHandler *)getTrack(Common::QuickTimeParser::_tracks[dtrackNum]->targetTrack);
+	VideoTrack *track = (VideoTrack *)(_decoder->getTrack(_decoder->Common::QuickTimeParser::_tracks[desc->_sceneTrackID - 1]->targetTrack));
+
+	int16 totalWidth = track->getWidth();
+	int16 totalHeight = track->getHeight();
 
 	warning("construct, w: %d, h: %d", totalWidth, totalHeight);
 
+#if 0
 	if (totalWidth <= 0 || totalHeight <= 0)
 		return;
 


Commit: e70bfa4d45807aa8c7f970cd61b286268a04a2a9
    https://github.com/scummvm/scummvm/commit/e70bfa4d45807aa8c7f970cd61b286268a04a2a9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-04T23:28:04+01:00

Commit Message:
VIDEO: QTVR: Correctly construct panorama image

Changed paths:
    video/qt_decoder.h
    video/qtvr_decoder.cpp


diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 95ddffead65..2839df2bf90 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -259,6 +259,8 @@ private:
 		Common::Rational getScaledWidth() const;
 		Common::Rational getScaledHeight() const;
 
+		const Graphics::Surface *bufferNextFrame();
+
 	private:
 		QuickTimeDecoder *_decoder;
 		Common::QuickTimeParser::Track *_parent;
@@ -283,7 +285,6 @@ private:
 		uint32 findKeyFrame(uint32 frame) const;
 		bool isEmptyEdit() const;
 		void enterNewEditListEntry(bool bufferFrames, bool intializingTrack = false);
-		const Graphics::Surface *bufferNextFrame();
 		uint32 getRateAdjustedFrameTime() const; // media time
 		uint32 getCurEditTimeOffset() const;     // media time
 		uint32 getCurEditTrackDuration() const;  // media time
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index c9741c8e30c..90accf0cc86 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -34,6 +34,7 @@
 
 #include "common/archive.h"
 #include "common/debug.h"
+#include "common/file.h"
 #include "common/memstream.h"
 #include "common/system.h"
 #include "common/textconsole.h"
@@ -43,6 +44,7 @@
 
 #include "graphics/cursorman.h"
 #include "image/icocur.h"
+#include "image/png.h"
 
 // Video codecs
 #include "image/codecs/codec.h"
@@ -352,40 +354,44 @@ void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
 	warning("sceneNumFrames: %d x %d sceneColorDepth: %d", desc->_sceneNumFramesX, desc->_sceneNumFramesY, desc->_sceneColorDepth);
 	warning("targetTrackID: %d", _parent->targetTrack);
 
-	//PanoTrackHandler *panoTrack = (PanoTrackHandler *)getTrack(Common::QuickTimeParser::_tracks[dtrackNum]->targetTrack);
-	VideoTrack *track = (VideoTrack *)(_decoder->getTrack(_decoder->Common::QuickTimeParser::_tracks[desc->_sceneTrackID - 1]->targetTrack));
+	VideoTrackHandler *track = (VideoTrackHandler *)(_decoder->getTrack(_decoder->Common::QuickTimeParser::_tracks[desc->_sceneTrackID - 1]->targetTrack));
 
-	int16 totalWidth = track->getWidth();
-	int16 totalHeight = track->getHeight();
-
-	warning("construct, w: %d, h: %d", totalWidth, totalHeight);
-
-#if 0
-	if (totalWidth <= 0 || totalHeight <= 0)
-		return;
+	int16 framew = track->getWidth();
+	int16 frameh = track->getHeight();
 
 	_constructedPano = new Graphics::Surface();
-	_constructedPano->create(totalWidth, totalHeight, getPixelFormat());
+	_constructedPano->create(desc->_sceneSizeX, desc->_sceneSizeY, track->getPixelFormat());
 
-	for (uint32 frameIndex = 0; frameIndex < _parent->frameCount; frameIndex++) {
-		const Graphics::Surface *frame = bufferNextFrame();
+	Common::Rect srcRect(0, 0, framew, frameh);
 
-		for (int16 y = 0; y < frame->h; y++) {
-			for (int16 x = 0; x < frame->w; x++) {
+	for (uint y = 0; y < desc->_sceneNumFramesY; y++) {
+		for (uint x = 0; x < desc->_sceneNumFramesX; x++) {
+			const Graphics::Surface *frame = track->bufferNextFrame();
 
-				int setX = (totalWidth - 1) - (frameIndex * _parent->height + y);
-				int setY = x;
-
-				if (setX >= 0 && setX < _constructedPano->w && setY >= 0 && setY < _constructedPano->h) {
-					uint32 pixel = frame->getPixel(x, y);
-					_constructedPano->setPixel(setX, setY, pixel);
-				}
+			if (!frame) {
+				warning("QuickTimeDecoder::PanoTrackHandler::constructPanorama(): Out of frames at: %d, %d", x, y);
+				break;
 			}
+
+			_constructedPano->copyRectToSurface(*frame, x * framew, y * frameh, srcRect);
+
 		}
 	}
 
+	Common::Path path = Common::Path("dumps/pano-full.png");
+
+	Common::DumpFile bitmapFile;
+	if (!bitmapFile.open(path, true)) {
+		warning("Cannot dump panorama into file '%s'", path.toString().c_str());
+		return;
+	}
+
+	Image::writePNG(bitmapFile, *_constructedPano);
+	bitmapFile.close();
+
+	debug(0, "Dumped panorama %s of %d x %d", path.toString().c_str(), _constructedPano->w, _constructedPano->h);
+
 	_isPanoConstructed = true;
-#endif
 }
 
 void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {


Commit: 81bbf1cf4b6aba08f04b0b99148cdd57d745c86d
    https://github.com/scummvm/scummvm/commit/81bbf1cf4b6aba08f04b0b99148cdd57d745c86d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-04T23:28:04+01:00

Commit Message:
VIDEO: QTVR: Construct Panorama Hotspot mosaic

Changed paths:
    video/qt_decoder.h
    video/qtvr_decoder.cpp


diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 2839df2bf90..f737858a7a6 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -314,6 +314,7 @@ private:
 		Common::Rational getScaledHeight() const;
 
 		void constructPanorama();
+		Graphics::Surface *constructMosaic(VideoTrackHandler *track, uint w, uint h, Common::String fname);
 
 	private:
 		QuickTimeDecoder *_decoder;
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 90accf0cc86..deba638d8de 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -345,27 +345,17 @@ const Graphics::Surface *QuickTimeDecoder::PanoTrackHandler::bufferNextFrame() {
 	return nullptr;
 }
 
-void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
-	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
-
-	warning("scene: %d (%d x %d) hotspots: %d (%d x %d)", desc->_sceneTrackID, desc->_sceneSizeX, desc->_sceneSizeY,
-			desc->_hotSpotTrackID, desc->_hotSpotSizeX, desc->_hotSpotSizeY);
-
-	warning("sceneNumFrames: %d x %d sceneColorDepth: %d", desc->_sceneNumFramesX, desc->_sceneNumFramesY, desc->_sceneColorDepth);
-	warning("targetTrackID: %d", _parent->targetTrack);
-
-	VideoTrackHandler *track = (VideoTrackHandler *)(_decoder->getTrack(_decoder->Common::QuickTimeParser::_tracks[desc->_sceneTrackID - 1]->targetTrack));
-
+Graphics::Surface *QuickTimeDecoder::PanoTrackHandler::constructMosaic(VideoTrackHandler *track, uint w, uint h, Common::String fname) {
 	int16 framew = track->getWidth();
 	int16 frameh = track->getHeight();
 
-	_constructedPano = new Graphics::Surface();
-	_constructedPano->create(desc->_sceneSizeX, desc->_sceneSizeY, track->getPixelFormat());
+	Graphics::Surface *target = new Graphics::Surface();
+	target->create(w * framew, h * frameh, track->getPixelFormat());
 
 	Common::Rect srcRect(0, 0, framew, frameh);
 
-	for (uint y = 0; y < desc->_sceneNumFramesY; y++) {
-		for (uint x = 0; x < desc->_sceneNumFramesX; x++) {
+	for (uint y = 0; y < h; y++) {
+		for (uint x = 0; x < w; x++) {
 			const Graphics::Surface *frame = track->bufferNextFrame();
 
 			if (!frame) {
@@ -373,23 +363,45 @@ void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
 				break;
 			}
 
-			_constructedPano->copyRectToSurface(*frame, x * framew, y * frameh, srcRect);
-
+			target->copyRectToSurface(*frame, x * framew, y * frameh, srcRect);
 		}
 	}
 
-	Common::Path path = Common::Path("dumps/pano-full.png");
+	Common::Path path = Common::Path(fname);
 
 	Common::DumpFile bitmapFile;
 	if (!bitmapFile.open(path, true)) {
 		warning("Cannot dump panorama into file '%s'", path.toString().c_str());
-		return;
+		return nullptr;
 	}
 
-	Image::writePNG(bitmapFile, *_constructedPano);
+	Image::writePNG(bitmapFile, *target, track->getPalette());
 	bitmapFile.close();
 
-	debug(0, "Dumped panorama %s of %d x %d", path.toString().c_str(), _constructedPano->w, _constructedPano->h);
+	debug(0, "Dumped panorama %s of %d x %d", path.toString().c_str(), target->w, target->h);
+
+	return target;
+}
+
+
+void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
+	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+
+	warning("scene: %d (%d x %d) hotspots: %d (%d x %d)", desc->_sceneTrackID, desc->_sceneSizeX, desc->_sceneSizeY,
+			desc->_hotSpotTrackID, desc->_hotSpotSizeX, desc->_hotSpotSizeY);
+
+	warning("sceneNumFrames: %d x %d sceneColorDepth: %d", desc->_sceneNumFramesX, desc->_sceneNumFramesY, desc->_sceneColorDepth);
+	warning("targetTrackID: %d", _parent->targetTrack);
+
+	VideoTrackHandler *track = (VideoTrackHandler *)(_decoder->getTrack(_decoder->Common::QuickTimeParser::_tracks[desc->_sceneTrackID - 1]->targetTrack));
+
+	_constructedPano = constructMosaic(track, desc->_sceneNumFramesX, desc->_sceneNumFramesY, "dumps/pano-full.png");
+
+	track = (VideoTrackHandler *)(_decoder->getTrack(_decoder->Common::QuickTimeParser::_tracks[desc->_hotSpotTrackID - 1]->targetTrack));
+
+	warning("hotspot format: %s", track->getPixelFormat().toString().c_str());
+
+	constructMosaic(track, desc->_hotSpotNumFramesX, desc->_hotSpotNumFramesY, "dumps/pano-hotspot.png");
 
 	_isPanoConstructed = true;
 }




More information about the Scummvm-git-logs mailing list