Repository navigation
PSD: avoid redundant plane copies, per-pixel mask tests and repeated quad solves (#1136) - #1137
Merged
Merged
Conversation
…quad solves (storytold#1136) Raw channels are borrowed, ZIP planes are un-predicted in place in the inflated buffer, the 32-bit un-predictor uses one scratch row, the layer mask tests the rect per row instead of per pixel (and skips a constant factor of 1.0), and a placed-layer bake solves the quad once and hoists per-triangle invariants. Output is bit-identical; tests compare against the replaced implementations and count the avoided work. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
h-a-n-a-s-h-i
pushed a commit
that referenced
this pull request
Oct 13, 2026
Member
|
Merged. Thank you for the contribution, @vangel76! It landed on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1136
What changed (crates/psd; output is bit-identical)
Cow), not copied; the merged image's ZIP planes are un-predicted in place in the inflated buffer (no per-planeto_vec); the 32-bit un-predictor reuses one scratch row instead of copying every row.getwith the default colour as fallback instead of indexing.SmartObject::map,placed_boundsandplaced_sizekeep their signatures; internally the quad's projective matrix is solved once per call and shared (render_placedsolves it once for the bounds, the size and the 49x49 grid;placed_sizeno longer recomputes bounds separately inside a bake). In the triangle loop the source corners and the barycentric coefficients are hoisted out of the pixel loop (same operations, same order, so results do not change; the per-pixel division by the denominator is kept on purpose, a reciprocal would change rounding).Tests (crates/psd/src/tests_opt.rs)
The replaced implementations are kept in the test module as references (
ref_unpredict,ref_decode_channel,ref_composite,ref_layer_pixels,ref_map,ref_placed_bounds,ref_render_placed).sizeNone / Some, several k.placed_boundsand a wholerender_placedsolve the quad once (was 1089 per bounds call, plus again for the size, plus 2401 for the grid).Cow::Borrowedview into the file data; a ZIP plane handed out is a sub-slice of the inflated buffer.Commands run
cargo test -p effectcraft-psd(24 pass)cargo test -p effectcraft-media layered,cargo test -p effectcraft-engine psd(pass)cargo clippy --workspace --all-targets -- -D warnings(clean)cargo fmt --all --check(clean),cargo xtask layers(ok)cargo check -p effectcraft-psd --target wasm32-unknown-unknown(ok)Not run: the full
cargo xtask ci, the full workspace test suite. No timings or speed claims are made.Deliberately left out
psd_import.rscloning the wholeLayerper node): open PR feat(aep): import After Effects projects through an external py-aep converter #860 touchescrates/engine/src/psd_import.rs.Warp::apply); a small merge conflict inplaced.rs/lib.rsis possible and will be resolved with a merge.🤖 Generated with Claude Code