Repository navigation
LRC-LIB-CATALOG-IMPORT: the ARW6 plan keeps the probe's scattered strip reads - #1223
mdlmarkham wants to merge 4 commits into
Conversation
Three boolean expressions clippy now wants simplified (pipeline's normalize_wb, engine's learn_as_shot_wb, per nonminimal_bool), a descriptor_copy only its #[cfg(unix)] test calls (dead on Windows), and desktop_entries_give_their_program is unix-gated (Path::is_absolute decides by the platform, and desktop entries run there). None change behaviour; all four fail cargo xtask ci on this toolchain from main. Co-Authored-By: GLM 5.3 Flash <noreply@z.ai>
Co-Authored-By: GLM 5.3 Flash <noreply@z.ai>
…ip reads The equivalence of `header_plan` / `preview_plan` broke for the corpus's ARW6 pair: a Compression-32766 strip was holed behind its first 64 KiB prefix, but the header probe validates more there - `parse_tile_header` walks the 13 stream header words of every tile, `stream_halves` reads each stream's index table, and `first_half_shift` decodes the residual stream's first half, which sits behind the earlier streams' data. The probe read zeros (and 0xFF) there and failed with "ARW6 first-half row count outside 2..=7" where the whole file decodes (first corpus case: arw6-sony-ilce7rm6-apsc-land-hq.arw; the corpus is git-ignored, so CI never saw it). `tiff_plan` now asks `arw6_keep` (crates/raw/src/sparse.rs) for those scattered ranges when `image()` reports Compression 32766 for one strip: the tile table, then per tile, in staged rounds so each ask sits in one `Need`, the picture/group tables, the stream header words (positions from the new `arw6::stream_header_positions`, mirroring the group-table walk), then with the real `parse_tile_header` run, the 13 index tables and finally each residual first half (its length A is its index's first entry). A layout that cannot be walked - a corrupt ARW6 - reads whole: `arw6::decode` stops at the same validation of loaded bytes, so the probe is still identical. `parse_tile_table`/`parse_tile_header`/`u16_be` /`u24_be` are now `pub(crate)` for the walker, and `Want::pending_plan` (renamed from `into_plan`) takes `&mut self` so the walk can keep asking after the IFD walk answered. The full-size JPEG these files carry as a `JPEGInterchangeFormat` image (compression 6/7, where 0x0201/0x0202 are the interchange tag and its length and `image()` therefore declines) reached no hole at all and made the plan read it whole: together with the strip work, the header plan now reads 26-28% -> ARW corpus average 1.7% (the two ARW6 files read 2 / 1%); nothing reads the interchange image in header mode, and under `preview_plan` `embedded_preview` wants it, so the hole is header-mode only (the corpus test's 0 / 0xFF fills guard both). Tests: without the corpus, sparse.rs's synthetic single- and two-tile ARW6 files (residual stream past the prefix, Qis::REAL) assert the plan reads past the 512 KiB prefix and probes as the whole file does, for both fills; with it, `sparse_corpus` passes for both real files, both fills, both plans, and the ARW6 decode-sum corpus tests are unchanged. Gates: fmt, clippy -D warnings, heif, parity (+ refreshed summary), layers, assets and wasm all pass; `cargo test --workspace` has no failure that clean main doesn't show on this Windows machine (engine sidecar's 20 fs-fault and ui-egui's denoise-model tests fail there identically with the fix stashed). Co-Authored-By: GLM 5.3 Flash <noreply@z.ai>
|
Note for review: the middle Two scoping facts so it doesn't read as a complete toolchain fix:
|
# Conflicts: # crates/catalog/src/lock.rs # docs/parity-checklist.md
wanikhawar
left a comment
There was a problem hiding this comment.
This PR also changes apps/lightcraft/src/editors.rs and contributors/people.toml, which have nothing to do with the ARW6 strip plan (rule 8). Please split them out. It also conflicts with main now.
|
#1477 already made ARW6 import describe from the whole file, and |
|
Thank you @mdlmarkham. The ARW6 probe break was fixed on |
What this does
Fixes the sparse-equivalence break PR #1020 reported (
no issue exists for it):header_plan/preview_plandescribed a Compression-32766 (ARW6) strip from part of it while the header probe validates bytes scattered
through a 30-63 MB strip. The corpus's ARW6 pair was described from zeros (and again 0xFF) and the probe failed
where the whole file decodes:
The probe's reads on an ARW6 strip are not a prefix (
docs/arw6-compression.md): per tile,parse_tile_headerwalks the 13 stream header words,
stream_halvesreads each stream's index table, andfirst_half_shiftdecodesthe residual stream's first half — which sits behind the earlier streams' data (megabytes in). The 64 KiB
prefix the plan kept does not reach any of that.
How
when an IFD's image says Compression 32766 and has one strip,
tiff_planasksarw6_keepfor the strip'sscattered reads and holes only the rest. The walk runs in stages — each one answers with a single
Need:u32count + up to 16 24-byte entries),arw6::stream_header_positions,mirroring
parse_tile_header's group-table walk — the two walks must agree),parse_tile_headerplaces each stream's index table,Ais its index's first entry, andfirst_half_shiftdecodes those lines for the anchor offset.
Whole:arw6::decodestops atthe same validation of loaded bytes, so the probe is still identical (it reads whole and the equivalence holds
trivially). This never guesses: the keeps are exactly the bytes
arw6::decodereads in header mode.Want::into_planbecomespending_plan(&mut self)(std::mem::takeof the asks), so the ARW6 walk can keepasking after the IFD walk already returned.
JPEGInterchangeFormatimage(compression 6/7, where 0x0201/0x0202 are the interchange tag and its length and
image()therefore declines).Neither hole arm reached that IFD, so the header plan read the whole 7.4 / 16.7 MB JPEG. Nothing reads it in
header mode, so
header_planholes its bulk (>= BULK, keeping the first 64 KiB like any image); underpreview_planembedded_previewwants it, so the hole is header-mode only.embedded_previewitself isunchanged and its output identical.
Measured
Over the full CC0 corpus (
cargo xtask corpus --download, 111 raws), through the same runs the corpus test makes:Tests
(with the corpus): both pinned ARW6 files — APS-C HQ, one tile; full-frame Compressed, four tiles — pass the
describe-equality with skipped bytes 0 and again 0xFF, under both
header_planandpreview_plan; the ARW6decode-sum corpus tests are unchanged.
gains
arw6_plan_keeps_the_scattered_probe_reads: syntheticarw6_testencfiles (single tile withs = 3, anda two-tile full-frame layout) whose residual stream starts past the 512 KiB prefix, asserting (a) the plan asks
for bytes past the prefix and (b) the buffer probes as the whole file does, for both fills. This failed pre-fix
with the "first-half row count" error and is what keeps the walk honest when the corpus is absent (which is why
CI never saw this).
Verification
fmt, clippy
-D warnings, heif, parity (+ summary refreshed), layers, assets and wasm all pass individually(
cargo xtask cistops at theteststep on this Windows machine).cargo test --workspacehas no failurethat clean main does not show here: with the whole branch stashed,
lightcraft-engine --libfails the same20 sidecar fs-fault tests and
lightcraft-ui-egui --libthe same denoise-model tests ("this build cannot rundenoise models"); nothing else fails. Those are platform/build-environment failures of
main, not of this branch.Three commits:
LRC-LIB-CATALOG-IMPORT: the ARW6 fix (this branch's subject),ci: clippy on stable 1.96.1 (this machine's stable) and the Windows-only pre-existing failures (threenew-lint boolean simplifications, a
descriptor_copygated to the#[cfg(unix)]test that calls it, anddesktop_entries_give_their_programunix-gated like the catalog's fork test) — without it clippy fails onmainhere. Scoping, so this does not read as a complete toolchain fix:descriptor_copyanddesktop_entries_give_their_programalready sit in Windows: case-insensitive sidecar/rename fixes; Windows test and toolchain fixes #1052 (see the review note that opens the conversation) —happy to drop this commit and rebase onto whichever of the three lands first — and the lint 1.99 fails on
(
crates/pipeline/src/spots.rs'schunks_exact_to_as_chunks, what Tests don't run in CI on macOS, Windows or Linux, and the CPU/GPU equivalence tests never run in CI (gap 9) #1050 measures as the maintainers' stable)is not touched by it: Windows: case-insensitive sidecar/rename fixes; Windows test and toolchain fixes #1052 fixes that one.
cargo xtask parity --write): a separate, pre-existing one-row drift correction(totals 407/50/73 → 408/51/72, P0 200 → 201), unrelated to ARW6 —
main's parity-checklist revision historyalready had the summary marked as due for a
--write.Related
LR-IMP-PREVIEW-READ: a CR3 or a TIFF raw's preview is read from the plan's ranges #1020: documents this failure (and the step-2 plan loader this unblocks for ARW6).
LRC-LIB-CATALOG-IMPORT: describe raws from their headers without reading pixel data (step 1 of #832) #961: the module; its ARW row's 7.5 % was the old ARWs — the ARW6 pair had never gone through.
Lightroom catalog import: every original is read in full and hashed, progress stays near 0 % and Cancel waits for all of it (38k photos ≈ 25 min on a USB SSD) #832: the batched import this module exists for. No production caller yet — LRC-LIB-CATALOG-IMPORT: describe raws from their headers without reading pixel data (step 1 of #832) #961's own body says "Nothing
calls it yet" — so merging this is invisible to users today. What it does:
(
arw6-sony-ilce7rm6-apsc-land-hq.arw: differs from the whole file);tiff_plan) servesheader_planandpreview_plan, andpreview_planis what LR-IMP-PREVIEW-READ: a CR3 or a TIFF raw's preview is read from the plan's ranges #1020's files.rs loader calls;
30-63 MB file instead of the current 26-28 %.
Co-Authored-By: GLM 5.3 Flash noreply@z.ai
Fixes
Fixes #1225 (the issue tracking this failure).
The three as one story
sparse::header_plan/preview_plan; step 2 builds the batched import probe on it.pre-existing
sparse_corpusfailure reproduced from upstream's own test file).to fix, so this PR had no
Fixes #Nand nothing tracking it. Whoever batches can see the three as one story here.