[Scummvm-git-logs] scummvm master -> b3ab2e0774e8eaacc85b9474e5c47e63ce52b224
bluegr
noreply at scummvm.org
Mon Mar 10 17:03:29 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:
2e5122deb6 VIDEO: Use palette class in DXA decoder
cb8d5d4bd6 VIDEO: Use palette class in FLIC decoder
5e9f79d537 VIDEO: Use palette class in MVE decoder
99330f128c VIDEO: Use palette class in Coktel decoder
b3ab2e0774 VIDEO: Use palette class in PACo decoder
Commit: 2e5122deb676f8f52b744704f56b9bc7c85d808e
https://github.com/scummvm/scummvm/commit/2e5122deb676f8f52b744704f56b9bc7c85d808e
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2025-03-10T19:03:23+02:00
Commit Message:
VIDEO: Use palette class in DXA decoder
Changed paths:
video/dxa_decoder.cpp
video/dxa_decoder.h
diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp
index 620b76fb9a7..80c56b4d77c 100644
--- a/video/dxa_decoder.cpp
+++ b/video/dxa_decoder.cpp
@@ -73,13 +73,12 @@ void DXADecoder::readSoundData(Common::SeekableReadStream *stream) {
}
}
-DXADecoder::DXAVideoTrack::DXAVideoTrack(Common::SeekableReadStream *stream) {
+DXADecoder::DXAVideoTrack::DXAVideoTrack(Common::SeekableReadStream *stream) : _palette(256) {
_fileStream = stream;
_curFrame = -1;
_frameStartOffset = 0;
_decompBuffer = 0;
_inBuffer = 0;
- memset(_palette, 0, 256 * 3);
uint8 flags = _fileStream->readByte();
_frameCount = _fileStream->readUint16BE();
@@ -465,7 +464,13 @@ void DXADecoder::DXAVideoTrack::decode13(int size) {
const Graphics::Surface *DXADecoder::DXAVideoTrack::decodeNextFrame() {
uint32 tag = _fileStream->readUint32BE();
if (tag == MKTAG('C','M','A','P')) {
- _fileStream->read(_palette, 256 * 3);
+ for (int i = 0; i < 256; i++) {
+ byte r = _fileStream->readByte();
+ byte g = _fileStream->readByte();
+ byte b = _fileStream->readByte();
+ _palette.set(i, r, g, b);
+ }
+
_dirtyPalette = true;
}
diff --git a/video/dxa_decoder.h b/video/dxa_decoder.h
index fd50194d397..b2f3838d8b6 100644
--- a/video/dxa_decoder.h
+++ b/video/dxa_decoder.h
@@ -23,6 +23,7 @@
#define VIDEO_DXA_DECODER_H
#include "common/rational.h"
+#include "graphics/palette.h"
#include "graphics/pixelformat.h"
#include "video/video_decoder.h"
@@ -68,7 +69,7 @@ private:
int getCurFrame() const { return _curFrame; }
int getFrameCount() const { return _frameCount; }
const Graphics::Surface *decodeNextFrame();
- const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+ const byte *getPalette() const { _dirtyPalette = false; return _palette.data(); }
bool hasDirtyPalette() const { return _dirtyPalette; }
void setFrameStartPos();
@@ -103,7 +104,7 @@ private:
uint16 _width, _height;
uint32 _frameRate;
uint32 _frameCount;
- byte _palette[256 * 3];
+ Graphics::Palette _palette;
mutable bool _dirtyPalette;
int _curFrame;
uint32 _frameStartOffset;
Commit: cb8d5d4bd6503aef6ce0a10e2f08d947f32a9b76
https://github.com/scummvm/scummvm/commit/cb8d5d4bd6503aef6ce0a10e2f08d947f32a9b76
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2025-03-10T19:03:23+02:00
Commit Message:
VIDEO: Use palette class in FLIC decoder
Changed paths:
engines/chewy/video/cfo_decoder.cpp
video/flic_decoder.cpp
video/flic_decoder.h
diff --git a/engines/chewy/video/cfo_decoder.cpp b/engines/chewy/video/cfo_decoder.cpp
index b156a38a491..1c8808028d1 100644
--- a/engines/chewy/video/cfo_decoder.cpp
+++ b/engines/chewy/video/cfo_decoder.cpp
@@ -326,16 +326,19 @@ void CfoDecoder::CfoVideoTrack::handleCustomFrame() {
void CfoDecoder::CfoVideoTrack::fadeOut() {
for (int j = 0; j < 64; j++) {
for (int i = 0; i < 256; i++) {
- if (_palette[i * 3 + 0] > 0)
- --_palette[i * 3 + 0];
- if (_palette[i * 3 + 1] > 0)
- --_palette[i * 3 + 1];
- if (_palette[i * 3 + 2] > 0)
- --_palette[i * 3 + 2];
+ byte r, g, b;
+ _palette.get(i, r, g, b);
+ if (r > 0)
+ --r;
+ if (g > 0)
+ --g;
+ if (b > 0)
+ --b;
+ _palette.set(i, r, g, b);
}
//setScummVMPalette(_palette, 0, 256);
- g_system->getPaletteManager()->setPalette(_palette, 0, 256);
+ g_system->getPaletteManager()->setPalette(_palette, 0);
g_system->updateScreen();
g_system->delayMillis(10);
}
diff --git a/video/flic_decoder.cpp b/video/flic_decoder.cpp
index b93e0517995..2d2677e7e19 100644
--- a/video/flic_decoder.cpp
+++ b/video/flic_decoder.cpp
@@ -84,13 +84,12 @@ void FlicDecoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
((FlicVideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch);
}
-FlicDecoder::FlicVideoTrack::FlicVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader) {
+FlicDecoder::FlicVideoTrack::FlicVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader) : _palette(256) {
_fileStream = stream;
_frameCount = frameCount;
_surface = new Graphics::Surface();
_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- _palette = new byte[3 * 256]();
_dirtyPalette = false;
_curFrame = -1;
@@ -103,7 +102,6 @@ FlicDecoder::FlicVideoTrack::FlicVideoTrack(Common::SeekableReadStream *stream,
FlicDecoder::FlicVideoTrack::~FlicVideoTrack() {
delete _fileStream;
- delete[] _palette;
_surface->free();
delete _surface;
@@ -363,7 +361,10 @@ void FlicDecoder::FlicVideoTrack::unpackPalette(uint8 *data) {
if (0 == READ_LE_UINT16(data)) { //special case
data += 2;
for (int i = 0; i < 256; ++i) {
- memcpy(_palette + i * 3, data + i * 3, 3);
+ byte r = data[i * 3];
+ byte g = data[i * 3 + 1];
+ byte b = data[i * 3 + 2];
+ _palette.set(i, r, g, b);
}
} else {
uint8 palPos = 0;
@@ -373,7 +374,10 @@ void FlicDecoder::FlicVideoTrack::unpackPalette(uint8 *data) {
uint8 change = *data++;
for (int i = 0; i < change; ++i) {
- memcpy(_palette + (palPos + i) * 3, data + i * 3, 3);
+ byte r = data[i * 3];
+ byte g = data[i * 3 + 1];
+ byte b = data[i * 3 + 2];
+ _palette.set(palPos + i, r, g, b);
}
palPos += change;
diff --git a/video/flic_decoder.h b/video/flic_decoder.h
index 7669f1b6db0..fd2a35b07d3 100644
--- a/video/flic_decoder.h
+++ b/video/flic_decoder.h
@@ -25,6 +25,7 @@
#include "video/video_decoder.h"
#include "common/list.h"
#include "common/rect.h"
+#include "graphics/palette.h"
namespace Common {
class SeekableReadStream;
@@ -77,7 +78,7 @@ protected:
uint32 getNextFrameStartTime() const { return _nextFrameStartTime; }
virtual const Graphics::Surface *decodeNextFrame();
virtual void handleFrame();
- const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+ const byte *getPalette() const { _dirtyPalette = false; return _palette.data(); }
bool hasDirtyPalette() const { return _dirtyPalette; }
const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
@@ -93,7 +94,7 @@ protected:
uint32 _offsetFrame1;
uint32 _offsetFrame2;
- byte *_palette;
+ Graphics::Palette _palette;
mutable bool _dirtyPalette;
uint32 _frameCount;
Commit: 5e9f79d537e3f6e38dd4a267af7d8aa6151d6b0d
https://github.com/scummvm/scummvm/commit/5e9f79d537e3f6e38dd4a267af7d8aa6151d6b0d
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2025-03-10T19:03:23+02:00
Commit Message:
VIDEO: Use palette class in MVE decoder
Changed paths:
video/mve_decoder.cpp
video/mve_decoder.h
diff --git a/video/mve_decoder.cpp b/video/mve_decoder.cpp
index 4a20b54d263..fc415960b31 100644
--- a/video/mve_decoder.cpp
+++ b/video/mve_decoder.cpp
@@ -40,6 +40,7 @@ MveDecoder::MveDecoder()
: _done(false),
_s(nullptr),
_dirtyPalette(false),
+ _palette(256),
_skipMapSize(0),
_skipMap(nullptr),
_decodingMapSize(0),
@@ -50,8 +51,6 @@ MveDecoder::MveDecoder()
_audioTrack(0),
_audioStream(nullptr)
{
- for (int i = 0; i < 0x300; ++i)
- _palette[i] = 0;
}
MveDecoder::~MveDecoder() {
@@ -97,7 +96,7 @@ void MveDecoder::setAudioTrack(int track) {
}
void MveDecoder::applyPalette(PaletteManager *paletteManager) {
- paletteManager->setPalette(_palette + 3 * _palStart, _palStart, _palCount);
+ paletteManager->setPalette(_palette.data() + 3 * _palStart, _palStart, _palCount);
}
void MveDecoder::copyBlock_8bit(Graphics::Surface &dst, Common::MemoryReadStream &s, int block) {
@@ -443,9 +442,7 @@ void MveDecoder::readNextPacket() {
byte g = _s->readByte();
byte b = _s->readByte();
- _palette[3*i+0] = (r << 2) | (r >> 4);
- _palette[3*i+1] = (g << 2) | (g >> 4);
- _palette[3*i+2] = (b << 2) | (b >> 4);
+ _palette.set(i, (r << 2) | (r >> 4), (g << 2) | (g >> 4), (b << 2) | (b >> 4));
}
if (palCount & 1) {
_s->skip(1);
@@ -523,7 +520,7 @@ const Graphics::Surface *MveDecoder::MveVideoTrack::decodeNextFrame() {
}
const byte *MveDecoder::MveVideoTrack::getPalette() const {
- return _decoder->_palette;
+ return _decoder->_palette.data();
}
bool MveDecoder::MveVideoTrack::hasDirtyPalette() const {
diff --git a/video/mve_decoder.h b/video/mve_decoder.h
index eccdff18857..f246232dd89 100644
--- a/video/mve_decoder.h
+++ b/video/mve_decoder.h
@@ -24,6 +24,7 @@
#include "audio/audiostream.h"
#include "video/video_decoder.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "common/list.h"
#include "common/rect.h"
@@ -72,7 +73,7 @@ class MveDecoder : public VideoDecoder {
bool _dirtyPalette;
uint16 _palStart;
uint16 _palCount;
- byte _palette[0x300];
+ Graphics::Palette _palette;
uint16 _skipMapSize;
byte *_skipMap;
Commit: 99330f128cc372868b61cd268bafce4851536643
https://github.com/scummvm/scummvm/commit/99330f128cc372868b61cd268bafce4851536643
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2025-03-10T19:03:23+02:00
Commit Message:
VIDEO: Use palette class in Coktel decoder
Changed paths:
video/coktel_decoder.cpp
video/coktel_decoder.h
diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp
index 6b4f6baea29..0202b8e5393 100644
--- a/video/coktel_decoder.cpp
+++ b/video/coktel_decoder.cpp
@@ -57,14 +57,12 @@ CoktelDecoder::State::State() : flags(0), speechId(0) {
CoktelDecoder::CoktelDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) :
_mixer(mixer), _soundType(soundType), _width(0), _height(0), _x(0), _y(0),
- _defaultX(0), _defaultY(0), _features(0), _frameCount(0), _paletteDirty(false),
+ _defaultX(0), _defaultY(0), _features(0), _frameCount(0), _palette(256), _paletteDirty(false),
_isDouble(false), _ownSurface(true), _frameRate(12), _hasSound(false),
_soundEnabled(false), _soundStage(kSoundNone), _audioStream(0), _startTime(0),
_pauseStartTime(0), _isPaused(false) {
assert(_mixer);
-
- memset(_palette, 0, 768);
}
CoktelDecoder::~CoktelDecoder() {
@@ -316,7 +314,7 @@ uint32 CoktelDecoder::getFrameCount() const {
const byte *CoktelDecoder::getPalette() {
_paletteDirty = false;
- return _palette;
+ return _palette.data();
}
bool CoktelDecoder::hasDirtyPalette() const {
@@ -1122,8 +1120,12 @@ bool IMDDecoder::loadStream(Common::SeekableReadStream *stream) {
_features |= kFeaturesPalette;
// Palette
- for (int i = 0; i < 768; i++)
- _palette[i] = _stream->readByte() << 2;
+ for (int i = 0; i < 256; i++) {
+ byte r = _stream->readByte() << 2;
+ byte g = _stream->readByte() << 2;
+ byte b = _stream->readByte() << 2;
+ _palette.set(i, r, g, b);
+ }
_paletteDirty = true;
@@ -1403,8 +1405,12 @@ void IMDDecoder::processFrame() {
_paletteDirty = true;
- for (int i = 0; i < 768; i++)
- _palette[i] = _stream->readByte() << 2;
+ for (int i = 0; i < 256; i++) {
+ byte r = _stream->readByte() << 2;
+ byte g = _stream->readByte() << 2;
+ byte b = _stream->readByte() << 2;
+ _palette.set(i, r, g, b);
+ }
cmd = _stream->readUint16LE();
}
@@ -1519,9 +1525,13 @@ bool IMDDecoder::renderFrame(Common::Rect &rect) {
// One byte index
int index = *dataPtr++;
- int count = MIN((255 - index) * 3, 48);
- for (int i = 0; i < count; i++)
- _palette[index * 3 + i] = dataPtr[i] << 2;
+ int count = MIN((255 - index), 16);
+ for (int i = 0; i < count; i++) {
+ byte r = dataPtr[i * 3] << 2;
+ byte g = dataPtr[i * 3 + 1] << 2;
+ byte b = dataPtr[i * 3 + 2] << 2;
+ _palette.set(index + i, r, g, b);
+ }
dataPtr += 48;
dataSize -= 49;
@@ -1964,8 +1974,12 @@ bool VMDDecoder::loadStream(Common::SeekableReadStream *stream) {
_videoCodec = _stream->readUint32BE();
if (_features & kFeaturesPalette) {
- for (int i = 0; i < 768; i++)
- _palette[i] = _stream->readByte() << 2;
+ for (int i = 0; i < 256; i++) {
+ byte r = _stream->readByte() << 2;
+ byte g = _stream->readByte() << 2;
+ byte b = _stream->readByte() << 2;
+ _palette.set(i, r, g, b);
+ }
_paletteDirty = true;
}
@@ -2389,8 +2403,12 @@ void VMDDecoder::processFrame() {
uint8 index = _stream->readByte();
uint8 count = _stream->readByte();
- for (int j = 0; j < ((count + 1) * 3); j++)
- _palette[index * 3 + j] = _stream->readByte() << 2;
+ for (int j = 0; j < (count + 1); j++) {
+ byte r = _stream->readByte() << 2;
+ byte g = _stream->readByte() << 2;
+ byte b = _stream->readByte() << 2;
+ _palette.set(index + j, r, g, b);
+ }
_stream->skip((255 - count) * 3);
diff --git a/video/coktel_decoder.h b/video/coktel_decoder.h
index 27486a580fe..367753b8d64 100644
--- a/video/coktel_decoder.h
+++ b/video/coktel_decoder.h
@@ -40,6 +40,7 @@
#include "common/rational.h"
#include "common/str.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "video/video_decoder.h"
@@ -236,7 +237,7 @@ protected:
uint32 _startTime;
- byte _palette[768];
+ Graphics::Palette _palette;
bool _paletteDirty;
bool _isDouble;
Commit: b3ab2e0774e8eaacc85b9474e5c47e63ce52b224
https://github.com/scummvm/scummvm/commit/b3ab2e0774e8eaacc85b9474e5c47e63ce52b224
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2025-03-10T19:03:23+02:00
Commit Message:
VIDEO: Use palette class in PACo decoder
Changed paths:
video/paco_decoder.cpp
video/paco_decoder.h
diff --git a/video/paco_decoder.cpp b/video/paco_decoder.cpp
index 6e79442e97b..47db0b13591 100644
--- a/video/paco_decoder.cpp
+++ b/video/paco_decoder.cpp
@@ -171,18 +171,18 @@ const byte* PacoDecoder::getPalette(){
const byte* PacoDecoder::PacoVideoTrack::getPalette() const {
_dirtyPalette = false;
- return _palette;
+ return _palette.data();
}
PacoDecoder::PacoVideoTrack::PacoVideoTrack(
- uint16 frameRate, uint16 frameCount, uint16 width, uint16 height) {
+ uint16 frameRate, uint16 frameCount, uint16 width, uint16 height) : _palette(256) {
_curFrame = 0;
_frameRate = frameRate;
_frameCount = frameCount;
_surface = new Graphics::Surface();
_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- _palette = const_cast<byte *>(quickTimeDefaultPalette256);
+ _palette.set(quickTimeDefaultPalette256, 0, 256);
_dirtyPalette = true;
}
@@ -260,12 +260,14 @@ const Graphics::Surface *PacoDecoder::PacoVideoTrack::decodeNextFrame() {
void PacoDecoder::PacoVideoTrack::handlePalette(Common::SeekableReadStream *fileStream) {
uint32 header = fileStream->readUint32BE();
if (header == 0x30000000) { // default quicktime palette
- _palette = const_cast<byte *>(quickTimeDefaultPalette256);
+ _palette.set(quickTimeDefaultPalette256, 0, 256);
} else {
fileStream->readUint32BE(); // 4 bytes of 00
- _palette = new byte[256 * 3]();
- for (int i = 0; i < 256 * 3; i++){
- _palette[i] = fileStream->readByte();
+ for (int i = 0; i < 256; i++){
+ byte r = fileStream->readByte();
+ byte g = fileStream->readByte();
+ byte b = fileStream->readByte();
+ _palette.set(i, r, g, b);
}
}
_dirtyPalette = true;
diff --git a/video/paco_decoder.h b/video/paco_decoder.h
index 0a83599b2c9..28218a30b0c 100644
--- a/video/paco_decoder.h
+++ b/video/paco_decoder.h
@@ -25,6 +25,7 @@
#include "audio/audiostream.h"
#include "common/list.h"
#include "common/rect.h"
+#include "graphics/palette.h"
#include "video/video_decoder.h"
namespace Common {
@@ -88,8 +89,7 @@ protected:
protected:
Graphics::Surface *_surface;
-
- byte *_palette;
+ Graphics::Palette _palette;
mutable bool _dirtyPalette;
More information about the Scummvm-git-logs
mailing list