mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-07-21 16:00:56 -04:00
IFF: support for ZIP compressed RGFX
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
BIN
autotests/read/iff/sv5_idx8z_rgx.iff
Normal file
BIN
autotests/read/iff/sv5_idx8z_rgx.iff
Normal file
Binary file not shown.
5
autotests/read/iff/sv5_idx8z_rgx.iff.json
Normal file
5
autotests/read/iff/sv5_idx8z_rgx.iff.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "sv5_idx8_rgx.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
BIN
autotests/read/iff/sv5_rgb16z_rgx.iff
Normal file
BIN
autotests/read/iff/sv5_rgb16z_rgx.iff
Normal file
Binary file not shown.
5
autotests/read/iff/sv5_rgb16z_rgx.iff.json
Normal file
5
autotests/read/iff/sv5_rgb16z_rgx.iff.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "sv5_rgb16_rgx.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
BIN
autotests/read/iff/sv5_rgb32z_rgx.iff
Normal file
BIN
autotests/read/iff/sv5_rgb32z_rgx.iff
Normal file
Binary file not shown.
5
autotests/read/iff/sv5_rgb32z_rgx.iff.json
Normal file
5
autotests/read/iff/sv5_rgb32z_rgx.iff.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "sv5_rgb32_rgx.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
BIN
autotests/read/iff/sv5_rgb8z_rgx.iff
Normal file
BIN
autotests/read/iff/sv5_rgb8z_rgx.iff
Normal file
Binary file not shown.
5
autotests/read/iff/sv5_rgb8z_rgx.iff.json
Normal file
5
autotests/read/iff/sv5_rgb8z_rgx.iff.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "sv5_rgb8_rgx.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
BIN
autotests/read/iff/sv5_rgba16z_rgx.iff
Normal file
BIN
autotests/read/iff/sv5_rgba16z_rgx.iff
Normal file
Binary file not shown.
5
autotests/read/iff/sv5_rgba16z_rgx.iff.json
Normal file
5
autotests/read/iff/sv5_rgba16z_rgx.iff.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "sv5_rgba16_rgx.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
BIN
autotests/read/iff/sv5_rgba32z_rgx.iff
Normal file
BIN
autotests/read/iff/sv5_rgba32z_rgx.iff
Normal file
Binary file not shown.
5
autotests/read/iff/sv5_rgba32z_rgx.iff.json
Normal file
5
autotests/read/iff/sv5_rgba32z_rgx.iff.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "sv5_rgba32_rgx.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
BIN
autotests/read/iff/sv5_rgba8z_rgx.iff
Normal file
BIN
autotests/read/iff/sv5_rgba8z_rgx.iff
Normal file
Binary file not shown.
5
autotests/read/iff/sv5_rgba8z_rgx.iff.json
Normal file
5
autotests/read/iff/sv5_rgba8z_rgx.iff.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "sv5_rgba8_rgx.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user