DDS: improved read/write support

The following changes have been made:

- Improved writing speed by using scanLine() instead of pixel()
- Optimized memory usage on writing by using ScanlineConverter class
- Added native write support for RGBA32FPx4, RGBA16FPx4, RGB8, Grayscale8 and Indexed8 uncompressed formats
- Grayscale DDS without alpha are loaded in a Grayscale8 image
- Fixed warnings about wrong PITCH reported by GIMP on DDSs saved by this plugin
- Initial support for loading DX10 formats (R16F, RG16F, RGBA16F, RGBPreMulA16F, R32F, RG32F, RGBA32F, RGBPreMulA32F)
- Fixed alignment issues and A8P8 format support of the attached images*

Tested using GIMP and [NVIDIA Texture Tools](https://developer.nvidia.com/texture-tools-exporter) plugin for Photoshop.

(*) The following images (taken from [here](https://github.com/walbourn/directxtexmedia)) cannot be added to read tests due to license issue:
[test8_DWORD.dds](/uploads/449b5a0d886aaf6764af554fe38e2b09/test8_DWORD.dds)
[dx5_logo.dds](/uploads/6f5f27df752890b227ef07e0195435d4/dx5_logo.dds)
[test888_DWORD.dds](/uploads/c8bc355c5749cf203d47e0b3073ad419/test888_DWORD.dds)
This commit is contained in:
Mirco Miranda
2024-12-17 23:08:43 +00:00
committed by Albert Astals Cid
parent a6f7482957
commit adc5c7ae9a
68 changed files with 695 additions and 105 deletions

View File

@ -66,8 +66,8 @@ removed.
### The DDS plugin
The DDS plugin is a fork from Qt 5.6. It will be activated once the
security issues are resolved.
The DDS plugin is a fork of Qt 5.6 with bug fixes and improvements. It
will be activated once the security issues are resolved.
## License
@ -79,22 +79,23 @@ The CMake code in this framework is licensed under the
## Plugin status
The current implementation of a plugin may not be complete or may have limitations
of various kinds. Typically the limitations are on maximum size and color depth.
The current implementation of a plugin may not be complete or may have
limitations of various kinds. Typically the limitations are on maximum size
and color depth.
The various plugins are also limited by the formats natively supported by Qt.
The various plugins are also limited by the formats natively supported by Qt.
For example, native support for CMYK images is only available since Qt 6.8.
### HDR images
HDR images are supported via floating point image formats from EXR, HDR, JXL,
JXR, PFM and PSD plugins.
It is important to note that in the past these plugins stripped away HDR
HDR images are supported via floating point image formats from DDS, EXR, HDR,
JXL, JXR, PFM and PSD plugins.
It is important to note that in the past these plugins stripped away HDR
information, returning SDR images.
HDR images return R, G and B values outside the range 0.0 - 1.0.
While Qt painters handles HDR data correctly, some older programs may display
strange artifacts if they do not use a tone mapping operator (or at least a
While Qt painters handles HDR data correctly, some older programs may display
strange artifacts if they do not use a tone mapping operator (or at least a
clamp). This is not a plugin issue.
### Metadata
@ -176,6 +177,9 @@ with Qt 6.8+.
**This plugin is disabled by default. It can be enabled with the
`KIMAGEFORMATS_DDS` build option in the cmake file.**
The following defines can be defined in cmake to modify the behavior of the plugin:
- `DDS_DISABLE_STRIDE_ALIGNMENT`: disable the stride aligment based on DDS pitch: it is known that some writers do not set it correctly.
### The HEIF plugin
**This plugin is disabled by default. It can be enabled with the