Original MRW reader and retained tests by Andrew Frahn, d6c29aaf; shared parser already exists at the workspace craft-raw pin. Keep the public facade and recovery contract.
Co-authored-by: Andrew Frahn <andrew@emmertex.com>
* codecs,raw,preview,meta,engine: cut over TIFF/JPEG/focus to craft-libs and fix CI
* docs: update parity-checklist paths after craft-raw/craft-metadata cutover
* Remove unused codec workspace deps and cut examples over to craft-image-codecs
* chore: update Cargo.lock after removing unused codec deps
* security(meta): bound namespace declarations in scope while parsing XMP
* address review: a readable sidecar that fails the merge read-back is kept and the save fails
* address review: a sidecar over the XMP complexity limit is kept and the save fails
* merge main into fix/sec-xmp-namespace-bound
* address review: text with no rdf:RDF element is backed up and replaced, not kept as readable
* xmp merge: open a self-closing rdf:RDF element instead of replacing the sidecar
Use craft-gainmap from craft-libs for gain map metadata and arithmetic
* Use craft-heif from craft-libs; remove crates/heif
lightcraft-heif moved to craft-libs unchanged as craft-heif
(storytold/craft-libs#784), so PhotoCraft can share it. The layer table,
the heif CI step and the change triggers drop the local crate; a workspace
file change (which a craft-heif rev bump is) still runs the heif step.
* Pin craft-heif to the merge of storytold/craft-libs#794
* docs: the HEIF rows point at craft-heif, not the removed crates/heif
* Use craft-gainmap from craft-libs for gain map metadata and arithmetic
crates/codecs/src/gainmap.rs keeps the JPEG layout (encode_jpeg, read_jpeg,
is_gain_map_jpeg) and re-exports GainMapMeta, GainImage, GainMapOptions,
ISO_URN, compute and apply from craft-gainmap, which is this file's metadata
and arithmetic moved to craft-libs (storytold/craft-libs#904). The tests of
the moved code went with it.
* craft-heif's Options has a chroma field at this rev: keep the libheif upsampling LightCraft had
* raw: count the chunks a TIFF declares from its offsets table
craft-tiff builds at most one chunk descriptor per byte of file
(craft-libs#827), so a grid of tiles sharing one payload lists fewer
chunks than the image declares. Compare the offsets table, which is the
source of truth, so such a file reaches the byte-accounting check and is
refused for the data it actually holds.
* Use craft-tiff from craft-libs; remove crates/tiff
lightcraft-tiff moved to craft-libs unchanged as craft-tiff
(storytold/craft-libs#783), the first step of sharing RAW support with
PhotoCraft (storytold/craft-libs#587). The layer table drops tiff and its
intra-layer ordering before raster.
* Pin craft-tiff to the merge of storytold/craft-libs#795
* security(meta): linear entity decoding, indexed keyword de-duplication, bounded XMP path building
* address review: decode zero-padded numeric references in the three entity decoders
* never-crash: deny the panic lints in every crate root; GPU asserts become fail paths (#2137)
The never-crash policy was documented but not machine-checked for the two largest crates:
engine and meta carried only #![forbid(unsafe_code)], so a future unwrap/expect/panic would
pass cargo xtask ci. Both crate roots now also carry
as does xtask (previously un-annotated); the guarded expects in meta/src/xmp.rs and xtask's
parity.rs / root() now use the documented #[allow(clippy::expect_used)] + invariant form.
crates/gpu: the three production asserts become fail(FailKind::Fatal, ..) + return, so a
binding-count mismatch, an over-long readback, or a wrong-length curve fails the render over
to the CPU instead of crashing (finish_and_read also early-returns on len == 0, which would
have issued a zero-size copy_buffer_to_buffer that wgpu rejects).
xtask: new roots check (in ci) verifies every workspace lib root and every binary main.rs
carries both attributes; crates/sysmem is the documented exception for forbid(unsafe_code)
only. A panic in placement or readback is a fail, not a crash.
* audit fixes: roots covers binary and cdylib/rlib roots; render gates on failed() after finish_block (#2137)
Two reviewers audited the first commit; both highs it found are fixed here:
- roots scanner: the by_ref().any()/any() pair consumed the kind iterator hunting for
"lib", so every bin-only root (both app mains, the sam3-worker bin, xtask itself) and the
cdylib/rlib web root was silently unchecked — the check covered 29 of the 33 real roots.
Kind detection now collects the kinds once and matches lib/rlib/dylib/cdylib/staticlib,
with a root_paths regression test over bin, lib and cdylib/rlib targets; unreadable root
files now fail with the I/O error instead of a fake policy violation.
- render.rs: the caller gates on failed() right after finish_block, so the malformed-curve
fail path can no longer reach the band loop's p[y0_at] index on the empty block.
- finish_and_read: the len == 0 path now submits the encoder before returning zeros, so a
failure staged in the same render stays detectable (the old zero-size copy failed loudly
via the error scopes; a bare return would have hidden it).
- docs: finish_block and finish_and_read state their failure contracts; USAGE and AGENTS.md
name the new roots step in the ci enumeration.
* xtask: check a library root at the source path that cargo metadata reports
The roots check read src/lib.rs for every library target, so a package that sets its library path was checked on the wrong file. Libraries now use the reported source path, with the same default as binaries when none is given.
* xtask: match the crate-root deny lints by whole name, ignoring a trailing comment
A lint named only in a trailing comment, or a lint whose name contains another (clippy::panic inside clippy::panic_in_result_fn), satisfied the deny check. Lint names are now compared whole and a trailing comment is ignored.
* xtask: read the crate-root attributes from the header, not a fixed 30 lines
The roots check read only the first 30 lines of each crate root, so a root whose attributes came after a longer doc header was reported as missing them. The check now reads the inner attributes at the top of the file: it skips blank lines and comments, reads each attribute whole, and stops at the first item. A multi-line list is read in full and a commented-out attribute does not count.
* xtask: reword two comments in the roots check
Comments only: the lint-name match and the source-path default are described without naming a lint or a build tool. No code changes.
* xtask: report a root attribute that overrides the required denies
* xtask: accept a runtime manifest dir only when it has a parent
* xtask: render the overridden deny attribute without literal braces
The write! escaped the braces around the substituted attribute and lint,
so the violation printed `#![{allow}({clippy::panic})]`; assert the
rendered message in the allow-override test.
* Tests: new test helpers meet the crate-root panic lints
Main added test helpers after this branch; the deny at the crate root now
applies to them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* roots: crates/wincolor is the second crate allowed unsafe
Main added it for the Windows colour APIs after this branch; its module docs
already say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A photo whose Exif states a size but no orientation, and whose XMP says
tiff:Orientation=6, is displayed as stored (by the Exif alone). extract turned
its stored-frame boxes by the XMP's orientation anyway, so import stored them
turned while Read Metadata from File did not (review of #2857).
extract_embedded now turns by the orientation the Exif's own first IFD states
(exif::ifd0_orientation, which also leaves out the XMP in a TIFF's tag 700),
the same rule as for the size. Metadata::orientation is still filled from the
XMP as before.
Tests (both fail on the previous head, with the reviewer's numbers): the photo
as a JPEG and as a TIFF in lightcraft-meta, and through library.import and
photo.readMetadataFromFile in the engine.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CvoftP5JSqAEJ9t7FSczTs
docs/gaps.md, docs/parity-checklist.md, docs/whats-new.md: both sides kept; the PR's sentences added to main's rows and entries.
docs/xmp-interop.md: capture-time paragraph combines both sides.
The PR's test file crates/engine/src/tests_import.rs landed in crates/engine/src/tests/import.rs (moved on main).
crates/meta/src/xmp.rs: kept main's 'mod tests;'; the PR's two tests ported to xmp/tests.rs.
docs/gaps.md, docs/parity-checklist.md, docs/whats-new.md: both sides kept; newer date in headers; XMP row and header carry the PR's sentence.
extract turned regions by the shape of the size it had, and that could be the XMP's: tiff:ImageWidth and
tiff:ImageLength fill it in when Exif states no size, and for a TIFF-based file from_tiff has already merged the file's
own XMP. An XMP size of the upright photo then matched boxes drawn on the upright photo, so they were turned by
mistake. Other paths don't get here (the image header decides for images, merge_into for a packet read as a sidecar).
A raw with its own sidecar without mwg-rs:Regions does, because it keeps extract's boxes.
from_tiff now keeps the size Exif states when it merges the XMP, and extract decides with that size; with none, boxes
stay as written, as they do on main. extract still reports the XMP's size. Every raw decoder sets its own size after
from_tiff, so none of them sees a difference.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CvoftN82NMM6Ebbf3YAK9e
Preserve main's module boundaries and current metadata behavior. Move the shutter changes and regressions into the corresponding probe, encoding and test modules. Preserve both parity records. Hosted CI must validate this refreshed head.
- tag 0x0001 is CameraSettings (numeric LensType at index 22), not an ASCII name; real EOS 5D files never carry a lens name there
- read the lens name from 0x0095 (LensModel) and yield none when only the numeric LensType exists
- fixture now builds a representative maker note (CameraSettings table + LensType 178) and covers both byte orders plus the nameless case
LightCraft already fills a missing lens_model from the Panasonic and Nikon maker notes in try_read_exif, but never from the Canon maker note, so Canon bodies such as the EOS 5D that omit EXIF LensModel cannot match any lens profile even when the maker note records the lens.
Add a canon_maker_note_lens fallback in try_read_exif, parsed with lightcraft_tiff::makernote::parse_makernote (Canon notes are the Plain kind), mirroring panasonic_maker_note_lens; add a unit test in exif.rs that feeds an Exif block with a Canon maker note but no LensModel and asserts lens_model is populated.
Test: canon_maker_note_lens_fills_lens_model failed before the change and passes after.