Compare commits

...
6 Commits
Author SHA1 Message Date
Sertonix NorsonandAlbert Astals Cid 104643bf09 IFF: fix BODYChunk::deinterleave on big-endian
Qt accesses the data of QImage::Format_RGBX64 and QImage::Format_RGBA64
as host-endian quint16. Having BODYChunk::deinterleave write the data
with host-endian to fix parsing on big-endian systems.
2026-10-03 10:43:42 +00:00
Sertonix NorsonandAlbert Astals Cid 9a45321440 IFF: fix DBODChunk::strideRead on big-endian
On big-endian systems the uint16 data should stay big-endian.
2026-10-03 10:43:42 +00:00
Sertonix NorsonandAlbert Astals Cid f5ba223e15 TIM: fix 16BPP on big-endian
Despite the QImage::scanLine doc only warning about byte order issues
for 32-bpp formats[0] the same warning seems to apply to 16BPP formats
like QImage::Format_RGB555 as well.

[0]: https://doc.qt.io/qt-6/qimage.html#scanLine
2026-10-03 10:34:55 +00:00
Sertonix NorsonandAlbert Astals Cid e23328fda8 FF: replace broken #if Q_LITTLE_ENDIAN
Q_LITTLE_ENDIAN was used incorrectly, it should have been
"#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN"

Use qFromBigEndian since it is more explicit.

Fixes 6d5e61f0b0
2026-10-03 10:22:23 +00:00
Mirco MirandaandNicolas Fella 8b8eb91f2b Disable LSAN due to obsolete JXRLIB on CI 2026-10-02 16:02:55 +02:00
Nicolas Fella 5e3c759e21 Update version to 6.32.0 2026-10-02 15:49:57 +02:00
5 changed files with 20 additions and 18 deletions
+1 -1
View File
@@ -9,4 +9,4 @@ Options:
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
cmake-options: "-DKIMAGEFORMATS_WITH_KNOWN_CRASHES_JXR=ON -DKIMAGEFORMATS_HEIF=ON -DKIMAGEFORMATS_HEIC_TEST:STRING=OFF -DKIMAGEFORMATS_HEIF_TEST:STRING=OFF -DKIMAGEFORMATS_HEJ2_TEST:STRING=OFF -DKIMAGEFORMATS_AVCI_TEST:STRING=OFF"
per-test-timeout: 90
enable-lsan: True
enable-lsan: False
+1 -1
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.30)
set(KF_VERSION "6.31.0") # handled by release scripts
set(KF_VERSION "6.32.0") # handled by release scripts
set(KF_DEP_VERSION "6.31.0") # handled by release scripts
project(KImageFormats VERSION ${KF_VERSION})
+14 -11
View File
@@ -1271,33 +1271,34 @@ QByteArray BODYChunk::deinterleave(const QByteArray &planes, qint32 y, const BMH
// from the PNG format into the Amiga (ILBM) bitmap format.
ba = QByteArray(rowLen * 64, char()); // the RGBX QT format is 64-bits
quint16 *data = reinterpret_cast<quint16*>(ba.data());
const qint32 order[] = { 1, 0, 3, 2, 5, 4, 7, 6 };
for (qint32 i = 0, cnt = 0, p = bitplanes / 8; i < rowLen; ++i) {
for (qint32 j = 0; j < 8; ++j, cnt += 8) {
for (qint32 k = 0; k < p; ++k) {
auto k8 = k * 8;
auto msk = (1 << (7 - j));
auto idx = cnt + order[k];
auto idx = (cnt + order[k]) / 2;
auto shift = (order[k] % 2) * 8;
if (planes.at(k8 * rowLen + i) & msk)
ba[idx] |= 0x01;
data[idx] |= 0x01 << shift;
if (planes.at((1 + k8) * rowLen + i) & msk)
ba[idx] |= 0x02;
data[idx] |= 0x02 << shift;
if (planes.at((2 + k8) * rowLen + i) & msk)
ba[idx] |= 0x04;
data[idx] |= 0x04 << shift;
if (planes.at((3 + k8) * rowLen + i) & msk)
ba[idx] |= 0x08;
data[idx] |= 0x08 << shift;
if (planes.at((4 + k8) * rowLen + i) & msk)
ba[idx] |= 0x10;
data[idx] |= 0x10 << shift;
if (planes.at((5 + k8) * rowLen + i) & msk)
ba[idx] |= 0x20;
data[idx] |= 0x20 << shift;
if (planes.at((6 + k8) * rowLen + i) & msk)
ba[idx] |= 0x40;
data[idx] |= 0x40 << shift;
if (planes.at((7 + k8) * rowLen + i) & msk)
ba[idx] |= 0x80;
data[idx] |= 0x80 << shift;
}
if (p == 6) { // RGBX wants unused X data set to 0xFF
ba[cnt + 6] = char(0xFF);
ba[cnt + 7] = char(0xFF);
data[cnt / 2 + 3] = 0xFFFF;
}
}
}
@@ -4083,6 +4084,7 @@ QByteArray DBODChunk::strideRead(QIODevice *d, qint32, const DGBLChunk *header,
return {};
}
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
// byte swap
if (auto count = pel->count()) {
if (pel->depth() / count == 16) {
@@ -4091,6 +4093,7 @@ QByteArray DBODChunk::strideRead(QIODevice *d, qint32, const DGBLChunk *header,
}
}
}
#endif
return planes;
}
+1 -5
View File
@@ -176,11 +176,7 @@ bool FFHandler::read(QImage *image)
qCWarning(LOG_FFPLUGIN) << "FFHandler::read() error while reading image scanline";
return false;
}
#if Q_LITTLE_ENDIAN
for (auto i = 0; i < size; i += 2) {
std::swap(line[i], line[i + 1]);
}
#endif
qFromBigEndian<quint16>(line, size / 2, line);
}
img.setColorSpace(QColorSpace(QColorSpace::SRgb));
+3
View File
@@ -311,6 +311,9 @@ bool TIMHandler::read(QImage *image)
qCWarning(LOG_TIMPLUGIN) << "TIMHandler::read() error while reading image scanline";
return false;
}
if (img.format() == QImage::Format_RGB555) {
qFromLittleEndian<quint16>(line, size / 2, line);
}
if (conv_4bpp) {
for (auto x = 0, w = qint32(tmpBuff.size()); x < w; ++x) {
auto &&v = tmpBuff.at(x);