Skip to content

Commit 3f1caca

Browse files
lji-ilmlgritz
authored andcommitted
openexr: Add htj2k as a compression option for OpenEXR (#4785)
After adding the new `htj2k` compression codec to OpenEXR, here we enable it in the OIIO stack so it will be recognized by the library and binary tools, such as using `oiiotool` to directly change compression type into htj2k. --------- Signed-off-by: lji <[email protected]>
1 parent 33f5a32 commit 3f1caca

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

src/doc/builtinplugins.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,8 +1497,9 @@ The official OpenEXR site is http://www.openexr.com/.
14971497
* - ``compression``
14981498
- string
14991499
- one of: ``"none"``, ``"rle"``, ``"zip"``, ``"zips"``, ``"piz"``,
1500-
``"pxr24"``, ``"b44"``, ``"b44a"``, ``"dwaa"``, or ``"dwab"``. If
1501-
the writer receives a request for a compression type it does not
1500+
``"pxr24"``, ``"b44"``, ``"b44a"``, ``"dwaa"``, ``"dwab"`` or ``"htj2k"``.
1501+
(``"htj2k"`` is only supported with OpenEXR 3.4 or later.)
1502+
If the writer receives a request for a compression type it does not
15021503
recognize or is not supported by the version of OpenEXR on the
15031504
system, it will use ``"zip"`` by default. For ``"dwaa"`` and
15041505
``"dwab"``, the dwaCompressionLevel may be optionally appended to the

src/openexr.imageio/exrinput.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ OpenEXRInput::PartInfo::parse_header(OpenEXRInput* in,
436436
case Imf::B44A_COMPRESSION: comp = "b44a"; break;
437437
case Imf::DWAA_COMPRESSION: comp = "dwaa"; break;
438438
case Imf::DWAB_COMPRESSION: comp = "dwab"; break;
439+
#ifdef IMF_HTJ2K_COMPRESSION
440+
case Imf::HTJ2K_COMPRESSION: comp = "htj2k"; break;
441+
#endif
439442
default: break;
440443
}
441444
if (comp)

src/openexr.imageio/exrinput_c.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,9 @@ OpenEXRCoreInput::PartInfo::parse_header(OpenEXRCoreInput* in,
571571
case EXR_COMPRESSION_B44A: comp = "b44a"; break;
572572
case EXR_COMPRESSION_DWAA: comp = "dwaa"; break;
573573
case EXR_COMPRESSION_DWAB: comp = "dwab"; break;
574+
#ifdef IMF_HTJ2K_COMPRESSION
575+
case EXR_COMPRESSION_HTJ2K: comp = "htj2k"; break;
576+
#endif
574577
default: break;
575578
}
576579
if (comp)

src/openexr.imageio/exroutput.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,10 @@ OpenEXROutput::put_parameter(const std::string& name, TypeDesc type,
960960
header.compression() = Imf::DWAA_COMPRESSION;
961961
else if (Strutil::iequals(str, "dwab"))
962962
header.compression() = Imf::DWAB_COMPRESSION;
963+
#ifdef IMF_HTJ2K_COMPRESSION
964+
else if (Strutil::iequals(str, "htj2k"))
965+
header.compression() = Imf::HTJ2K_COMPRESSION;
966+
#endif
963967
}
964968
return true;
965969
}

0 commit comments

Comments
 (0)