Skip to content

nikon_he: complete HE/HE* header parsing and integration - #1

Merged
yogthos merged 5 commits into
yogthos:nikon-he-decoderfrom
y-g-jiang:nikon-he-production
Aug 10, 2026
Merged

yogthos merged 5 commits into
yogthos:nikon-he-decoderfrom
y-g-jiang:nikon-he-production

Conversation

@y-g-jiang

Copy link
Copy Markdown

Builds on LibRaw#826 by @yogthos. The original three commits and authorship are preserved; this PR contains only the follow-up changes.

Changes:

  • parse the JPEG XS picture header and derive GTLI from the per-file WGT marker
  • dispatch HE/HE* using Nikon's MakerNote compression value
  • validate the fixed Nikon profile and harden short-read/error paths
  • add the new parser to the supported build configurations

Validation:

Known limits:

  • all errors larger than 1 LSB are confined to the final two image rows; the Adobe boundary convention is still unresolved
  • DX crop and ZR samples have not been validated
  • MSVC project files were syntax-checked but not built

AI assistance was used during implementation and review. I reviewed and tested the resulting code and take responsibility for the contribution.

I agree that this contribution may be distributed under both LGPL 2.1 and CDDL 1.0.

@yogthos

yogthos commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Nice work!

@JuanPabloZambrano

JuanPabloZambrano commented Jul 27, 2026

Copy link
Copy Markdown

Nikon ZR works

@Marcin648

Copy link
Copy Markdown

Nikon Z5ii RAWs also works!

@yogthos
yogthos merged commit 499bfd4 into yogthos:nikon-he-decoder Aug 10, 2026
@RdWing

RdWing commented Sep 11, 2026

Copy link
Copy Markdown

I've been putting together a public format reference for Nikon HE/HE* and tested the implementation at 499bfd4 against Adobe DNG Converter. I've posted the findings on LibRaw#826, but wanted to link them here too, since they cover the unresolved bottom-row differences and approximate curve mentioned in this PR:

  1. Bottom-row reconstruction: extend the already computed intermediate at the image boundary.
  2. Lookup-table bounds: fix an out-of-bounds read during table construction.
  3. Exact transfer function: replace the approximate curve with an integer rule, including rounding and three parameters from the vendor PIH extension.
  4. Raw-GCLI handling: handle the packet flag that selects directly stored bit-plane counts. This was demonstrated with a synthetic stream.

With the corrections, the decoder matches Adobe's raw samples exactly across the 11 natural HE/HE* files tested from Z9, Z8, Z6III, Zf and Z5II bodies. The comments include the changes and validation details.

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.

5 participants