mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-20 00:55:43 +00:00
Footage cache (#3271): FootageSource::aux stays every channel; effects doc stays generated
MediaPool::aux (no render asks for it: renders ask for what their effects read) again gives every channel, the picture's too, so the pinned OpenEXR golden hashes stay as they were; 'all channels' without the picture applies to the effects' requests. docs/effects.md is generated: the note on static channel selection lives in docs/footage.md.
This commit is contained in:
1 parent
612419f3c1
commit
e04d57ce03
3 files changed
+26
-8
No files matched your search
@@ -1247,13 +1247,28 @@ pub(crate) fn picture_rows(path: &str, source: &ExrSource, op: AlphaOp, rows: (i
|
||||
/// The channels `need` reads of the OpenEXR at `path` (all for [`AuxNeed::All`]), from the
|
||||
/// store. `None` when it isn't a readable OpenEXR (or the request was called off).
|
||||
pub(crate) fn aux(path: &str, source: &ExrSource, need: &AuxNeed) -> Option<Arc<AuxChannels>> {
|
||||
aux_of(path, source, need, false)
|
||||
}
|
||||
|
||||
/// Every channel of the OpenEXR at `path`, the picture's too ([`FootageSource::aux`]: no render
|
||||
/// asks for that; a render asks for what its effects read, [`aux`]).
|
||||
///
|
||||
/// [`FootageSource::aux`]: effectcraft_render::FootageSource::aux
|
||||
pub(crate) fn every_channel(path: &str, source: &ExrSource) -> Option<Arc<AuxChannels>> {
|
||||
aux_of(path, source, &AuxNeed::All, true)
|
||||
}
|
||||
|
||||
fn aux_of(path: &str, source: &ExrSource, need: &AuxNeed, with_picture: bool) -> Option<Arc<AuxChannels>> {
|
||||
for _ in 0..2 {
|
||||
let since = drop_generation();
|
||||
let (index, opened) = exr_index::get_opened(path, source).ok()?;
|
||||
let want = match need_ids(&index, need) {
|
||||
let mut want = match need_ids(&index, need) {
|
||||
Some(ids) => Want { all: false, ids },
|
||||
None => Want { all: true, ids: BTreeSet::new() },
|
||||
};
|
||||
if with_picture {
|
||||
want.ids.extend(index.picture_ids().unwrap_or_default());
|
||||
}
|
||||
match store().get_opened(path, source, &index, &want, Use::Other, opened, since) {
|
||||
Ok(b) => return Some(b.aux.clone()),
|
||||
Err(Refused::Changed) => continue,
|
||||
|
||||
@@ -181,7 +181,7 @@ fn multipart_channels_are_found_by_their_stored_names() {
|
||||
assert_eq!(aux.manifest(&layer).map(<[_]>::len), Some(1));
|
||||
// The names alone, from the headers.
|
||||
let names = pool.aux_names(ItemId(1), &f, Tick::ZERO).unwrap();
|
||||
assert_eq!(names.names(), aux.listed.iter().map(String::as_str).collect::<Vec<_>>());
|
||||
assert_eq!(names.names(), aux.names());
|
||||
assert!(names.channels.iter().all(|(_, p)| p.is_empty()), "no pixels decoded");
|
||||
}
|
||||
|
||||
@@ -527,10 +527,10 @@ fn given_aux_footage_decodes_once_from_the_first_frame() {
|
||||
pool.set_aux_footage(&[given.to_string()]);
|
||||
take_decodes();
|
||||
pool.frame_at(&f[given], Tick::ZERO).unwrap();
|
||||
assert!(pool.aux(ItemId(1), &f[given], Tick::ZERO).unwrap().get("diffuse.R").is_some());
|
||||
assert!(pool.aux_for(ItemId(1), &f[given], Tick::ZERO, &AuxNeed::All).unwrap().get("diffuse.R").is_some());
|
||||
assert_eq!(take_decodes(), [0, 1], "the picture and the channels share one decode");
|
||||
pool.frame_at(&f[learned], Tick::ZERO).unwrap();
|
||||
pool.aux(ItemId(2), &f[learned], Tick::ZERO).unwrap();
|
||||
pool.aux_for(ItemId(2), &f[learned], Tick::ZERO, &AuxNeed::All).unwrap();
|
||||
assert_eq!(take_decodes(), [0, 2]);
|
||||
let d = decodes_of(learned);
|
||||
assert_eq!(d[0].channels.len(), 4, "the picture alone");
|
||||
@@ -708,8 +708,8 @@ fn a_new_aux_footage_set_returns_to_picture_only() {
|
||||
pool.set_aux_footage(&[]);
|
||||
assert!(!shared().is_held(&paths[0]), "no longer kept once no effect reads it");
|
||||
assert_eq!(frame(1), Some(4), "no longer given: the picture alone");
|
||||
// Learned by `aux()`, then a new set without it: picture only again.
|
||||
pool.aux(ItemId(1), &f, at(1)).unwrap();
|
||||
// Learned by `aux_for()`, then a new set without it: picture only again.
|
||||
pool.aux_for(ItemId(1), &f, at(1), &AuxNeed::All).unwrap();
|
||||
assert_eq!(frame(2), Some(all), "learned");
|
||||
pool.set_aux_footage(&[]);
|
||||
assert_eq!(frame(3), Some(4), "a new set drops what was learned");
|
||||
|
||||
@@ -1698,8 +1698,11 @@ impl FootageSource for MediaPool {
|
||||
wanted.needs = needs;
|
||||
}
|
||||
|
||||
fn aux(&self, item: ItemId, footage: &Footage, t: Tick) -> Option<Arc<effectcraft_raster::AuxChannels>> {
|
||||
self.aux_for(item, footage, t, &AuxNeed::All)
|
||||
/// Every channel, the picture's too (no render asks for that: renders ask for what their
|
||||
/// effects read, [`FootageSource::aux_for`]).
|
||||
fn aux(&self, _item: ItemId, footage: &Footage, t: Tick) -> Option<Arc<effectcraft_raster::AuxChannels>> {
|
||||
let path = self.aux_path(footage, t)?;
|
||||
crate::exr_planes::every_channel(&path, &self.inner.exr_source(&path))
|
||||
}
|
||||
|
||||
fn aux_names(&self, _item: ItemId, footage: &Footage, t: Tick) -> Option<Arc<effectcraft_raster::AuxChannels>> {
|
||||
|
||||
Reference in new issue
Block a user