Skip to content

EXRLoader: Add HTJ2K compression support#32233

Draft
mrdoob wants to merge 2 commits into
devfrom
exr-htj2k
Draft

EXRLoader: Add HTJ2K compression support#32233
mrdoob wants to merge 2 commits into
devfrom
exr-htj2k

Conversation

@mrdoob
Copy link
Copy Markdown
Owner

@mrdoob mrdoob commented Nov 10, 2025

Related issue: #31911

Description

Adds support for HTJ2K (High Throughput JPEG 2000) compression in EXRLoader, following OpenEXR 3.4.0 specification. Includes a new JPHLoader for standalone JPEG 2000 files.

Changes

  • EXRLoader: Added HTJ2K decompression (compression code 11)

    • Automatic OpenJPH WASM initialization (lazy loading)
    • Parses HTJ2K header format (magic, payload length, channel map)
    • Async parse() method to support WASM loading
  • JPHLoader: New loader for standalone JPEG 2000/HTJ2K files

    • Auto-initializes OpenJPH WASM on first use
    • Supports 8-bit, 16-bit, and 32-bit data
    • Progressive decoding and resolution skipping
  • Bundled OpenJPH WASM: ~126 KB (105 KB WASM + 21 KB JS)

@mrdoob mrdoob added this to the r182 milestone Nov 10, 2025
Comment thread examples/jsm/loaders/EXRLoader.js Fixed
…rt, function or class

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
'DWAA_COMPRESSION',
'DWAB_COMPRESSION'
'DWAB_COMPRESSION',
'UNKNOWN_COMPRESSION', // 10
Copy link
Copy Markdown

@TodicaIonut TodicaIonut Nov 15, 2025

Choose a reason for hiding this comment

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

EXR compression test:
htj2k256 float 32.exr test
htj2k256 half 16.exr test
htj2k32 float 32.exr test
htj2k32 half 16.exr test

HTJ2K256_COMPRESSION - JPEG 2000 lossless coding, in blocks of 256 scanlines and using the High-Throughput (HT) blocker. Offers both speed and high-coding efficiency.
HTJ2K32_COMPRESSION - JPEG 2000 lossless coding, in blocks of 32 scanlines and using the High-Throughput (HT) blocker. Offers both speed and high-coding efficiency.

cc @mrdoob

Suggested change
'UNKNOWN_COMPRESSION', // 10
'HTJ2K256_COMPRESSION', // 10
'HTJ2K32_COMPRESSION' // 11

@mrdoob mrdoob modified the milestones: r182, r183 Dec 10, 2025
@mrdoob mrdoob modified the milestones: r183, r184 Feb 18, 2026
@mrdoob mrdoob modified the milestones: r184, r185 Apr 16, 2026
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.

3 participants