DDS: Fix warning in qfloat16 and test failure on PowerPC

Fixes the following warning:
```
/home/daniel/kimageformats/src/imageformats/dds.cpp: In function ‘qfloat16 readFloat16(QDataStream&)’:
/home/daniel/kimageformats/src/imageformats/dds.cpp:1037:11: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class qfloat16’ from an array of ‘quint16’ {aka ‘short unsigned int’} [-Wclass-memaccess]
 1037 |     memcpy(&f16, &rawData, sizeof(rawData));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/qt6/QtCore/qmetatype.h:14,
                 from /usr/include/qt6/QtCore/qobject.h:18,
                 from /usr/include/qt6/QtCore/qiodevice.h:10,
                 from /usr/include/qt6/QtGui/qimageiohandler.h:9,
                 from /usr/include/qt6/QtGui/QImageIOPlugin:1,
                 from /home/daniel/kimageformats/src/imageformats/dds_p.h:13,
                 from /home/daniel/kimageformats/src/imageformats/dds.cpp:12:
/usr/include/qt6/QtCore/qfloat16.h:46:7: note: ‘class qfloat16’ declared here
   46 | class qfloat16
      |       ^~~~~~~~

```

Should also fixes the following failed tests under PowerPC (32-bits):
```
INFO : rgba16dx10.dds: converting rgba16dx10.dds from RGBA16FPx4 to ARGB32
FAIL : rgba16dx10.dds: differs from rgba16dx10.png
       expected data written to rgba16dx10.dds-expected.data
       actual data written to rgba16dx10.dds-actual.data
```
```
INFO : rgba_f16.dds: converting rgba_f16.dds from RGBA16FPx4 to ARGB32
FAIL : rgba_f16.dds: differs from rgba_f16.png
       expected data written to rgba_f16.dds-expected.data
       actual data written to rgba_f16.dds-actual.data
```
This commit is contained in:
Mirco Miranda
2025-01-15 17:45:57 +00:00
committed by Daniel Novomeský
parent ae00c110f2
commit 5f92bcbf26
7 changed files with 44 additions and 10 deletions

View File

@ -63,13 +63,25 @@ public:
/*!
* \brief checkOptionaInfo
* Verify the optional information (resolution, metadata, etc.) of the image with that in the template if present.
* Verify the optional information (resolution, metadata, etc.) of the
* image with that in the template if present.
* \param image The image to check optional information on.
* \param error The error message when returns false.
* \return True on success, otherwise false.
*/
bool checkOptionaInfo(const QImage& image, QString& error) const;
/*!
* \brief fuzziness
* The fuzziness value that ensures the test works correctly. Normally
* set for lossy codecs and images that require floating point
* conversions.
* Floating point conversions may give slightly different results from
* one architecture to another (Intel, PowerPC, Arm, etc...).
* \return The default fuzziness value for the image. Zero means no fuzziness.
*/
quint8 fuzziness() const;
/*!
* \brief suffixes
* \return The list of suffixes considered templates.