openexr icon indicating copy to clipboard operation
openexr copied to clipboard

Add gdeflate compression and decompression with NVIDIA fork of libdeflate.

Open MarkLeone opened this issue 2 months ago • 4 comments

  • Gdeflate compression can yield multiple 64K pages.
  • Each chunk includes number of pages and size of each page.
  • Off by default. gdeflate calls are wrapped and conditionally compiled in.
  • CMake and Bazel builds can optionally fetch NVIDIA fork of libdeflate. Additional info and discussion on [email protected]

MarkLeone avatar Oct 16 '25 22:10 MarkLeone

CLA Not Signed

Thanks for this! I'll look into the failing CI checks this weekend, I think I know what's going on.

The project policy is to require a signed Contributor License Agreement. I don't recall if Nvidia has an agreement in place, but is that something you can follow up on?

Also, we require signed git commits. Could you amend your commit with "-s"? That adds the "Signed-off-by" line. Note it's not sufficient to submit an additional commit, they all have to be signed, so you'll need to amend the commit and force-push. Or close this PR and submit a fresh one.

cary-ilm avatar Oct 16 '25 23:10 cary-ilm

@MarkLeone, looking at this a little deeper, I think the better configuration is to simply vendor in the source code directly from NVIDIA/libdeflate, and avoid the FetchContent altogether. Look in share/util/check_deflate.sh, which is a helper script to be run manually whenever a new version of libdeflate is released. In essence, that's what you've done, but with a forked repo. I think if you change the URL in that script to https://github.com/NVIDIA/libdeflate, then run it, the CMake configuration doesn't to change much at all.

src/lib/OpenEXRCore/compression.c includes only the files out of libdeflate that are needed, the rest are ignored. You'll need to add whatever gdeflate-related files are needed there.

cary-ilm avatar Oct 18 '25 23:10 cary-ilm

@MarkLeone, it looks like NVIDIA/libdeflate is based on a very old fork of ebiggers/libdeflate (v1.8 from 2021), which was before libdeflate introduced cmake support, which complicates the setup, since your library has no cmake config. I started working on fixing the CI to test against an external build of NVIDIA/libdeflate, but that's going to require some extra hoops to jump through.

cary-ilm avatar Oct 19 '25 18:10 cary-ilm