Skip to content

Releases: Raster-Lab/JLSwift

v0.9.0 — Hot-path performance rewrite

Choose a tag to compare

@SureshKViswanathan SureshKViswanathan released this 11 Jun 10:43
53d902f

Highlights

0.9.0 is a performance release: the codec hot path was rewritten end to end, guided by CPU profiling against real radiology DICOM data, with every change gated on byte-identical encoded output versus 0.8.0.

Benchmark (Apple Silicon) v0.8.0 v0.9.0 Speedup
Real DICOM encode (lossless, 6 modalities) 27.3 MB/s 79.4 MB/s 2.9x
Real DICOM decode 41.3 MB/s 82.3 MB/s 2.0x
Synthetic 16-bit 2048² encode / decode 36.6 / 57.2 MB/s 99.7 / 101.7 MB/s 2.7x / 1.8x
4096² frame with restart intervals (wall) 0.84 s / 0.69 s 0.31 s / 0.24 s ~2.8x, all cores

New: restart-interval parallelism (DRI/RSTm)

let config = try JPEGLSEncoder.Configuration(restartInterval: 256)  // lines per interval
let encoded = try JPEGLSEncoder().encode(imageData, configuration: config)
// Decoding splits at the RST markers automatically and decodes intervals concurrently.

Standards-compliant intra-image parallelism for large frames (e.g. 17 MP mammography) at ~0.03 % size cost — jpegls encode --restart-interval N from the CLI. This work also fixed a decoder bug where conformant streams containing restart markers failed to decode.

Also in this release

  • jpegls batch encode / batch decode are now implemented (parallel worker pool, byte-identical to serial encodes)
  • The never-invoked GPU/SIMD Platform/ layer (Metal, Vulkan, Accelerate, ARM64/x86-64) was removed (~9,400 lines); documentation now describes only what ships
  • Robustness hardening from an adversarial review: Data-slice decoding, hostile/malformed stream handling (crafted LSE segments, stray or out-of-sequence restart markers, oversized MAXVAL), per-scan DRI semantics, and encoder rejection of sub-sampled planes — all with regression tests

Breaking changes (0.x minor)

  • Removed public types: the Platform/ accelerators, PlatformAccelerator protocol, JPEGLSBufferPool, JPEGLSCacheFriendlyBuffer, JPEGLSTileProcessor (none were used by the codec; restart intervals are the supported parallelism mechanism)
  • jpegls batch no longer accepts the never-functional raw-input options

Full details in the CHANGELOG and the analysis behind the rewrite in docs/OPTIMIZATION_PLAN.md.

🤖 Generated with Claude Code

JLSwift v0.8.0

Choose a tag to compare

@SureshKViswanathan SureshKViswanathan released this 30 May 11:09
bcf00eb

JLSwift v0.8.0

Release Date: 2026-05-30
Type: Minor Release (first tagged release)

Overview

The first tagged release of JLSwift — a pure-Swift JPEG-LS (ITU-T.87) codec with Apple-Silicon (ARM64/NEON), Accelerate, and Metal GPU acceleration paths. This release consolidates the Validation & Conformance milestone (CharLS conformance, benchmarks, edge cases) together with the DICOM-independence work, and fixes several platform-specific defects that only manifest on Apple Silicon.

Highlights

  • 🎉 CharLS conformance — reference fixtures and a 589-test conformance suite; the parser handles CharLS extension markers (0xFF60–0xFF7F).
  • Hardware acceleration — ARM64/NEON, Accelerate (vDSP), and Metal GPU paths for gradient/MED/quantisation and HP1/HP2/HP3 colour transforms.
  • 🩺 DICOM toolingjpegls bench-dicom round-trips a DICOM corpus and reports per-modality throughput and lossless verification, now with first-mismatch diagnostics on failures.
  • 🐛 Platform fixes — Metal GPU path now works under swift build/swift test, plus correctness/robustness fixes in the ARM64 Golomb-Rice and gradient routines.
  • 📚 Documentation — Getting Started, Usage Examples, Performance Tuning, Troubleshooting, SwiftUI/AppKit integration guides, and a man page.

What's New

Added

  • jpegls bench-dicom command — JPEG-LS round-trip benchmark over a DICOM corpus (per-modality encode/decode throughput + lossless verification), with first-mismatch diagnostics (row/col, decoded vs original) on failures.
  • CharLS conformance — 12 JPEG-LS reference files, 7 reference images, a 589-test conformance suite, and extension-marker (0xFF60–0xFF7F) parsing.
  • Benchmark + edge-case suites — 18 performance benchmarks across sizes/bit-depths/components/NEAR/interleave modes, and a 38-test edge-case suite.
  • Documentation — DocC for all public APIs; GETTING_STARTED, USAGE_EXAMPLES (25+), PERFORMANCE_TUNING, TROUBLESHOOTING, SWIFTUI/APPKIT examples; man page (man/jpegls.1).
  • DICOM independence — non-DICOM usage examples and DICOM-aware/independent architecture documented.

Changed

  • Reorganised repository layout: docs into docs/, man page into man/.
  • Renamed the executable target jpeglsjpeglscli to avoid a case-insensitive-filesystem collision with the JPEGLS library target (the built product is still named jpegls).

Fixed

  • Metal GPU path under SwiftPMMetalAccelerator now compiles the bundled .metal shader source at runtime when no precompiled default.metallib is present (SwiftPM copies the source rather than compiling it), instead of failing with "no default library was found".
  • ARM64 Golomb-Rice clampARM64Accelerator.computeGolombRiceParameter now clamps k to the documented [0, 31] range for pathological a/n ratios, matching X86_64Accelerator.
  • Gradient CPU/GPU consistencyMetalAccelerator.computeGradientsBatch CPU fallback uses wrapping subtraction to match the GPU shader's two's-complement semantics, keeping the paths bit-identical and preventing a trap on extreme Int32 inputs.
  • Build & test compilation on case-insensitive (Apple) filesystems; SIMDMask.any() build error on ARM64.
  • CharLS-encoded files with extension markers now parse; conformance test-expectation corrections per ITU-T.87.

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/Raster-Lab/JLSwift.git", from: "0.8.0")
]

Command-Line Tool

git clone https://github.com/Raster-Lab/JLSwift.git
cd JLSwift
git checkout v0.8.0
swift build -c release
# binary at .build/release/jpegls

Requirements

  • Swift: 6.2 or later
  • Platforms: macOS 12+, iOS 15+, Linux
  • Primary: Apple Silicon with ARM64/NEON + Metal optimisations
  • Secondary: x86-64 (Intel/Linux) with SSE/AVX

Notes

  • This is a pre-1.0 release: the public API is not yet considered stable (see VERSIONING.md).
  • CI validates the Linux build/test/coverage; Metal and ARM64 acceleration paths are platform-gated and were validated locally on Apple Silicon.

Full Changelog

See CHANGELOG.md for the complete list of changes.

🤖 Generated with Claude Code