mirror of
https://github.com/storytold/filmcraft.git
synced 2026-12-03 04:25:56 -05:00
* engine: migrate legacy still sizes and Motion anchors on open Projects saved before stills applied EXIF Orientation store a portrait still at the size the file was stored at, unturned, and a clip placed from it baked its Motion anchor from that size. The picture decodes upright today, so the project reopens with the still scaled up and off-centre. On install, a still whose stored size is the transpose of the size its file decodes to now is recognised as legacy: its stored size is swapped to the oriented one and the anchor points of clips placed from it are transposed to match, keyframes included. * engine: turn legacy still anchors by the file's EXIF Orientation The migration's plain axis swap (x, y) -> (y, x) is the right mapping only for Orientation 5. For Orientations 6, 7 and 8 the stored pixel position reaches the upright picture through a rotation or flip, which subtracts from a dimension: a stored (4, 6) on a 40x20 still lands at (14, 4) for Orientation 6, not (6, 4). Centre anchors are invariant under all four mappings, so the original tests could not see it. The migration now reads the orientation the decoder applied from the decoded source itself (MediaSource::still_orientation, reported by StillSource from the raster it decoded), and maps each anchor, static and keyframed, by that orientation. The pool's slate wrappers delegate it, so a pooled source still reports what its inner source decoded. Two coupled fixes in the same area. A clip placed from a subclip of the still keeps the subclip's id, so the migration skipped it; it now collects every item that resolves to the still through resolve_media. And placing from a subclip baked the anchor from the sequence frame instead of the parent media's size, so without that fix the transpose would have moved a sequence-centre anchor: place_item now resolves a subclip's size from its parent. Tests: a noncentre anchor with a noncentre keyframe for Orientations 5-8 (fails without the fix at Orientation 6, (6, 4) instead of (14, 4)); a clip placed from a subclip of the still (fails without either half of the fix); a DNG carrying an Orientation tag, which the migration leaves alone because DNG ignores EXIF Orientation. The media orientation suite now also asserts the orientation each decode reports. `image` moves from the engine's dev-dependencies to its dependencies: the migration and the pool wrappers name `image::metadata::Orientation` in production code, and a lib build without dev-dependencies did not compile before the move. * engine: probe still geometry for the legacy migration and recentre the saved subclip anchor Two points from the re-review of the #4613 migration. The migration decided legacy state by resolving a full source for every nonsquare still in the project, which decoded and retained a frame for stills that turned out to be current. It now asks MediaPool::still_geometry, which probes the file's headers through the new filmcraft_media::still::probe_geometry: each format answers from the same header its decoder reads, under the same pixel ceiling, and reports the size and orientation the decode would apply. No picture is decoded and the pool retains no source. A subclip placed before the subclip source-size fix saved its anchor as the centre of a 1920x1080 fallback frame, (960, 540), which is not a point in the still's coordinates. On a clip placed from a subclip, an anchor still holding exactly that value with no keyframes now migrates to the upright centre; edited and keyframed anchors turn as before. The media suite proves the probe agrees with the decode for every orientation across JPEG, PNG, WebP, RGB TIFF and YCbCr TIFF. The migration suite gains the saved fallback fixture, a second save/reopen proving idempotence, and a check that opening a current or legacy project caches no source for its stills. * engine, media: use bounded header-only reads, require EXIF 5..=8, and expand migration tests --------- Co-authored-by: fanyzp <[email protected]> Co-authored-by: Dylan M. Taylor <[email protected]>