M12.4: fast bit-depth quantization
8/16 bpc no longer re-quantises the whole comp after every layer: 2D layers report the canvas region they can change (transformed buffer bounds plus the resampling margin; stencil modes, motion blur, perspective, styles, adjustment and 3D runs fall back to the full canvas), and only that region is quantised. A quantised buffer placed pixel-exactly (integer translation, Normal, 100%) over a blank canvas needs nothing; invisible layers need nothing; collapsed precomps quantise per nested layer. The redundant final comp pass is skipped unless the comp is re-encoded. Solids are filled with a pre-quantised colour and skip the source pass unless masked. Row-parallel vectorisable kernel. Debug builds verify every pixel outside the region is already quantised (whole workspace test suite run with 8 bpc forced: no violations). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ab3b4cfb70
commit
40321f963b
@@ -113,11 +113,12 @@ pub fn shapes(ctx: &EvalCtx, layer: &Layer) -> Vec<effectcraft_effects::MaskShap
|
||||
}
|
||||
|
||||
/// Apply the layer's masks to its buffer.
|
||||
pub fn apply(ctx: &EvalCtx, layer: &Layer, buf: &mut Buf) {
|
||||
let Some(masks) = layer.masks() else { return };
|
||||
/// Returns whether any mask was applied.
|
||||
pub fn apply(ctx: &EvalCtx, layer: &Layer, buf: &mut Buf) -> bool {
|
||||
let Some(masks) = layer.masks() else { return false };
|
||||
let list: Vec<_> = masks.groups().filter(|g| g.enabled && matches!(g.kind, GroupKind::Mask { mode, .. } if mode != MaskMode::None)).collect();
|
||||
if list.is_empty() {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
// Masks may extend past the source: grow the buffer to cover them when feather/expansion pads.
|
||||
let n = (buf.img.width * buf.img.height) as usize;
|
||||
@@ -146,4 +147,5 @@ pub fn apply(ctx: &EvalCtx, layer: &Layer, buf: &mut Buf) {
|
||||
});
|
||||
}
|
||||
buf.img.mul_mask(&acc);
|
||||
true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user