mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-11-02 08:08:50 -05:00
EXR: support for lossy HTJ2K quality introduced in OpenEXR 3.5
This commit is contained in:
committed by
Mirco Miranda
parent
59157971e8
commit
487b51ae9c
@@ -774,9 +774,16 @@ bool EXRHandler::write(const QImage &image)
|
|||||||
// set the DCT quality (used by DCT compressions only)
|
// set the DCT quality (used by DCT compressions only)
|
||||||
if (m_quality > -1 && m_quality <= 100) {
|
if (m_quality > -1 && m_quality <= 100) {
|
||||||
header.dwaCompressionLevel() = float(m_quality);
|
header.dwaCompressionLevel() = float(m_quality);
|
||||||
|
#if QT_VERSION_CHECK(OPENEXR_VERSION_MAJOR, OPENEXR_VERSION_MINOR, OPENEXR_VERSION_PATCH) >= QT_VERSION_CHECK(3, 5, 0)
|
||||||
|
header.lossyHTJ2KQuality() = float(m_quality) * 1.5f; // Lossy J2K max quality is 150
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// make ZIP compression fast (used by ZIP compressions)
|
// make ZIP compression fast (used by ZIP compressions)
|
||||||
header.zipCompressionLevel() = 1;
|
header.zipCompressionLevel() = 1;
|
||||||
|
#if QT_VERSION_CHECK(OPENEXR_VERSION_MAJOR, OPENEXR_VERSION_MINOR, OPENEXR_VERSION_PATCH) >= QT_VERSION_CHECK(3, 5, 0)
|
||||||
|
// make ZSTD compression fast (used by ZSTD compressions)
|
||||||
|
header.zstdCompressionLevel() = 1; // default is 5 -> 1 is faster
|
||||||
|
#endif
|
||||||
|
|
||||||
// set preview (don't set it for small images)
|
// set preview (don't set it for small images)
|
||||||
if (width > 1024 || height > 1024) {
|
if (width > 1024 || height > 1024) {
|
||||||
|
|||||||
@@ -76,18 +76,21 @@ private:
|
|||||||
* Value set by QImageWriter::setCompression().
|
* Value set by QImageWriter::setCompression().
|
||||||
*
|
*
|
||||||
* The compression scheme is the same as defined by OpenEXR library:
|
* The compression scheme is the same as defined by OpenEXR library:
|
||||||
* - 0: no compression
|
* - 0: no compression.
|
||||||
* - 1: run length encoding
|
* - 1: run length encoding.
|
||||||
* - 2: zlib compression, one scan line at a time
|
* - 2: zlib compression, one scan line at a time.
|
||||||
* - 3: zlib compression, in blocks of 16 scan lines
|
* - 3: zlib compression, in blocks of 16 scan lines.
|
||||||
* - 4: piz-based wavelet compression (default)
|
* - 4: piz-based wavelet compression (default).
|
||||||
* - 5: lossy 24-bit float compression
|
* - 5: lossy 24-bit float compression.
|
||||||
* - 6: lossy 4-by-4 pixel block compression, fixed compression rate
|
* - 6: lossy 4-by-4 pixel block compression, fixed compression rate.
|
||||||
* - 7: lossy 4-by-4 pixel block compression, fields are compressed more
|
* - 7: lossy 4-by-4 pixel block compression, fields are compressed more.
|
||||||
* - 8: lossy DCT based compression, in blocks of 32 scanlines. More efficient for partial buffer access.
|
* - 8: lossy DCT based compression, in blocks of 32 scanlines. More efficient for partial buffer access.
|
||||||
* - 9: lossy DCT based compression, in blocks of 256 scanlines. More efficient space wise and faster to decode full frames than DWAA_COMPRESSION.
|
* - 9: lossy DCT based compression, in blocks of 256 scanlines. More efficient space wise and faster to decode full frames than DWAA_COMPRESSION.
|
||||||
* - 10: High-Throughput JPEG2000 (HTJ2K), 256 scanlines (requires OpenEXR 3.4+).
|
* - 10: High-Throughput JPEG2000 (HTJ2K), 256 scanlines (requires OpenEXR 3.4+).
|
||||||
* - 11: High-Throughput JPEG2000 (HTJ2K), 32 scanlines (requires OpenEXR 3.4+).
|
* - 11: High-Throughput JPEG2000 (HTJ2K), 32 scanlines (requires OpenEXR 3.4+).
|
||||||
|
* - 12: High-Throughput JPEG2000 (HTJ2K), lossy, 256 scanlines (requires OpenEXR 3.5+).
|
||||||
|
* - 13: zstd lossless compression, one scan line at a time (requires OpenEXR 3.5+).
|
||||||
|
* \note If compiled with a more recent EXR library, any new compression methods can be used.
|
||||||
*/
|
*/
|
||||||
qint32 m_compressionRatio;
|
qint32 m_compressionRatio;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user