Repository navigation
LR-IMP-FORMATS: uncompressed Leaf MOS is a raw, the Hasselblad Lunar decodes as an ARW - #1324
Merged
Merged
Conversation
…decodes as an ARW (storytold#1275) An uncompressed Leaf Aptus 22 MOS keeps its 16-bit mosaic in IFD0 (compression 1, BlackIsZero, one sample per pixel) with no Make tag and no CFA photometric, so `probe` returned None and the file imported as a greyscale image of the mosaic. Leaf's data block, tag 0x8606 (LeafData in the ExifTool EXIF tag-name documentation), now marks such an IFD0 as a raw: OtherTiff, preview only with the reason, as the lossless-JPEG MOS already is. A rendered RGB image that kept the block stays an image. The Hasselblad Lunar is a Sony NEX-7 that writes an ARW under Make HASSELBLAD; only SONY files reached the ARW reader, so it opened as its preview. A HASSELBLAD file with Sony's raw coding (an IFD with compression 32767 or the tone-curve tag 0x7010, which no 3FR / FFF has) now goes there and decodes like a NEX-7: black 512, the SR2SubIFD white balance. The Tag2010 white-balance fallback, the one table arw.rs keys by model, takes the body from the maker note's SonyModelID (0xb001) when the file is not Sony-branded. Docs: the Lunar is verified in docs/raw/evidence.tsv (236 verified), raw-parity.md, parity-checklist.md, gaps.md and whats-new.md. RENDER_CACHE_VERSION 61 -> 62: a Lunar's thumbnails were rendered from its preview. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
Merged
Member
|
Landed on main in #1431. Thank you, @AlexChambers! Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1275
What was wrong
lightcraft_raw::probemisrouted two kinds of CC0 raw.pixls.us files onmainat 25ef65c.0x8606(LeafData), says it is a raw.probereturned None, so the file imported as a 4008 x 5344 greyscale image of its mosaic: dark, sideways, no colour.make.starts_with("SONY")reached the ARW reader, so the file fell through to OtherTiff and opened as its 1616 x 1080 preview.The fix
probe(crates/raw/src/lib.rs): an IFD0 that carries0x8606and has one sample per pixel is a raw. It is OtherTiff, preview only with the existing reason, as the lossless-JPEG MOS (3196) already is. The same grey IFD without the block, or a rendered RGB image that kept it, stays an ordinary image.probe: a HASSELBLAD file with Sony's raw coding goes to the ARW reader. The evidence is an IFD with compression 32767 (Sony ARW compressed) or the tone-curve tag0x7010; no 3FR or FFF has either.vendor/arw.rs: the only table there keyed by model, theTag2010white-balance fallback, now takes the body from the maker note'sSonyModelID(0xb001, ExifTool Sony tag-name documentation) when the file isn't Sony-branded. It lists the IDs of the Sony bodies Hasselblad rebadged: 289 NEX-7 (Lunar), 294 SLT-A99 (HV), 297 DSC-RX100 (Stellar), 308 DSC-RX100M2 (Stellar II). Only the Lunar is measured; the other three IDs come from the documentation, with no public sample to check them. The Lunar itself doesn't need the fallback: like a NEX-7, it reads its white balance from the SR2SubIFD.RENDER_CACHE_VERSION61 to 62 (crates/engine/src/media.rs): a Lunar's cached thumbnails were rendered from its preview.docs/raw/evidence.tsvandcoverage.tsvis regenerated (236 verified, 232 preview). Alsodocs/raw-parity.md(headline, maker table, ARW and MOS rows), the LR-IMP-FORMATS row ofdocs/parity-checklist.md, gap 10 indocs/gaps.md, anddocs/whats-new.md.lightcraft-rawhas no README.The MOS mosaic itself is still not decoded; that needs the CFA phase and orientation from the Leaf data, a separate task.
Measurements
Release builds of
main(25ef65c) and this branch. Renders arelightcraft-cli render FILE --size 1200, compared with the camera's embedded JPEG at 200 px wide with the comparison the sweep behind #1275 used (ΔE76, ΔL*, chroma ratio, luma correlation).mainprobecatalog.query)kind: image, 4008 x 5344,previewOnly: nullkind: raw, 332 x 244,previewOnly: "OtherTiff files are not decoded yet"probeThe Lunar against a real NEX-7 (raw.pixls.us
data/Sony/NEX-7/RAW_SONY_NEX7.ARW, decoded bymain):mainWB_RGGBLevels2544 1024 1024 1484: R 2.484, B 1.449On the white level: #1275 lists the SR2SubIFD's 15360 (
0x787f, on both files). The ARW reader doesn't read that tag for any body, so a NEX-7 decodes with 16383 onmainand the Lunar does the same. Reading it would change every ARW2 body, so it isn't part of this PR.Control set: the decode facts (format, header probe, sensor size, CFA, black and white levels, crop, orientation, white balance, matrix source, sample statistics, preview size) of 158 files,
mainagainst this branch. They are the 111RAW_SAMPLEScorpus files (27 ARW, 21 RAF, 13 RW2 and 3 RAW / RWL, 10 CR3, 9 CR2, 9 DNG, 8 NEF / NRW, 5 ORF, 3 PEF, 3 SRW), the 46 files kept from the sweep (both MOS, 3 FFF and the Lunar among them) and the NEX-7. 156 are identical; the 2 that change are 3197 and 4051.Tests
New, each a synthetic file:
crates/raw/src/lib.rs:uncompressed_leaf_mos_is_a_raw(a 16-bit BlackIsZero IFD0 with a0x8606entry is OtherTiff and refuses to decode; without the block, or as RGB, it is not a raw) andhasselblad_make_with_sony_raw_coding_is_arw(compression 32767 or0x7010under HASSELBLAD reaches the ARW reader and decodes; compression 1 or 7 without them doesn't).crates/raw/src/vendor/arw.rs:rebadged_body_takes_its_tag2010_layout_from_the_sony_model_id(HASSELBLAD / Lunar with SonyModelID 289 reads the NEX-7 layout; no ID, an unlisted ID, or a Sony file with another model don't).crates/engine/src/files.rs:uncompressed_leaf_mos_imports_as_a_preview_only_raw(imports asMediaKind::Raw, preview only, at the preview's size; the same file without the block imports as an image).On
main(the tests copied onto 25ef65c, with the two tag constants they name), all four fail at their first assertion:probegives None for the MOS (expected OtherTiff) and OtherTiff for the Lunar-style files (expected Arw), and the engine imports the MOS as(Image, "MOS", 16, 12)instead of(Raw, "MOS", 40, 30).cargo test -p lightcraft-raw --testswith the 111-file corpus: the unit tests,corpus(24),cr3_corpus(9),dngandrobustpass.sparse_corpusfails onarw6-sony-ilce7rm6-apsc-land-hq.arw("differs from the whole file"), exactly as it does onmain; it is the ARW6 header plan, untouched here.CI
cargo xtask cion macOS, run with the two macOS build fixes of #990 and #997 applied temporarily (reverted afterwards, not part of this branch; #990's shortened line intests_lock.rswas run through rustfmt for the run):-D warnings) and heif pass.cargo fmt --checkalso passes on the branch itself.cargo test --workspace --no-fail-fastrun: 3031 passed, 12 failed, exactly the 12 known ones: the tensidecar::tests_repair_*tests,tests_lightroom_folder::odd_folders_never_fail_the_checkandtests_dialog_fit::export_dialog_is_unchanged_in_a_tall_window. The new tests pass.mainprints too.Overlapping PRs
The branch is on 25ef65c and merges cleanly with
mainat 701f78e (0.7.1). Test merges of this branch into each PR's head (git merge-tree):probebranch a few lines above the OtherTiff line this changes; LR-IMP-FORMATS: decode Minolta MRW #1040 (MRW) edits the MRW test next to where the new engine test sits (it is placed after that test to stay clear). LR-EDIT-OPTICS-PROFILE: decode Sony shading, CA and distortion tables (nothing new applied), plus a BigTIFF overflow fix #1176 and LR-IMP-FORMATS: folder import finds Sony SR2 and SRF files #1165 (Sony lens tables, SR2 / SRF discovery), LR-EDIT-OPTICS-PROFILE: Sony ILCE-7RM6 lateral CA corrected on the raw mosaic before demosaic #1115 and LR-EDIT-OPTICS-PROFILE: Sony ILCE-7RM6 embedded lens corrections (distortion applied; CA and vignetting parsed) #824 (ILCE-7RM6 lens corrections) touchvendor/arw.rsor the Sony docs, not these lines.docs/raw-parity.md,docs/parity-checklist.mdanddocs/gaps.md, and the LR-IMP-FORMATS row, conflict with LR-IMP-FORMATS: decode Minolta MRW #1040, LR-IMP-CAMERA-COVERAGE: verify 117 Nikon and Fujifilm bodies on CC0 files #1045, LR-PROF-IMPORT: import the user's own DNG camera profiles (.dcp) #1063, LR-IMP-CAMERA-COVERAGE: verify 97 Canon CR2, Pentax and Ricoh models on CC0 files #1081, LR-IMP-FORMATS: decode Epson ERF #1087, LR-IMP-CAMERA-COVERAGE: verify 21 Sony and Leica models on CC0 files #1096, LR-IMP-FORMATS: import and decode Mamiya MEF (stacked on #1087) #1105, LR-IMP-CAMERA-COVERAGE: verify 17 uncompressed Olympus and Samsung models on CC0 files #1108, LR-EDIT-OPTICS-PROFILE: Sony ILCE-7RM6 lateral CA corrected on the raw mosaic before demosaic #1115, M11: decode lossless Olympus and OM System ORF #1162, LR-IMP-FORMATS: folder import finds Sony SR2 and SRF files #1165 and Preserve Lightroom edits and improve measured rendering fidelity #1226 (and the checklist alone with LR-EDIT-OPTICS-PROFILE: Sony ILCE-7RM6 embedded lens corrections (distortion applied; CA and vignetting parsed) #824, LR-IMP-FORMATS: recheck stale preview-only raws when a library opens (#662) #974, LR-EDIT-OPTICS-PROFILE: decode Sony shading, CA and distortion tables (nothing new applied), plus a BigTIFF overflow fix #1176). The verified counts (236, gap 10) move with the evidence PRs LR-IMP-CAMERA-COVERAGE: verify 117 Nikon and Fujifilm bodies on CC0 files #1045, LR-IMP-CAMERA-COVERAGE: verify 97 Canon CR2, Pentax and Ricoh models on CC0 files #1081, LR-IMP-CAMERA-COVERAGE: verify 21 Sony and Leica models on CC0 files #1096, LR-IMP-CAMERA-COVERAGE: verify 17 uncompressed Olympus and Samsung models on CC0 files #1108; a rebase re-runspython3 docs/raw/coverage.py.evidence.tsvandcoverage.tsvmerge cleanly with all of them.RENDER_CACHE_VERSIONchange, 61 to 62, so the two merge without a conflict; whichever lands second should take 63, or one PR's thumbnails stay cached.🤖 Generated with Claude Code