mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-20 00:55:43 +00:00
Requests for a footage frame that another request is decoding now wait for that decode and take its picture. Before, a request on any rayon worker (all of the viewer's frame workers) decoded a private copy instead, so the same EXR was read and decoded several times at once. - The pool's in-flight set becomes a map of flights with a shared outcome slot. The owner's guard publishes the outcome on drop (an error when the decode failed or panicked), so no waiter is left blocked. A waiter whose owner was called off asks again (at most 3 times, then decodes a copy); a waiter called off itself stops waiting. - Decodes run on a dedicated decode pool (ec-decode-N, one per core) while the request blocks on a channel; the cancel flag and decoding hints go with them. Frame workers never run decode pieces and decode threads never wait for a picture, so waiting can't deadlock. Without decode threads (wasm32, or the pool failing to start) a thread decoding itself never waits; every wait is bounded (10 s) as a safety net. - A still is decoded whole once and each requested size is resampled from it with the same resampler as before, so the result is the same as a direct decode at that size. Sizes asked for at once share the in-flight decode; a size asked for shortly after (the Project panel's 192x108 comp thumbnail beside the half-resolution viewer) is resampled from the frame cache's whole picture or from recently decoded whole stills, kept beside the cache (512 MiB and half the budget at most, expiring after 256 frame cache inserts). A decode in flight across forget() keeps nothing. - PoolStats::decodes counts pictures decoded. Fixes #3269