Skip to content

Add support for lossy HTJ2K compressor#2425

Merged
cary-ilm merged 12 commits into
AcademySoftwareFoundation:lossy-htj2kfrom
sandflow:feature/lossy-htj2k
Jun 11, 2026
Merged

Add support for lossy HTJ2K compressor#2425
cary-ilm merged 12 commits into
AcademySoftwareFoundation:lossy-htj2kfrom
sandflow:feature/lossy-htj2k

Conversation

@palemieux

@palemieux palemieux commented May 17, 2026

Copy link
Copy Markdown
Collaborator
  • add support for a separate lossy HTJ2K compressor (using a log transfer function as opposed to DWA's log-gamma transfer function)
  • adds log MSE computation to exrmetrics (to measure the distortion introduced by lossy compressors)

See https://academysoftwarefdn.slack.com/archives/CMLRW4N73/p1777317753088359

@palemieux palemieux requested a review from cary-ilm May 17, 2026 21:07
@cary-ilm

Copy link
Copy Markdown
Member

@Vertexwahn, any suggestion to fix the Bazel failure here? I see two errors in the logs:

src/lib/OpenEXRCore/internal_ht.cpp:10:10: fatal error: openjph/ojph_arch.h: No such file or directory
   10 | #include <openjph/ojph_arch.h>

and:

In file included from src/lib/OpenEXRCore/base.c:8:
src/lib/OpenEXRCore/openexr_version.h:11: warning: "OPENEXR_VERSION_MAJOR" redefined
11 | # define OPENEXR_VERSION_MAJOR 4

@cary-ilm

Copy link
Copy Markdown
Member

And @palemieux, can you amend the commits with -s to add the required DCO?

@Vertexwahn

Copy link
Copy Markdown
Contributor

Short time solution: Change in MODULE.bazel the line bazel_dep(name = "openjph", version = "0.27.3") to bazel_dep(name = "openjph", version = "0.27.0")

@Vertexwahn

Copy link
Copy Markdown
Contributor

Once bazelbuild/bazel-central-registry#9032 is merge you can change bazel_dep(name = "openjph", version = "0.27... to bazel_dep(name = "openjph", version = "0.27.3.bcr.1") (bcr.1 is a patch that contains the missing include path)

@palemieux palemieux force-pushed the feature/lossy-htj2k branch 3 times, most recently from b87f94b to 5011ecd Compare May 28, 2026 18:22
Comment thread src/bin/exrmetrics/exrmetrics.cpp Outdated
Comment thread src/bin/exrmetrics/exrmetrics.cpp Outdated
@peterhillman

Copy link
Copy Markdown
Contributor

It might be better to put the exrmetrics changes into a separate PR (apart from minimal support for modifying the amount of compression). The MSE changes aren't directly related to lossy HTJ2K

Comment thread cmake/OpenEXRSetup.cmake
Comment thread src/lib/OpenEXR/ImfHeader.h

@cary-ilm cary-ilm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, are the changes to the vendored OpenJPH simply from vendoring in 0.27.3? Are there any changes we need to make sure don't get stomped on?

@palemieux

Copy link
Copy Markdown
Collaborator Author

Just to confirm, are the changes to the vendored OpenJPH simply from vendoring in 0.27.3? Are there any changes we need to make sure don't get stomped on?

Stock 27.3. No additional changes. Thanks for making sure.

@palemieux

Copy link
Copy Markdown
Collaborator Author

It might be better to put the exrmetrics changes into a separate PR (apart from minimal support for modifying the amount of compression). The MSE changes aren't directly related to lossy HTJ2K

Ok. Will split it off before the lossy J2K branch is merged.

Comment thread src/lib/OpenEXR/ImfCompressor.cpp
@cary-ilm

Copy link
Copy Markdown
Member

@peterhillman and @palemieux, since this PR is going into the lossy-htj2k feature branch, the exrmetrics changes can stay here and also go into a separate PR for main. That will highlight them more prominently in the commit history and release notes.

@palemieux

Copy link
Copy Markdown
Collaborator Author

Ok. I can create a PR against main.

@cary-ilm

Copy link
Copy Markdown
Member

@palemieux, I think this is only waiting on @michaeldsmith's comment suggestions?

@palemieux

Copy link
Copy Markdown
Collaborator Author

See #2448 for a standalone PR adding MSE to exrmetrics.

Comment thread src/lib/OpenEXRCore/internal_ht.cpp Outdated
Comment thread src/lib/OpenEXRCore/openexr_base.h Outdated
Comment thread src/lib/OpenEXRCore/openexr_base.h Outdated
Comment thread src/lib/OpenEXRCore/openexr_base.h
Comment thread src/lib/OpenEXRCore/openexr_part.h Outdated
Comment thread src/lib/OpenEXRCore/openexr_part.h Outdated
Comment thread src/test/OpenEXRTest/compareHTJ2KL256.cpp Outdated

@cary-ilm cary-ilm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor suggestions, otherwise it looks ready to go to me.

@palemieux palemieux force-pushed the feature/lossy-htj2k branch 2 times, most recently from 41e5f6f to 234b058 Compare June 10, 2026 20:39
@palemieux palemieux force-pushed the feature/lossy-htj2k branch from 234b058 to 7a41a80 Compare June 10, 2026 20:46
palemieux and others added 5 commits June 10, 2026 13:49
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
* Improve the handling of non-finite samples

Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
@palemieux palemieux force-pushed the feature/lossy-htj2k branch from 7a41a80 to c50df3b Compare June 10, 2026 20:50
palemieux and others added 7 commits June 10, 2026 13:51
Co-authored-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Co-authored-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Co-authored-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Co-authored-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Co-authored-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Co-authored-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
@cary-ilm cary-ilm merged commit b5efc6c into AcademySoftwareFoundation:lossy-htj2k Jun 11, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants