Skip to content

WIP: Add versioned Nikon base colour and chart calibration - #270

Draft
Hanmo123 wants to merge 2 commits into
storytold:mainfrom
Hanmo123:codex/nikon-color-pipeline
Draft

Hanmo123 wants to merge 2 commits into
storytold:mainfrom
Hanmo123:codex/nikon-color-pipeline

Conversation

@Hanmo123

@Hanmo123 Hanmo123 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Uncalibrated Nikon RAW currently relies on a per-file JPEG look estimate. This draft adds an opt-in sensor-colour calibration path and chart tooling, with camera JPEG matching as a separate display-style choice. The framework is implemented; no measured Nikon/Z8 calibration or absolute-Kelvin accuracy is claimed.

Implementation

  • Versioned legacy, base, and matchCamera interpretations, selected through engine commands and the Edit panel. Existing edits default to legacy. A missing valid calibration preserves the previous source interpretation and displays an estimate notice.
  • A pure-Rust stable decoder path for black/white levels, effective crop and camera WB coefficients; valid standard file calibration takes priority over an explicitly supplied, provenance-carrying own profile saved with the edit.
  • Warm/daylight camera matrices, reciprocal-temperature interpolation, model-based Kelvin/Tint, and sensor RGB to the linear working colour space. JPEG tone/chroma matching is optional and separate.
  • Pure-Rust chart inspect/sample/fit/validate tools with capture provenance, training/validation hash separation, and documented capture requirements. Regression coverage includes neutral greys, Tint direction, exposure/WB, legacy settings and CPU/GPU/preview/export consistency.

Validation at ceede44

  • Complete local cargo xtask ci: all seven stages passed; 1088 tests passed, 0 failed, 10 ignored.
  • A supplied Z8 NEF/JPEG pair was checked in the native app on Apple M3/Metal and through export. Legacy As Shot, a custom WB/exposure edit, and JPEG output matched the exact d614dc7 baseline pixel-for-pixel at the documented comparison size.
  • The uncalibrated base/match-camera fallback matched legacy. Real NEF CPU/GPU comparisons differed by at most one 8-bit RGB LSB; a full-resolution fallback export completed.
  • See docs/nikon-colour-calibration.md for operation and docs/nikon-colour-validation.md for the actual evidence and its limits. No media fixtures are included.

Why this remains WIP

  • Resolve the uncalibrated-RAW Kelvin UI regression versus release 0.2.1, including the relative Tint UI's +/-100 display limit versus the engine's +/-150 range. This branch still inherits the upstream relative-WB behaviour; it does not include the separate estimated-Kelvin restoration.
  • Resolve old-edit compatibility with Correct global Tint direction (compatibility review) #258. This branch is based on its Tint-direction commit d614dc7, so its main-targeted diff currently includes that change. The pixel-compatibility evidence is against d614dc7, not against pre-Tint or release-0.2.1 edits; automatic migration is not implemented.
  • Reconcile shared crop/preview-colour changes with Fix Nikon NEF CropArea and embedded preview colour space #257, then rebase and rerun the complete CI and relevant rendering checks after dependency changes.

Measured camera calibration remains follow-up work: there is no bundled Z8 profile, independently validated real warm/daylight calibration, or measured camera colour-accuracy claim. The supplied uncalibrated photo still uses the previous estimate, including its pale highlights and legacy crop/levels. This is a framework review, not a claim that the sample's rendering fidelity is fixed or that Nikon HE/HE* decoding is supported.

Hanmo123 and others added 2 commits October 8, 2026 10:26
Preserve d614dc7 edits and the estimated fallback. Add stable Nikon
levels/crop, validated file and provenance-carrying own dual-light
calibration, camera-model WB, and optional JPEG tone/chroma matching.
Provide Rust chart sampling, fitting and independent validation tools.

Document the measured sample checks and the remaining calibration gap:
no measured Nikon or Z 8 profile is supplied. Full cargo xtask ci passed
all seven stages (1088 passed, 0 failed, 10 ignored); native M3 UI and
sample CPU/GPU rendering were inspected.

Co-authored-by: Codex <noreply@openai.com>
@wanikhawar

Copy link
Copy Markdown
Contributor

Please rebase this off #258 and split it into the base-colour interpretation, the chart tool and the web wire-format changes (rule 8). The new dependency in apps/lightcraft-cli/Cargo.toml needs a licence check (rule 26). Please also say how this differs from #2222.

This branch has not been deployed

No deployments
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.

2 participants