Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/openexr.imageio/exrinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ OpenEXRInput::PartInfo::parse_header(OpenEXRInput* in,
#endif
#ifdef IMF_HTJ2K32_COMPRESSION
case Imf::HTJ2K32_COMPRESSION: comp = "htj2k32"; break;
#endif
#ifdef IMF_HTJ2KL256_COMPRESSION
case Imf::HTJ2KL256_COMPRESSION: comp = "htj2kl256"; break;
#endif
default: break;
}
Expand Down
3 changes: 3 additions & 0 deletions src/openexr.imageio/exrinput_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,9 @@ OpenEXRCoreInput::PartInfo::parse_header(OpenEXRCoreInput* in,
#endif
#ifdef IMF_HTJ2K32_COMPRESSION
case EXR_COMPRESSION_HTJ2K32: comp = "htj2k32"; break;
#endif
#ifdef IMF_HTJ2KL256_COMPRESSION
case EXR_COMPRESSION_HTJ2KL256: comp = "htj2kl256"; break;
#endif
default: break;
}
Expand Down
12 changes: 12 additions & 0 deletions src/openexr.imageio/exroutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,14 @@ OpenEXROutput::spec_to_header(ImageSpec& spec, int subimage,
header.zipCompressionLevel() = (qual >= 1 && qual <= 9) ? qual : 4;
}
#endif
if (Strutil::istarts_with(comp, "htj2k") && qual > 110) {
#if OPENEXR_CODED_VERSION >= 30500
// OpenEXR 3.5.0 and later have an API for setting the quality level
// in the Header object. Older ones do it by setting an attribute, as
// below.
header.lossyHTJ2KQuality() = float(qual);
#endif
================
if (Strutil::istarts_with(comp, "dwa") && qual > 0) {
#if OPENEXR_CODED_VERSION >= 30103
// OpenEXR 3.1.3 and later have an API for setting the quality level
Expand Down Expand Up @@ -1204,6 +1212,10 @@ OpenEXROutput::put_parameter(const std::string& name, TypeDesc type,
#ifdef IMF_HTJ2K32_COMPRESSION
else if (Strutil::iequals(str, "htj2k32"))
header.compression() = Imf::HTJ2K32_COMPRESSION;
#endif
#ifdef HTJ2KL256_COMPRESSION
else if (Strutil::iequals(str, "htj2kl256"))
header.compression() = Imf::HTJ2KL256_COMPRESSION;
#endif
}
return true;
Expand Down
Loading