storytold main 83cb1133dd (291 commits) into the integration head bab1a99b85; 47 conflicted files.
- Domain test files (metafile, prepress, pdf plates, settings store, heif, media-testkit, atomic): tests next cut stay cut; tests new on main are kept, as trials where the crate's test target runs trials.
- atomic: main's group-bits test and Faulty::set_group go to src/tests.rs. audio: main's GSM and SBC oracles join tests/main.rs. cms constructors, pdf knockout_backdrop and testing_pdf join their crates' one test binary; timeline's preflight tests become src/preflight_tests.rs trials.
- update: main's changes to detect, install (linux, macos) and the tests land in next's split modules. The app's own offer is inspected on a thread of its own, picked up by tick's polling; settle_for_tests settles offers too. Later on a ready update drops the close it asked for. updater_pin_tests.rs stays deleted; its new pin test is in tests/it/update.rs.
- craft-color: main added a different crate at crates/color (the colour tags of compositor and display frames); it is next's craft-color module `tags`, re-exported at the root.
- Old crates/ui (combo, docking, testing, README) and keymap's ui/view.rs stay deleted; main's new crates/ui/src/testing files are dropped with them.
- New crates in the craft facade: ai, control, dds, frame, ipc, media-source, palette, press-print, score, ssip. testkit and xtask are listed outside it.
- Cargo.lock: the union of both locks, resolved by cargo metadata. Workflow: main's nextest Windows leg, with next's --keep-going clippy.
craft-heif
An optional HEIF / HEIC decoder for iPhone and Mac photos, shared by LightCraft and PhotoCraft. It was moved from
LightCraft's lightcraft-heif. heic-rs
(pure Rust, no unsafe, MIT OR Apache-2.0, written from the H.265 / HEIF specifications) reads the
container and reconstructs the HEVC pictures; this crate turns them into 16-bit RGB itself so the
result matches libheif to within one code value:
- the colour description is the item's
colr nclx(or its first tile's), else the HEVC VUI (iPhones: full range), else the H.265 defaults; an unspecified matrix is BT.601. heic-rs alone assumes BT.709 limited range, about 8 code values off on every iPhone photo; - chroma is upsampled by nearest neighbour, or centred bilinear when a
clapstarts on an odd pixel, as libheif does; imiraxis 0 flips top and bottom, as libheif writes and reads it (heic-rs names it the other way);- a grid's ICC profile may sit on its tiles.
Single pictures and grid-tiled photos, 4:2:0 and monochrome, 8- to 10-bit, alpha auxiliary images
(other auxiliary images — HDR gain maps, depth — are ignored), the container's rotation/mirror/crop,
ICC, EXIF and XMP, and the file's thumbnail item. 4:2:2 and 4:4:4 (Canon/Sony "HIF") are refused
with Error::Unsupported: heic-rs 0.1.1 loses sync on them. Read-only.
let info = craft_heif::probe(&bytes)?; // size, depth, alpha: check limits first
let img = craft_heif::decode(&bytes, &craft_heif::Options::default())?;
// img.width, img.height, img.has_alpha, img.bit_depth, img.data (RGB/RGBA u16), img.colour, img.icc, img.exif, img.xmp
let thumb = craft_heif::decode_thumbnail(&bytes, 256, &Default::default())?; // Option<Decoded>
let (exif, xmp) = craft_heif::read_metadata(&bytes)?; // no picture decoded: for cataloguing
Chroma is upsampled like libheif by default.
craft_heif::Options { chroma: craft_heif::Chroma::Apple, ..Default::default() } matches Apple's
decoder (and so Photoshop on macOS) instead; the two differ only next to sharp colour edges, where
Apple's blends the neighbouring column and, for 4:2:0, the neighbouring row.
Errors are Error::Unsupported (image sequences, overlays, 4:2:2/4:4:4, …), Error::Limit or
Error::Malformed. It never panics: every call into heic-rs runs under catch_unwind, and a panic
inside it (PhotoCraft's fuzzing found two in 0.1.1) becomes Error::Malformed.
Features: decode (default) is the decoder above. metadata adds craft_heif::items, which reads
the Exif and XMP items from the box structure alone (pitm, iinf, iref, iloc, idat),
without heic-rs:
items::readreturns the photo's own EXIF and XMP: the itemscdscties to the primary image or to an image it is made from (dimg: grid tiles,iden,iovl,tmap), else those tied to no image. A thumbnail's or depth map's metadata is not the photo's.items::scanreturns every EXIF and XMP item, whichever image it describes, and says when it can't be sure it saw them all:Scan::completeis false for an incomplete or damaged item catalog, and an item whose bytes can't be read comes back asUnreadable. An app that must prove a file has no location (before an export that removes it) refuses when unsure.items::exif_tifffinds the TIFF stream in anExifitem, with or without a correct offset field or anExif\0\0prefix.
The reader walks at most 65,536 boxes and walks iloc once. It gathers at most 16 MiB per item,
and a scan gathers at most 64 MiB in all. A build with
default-features = false, features = ["metadata"] has no heic-rs dependency, and its
read_metadata is items::read. With both features, a test checks that the two readers agree.
Feature test-support exposes craft_heif::testdata: lossless synthetic HEIF files (PCM-coded
32 × 32 HEVC pictures, grids, every property above) for the tests of the crates above. The
feature's former name, testdata, still turns it on until every crate that enables it uses
test-support.
Why it is a separate, optional crate
- A young decoder. heic-rs is new and has a single maintainer. It is pinned exactly
(
=0.1.4); moving the pin is a reviewed change (re-run the crate tests and each app's HEIF tests, e.g.cargo test -p lightcraft-codecs --features heif). The other permissive candidates were rejected: heif-oxide's HEVC decoder (rust_h265) follows FFmpeg's (LGPL) code structure, and gamut-heic has no HEVC decoder of its own. - HEVC patents are a distributor's call. Apps use this crate only behind a non-default
heiffeature, which their release packages enable. Without it, HEIC files are still recognised, and opening one gives a clear "HEIC/HEIF support isn't included in this build" error.
The crate depends on no other Craft crate.