Skip to content

Add JPEG 2000 codec with optional nvJPEG2000 GPU acceleration#1049

Open
brendancol wants to merge 4 commits intogeotiff-reader-writerfrom
issue-1048
Open

Add JPEG 2000 codec with optional nvJPEG2000 GPU acceleration#1049
brendancol wants to merge 4 commits intogeotiff-reader-writerfrom
issue-1048

Conversation

@brendancol
Copy link
Contributor

Closes #1048

Summary

  • JPEG 2000 compression (TIFF tag 34712) for the geotiff reader/writer
  • CPU codec via glymur (optional, same pattern as Pillow/JPEG and zstandard/ZSTD)
  • GPU codec via nvJPEG2000 ctypes bindings (optional, same pattern as nvCOMP)
  • Both optional, both fall back gracefully, no new hard dependencies
  • 14 new tests: codec roundtrip, TIFF write/read, public API, error handling
  • User guide notebook with file size comparison, multi-band example, GPU notes

Test plan

  • 285 geotiff tests pass (14 new + 271 existing)
  • Codec roundtrip verified for uint8, uint16, and multi-band
  • Write/read roundtrip via _writer.write() and public write_geotiff/read_geotiff
  • Availability checks: constant value, tag mapping, ImportError when glymur missing
  • Manual GPU test on a machine with nvJPEG2000
  • Test with a real Sentinel-2 J2K-compressed GeoTIFF

CPU path via glymur (same pattern as JPEG/Pillow and ZSTD/zstandard).
GPU path via nvJPEG2000 ctypes bindings (same pattern as nvCOMP).
Both are optional -- graceful fallback if libraries aren't installed.
- 14 new tests: codec roundtrip, TIFF write/read roundtrip, public API,
  availability checks, and ImportError fallback
- Fix jpeg2000_compress: calculate numres from tile dimensions, remove
  pre-existing temp file before glymur write
- Update test_edge_cases: use 'webp' as unsupported compression example
  since 'jpeg2000' is now supported
Covers write/read roundtrip, file size comparison with deflate,
multi-band RGB example, and GPU acceleration notes.
@github-actions github-actions bot added the performance PR touches performance-sensitive code label Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant