IFF: support for ZIP compressed RGFX

This commit is contained in:
Mirco Miranda
2026-07-10 11:20:36 +02:00
parent 215305fa4b
commit 7e14d5616f
17 changed files with 51 additions and 1 deletions

View File

@@ -415,7 +415,7 @@ The plugin supports the following image data:
with color map only. with color map only.
- FORM IMAG (Compact Disc-Interactive): It supports CLut4, CLut7, CLut8, Rle7 - FORM IMAG (Compact Disc-Interactive): It supports CLut4, CLut7, CLut8, Rle7
and DYuv formats. and DYuv formats.
- FORM RGFX: It supports uncompressed images only. - FORM RGFX: It supports uncompressed and ZIP compressed images.
- FORM DEEP: It supports uncompressed, RLE and TVDC images. - FORM DEEP: It supports uncompressed, RLE and TVDC images.
- FOR4 CIMG (Maya Image File Format): It supports 24/48-bit RGB and 32/64-bit - FOR4 CIMG (Maya Image File Format): It supports 24/48-bit RGB and 32/64-bit
RGBA images. RGBA images.

Binary file not shown.

View File

@@ -0,0 +1,5 @@
[
{
"fileName" : "sv5_idx8_rgx.png"
}
]

Binary file not shown.

View File

@@ -0,0 +1,5 @@
[
{
"fileName" : "sv5_rgb16_rgx.png"
}
]

Binary file not shown.

View File

@@ -0,0 +1,5 @@
[
{
"fileName" : "sv5_rgb32_rgx.png"
}
]

Binary file not shown.

View File

@@ -0,0 +1,5 @@
[
{
"fileName" : "sv5_rgb8_rgx.png"
}
]

Binary file not shown.

View File

@@ -0,0 +1,5 @@
[
{
"fileName" : "sv5_rgba16_rgx.png"
}
]

Binary file not shown.

View File

@@ -0,0 +1,5 @@
[
{
"fileName" : "sv5_rgba32_rgx.png"
}
]

Binary file not shown.

View File

@@ -0,0 +1,5 @@
[
{
"fileName" : "sv5_rgba8_rgx.png"
}
]

View File

@@ -3501,6 +3501,17 @@ QByteArray RBODChunk::strideRead(QIODevice *d, qint32 y, const RGHDChunk *header
for (auto nextPos = nextChunkPos(); !d->atEnd() && d->pos() < nextPos && planes.size() < readSize;) { for (auto nextPos = nextChunkPos(); !d->atEnd() && d->pos() < nextPos && planes.size() < readSize;) {
if (header->compression() == RGHDChunk::Compression::Uncompressed) { if (header->compression() == RGHDChunk::Compression::Uncompressed) {
planes = d->read(readSize); planes = d->read(readSize);
} else if (header->compression() == RGHDChunk::Compression::Zip) {
if (_readBuffer.isEmpty()) {
auto size = nextPos - d->pos();
if (size < kMaxQVectorSize) {
// I have no control over qUncompress() so, I have to decompress the whole chunk
_readBuffer = qUncompress(deviceRead(d, size));
// Reset the position to avoid falling into the `d->pos() < nextPos` check
seek(d, 0);
}
}
planes = _readBuffer.mid(y * readSize, readSize);
} else { } else {
qCDebug(LOG_IFFPLUGIN) << "RBODChunk::strideRead(): unknown compression" << header->compression(); qCDebug(LOG_IFFPLUGIN) << "RBODChunk::strideRead(): unknown compression" << header->compression();
} }
@@ -3514,6 +3525,7 @@ QByteArray RBODChunk::strideRead(QIODevice *d, qint32 y, const RGHDChunk *header
bool RBODChunk::resetStrideRead(QIODevice *d) const bool RBODChunk::resetStrideRead(QIODevice *d) const
{ {
_readBuffer.clear();
return seek(d); return seek(d);
} }

View File

@@ -1964,6 +1964,9 @@ private:
QByteArray deinterleave(const QByteArray &planes, qint32 y, const RGHDChunk *header, const RSCMChunk *rcsm = nullptr, const RCOLChunk *rcol = nullptr) const; QByteArray deinterleave(const QByteArray &planes, qint32 y, const RGHDChunk *header, const RSCMChunk *rcsm = nullptr, const RCOLChunk *rcol = nullptr) const;
quint32 strideSize(const RGHDChunk *header) const; quint32 strideSize(const RGHDChunk *header) const;
private:
mutable QByteArray _readBuffer;
}; };