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.
This commit is contained in:
vangel76 committed 2026-11-08 03:11:53 +01:00
1 parent 043344445f
commit 278c4efecc
8 files changed
+246 -7

No files matched your search

+4
View File
@@ -381,6 +381,10 @@ impl FootageSource for ConfinedFootage {
fn frame_with(&self, item: ItemId, footage: &Footage, t: Tick, size: Option<(u32, u32)>, float: FloatCurve) -> Option<Arc<Image>> {
self.readable(footage).then(|| self.inner.frame_with(item, footage, t, size, float)).flatten()
}
/// Some rows of the frame, or `None` when the footage lies outside the allowed roots.
fn frame_rows(&self, item: ItemId, footage: &Footage, t: Tick, size: Option<(u32, u32)>, float: FloatCurve, rows: (i64, i64)) -> Option<Arc<Image>> {
self.readable(footage).then(|| self.inner.frame_rows(item, footage, t, size, float, rows)).flatten()
}
/// The footage audio from the inner source, or `None` when the footage lies outside the allowed roots.
fn audio(&self, item: ItemId, footage: &Footage, t: Tick, frames: usize, rate: u32) -> Option<Vec<f32>> {
self.readable(footage).then(|| self.inner.audio(item, footage, t, frames, rate)).flatten()
+14
View File
@@ -88,6 +88,20 @@ pub fn aux_needs(id: &str, params: &crate::Params) -> Option<Vec<AuxLookup>> {
})
}
/// How far effect `id` with `params` reaches around a pixel of its layer (layer pixels), for
/// reading only the footage rows a region of interest shows (#3271): `Some(0)` for effects whose
/// pixel depends on that pixel alone, `None` for every other (it may read anywhere).
pub fn pixel_margin(id: &str, params: &crate::Params) -> Option<f64> {
match id {
"ec.3d.channelextract" | "ec.3d.depthmatte" | "ec.3d.identifier" | "ec.3d.cryptomatte" | "ec.3d.extractor" => Some(0.0),
// (its Gradient Layer reads another layer)
"ec.3d.fog3d" if params.f("layerContribution") <= 0.0 => Some(0.0),
// (Feather blurs the matte)
"ec.3d.idmatte" if params.f("feather") <= 0.0 => Some(0.0),
_ => None,
}
}
fn aux(ctx: &EffectCtx) -> Option<Arc<AuxChannels>> {
ctx.env.host?.aux()
}
+1 -1
View File
@@ -116,7 +116,7 @@ pub use time_fx::{PixelMotion, TimewarpPlan, TwStep, pmb_plan, posterized_time,
pub use ocio::color_stabilizer_maps;
// GPU effects, part B (3D Channel, Immersive Video, colour management, simulation render passes).
pub use channel3d::{
CRYPTO_LAYERS, CryptoAux, MATTE_ONLY_IN_ALPHA, aux_needs, aux_point, crypto_aux_image, crypto_aux_image_with, crypto_layer_choices, crypto_layer_menu,
CRYPTO_LAYERS, CryptoAux, MATTE_ONLY_IN_ALPHA, aux_needs, aux_point, pixel_margin, crypto_aux_image, crypto_aux_image_with, crypto_layer_choices, crypto_layer_menu,
crypto_layer_name, crypto_layer_named, id_color, matte_only_px, reads_aux, selection_hashes,
};
pub use ocio::{ColorOp, Straight, Tf, color_program};
+48
View File
@@ -1002,6 +1002,54 @@ fn picture_of(index: &ExrIndex, batch: &Batch, op: AlphaOp) -> Option<Image> {
}
}
/// The picture of the OpenEXR at `path` (as [`picture`]) of only the display rows `rows`: those
/// rows are read (with 1-line chunks exactly those lines, else the chunks holding them) and
/// converted, the others stay empty (#3271: a region of interest). Read for this request alone,
/// not kept in the store or on disk (the pool keeps the picture under a key naming the rows).
pub(crate) fn picture_rows(path: &str, source: &ExrSource, op: AlphaOp, rows: (i64, i64)) -> Picture {
let (index, opened) = match index_of(path, source) {
Ok(ix) => ix,
Err(IndexError::Unsupported(why)) => return Picture::Done(Err(why.to_string())),
Err(_) => return Picture::Legacy,
};
let Some(mut ids) = index.picture_ids() else { return Picture::Legacy };
// (in file order: the planes are looked up by id)
ids.sort_unstable();
ids.dedup();
let opened = match opened {
Some(o) => Ok(o),
None => source.open(),
};
let Ok(mut opened) = opened else { return Picture::Legacy };
// (a file changed since it was indexed: the whole picture, as `picture` reads it)
if opened.stamp != index.stamp {
return picture(path, source, op, None);
}
let request = ReadRequest { rows: Some(rows.0..rows.1), max_bytes: cap_of(path), ..ReadRequest::full(ids.clone()) };
let (planes, stats) = read_planes(&mut *opened.reader, &index, &request);
let names: Vec<String> = ids.iter().filter_map(|i| index.channels.get(*i)).map(|c| c.name.clone()).collect();
#[cfg(test)]
DECODES.lock().unwrap_or_else(PoisonError::into_inner).push((path.to_string(), DecodeRecord { channels: names.clone(), stats, from_disk: false }));
#[cfg(not(test))]
let _ = stats;
let planes = match planes {
Ok(p) => p,
Err(ReadError::Cancelled) => return Picture::Cancelled,
Err(ReadError::TooLarge(why)) => return Picture::Done(Err(why)),
Err(_) => return Picture::Legacy,
};
let (w, h) = index.size();
let mut aux = AuxChannels::new(w as u32, h as u32, 1.0);
aux.channels = names.into_iter().zip(planes).collect();
let file = ReadFile::new(path, opened.stamp);
crate::reads::note(file.clone());
let batch = Batch { index: index.clone(), ids, all: false, aux: Arc::new(aux), file };
match picture_of(&index, &batch, op) {
Some(img) => Picture::Done(Ok(img)),
None => Picture::Legacy,
}
}
/// 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>> {
+44
View File
@@ -971,3 +971,47 @@ fn a_localized_network_file_is_read_from_its_copy() {
pool.set_localizer(None);
let _ = std::fs::remove_dir_all(&root);
}
/// #3271: a viewer region of interest reads only the footage rows it shows of an OpenEXR layer
/// (with one scan line per chunk, only those lines are decompressed), and the region renders
/// bit for bit what reading the whole frame renders, at full and reduced resolution.
#[test]
fn a_region_of_interest_reads_only_its_rows() {
use effectcraft_project::{Comp, ItemKind, LayerSource, Project, Value, build};
use effectcraft_render::{RenderOpts, Renderer};
use effectcraft_time::FrameRate;
/// The pool, reading whole frames (the region's rows ignored).
struct Whole<'a>(&'a crate::MediaPool);
impl FootageSource for Whole<'_> {
fn frame(&self, item: ItemId, f: &Footage, t: Tick) -> Option<Arc<Image>> {
self.0.frame(item, f, t)
}
fn frame_with(&self, item: ItemId, f: &Footage, t: Tick, size: Option<(u32, u32)>, float: FloatCurve) -> Option<Arc<Image>> {
self.0.frame_with(item, f, t, size, float)
}
}
let bytes: Arc<[u8]> = single_part_zips().into();
let path = "/3271-roi.exr";
let pool = crate::MediaPool::new();
pool.add_bytes(path, bytes.clone());
let f = crate::probe_bytes(path, bytes).unwrap();
let mut p = Project::default();
let comp = Comp::new(96, 96, FrameRate::FPS_30, Tick::from_seconds_f64(1.0));
let cid = p.add_item("Comp", effectcraft_color::Label::Sandstone, None, ItemKind::Comp(comp.clone().into()));
let fid = p.add_item("plate", effectcraft_color::Label::Aqua, None, ItemKind::Footage(f));
let mut l = build::layer(&mut p, &comp, "plate", LayerSource::Footage { item: fid }, (64, 64), None);
l.props.prop_mut("transform/position").unwrap().value = Value::Vec3([50.0, 46.0, 0.0]);
l.props.prop_mut("transform/rotation").unwrap().value = Value::Scalar(12.0);
l.props.prop_mut("transform/scale").unwrap().value = Value::Vec3([90.0, 110.0, 100.0]);
p.comp_mut(cid).unwrap().layers = vec![l].into();
for scale in [1.0, 0.5] {
let opts = RenderOpts { scale, roi: Some([30.0, 40.0, 24.0, 10.0]), ..Default::default() };
let whole = Renderer::new(&p, &Whole(&pool), opts).comp_frame(cid, Tick::ZERO);
let before = decodes_of(path).len();
let rows = Renderer::new(&p, &pool, opts).comp_frame(cid, Tick::ZERO);
assert_eq!(bits(&rows), bits(&whole), "at {scale}");
let d = decodes_of(path);
let last = d.get(before..).and_then(|d| d.last()).expect("a read of the region's rows");
assert!(last.stats.lines < SIZE.1, "at {scale}: {} lines", last.stats.lines);
}
}
+32 -4
View File
@@ -53,6 +53,9 @@ struct Key {
/// A still at a reduced `size`: the footage's nominal size, which decides whether it is
/// resampled (see `Inner::sized_still`); (0, 0) otherwise.
nominal: (u32, u32),
/// An OpenEXR frame of which only these rows are read (a region of interest, #3271; the other
/// rows are empty); `None`: all of it.
rows: Option<(i64, i64)>,
}
struct Entry {
@@ -1025,7 +1028,7 @@ impl Inner {
FloatCurve::Gamma24 => 2,
} << 2);
let matte = if footage.alpha == AlphaMode::Premultiplied { footage.premul_color.map(f32::to_bits) } else { [0; 3] };
let key = |path: &str, frame| Key { path: path.into(), frame, interp, matte, size: (0, 0), nominal: (0, 0) };
let key = |path: &str, frame| Key { path: path.into(), frame, interp, matte, size: (0, 0), nominal: (0, 0), rows: None };
match footage.kind {
FootageKind::Sequence if !footage.sequence.is_empty() => {
let i = Self::frame_index(footage.frame_rate, t, footage.sequence_frames(), footage.loop_count);
@@ -1067,11 +1070,26 @@ impl Inner {
/// thumbnail beside a reduced viewer) comes from the same decode, the frame cache's whole
/// picture or a recent one ([`CacheState::recent`]), and is the same as decoded on its own.
fn frame_at(self: &Arc<Self>, footage: &Footage, t: Tick, playback: bool, size: Option<(u32, u32)>, float: FloatCurve) -> Result<Arc<Image>> {
self.frame_at_rows(footage, t, playback, size, float, None)
}
/// [`Inner::frame_at`] of only the rows `rows` of an OpenEXR frame whose channels no effect
/// reads (#3271; others are read whole).
fn frame_at_rows(
self: &Arc<Self>,
footage: &Footage,
t: Tick,
playback: bool,
size: Option<(u32, u32)>,
float: FloatCurve,
rows: Option<(i64, i64)>,
) -> Result<Arc<Image>> {
if !footage.has_video {
return Err(MediaError::Unsupported(format!("{}: no video", footage.path)));
}
let mut loc = Self::locate(footage, t, float);
let movie = loc.media_t.is_some();
loc.key.rows = rows.filter(|_| !movie && crate::exr_planes::is_exr(&loc.key.path) && lock(&self.aux_footage).plan(&footage.path).is_none());
// A still asked for at its own size is the unsized frame (one decode, one entry).
if let Some(size) = size.filter(|s| movie || *s != (footage.width, footage.height)) {
loc.key.size = size;
@@ -1328,7 +1346,11 @@ impl Inner {
if crate::exr_planes::is_exr(path) {
use crate::exr_planes::Picture;
let extra = lock(&self.aux_footage).plan(&footage.path);
match crate::exr_planes::picture(path, &self.exr_source(path), op, extra.as_ref()) {
let picture = match loc.key.rows {
Some(rows) if extra.is_none() => crate::exr_planes::picture_rows(path, &self.exr_source(path), op, rows),
_ => crate::exr_planes::picture(path, &self.exr_source(path), op, extra.as_ref()),
};
match picture {
Picture::Done(Ok(img)) => return Ok(img),
Picture::Done(Err(why)) => return Err(MediaError::Decode(format!("{path}: {why}"))),
Picture::Cancelled => return Err(MediaError::Cancelled),
@@ -1482,6 +1504,12 @@ impl FootageSource for MediaPool {
fn frame_with(&self, item: ItemId, footage: &Footage, t: Tick, size: Option<(u32, u32)>, float: FloatCurve) -> Option<Arc<Image>> {
self.frame_sized(item, footage, t, size, float)
}
fn frame_rows(&self, _item: ItemId, footage: &Footage, t: Tick, size: Option<(u32, u32)>, float: FloatCurve, rows: (i64, i64)) -> Option<Arc<Image>> {
if footage.missing {
return None;
}
Inner::frame_at_rows(&self.inner, footage, t, true, size, float, Some(rows)).ok()
}
fn problem(&self, footage: &Footage) -> Option<String> {
if footage.missing || footage.kind != FootageKind::Video {
@@ -1753,7 +1781,7 @@ mod tests {
fn lru_respects_budget_and_recycles() {
let mut c = Lru::default();
let img = || Arc::new(Image::new(16, 16)); // 4 KiB + overhead
let k = |i| Key { path: "a".into(), frame: i, interp: 0, matte: [0; 3], size: (0, 0), nominal: (0, 0) };
let k = |i| Key { path: "a".into(), frame: i, interp: 0, matte: [0; 3], size: (0, 0), nominal: (0, 0), rows: None };
let budget = 3 * (4096 + 64);
for i in 0..10 {
c.insert(k(i), img(), Arc::default(), budget);
@@ -2120,7 +2148,7 @@ mod tests {
/// the frame cache has moved on.
#[test]
fn recent_whole_stills_are_capped_and_expire() {
let key = |i| Key { path: "/s.exr".into(), frame: i, interp: 0, matte: [0; 3], size: (0, 0), nominal: (0, 0) };
let key = |i| Key { path: "/s.exr".into(), frame: i, interp: 0, matte: [0; 3], size: (0, 0), nominal: (0, 0), rows: None };
let mut c = CacheState::default();
// 64 KiB each (64 × 64 pixels of 16 bytes), a budget of 512 KiB: room for 4.
for i in 0..6 {
+11
View File
@@ -37,6 +37,14 @@ pub trait FootageSource: Send + Sync {
None => self.frame(item, footage, t),
}
}
/// [`FootageSource::frame_with`] where only the rows `rows` (of the footage's frame, at
/// full resolution) are shown (#3271: a viewer region of interest mapped back through the
/// layer): a source may leave the other rows empty (any value) and read only those. Sources
/// that read whole frames can leave the default, which reads it all.
fn frame_rows(&self, item: ItemId, footage: &Footage, t: Tick, size: Option<(u32, u32)>, float: FloatCurve, rows: (i64, i64)) -> Option<Arc<Image>> {
let _ = rows;
self.frame_with(item, footage, t, size, float)
}
/// `frames` interleaved stereo sample frames of `item`'s audio from source time `t` at
/// `rate` Hz (`None` when unavailable). The first sample is `t.to_units_floor(rate)`;
/// a sample boundary uses the earliest representable tick that selects that sample.
@@ -273,6 +281,9 @@ impl FootageSource for CancellableFootage<'_> {
fn frame_with(&self, item: ItemId, footage: &Footage, t: Tick, size: Option<(u32, u32)>, float: FloatCurve) -> Option<Arc<Image>> {
self.read(|| self.inner.frame_with(item, footage, t, size, float))
}
fn frame_rows(&self, item: ItemId, footage: &Footage, t: Tick, size: Option<(u32, u32)>, float: FloatCurve, rows: (i64, i64)) -> Option<Arc<Image>> {
self.read(|| self.inner.frame_rows(item, footage, t, size, float, rows))
}
}
/// Footage that can be rasterised at any scale (SVG).
+92 -2
View File
@@ -866,7 +866,9 @@ impl<'a> Renderer<'a> {
let proxy = self.proxy_for(item);
let pf = proxy.unwrap_or(f);
let size = self.reduced_size(f.width, f.height).filter(|_| proxy.is_none());
let img = self.footage_frame(ctx, layer, item, pf, lt, size)?;
// Only the rows a viewer region of interest shows of it (#3271).
let rows = proxy.is_none().then(|| self.footage_rows(ctx, layer, f)).flatten();
let img = self.footage_frame_in(ctx, layer, item, pf, lt, size, rows)?;
Some(self.footage_buf(&img, pf, f.width, f.height))
}
// (the font files go to this render's log, which `ctx` may not carry: see
@@ -933,6 +935,49 @@ impl<'a> Renderer<'a> {
/// `t` falls between frames (footage rate ≠ comp rate, time stretch, time remapping).
/// `size`: a plain frame may come resampled to it ([`FootageSource::frame_at_size`]).
fn footage_frame(&self, ctx: &EvalCtx, layer: &Layer, item: ItemId, f: &Footage, t: Tick, size: Option<(u32, u32)>) -> Option<Arc<Image>> {
self.footage_frame_in(ctx, layer, item, f, t, size, None)
}
/// The footage rows a top-level region of interest shows of footage layer `layer` (`f`), at
/// full resolution, grown by what reaches into them: the layer's resampling (wider at a
/// reduced scale) and its effects' declared margins (#3271). `None` (the whole frame) without
/// a region, when the rows are all of it, or when anything may read the layer's other pixels:
/// a 3D layer, motion blur, frame blending, fields, layer styles, an effect that doesn't
/// declare its margin, or anything in the comp that reads layers' pixels (an effect's layer
/// parameter, an expression).
pub(crate) fn footage_rows(&self, ctx: &EvalCtx, layer: &Layer, f: &Footage) -> Option<(i64, i64)> {
let roi = self.opts.roi.filter(|_| self.top)?;
if layer.switches.three_d
|| f.fields != effectcraft_project::FieldOrder::Off
|| !matches!(f.kind, FootageKind::Still | FootageKind::Sequence)
|| self.mb_on(ctx, layer)
|| frame_blend_mode(ctx, layer) != FrameBlend::Off
|| styles::group(layer).is_some()
{
return None;
}
let fx_margin = effects_margin(ctx, layer)?;
if comp_reads_pixels(ctx) {
return None;
}
let inv = ctx.world_matrix(layer).inverse()?;
let ys: Vec<f64> = [[roi[0], roi[1]], [roi[0] + roi[2], roi[1]], [roi[0], roi[1] + roi[3]], [roi[0] + roi[2], roi[1] + roi[3]]]
.iter()
.map(|p| inv.apply(effectcraft_geom::vec3(p[0], p[1], 0.0)).y)
.collect();
let (lo, hi) = ys.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |(lo, hi), y| (lo.min(*y), hi.max(*y)));
if !lo.is_finite() || !hi.is_finite() {
return None;
}
let margin = 2.0 + (2.0 / self.opts.scale.max(1e-3)).ceil() + fx_margin.ceil();
let h = i64::from(f.height);
let (y0, y1) = (((lo - margin).floor() as i64).clamp(0, h), ((hi + margin).ceil() as i64).clamp(0, h));
(y0 > 0 || y1 < h).then_some((y0, y1.max(y0)))
}
/// [`Renderer::footage_frame`] of only the rows `rows` (see [`Renderer::footage_rows`]).
#[allow(clippy::too_many_arguments)]
fn footage_frame_in(&self, ctx: &EvalCtx, layer: &Layer, item: ItemId, f: &Footage, t: Tick, size: Option<(u32, u32)>, rows: Option<(i64, i64)>) -> Option<Arc<Image>> {
// Interpret Footage ▸ Separate Fields: each field is a frame at twice the rate.
if f.fields != effectcraft_project::FieldOrder::Off && matches!(f.kind, FootageKind::Video | FootageKind::Sequence) {
let field_rate = FrameRate::new(f.frame_rate.num * 2, f.frame_rate.den);
@@ -946,7 +991,11 @@ impl<'a> Renderer<'a> {
// Interpretation is per pixel but not linear: it runs on the frame before resampling.
let per_pixel = f.invert_alpha || f.linear_light_applies();
let size = size.filter(|_| !(per_pixel || f.cineon_applies()));
let img = self.footage_frame_raw(ctx, layer, item, f, t, size)?;
let img = match rows {
// (no frame blending, no fields: see `footage_rows`)
Some(rows) => self.read(|| self.footage.frame_rows(item, f, t, size, self.pipe.float_curve(f), rows)).map(|img| cineon_frame(img, f))?,
None => self.footage_frame_raw(ctx, layer, item, f, t, size)?,
};
if per_pixel { Some(Arc::new(interpret_pixels(&img, f, self.pipe.linear_footage_space(f)))) } else { Some(img) }
}
@@ -994,6 +1043,17 @@ impl<'a> Renderer<'a> {
self.read(|| self.footage.frame_with(item, f, t, size, float)).map(|img| cineon_frame(img, f))
}
/// Is footage layer `layer` read in part ([`Renderer::footage_rows`]).
fn reads_footage_rows(&self, ctx: &EvalCtx, layer: &Layer) -> bool {
let LayerSource::Footage { item } = &layer.source else { return false };
let item = ctx.media_item(layer, *item);
if self.opts.roi.is_none() || !self.top || self.proxy_for(item).is_some() {
return false;
}
let Some(ItemKind::Footage(f)) = ctx.project.item(item).map(|it| &it.kind) else { return false };
self.footage_rows(ctx, layer, f).is_some()
}
/// Source → masks, clamped/quantised to the project depth.
fn masked_source(&self, ctx: &EvalCtx, layer: &Layer) -> Option<Buf> {
let mut buf = match self.content_times(ctx, layer) {
@@ -1092,6 +1152,9 @@ impl<'a> Renderer<'a> {
mut timing: Option<&mut LayerTiming>,
) -> Option<(Arc<Buf>, Option<u64>, Arc<ReadFiles>)> {
let key = self.cache.and_then(|_| cache::layer_key(ctx, layer, self.raster_scale(ctx, layer), self.opts.draft, self.mb_on(ctx, layer)));
// A footage layer read in part (a region of interest, #3271) isn't kept: its key names
// the whole layer.
let key = key.filter(|_| !self.reads_footage_rows(ctx, layer));
let key = self.content_key(ctx, layer, key);
if let Some((b, files)) = self.cached(key) {
if let Some(t) = timing.as_deref_mut() {
@@ -1132,3 +1195,30 @@ impl<'a> Renderer<'a> {
Some(self.keep(key, Arc::new(buf?), &files).0)
}
}
/// How far the enabled effects of `layer` reach around a pixel (layer pixels), `None` when one
/// doesn't declare it (`effectcraft_effects::pixel_margin`).
fn effects_margin(ctx: &EvalCtx, layer: &Layer) -> Option<f64> {
if !layer.switches.effects {
return Some(0.0);
}
let mut most: f64 = 0.0;
for g in layer.effects().into_iter().flat_map(|fx| fx.groups()).filter(|g| g.enabled) {
let effectcraft_project::GroupKind::Effect { effect } = &g.kind else { return None };
let params = effectcraft_effects::flatten_params(g, &mut |p| ctx.value(layer, p));
most = most.max(effectcraft_effects::pixel_margin(effect, &params)?);
}
Some(most)
}
/// Does anything in the comp read layers' pixels where it likes: an enabled effect with a layer
/// parameter set, or an expression (`sampleImage`).
fn comp_reads_pixels(ctx: &EvalCtx) -> bool {
fn group(g: &effectcraft_project::PropGroup, effects: bool) -> bool {
g.children.iter().any(|c| match c {
effectcraft_project::Node::Prop(p) => p.has_expression() || (effects && matches!(p.value, effectcraft_keyframe::Value::Layer(Some(_)))),
effectcraft_project::Node::Group(sub) => group(sub, effects || matches!(sub.kind, effectcraft_project::GroupKind::Effect { .. })),
})
}
ctx.comp.layers.iter().any(|l| group(&l.props, false))
}