[Scummvm-git-logs] scummvm master -> 92116434cf39894df75e241f82195c299e16a824
fracturehill
noreply at scummvm.org
Mon Nov 20 21:04:46 UTC 2023
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:
92116434cf NANCY: Fix type 2 video frames on BE machines
Commit: 92116434cf39894df75e241f82195c299e16a824
https://github.com/scummvm/scummvm/commit/92116434cf39894df75e241f82195c299e16a824
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-11-20T23:04:32+02:00
Commit Message:
NANCY: Fix type 2 video frames on BE machines
This fixes an issue on big endian machines where some
videos would get corrupted on alternating frames due
to incorrect endianness conversion.
Changed paths:
engines/nancy/video.cpp
diff --git a/engines/nancy/video.cpp b/engines/nancy/video.cpp
index a89d74bbe05..209944e8be5 100644
--- a/engines/nancy/video.cpp
+++ b/engines/nancy/video.cpp
@@ -345,8 +345,19 @@ const Graphics::Surface *AVFDecoder::AVFVideoTrack::decodeFrame(uint frameNr) {
if (refFrame) {
Graphics::copyBlit((byte *)frameInCache.getPixels(), (const byte *)refFrame->getPixels(),
frameInCache.pitch, refFrame->pitch, frameInCache.w, frameInCache.h, frameInCache.format.bytesPerPixel);
+
+#ifdef SCUMM_BIG_ENDIAN
+ // Convert from BE back to LE so the decode step below works correctly
+ byte *buf = (byte *)frameInCache.getPixels();
+ if (g_nancy->_graphicsManager->getInputPixelFormat().bytesPerPixel == 2) {
+ for (int i = 0; i < frameInCache.pitch * frameInCache.h / 2; ++i) {
+ ((uint16 *)buf)[i] = SWAP_BYTES_16(((uint16 *)buf)[i]);
+ }
+ }
+#endif
}
}
+
Common::MemoryReadStream decompStr(decompBuf, info.size);
decode((byte *)frameInCache.getPixels(), _frameSize, decompStr);
}
@@ -355,14 +366,14 @@ const Graphics::Surface *AVFDecoder::AVFVideoTrack::decodeFrame(uint frameNr) {
delete[] decompBuf;
}
- #ifdef SCUMM_BIG_ENDIAN
+#ifdef SCUMM_BIG_ENDIAN
byte *buf = (byte *)frameInCache.getPixels();
if (g_nancy->_graphicsManager->getInputPixelFormat().bytesPerPixel == 2) {
for (int i = 0; i < frameInCache.pitch * frameInCache.h / 2; ++i) {
((uint16 *)buf)[i] = SWAP_BYTES_16(((uint16 *)buf)[i]);
}
}
- #endif
+#endif
return &frameInCache;
}
More information about the Scummvm-git-logs
mailing list