Commit Graph
443 Commits
Author SHA1 Message Date
vangel76 dfe9aedfe4 Footage cache (#3271): faster OpenEXR reads and disk plane hits
- The reader reads the next batch of chunks while the one before
  decompresses, reads chunks that follow each other in the file in one
  request, starts with a small batch so decoding begins early, places
  the planes in parallel, and converts half samples a slice at a time.
- A plane entry stores a half channel as half floats when every value
  round-trips bit for bit (NaN planes and float data stay f32), with a
  plain byte-plane shuffle; one entry per channel, read in parallel on a
  hit. Old multi-plane entries (format 5) read as misses.
- The planes of one decode go to the disk writer as one job that shares
  the plane store's set instead of a copy per channel; the queue counts
  their bytes once the store lets go of them.
- The plane store loses its unused level, and one eviction loop serves
  the budget and the memory accountant; dropping for bytes keeps
  remembered failures.
2026-11-08 06:01:48 +01:00
vangel76 d91f5d28fd Footage cache (#3271): stage B review fixes
- A region of interest reads rows only at the top level (no collapsed precomps, no nested
  comps, no adjustment layers); input and footprint keys never keep a rows-only buffer; a rows
  request takes the whole frame from the frame cache when it is there and keeps nothing itself.
- Sequence layers are keyed by their frame (without frame blending or fields), so times within
  a frame share the entry.
- A decode taken over by a decode thread runs under the asker's cancel flag and hints.
- Disk planes: one entry per channel, read back whatever was asked for before; queued planes
  are moved in (counted exactly), written by channel with checked math; the write refused when
  a plane is of another size. Segmentations are compressed on the writer thread.
- Memory accountant: the plane budget is in the sum; the disk queue counts only bytes it alone
  holds and never drops frame writes; one balance at a time, inserts balance at most every
  100 ms, a refilling holder stays protected for 10 s.
- Reload Footage gives thumbnails new keys; thumbnail keys are worked out at most every 0.25 s.
- Localizer: network footage locations (Settings > Disk, e.g. P:\) besides UNC paths; copies
  recorded beside them and adopted after a restart, stale temporaries deleted; the disk cache's
  reserve kept free; by default beside the disk cache's folder, 20 GB; a copy gone meanwhile
  reads the share; status shown translated, with the network locations.
- Tests: hooks hold the queued decode for the claim test; the disk test uses its own paths.
2026-11-08 03:59:09 +01:00
vangel76 c1534f4502 Footage cache (#3271): stage B self-review fixes
- A region of interest looks up the whole layer's cached buffer first; only a miss reads the
  rows (and keeps nothing).
- The rows margin counts the region's rounding at the layer's own scale; the region test covers
  shrunk and enlarged layers at reduced resolution.
- Layer and plane writes are bounded by the bytes they hold while queued (1 GB).
- The disk cache's drop generation is taken before the file is opened, so planes of a file
  reloaded meanwhile are refused.
- A plane entry of another shape than the planes asked for is a miss before anything is
  decompressed.
- The claim hand-off is one atomic phase (queued, running, claimed): no gap between the claim
  and the queued job.
2026-11-08 03:17:34 +01:00
vangel76 278c4efecc Footage cache (#3271): a region of interest reads only the OpenEXR rows it shows
The renderer maps a top-level region of interest back through a 2D footage layer's transform
to the footage rows it shows, grown by the resampling (wider at a reduced scale) and the
effects' declared margins (effects::pixel_margin: 0 for the per-pixel 3D Channel effects). It
reads the whole frame for 3D layers, motion blur, frame blending, fields, layer styles, effects
that don't declare, and comps that read layers' pixels elsewhere (layer parameters,
expressions); a layer read in part isn't layer-cached. FootageSource::frame_rows hands the rows
to the media pool, which keys the frame by them and reads only those rows (1-line chunks:
exactly those lines), for footage whose channels no effect reads. Pixels in the region are
those of a whole-frame read.
2026-11-08 03:11:53 +01:00
vangel76 043344445f Footage cache (#3271): optional background localizer for network footage
Settings > Disk > Localize Network Footage (off by default), with a folder and a size limit:
OpenEXR files on network shares (UNC paths) are copied one at a time on a background thread,
never on the playback path, under a temporary name and renamed when complete. A copy is read
only while its source has the size and modification time it had when copied and the copy is
complete; entries made of it keep naming the share's file and identity. The least recently
used copies go beyond the limit; Settings > Disk shows what the localizer is doing.
2026-11-08 03:08:10 +01:00
vangel76 d4a86e037e Footage cache (#3271): one memory accountant over the big caches
render::memory::Accountant: one budget (the sum of the Memory & CPU budgets) over the holders
that register with it: the footage frames (priority 0), the disk write queue (0), the decoded
footage planes (1) and the layer cache (2). Over the budget it frees lowest priority first,
down to 90% of it; a holder that makes again what it just let go of (the layer cache tells its
refills) is protected while it thrashes. Holders are held weakly and balanced after their own
inserts, with their locks released.
2026-11-08 03:05:18 +01:00
vangel76 8a3b15d41b Footage cache (#3271): decoded OpenEXR channels persist in the disk cache
A plane kind in the disk cache (planes/): named f32 planes, bit-exact, keyed by the source
file's path and identity, the channel set, the level and the rows; listing their source file,
so a changed file or Reload Footage drops them (the sweep covers planes). The plane store reads
them before decoding and queues what it decoded (encoded on the writer thread, refused when the
disk has no room or the file was dropped since the decode began). The footage source gets the
disk cache with set_disk_cache.
2026-11-08 03:00:29 +01:00
vangel76 2ff51655e3 Footage cache (#3271): disk entries are encoded on the writer thread
Queued writes carry their pixels (a layer buffer shared with the RAM cache, a frame moved in)
and the writer thread converts and compresses them; rendering threads go on at once. An entry
larger uncompressed than the cache may hold is refused before it is queued.
2026-11-08 02:58:03 +01:00
vangel76 b54030b39c Footage cache (#3271): OpenEXR sequence layers are layer-cached per frame
key_any keys an OpenEXR sequence layer (no proxy) by item and source time as it keys stills, so
a processed frame is kept in RAM and on disk; its entries list the frame file they read, so
Reload Footage and a changed file drop them as before.
2026-11-08 02:54:01 +01:00
vangel76 bf48ec8b8e Footage cache (#3271): review fixes
- A covered batch is served before a remembered failure; failures are kept per request, so a
  broken part or too many channels never hides the picture; a picture too large with its
  effects' channels is read alone.
- Hostile headers: parts whose data window or uncompressed block is out of bounds are refused
  before any decoder sees them (index, reader and the image crate's whole-file path, import).
- Seek and read errors are transient (Stopped), not remembered; the copy path notes its file.
- The index drops the headers' other attributes and previews, is bounded by bytes and checks
  the file's identity before it is reused.
- A picture read alone isn't kept twice (plane store and frame cache).
- A waiter whose decodes keep being called off decodes a copy; rounds are bounded.
- The Cryptomatte probe asks with its own effect's need; animated parameters are found in
  nested groups.
- Test hooks and caps are keyed by path; new tests: data window offsets, failures per request,
  too large with channels, the file bound, hostile data windows, damaged files, rows and levels
  on every compression and on tiles.
2026-11-08 02:43:58 +01:00
vangel76 63d32fa33e Merge remote-tracking branch 'origin/disk-cache-comp-scope' into footage-cache-3271 2026-11-08 02:23:46 +01:00
vangel76 089f8e374d Footage cache (#3271): plan the aux channels before the render
FootageSource gains aux_for (only what a need reads), aux_names (names from the headers) and
set_aux_needs (per footage file, what its effects read, so the picture is decoded with those
channels in one pass); the wrappers forward them. The renderer asks for the union of the layer's
effects' needs; the engine sends each aux footage's needs with the aux footage set (all channels
when a parameter is animated or an effect doesn't say); layer.channels and the popups read names
only.
2026-11-08 01:55:41 +01:00
vangel76 4c29667bf0 Disk cache: never serve a RAM layer buffer made before a drop of its files
A render that passed the drop check could sit in put_layer's encode
while Reload Footage cleared the layer cache and dropped the file, then
publish its old pixels to memory after the purge; get, and a fresh
render's insert, then served them. The disk-hit promotion went through
the same insert_mem.

Every way the cache hands out a RAM buffer (get, the kept-first path of
insert, an existing entry in insert_mem) now checks the entry's files
against the store's drops from their own generation (ReadFiles::since):
an entry made before a drop of one of its files is forgotten and the
lookup misses, so a fresh render's buffer replaces it. insert_mem also
re-checks a buffer just before publishing it.
2026-11-08 01:43:54 +01:00
vangel76 9d3152f4d2 Disk cache: a render's drop generation travels with its reads; no disk entries for Expression Selectors
Drop generation per render: the layer cache recovered a buffer's drop
generation from the latest miss of its key, so a second render of the
key that started after File > Reload Footage lent its generation to a
render still running from before, and that render's buffer (the file as
it was) was written after the sweep. Now Renderer::recorded starts each
buffer's read log at the store's drop generation before anything is
read (ReadLog::starting_at); ReadFiles carries the earliest generation
through merges, so derived buffers (styles, the blend-space copy, the
flattened layer) and frames that use a buffer from memory carry it too.
LayerCache::insert keeps a buffer made of a file dropped since its
reads began neither on disk nor in memory; a list that doesn't say
counts as made before every drop. DiskCache::dropped_since takes the
list's own generation too. missed_at keeps only the miss time.

Expression Selectors: the layer key evaluates a text Expression
Selector's amount for the first character only, so a per-character
dependency such as textIndex == 1 ? 0 : footage("ref.png").width was
not in the key, and after the footage item's width changed a reopened
session reused the old layer entry. A text layer with an Expression
Selector now marks its reads unkeyed (ReadFiles::is_unkeyed), which
merges like the generation; such buffers stay in memory and are never
written to disk. Frame entries are unaffected: the comp's frame key
hashes what the expressions name. The equality and hash of ReadFiles
ignore both new fields.
2026-11-08 01:04:45 +01:00
vangel76 8d4c37a38c Disk cache: follow 3D model sources in the comp's reach
The reach walk followed comp, footage and solid sources but not
LayerSource::Model. An expression reading a model layer's source
(thisComp.layer("Model").source.name) left the model item out of the
comp's content key, so renaming the model kept the key and the old
frames on disk were served. Every source item is followed now
(LayerSource::item), which also counts the model when no expression
reads it (Advanced 3D draws it).

The same omission is fixed in the RAM preview's content walk
(frames.rs) and in the layer key's walk of referenced layers
(cache/dependencies.rs).
2026-11-08 00:56:53 +01:00
vangel76 e1b59f3760 Disk cache: refuse writes below 64 MB of room, show this disk's reserve
Review follow-ups to the reserve fix:

- accepts_writes also refuses while free disk space leaves less than
  64 MB of room (a limit the setting asks for is always used): a few
  frames would fill it, and the rest would be compressed only to be
  refused.
- While writes are refused the idle passes ask for no repaint, so the
  UI keeps a frame coming every 5 s: the free space is read again and
  the RAM frames are written once there is room.
- Settings > Disk names the space kept free on this disk (the reserve
  the last reading applied; the rule from MIN/MAX_DISK_RESERVE when it
  is unknown), and the "no room" note follows accepts_writes.
- The settings.disk.cacheLimit automation label is machine-readable
  and the same in every language: limitMb, maxMb, reserveMb,
  spaceLimited, writes.
- cargo fmt.
2026-11-07 23:38:49 +01:00
vangel76 4295717ca7 Disk cache: cap the free-space reserve at 10 GB, skip encodes the limit refuses
The reserve the cache leaves free on its disk was max(2 GB, 5% of the
disk) (#2551). On a 4 TB disk with 190 GB free that is 200 GB, so a
cache set to 20 GB had a limit of 0: every write was refused, the cache
never held anything, and only a log warning said so.

The reserve is now clamp(5% of the disk, 2 GB, 10 GB). It is there to
keep the cache from filling the disk, not to keep a share of a large
disk free: 10 GB leaves the system room to work on any disk, a small
disk still keeps 2 GB, and a 100 GB disk keeps 5 GB as before. After
Effects has only a maximum cache size and no reserve; a clamp keeps
the floor for small disks, where a fixed 10 GB would take most of the
space.

Writes the limit refuses cost no work: DiskCache::accepts_writes (one
atomic read) is checked before a frame is converted (put_disk_frame)
and before frames and layers are compressed (put_frame, put_frame_f16,
put_layer). The frame workers spent about 8 ms per frame and 14 ms per
layer on encodes that were then refused. persist_missing returns at
once at limit 0 instead of converting the RAM frames on every idle pass.

Settings > Disk shows the limit in effect in MB under Maximum Disk
Cache Size, with a note when free disk space lowers it
(settings.disk.cacheLimit).
2026-11-07 23:27:17 +01:00
vangel76 250e52cdc3 Merge remote-tracking branch 'upstream/main' into disk-cache-comp-scope 2026-11-07 21:38:56 +01:00
vangel76 8a479a4922 Doc comments for the functions this PR touches 2026-11-07 19:52:49 +01:00
vangel76andClaude Opus 5.5 ac34105a57 Disk cache: RAM frames keep the drop generation their render started at
Reload Footage empties the RAM preview, but an idle pass of
persist_missing may already hold a frame from before the reload. It
took the cache's drop generation when it ran, after the drop, so the old
pixels could be written back and, with the file's size and time
unchanged, served again after a restart.

Each RAM frame now keeps the disk cache its render started with and
that cache's drop generation then. persist_missing writes a frame only
to that cache, with that generation, and skips it once one of its files
was dropped since; a frame rendered without that cache is not written
from there.

Tests use tempfile directories (the layer drop test, the frame_files
folders under target/).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:42:56 +01:00
vangel76andClaude Opus 5.5 037895f468 Disk cache: Reload Footage closes the gaps around its drop (#3184)
- A reload while the disk cache is off is kept on the session
  (pending_disk_drops) and applied when the cache is switched on, before
  anything is read from it.
- Each render takes the cache's drop generation before it reads (frame
  worker; layer cache at the miss). An entry listing a file dropped after
  that is refused under the queue's lock, so a render that was under way
  during the reload can't store pixels from before it. Such a frame is
  shown with an incomplete file list, so persist_missing skips it too.
  The per-file record is bounded (past it, everything older is refused).
- An entry read while its drop was pending is a miss even when the
  writer ends the sweep between the read and the check (a stale hit
  found under load): the pending drops and the generation are taken
  before the entry is read.
- Test: a reopened project serves its frame from disk with no source file
  opened or decoded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:18:42 +01:00
vangel76andClaude Opus 5.5 fbac5f7099 Merge disk-cache-layer-files: third review round of step 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 04:55:27 +01:00
vangel76andClaude Opus 5.5 28ec046c77 Merge disk-cache-frame-keys: third review round of step 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 04:55:27 +01:00
vangel76andClaude Opus 5.5 dc88b8b534 Merge disk-cache-per-frame-files: third review round of step 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 04:55:26 +01:00
vangel76andClaude Opus 5.5 3095b856ee Render: text lists the font file of a run that draws no glyph; tests clean their temp dirs
An empty first paragraph draws no glyph, but in a box its face sets the
first baseline that places every later line. The read list took faces only
from glyphs, so it could be complete without that file. Note each style
run's resolved face as well.

The font-reads and confine tests use tempfile::tempdir(): a fresh
directory per run, removed on panic too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 04:54:38 +01:00
vangel76 02fa676925 Merge remote-tracking branch 'origin/disk-cache-layer-files' into disk-cache-comp-scope 2026-11-07 03:32:53 +01:00
vangel76andClaude Opus 5.5 a1ea8c2282 Merge disk-cache-frame-keys: second review round of steps 1 and 2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 03:21:20 +01:00
vangel76andClaude Opus 5.5 3f62c14fa6 Merge disk-cache-per-frame-files: second review round of step 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 03:10:31 +01:00
vangel76andClaude Opus 5.5 e6b19c9bc4 Render: cached buffers list what their expressions and substituted characters read
- Buffers made under `Renderer::recorded` (layer content, a Time effect's input, an adjustment
  layer's footprint) evaluate their masks, shapes and effects with the context that notes into
  the buffer's own read log, so a file an expression reads (`sampleImage`, also at shutter times
  mask motion blur adds and the cache key doesn't see) is in the buffer's files.
- A styled layer served from the cache lists the files of the cached body and passes too, so
  the buffers made of it (flattened, blending space) don't get a complete list when one of them
  came with an incomplete one.
- A character put in by Character Offset or Character Value without a relayout notes the font
  it is drawn with; a fallback face (or none) leaves the list incomplete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 03:10:25 +01:00
vangel76andClaude Opus 5.5 e88b847259 Layer cache: masked buffers are keyed by the mask motion blur gate
A mask with Mask Motion Blur On blurs even when the layer's own switch is off,
as long as the render's gate is open (Render Settings motion blur, and with
Switches Affect Nested Comps the precomp layers above). The key held the
layer's own motion blur state only, so a buffer blurred with the gate open was
reused with it closed (and the other way round), also from the disk cache.
Masked layer, input and footprint keys now tell a closed gate apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 02:51:51 +01:00
vangel76andClaude Opus 5.5 a5e673dd6a Layer cache: buffers that read other layers are keyed by the switches passed down
A layer whose effect reads another layer (Gradient Wipe, Set Matte, Blend…) gets
that layer drawn by its own renderer. Through a precomp layer, Switches Affect
Nested Comps, the switches inherited from the precomp layers above and motion
blur on change those pixels, but the key held only the layers' own switches: a
buffer made with the setting on was reused (from memory or the disk cache) with
it off. Such layers now derive their key with what the renderer passes down.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 02:42:22 +01:00
vangel76andClaude Opus 5.5 47d8acb694 Merge disk-cache-layer-files (step 3 review fixes) into disk-cache-comp-scope
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 02:37:16 +01:00
vangel76andClaude Opus 5.5 eeff6f44ff Disk cache: layer entries store the whole modification time
Layer entries share the frame entries' file list layout, which now stores the
full i128 modification time: the layer entry format version goes to
layer-entry-files-2. The module doc names the font files text is drawn with
among an entry's source files, and what keeps a list incomplete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 02:30:50 +01:00
vangel76andClaude Opus 5.5 c925f1e190 Merge disk-cache-frame-keys: review fixes of steps 1 and 2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 02:30:50 +01:00
vangel76andClaude Opus 5.5 1e569ee3a9 Disk cache: frame entries store the whole modification time
A frame entry's file list stores a file's modification time as i128 nanoseconds
since 1970 (negative before), as the file stamps now keep it; the frame entry
format version goes to frame-entry-files-2 so entries in the old layout are not
read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 02:14:17 +01:00
vangel76andClaude Opus 5.5 37cb22df1f Merge disk-cache-per-frame-files: review fixes of step 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 01:58:20 +01:00
vangel76andClaude Opus 5.5 d04ccd5234 Render: sampleImage and text fonts note the files they read
EvalCtx carries the render's read log. A sampleImage render records its footage
reads, keeps them with its per-thread cached buffer and notes them in the
evaluating render's log on every use. Text notes the font files it is drawn with,
with the identity their bytes were read with; a family that isn't installed, a
fallback or missing glyph, or a font from memory leaves the list incomplete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 01:58:15 +01:00
vangel76andClaude Opus 5.5 8d948c231c Render: a buffer kept by another worker comes with its own files
LayerCache::insert returns the files of the buffer it keeps, and Renderer::keep
notes them in the render's log and returns them, so a render that uses another
worker's buffer lists that buffer's files (a file changed between the two reads
then has two identities and the list is incomplete).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 01:58:15 +01:00
vangel76andClaude Opus 5.5 d2372b7e2d Disk cache: file stamps keep the whole modification time
A file's modification time was nanoseconds since 1970 as u64: a time before 1970
read as "no time" (two such files of one size looked alike) and times after 2554
were truncated. It is now i128 nanoseconds, negative before the epoch; None only
means the file system has no time. The content-key hash writes a presence tag and
the full value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 01:58:15 +01:00
vangel76andClaude Opus 5.5 0bf8bf2b5e Disk cache: Reload Footage drops the entries of its files, docs
File > Reload Footage now deletes the frame and layer entries whose file
lists name the reloaded item's files (DiskCache::drop_files), so a file
replaced by one with the same size and modification time, which the
check on hit can't tell apart, is read again. The index knows keys, not
files: the writer thread reads the files section at the start of each
frame and layer entry (not the pixels) after the writes queued before
it, and deletes the entries that list one of the files. Until it is
done, an entry made of one of them is a miss and frames aren't linked to
new keys. The entries are gone for good, so they don't come back after a
restart. Automatic reloads don't drop anything: they follow a changed
stamp, which the check on hit catches. The browser needs nothing (its
file identities are content hashes).

Removed: disk_cache::seal, which steps 2 and 3 left without callers (the
tests use seal_format). Updated the module, seal_format and forget_media
docs, and docs/architecture.md / docs/web.md describe the final design:
what is cached, keys from memory, file lists checked on hit, nothing
scans the project, incomplete lists stay in memory, Reload Footage drops
entries, edits keep the frames they can't change.

Tests: render unit tests (same size and time passes the check but not
the drop; other files' entries stay; an entry queued before the drop is
dropped; a layer entry too; written again afterwards it is used; the
drop survives a restart; a pending drop is a miss), and an engine test
through file.reloadFootage.

Closes #3184. Part of #1492.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 01:11:55 +01:00
vangel76andClaude Opus 5.5 642fcb7bcb Disk cache: the comp key covers what its expressions can read
With an expression anywhere in the project, every comp's disk key hashed
every item of the project, so any edit (another comp, an unused footage
item) threw away every comp's frames on disk. The key now covers what the
comp can draw plus what the expressions among it can reach
(Project::pixel_reach):

- without expressions: the items the comp draws, without silent layers,
  plus the footage its precomp layers swap in (Media Replacement);
- with expressions: every layer of the comps they reach, their markers,
  the comps and footage they name with string literals (comp("Name"),
  footage("Name")) together with which items have those names now, and
  the footage named like a reached source (its data is read by name);
- the whole project when an expression computes a name, uses the object
  model's constructors or internals, dynamic code, computed keys or
  writes, or text the scanner can't read for sure (regex literals,
  template strings, escapes): expression_reach errs towards reaching more.

Markers count only where an expression can read them (#1083). Memory
only, no file is looked at.

Tests: scanner and reach unit tests in the project crate; engine tests
for the key (own-comp expressions keep the key through edits elsewhere,
comp("Other") follows Other and not a third comp, a second comp taking
the name counts, a computed name counts every item, markers read from
another comp); a ui-egui test that the disk frames outside an expression
layer are carried when the comp it names changes.

Part of #3184. Part of #1492.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 01:05:11 +01:00
vangel76andClaude Opus 5.5 2efa859aa9 Disk cache: no-salt worker test, sequence paths in the frame-blend key
Part of #3184 (step 3 of 4).

- A frame-blended footage frame's layer-cache key now hashes the
  sequence's file list: with no project-wide salt, two projects whose
  items share an id and a first frame must not share its disk entry.
- Test: a frame worker syncing, patching and rendering a project with an
  unused 5000-frame sequence asks its file hook only about the file its
  buffer reads (the salt asked about every file at every sync).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 00:19:15 +01:00
vangel76andClaude Opus 5.5 726d78d1c0 Disk cache: layer entries keep their source files, no footage salt
Part of #3184 (step 3 of 4).

Layer buffers on disk (and in the browser's layer store) now carry the
files they were made of, like frame entries since step 2, and are checked
against exactly those files when used. The project-wide footage salt is
gone: nothing stamps every footage file any more.

- Layer entry format 4: the buffer's EntryFiles, then the pixels. A hit
  checks only the listed files (metadata, or the VirtualFileId hook for
  files from memory; Missing must still be missing); a change, a damaged
  entry or the old format 0 is a miss and the entry is deleted, so the
  re-rendered buffer replaces it. A hit reports its file list, so frames
  made of buffers from disk are complete and get stored again.
- Buffers whose files can't all be named are not written.
- Layer disk keys: layer_disk_key = hash of the layer entry version, the
  renderer version and the layer cache key (which names the footage items
  with their paths and settings, from memory).
- PrefetchStore checks on use; an entry made of changed files is dropped
  and forgotten, so the new buffer is queued over it. FrameServer passes
  its virtual-file hook to its layer cache.
- Removed: footage_salt(_with), file_stamp, footage_stamp,
  set_disk_salt, set_store_salt, Session::refresh_disk_salt,
  poll_disk_salt, footage_fingerprint, disk_salt, disk_salt_background,
  disk_salt_job, DiskSaltJob, the UI's per-frame poll, the salt in
  FrameServer and in the availability worker (with its cache_enabled
  plumbing). The disk cache is attached as soon as it is configured.
- Docs: architecture.md, web.md.

Tests: layer entries check their files (size, time, missing/back,
folder, damaged, old format, incomplete); virtual files; prefetch store;
media tests with a real pool across restarts (only the changed file is
read, projects with the same item ids never share an entry, missing,
unreadable and damaged never serve stale buffers); engine tests that the
cache is attached at once and edits do no file work (#1926, #3106).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 00:12:07 +01:00
719b9170dd 3D rotation order, keyed Orientation, linear-to-eased keyframes and Timewarp behave as in After Effects (#1876)
* 3D: Orientation and X/Y/Z Rotation turn Z first, keyed Orientation slerps, as After Effects

After Effects composes a 3D layer's (and a camera's) Orientation and its X/Y/Z
Rotation as Rx * Ry * Rz each, Orientation before the axis rotations; EffectCraft
used Rz * Ry * Rx. Measured on synthetic AE 2026 cases: Orientation [10,20,30]
(488) was 5.2 % of the frame off and now matches to the anti-aliased edge (0.03 %);
X/Y/Z Rotation 10/20/30 (800), Orientation + X Rotation (801) and one-node
cameras (804, 805) likewise.

Keyed Orientation moves along the shortest arc between the keys (quaternion
slerp, eased in time, angles written in [0, 360)): keys [0,0,0] -> [10,20,30]
read back [6.2643, 9.3531, 15.2190] half-way where EffectCraft gave [5,10,15];
[0,0,0] -> [60,80,40] linear and eased match AE's read-backs within 0.002 deg.

lookAt() returns AE's angles (z axis on the target, x axis level; two AE
read-backs within 1e-3 deg). The camera tracker, VR editor, Look At and orbit
commands use the new decomposition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keyframes: a linear side next to an eased side has 16.67 % influence, as After Effects

In a segment that is Bezier on one side and linear on the other, the linear
side keeps the segment's average speed, but with the 16.67 % influence After
Effects shows for linear keys in the Keyframe Velocity dialog (and reports to
scripts), not 33.3 %. Measured on an After Effects 2026 time-remap render (a
square at x = 50 + 455 * remap): out of a key at 2 s (3.5, speed 0, influence
50 %) into a linear key at 4 s (0.5), AE plays 3.290 at 2.5 s and 2.657 at
3 s; EffectCraft played 3.308 and 2.629 (8 and 13 px off), now the same
square positions to the pixel.

LINEAR_SIDE_INFLUENCE is used by evaluation (scalar, per-dimension, paths and
spatial), side_ease (Graph Editor, velocity dialog, keyIn/OutTemporalEase) and
the Lottie export, so exported easing plays as EffectCraft does. Segments
linear on both sides stay straight lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Timewarp: retime the layer's source without the effects above it, as After Effects

After Effects' Timewarp reads the layer's source (with its masks) at the
retimed times and ignores the effects applied before it: a red solid with a
Gradient Ramp and then Timewarp (Speed 25) renders as the red solid in AE
2026 (EXPORTER e2 read-back). EffectCraft retimed the layer with its
effects (mean difference 127.5/255 over the comp), now identical (0, CPU and
GPU). Echo, Posterize Time and the other time effects keep reading the
effects before them, as measured before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Image sequences: a gap in the numbering holds the previous frame, as After Effects

After Effects 2026 shows the last existing file across a gap in a sequence's
numbering (case 860: files 1, 2, 4, 5 show frame 2 at frame 3; VERIFY
read-back). EffectCraft drew colour bars there. The media pool now holds the
previous file (Footage::sequence_file_held); colour bars remain only where no
file precedes the frame. Missing-frame reports on import are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Review: keyed Orientation uses LINEAR_SIDE_INFLUENCE for linear sides; real NaN assert

evaluate_orientation still gave a linear side (and the unreachable missing-key fallback)
1/3 influence while segment_value, side_ease and the Lottie export use
LINEAR_SIDE_INFLUENCE (1/6), so a keyed Orientation next to an eased key moved on a
different curve than every other property (CodeRabbit on #1876). New test:
orientation_linear_side_next_to_an_eased_side_matches_a_scalar (both directions).
The always-true NaN assert in keyed_orientation_slerps_as_after_effects now checks that
a non-finite key comes back as given; Property::value_at says why the match_id
"orientation" routing is safe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Format keyframe orientation test (cargo fmt)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Move the image-sequence gap change out of this branch

The gap change (hold the previous file instead of colour bars) reverses
#297's documented behaviour and goes to its own PR, as requested in review.
pool.rs, sequence.rs, the footage test and docs/footage.md / docs/agents.md
are back to main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-07 00:03:52 +01:00
vangel76andClaude Opus 5.5 99b65562de Disk cache: frame entries keep their source files, comp key from memory
Part of #3184 (step 2). Fixes #3175: opening a comp no longer stamps every
footage file of the project before its first frame can show.

- The comp's content key (`disk_cache::comp_content_key`) is taken from the
  project in memory alone: no footage or proxy file is stamped, no
  `VirtualFileId` is asked. `comp_content_key_with` is gone; `frame_key`
  hashes a new entry version, so entries of the earlier format are never
  looked up again (LRU evicts them).
- Frame entries (formats 2 and 3) store the files the frame read
  (`EntryFiles`: size and modification time as read; size and content hash
  through `VirtualFileId` for files from memory; missing files), then the
  pixels. Formats 0 and 1 read as misses and are deleted.
- Check on hit: `get_frame`/`get_frame_f16` look only at the listed files
  (one metadata call each) on the frame worker. A changed, back or unreadable
  file, or a damaged entry, is a miss: the entry is deleted and the frame
  rendered and stored again.
- A frame whose file list is incomplete is shown but not stored. The RAM
  preview keeps each frame's files, so `persist_missing` writes only frames
  with a complete list.
- Remote frame worker: `FrameServer` records each frame's reads
  (`take_files`); the web worker stores them with the entry and the page
  checks them through the file table before using it. The browser's media
  epoch existed only for the old key and is removed. Export does not use
  frame entries.
- The cache indicator still only asks whether an entry exists.

Tests: entry format round trip and damage, the check per file, and in the
viewer: a changed file re-renders exactly its frames (and a reopen reads the
rest from disk); a frame checks only its own files in a project with a large
unused sequence and the key looks at no file; missing, unreadable files and
damaged entries never serve a stale frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 23:19:09 +01:00
vangel76andClaude Opus 5.5 91443ef25e Disk cache: record the source files each frame reads
Part of #3184 (step 1): renders now report which footage files they read,
each with its identity (size and modification time) as read. Nothing uses
the list yet: images, cache keys and cache behaviour are unchanged.

- render: `reads` module with `FileStamp`, `ReadFile`, `ReadFiles` (sorted,
  deduplicated, bounded; marked incomplete when it can't vouch for every
  file) and the thread-safe `ReadLog`. `Renderer::reads` collects a frame's
  files; `FootageSource::recording` lets a source note what it reads.
  `file_stamp` uses the same identity.
- Layer cache entries keep the files their buffer was made of and report
  them on every hit; derived entries (styles, blend space, flattened) keep
  their base's. Buffers from the disk cache or the browser store don't know
  their files yet and mark the list incomplete.
- Media pool: every file read notes its identity, taken from the file it
  opens. Decoded frames, opened movies, GIFs, models and EXR channels keep
  it with the cache entry, so a frame served from memory reports its file
  without touching the disk.
- Viewer frame worker collects each frame's list and carries it to where
  the disk entry is written (step 2 stores it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 22:20:40 +01:00
Valentin KleinandClaude Sonnet 5.5 fdcc715829 Viewer exposure on the full float range of 32 bpc frames (#2937)
* Viewer exposure on the full float range of 32 bpc frames (#2797)

32 bpc viewer frames on the desktop are rendered without the HDR step (skip_hdr_step,
#2916) and kept as half floats in the RAM preview. A display pass on egui-wgpu's device
turns each frame into one RGBA8 texture with mips per viewer, in this order: decode,
exposure in linear light, Compand / Tone Map, encode, display colour, Show Channel,
rounding. Before, exposure was an 8-bit lookup applied after tone mapping, clamping and
the display conversion, so -2 EV could not bring values above 1.0 back.

- engine: viewer::DisplayPass describes the pass as data; its pixel() is the CPU
  fallback (no device) and the shader's reference. It replaces exposure_lut /
  display_transform. FrameEncoding records a frame's curve and the HDR step it still
  needs. 32 bpc snapshots are taken without the HDR step; snapshot_rgba8 applies it.
- ui-egui: FrameImage::CpuF16 (half crate, F16C at run time), byte accounting at 8 bytes
  a pixel in the cache and the prefetch estimates; display_gpu.rs + display_gpu.wgsl;
  main viewer, snapshot and passive viewers draw through the pass; the 8-bit image other
  panels read is made on demand with the HDR step; the Info panel shows float values.
- Half-float frames are not written to the disk cache yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Viewer display pass: f16 disk cache entries, window-device gating, review fixes

- Disk cache: half-float frame entries (format byte in the entry header, byte planes +
  LZ4); 8-bit entries keep format 0 and stay valid. 32 bpc viewer frames are written and
  read again, and the timeline's disk bar sees them. A damaged half-float entry is
  deleted.
- The display pass runs on the window's egui-wgpu device, with or without the GPU
  compositor (still building, failed, GL fallback). Its pipelines are made inside error
  scopes; a backend that rejects them gets the CPU pass instead of a blank viewer.
- A new LUT of the same size (another ICC profile, Preserve RGB, another display) runs
  the pass again.
- f32 to f16: one pass per L1-sized block, the NaN / infinity fix-up on the bits, no
  fill of the buffer (4K: 4.7 ms, as the 8-bit conversion).
- Mips of odd-sized levels include the last column / row; the snapshot's half floats
  and texture go with the snapshot; no placeholder texture ids; u64 size checks.
- Tests: LUT profiles and negative values against the shader, Bake reruns, the passive
  viewer's colour, f16 disk round trips; exact comparisons allow 1 LSB on software
  rasterizers. Docs: the display pass and the f16 disk entries in architecture.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Viewer f16 disk-cache test: temp dir removed on failure too, wait for the queued disk write

Review points: the test's directory was only removed by its last statement
(now tempfile::TempDir), and the frame is released before its disk write is
queued, so flush() could return early (now waits for the entry).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Viewer: oversized half-float frames use the CPU display pass, so exposure/HDR come before the averaging down

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Viewer: fmt and a debug assert for the half-float upload path

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Disk cache: persist_missing also writes half-float frames

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Passive viewer: oversized half-float frames take the CPU display pass instead of leaving a stale texture

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 17:37:23 +01:00
Valentin KleinandClaude Sonnet 5.5 ae068ff931 EXR export: write the output space's chromaticities attribute (#3038)
* EXR export: write the output space's chromaticities attribute (#3037)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* EXR chromaticities: tests for unmanaged and PQ ProEXR, every space once

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* EXR export: note why the comp background is added before decoding (review point)

CodeRabbit asked to convert Comp.background to the output space before
compositing. Every output path (Image::to_rgba8_over) adds the background to
the output-encoded frame as it is, so the EXR now matches the other outputs;
converting would make the EXR colour differ from the PNG of the same comp.
Comment only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Format the merged code with rustfmt

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 17:19:05 +01:00
ash 7fc1be0bf2 Report offline footage and recover automatically when media returns (#3161)
* 3118: report and recover offline footage consistently

* 3118: preserve manual reload and refresh data watch paths

* 3118: document availability and reload contracts
2026-11-06 11:38:57 +01:00
FredApps 8b63d4308c Merge pull request #2916 from vangel76/fix/exr-scene-linear-output
EXR export: no compand / tone mapping, and the output space's own curve (#2913)
2026-11-06 00:12:32 +01:00