The palette was filled with 16 (1 bit, 4 planes) or 256 (8 bits) entries
read with QImage::color(), reading past the end of the color table of
images with fewer colors. Entries past the color table (all of them for
an image without one) are now written as black, as the DDS plugin does.
The 4-plane writer set BytesPerLine to width / 8, so for widths not a
multiple of 8 the last pixels of each line were set one byte past the
end of the line buffers (an assertion in debug builds) and dropped from
the file, which the plugin then could not read back. Images narrower
than 8 pixels could not be saved at all. It is now (width + 7) / 8.
The 1-bit and 8-bit writers copied whole scanlines of the image into the
file, including their uninitialized padding bytes. Only the bytes used by
the pixels are copied now.
Added indexed images with 3, 5, 16 and 40 colors (6, 13, 16 and 17 pixels
wide) to autotests/write/basic, with the .qoi and .rgb files of the
formats whose output is checked byte for byte. writetest now compares
indexed images as RGB32 or ARGB32, since fuzzyeq() only takes 24, 32 and
64 bit images.
Some Grayscale images with certain color profiles triggered
problems during saving with lossy compression,
16-bit depth pixel values were written into buffer allocated
for 8-bit depth.
A grayscale image with one channel, whose resources announce an alpha channel (Alpha Identifiers), was loaded as RGBA: the alpha of each pixel was read from the gray of the next one, and for the last pixel of each line from past the end of the decoded line, a value never set. Such a file is malformed, so it is now refused.
addLibraryPath() is a no-op if the path being added is already present,
which is the case for PLUGIN_DIR here (it is set to the test's own
directory). The docs for addLibraryPath() say this directory is last in
the default list.
Images are allocated without being initialized, so a reader must write
every pixel of every line. The IFF reader did not always:
- Maya: nothing checked that the tiles cover the image: areas no tile
covers are now opaque black.
- readStandardImage(), readCDIImage(), readRGFXImage() and
readDEEPImage() copied min(bytesPerLine, decoded line) bytes, and some
decoded lines are shorter than the image line:
- a PBM with 8 bitplanes and a 64 color CMAP was taken for HAM and
allocated as RGB888, while PBM data are one index per pixel: HAM is
no longer applied to PBM images;
- other mismatches (e.g. HAM without CMAP, RGB8 with 32 bitplanes, CD-i
CLUT3 or RGB888, a truncated CD-i line) are now an error: a decoded
line that does not cover the image line is refused.
Added the read test pbm_64colors.iff, which fails without this change.
Images are allocated without being initialized, so a reader must write
every pixel of every line. The PCX reader did not always:
- readImage2() and readImage4v2() decoded width / 4 and width / 2 bytes,
so the last pixels of lines whose width is not a multiple of 4 (2 bits)
or 2 (4 bits) were not set. They now decode every pixel.
- With a BytesPerLine smaller than a line of pixels, readImage1(),
readImage8() and readImage24() left the end of each line unset: such
headers are now refused by isSupported(), which replaces the check
readImage4() had.
Added the read tests indexed2_w13.pcx and indexed4_w13.pcx, which fail
without this change.
1-bit images with a color map are loaded as Indexed8, but their lines
were copied packed: the first (width + 7) / 8 bytes (rounded up to an
even number) of each line held packed bits read as indexes, and the rest
of the line was not set, so it kept whatever the memory held (images are
allocated without being initialized). The bits are now unpacked to one
index per pixel.
Added the read test pal1bit.ras, which fails without this change.
Originally we uses getNormalZ() for the image, which treat the
image as a normal map. Visual Studio simply fill the blue channel
with 0 instead. Since DDS is for DirectX which is a MS stuff, align
to Visual Studio might be a good idea.
Also, red and green channel should be swapped.
DX10 DDS files using the BC (block compression) formats were reported as
unsupported: knownDXGIFormat() only mapped the floating point DXGI
formats, so getFormat() returned FormatUnknown and ensureScanned() failed,
e.g. for a BC7_UNORM_SRGB (dxgi 99) image.
The following changes have been made:
- Added a self-contained BC7 decoder following the "BC7 Format"
specification, supporting all 8 modes, for both the UNORM and the
UNORM_SRGB variants (loaded as ARGB32)
- Added BC4 support (single channel, loaded as Grayscale8)
- Added BC5 support, reusing the existing ATI2/3Dc normal map decoder
- Added DX10 mappings for BC1/BC2/BC3, which were previously handled only
as the legacy DXT1/DXT3/DXT5 fourCC formats
- Added read tests for BC4, BC5, BC7 and BC7_UNORM_SRGB, plus DX10
variants of the existing BC1/BC2/BC3 test images
BC6H (HDR) is not supported.
The test data was generated from the existing rgba.png test image, encoded
with bc7enc_rdo and decoded with bcdec.
BUG: 524495
read_orientation_helper() mapped the irot/imir properties to an EXIF
orientation with a list of conditions that misses several combinations,
e.g. a 90 degrees counterclockwise rotation followed by a mirroring,
which is how iPhone front-camera photos are stored. For those it still
returned true, so libheif was told to ignore the transformations while
Qt got no orientation either, and the image was shown sideways.
The orientation is now chosen by a switch on the rotation and, in each
case, on the mirroring, which is applied after the rotation as MIAF
requires. Other rotation values are left to libheif.
The new read tests cover the twelve rotation and mirroring combinations,
named like the AVIF ones. All of them display the same picture (colored
corners and an "F"): the stored pixels are that picture with the
transformations undone, written as uncompressed HEIF with libheif. Four
of them fail without this change.
Current cmake module assumes the headers are installed in $(INCLUDEDIR)/jxrlib, which is only true if using a custom CMakeLists (as provided by eg. Fedora)
Fix detection of jxrlib compiled with the upstream Makefile by checking the pc file first, and fallback to manual detection as before.
libjxl with SIMD disabled (HWY_COMPILE_ONLY_SCALAR) and with
O1 optimization level is very slow for real use,
leading to timeouts.
HWY_COMPILE_ONLY_STATIC enables baseline SIMD, which should be
always supported by current arch. (for example SSE2 on x86_64)
Fixes kimageformats-write-exr test on Alpine Linux armhf, armv7,
loongarch64, ppc64le, riscv64 and s390x.
Working alternatives are increasing fuzziness to 10 or using 64bpp
formats as compareFormat.
In practice UTF-16 (especially from windows) uses little-endian without
a BOM. By default Qt uses host endianess which causes TIFF_XPTITLE and
TIFF_XPKEYWORDS to not be read correctly.
Fixes c21b50d699
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.