The mesh warp's least squares was solved by CGLS, which ran its whole iteration
budget on an ill-conditioned system. The static shape and anchor terms are now
assembled once per solve and factored with a banded Cholesky, and each round adds
the constraint lines as an exact low-rank update (conjugate gradients remain as the
fallback). Csr and BandChol move from puppet.rs to photo_util.rs so both share them.
* perf(seam): drop the original-column map from the shrink proxy, same pixels (-15 % at 24 MP)
Content-Aware Scale's proxy seam search tracked each panel column's original
column in an idx map, one usize per proxy pixel, shifted by every seam. The
original column is x plus the number of columns already taken at or left of it,
so a per-row list of the taken columns answers the same question without a
buffer the size of the energy map.
The recorded P28 budget number predates the proxies: the 2026-10-05 baseline
commit carves at full height and recomputes energy per seam, and measures
266 s for the 24 MP case on the machine this was timed on, against 2.6 s now.
Documented in docs/seam-carving-performance.md; enforce stays off until a
budgeted-class run can vouch for the whole row.
* review: generate exactly ch samples per pixel in bench_seam, reject ch > 4
The fixture flattened four samples per pixel and then truncated to w*h*ch, so a
three-channel run grouped samples across pixel boundaries and any ch above four
built a buffer shorter than the rows carve_width indexes.
Generate ch samples inside the per-pixel closure and refuse ch outside 1..=4.
The three-channel row is dropped from the perf note rather than re-measured
here: it moved inside the timer noise either way, and the other agents' builds
on this machine make a fresh number worthless. The four-channel hashes are
unchanged, which is the check that this edit touched only the fixture.
* perf(seam): find the removed column by binary search, not a linear scan
Recording a seam recovered each removed original column by scanning the row's
list of already-taken columns, so a deep shrink paid a comparison per removed
column on every row and every seam: quadratic in the seam count, and worse than
the index map this PR replaced once a shrink got deep enough.
`o - i` never decreases along the row's sorted list, so that count is a binary
search, and the original column belongs where the search stopped; the rows are
independent and update in parallel, like the pixel shift. What is left per
removed column is one insert.
Output is unchanged: same columns, same order, same hashes (10 % and 50 % width
cases below), and `counted_removed_columns_match_the_tracked_map` now runs a
tracking and a counting carver side by side to one column and compares every
row's list after every seam.
docs/seam-carving-performance.md gains those cases, states that the ~104x
figure is the two example runs rather than the baseline row, and names
perf/baseline.json as the source of the 954 s.
---------
Co-authored-by: ebosido444-ai <ebosido444-ai@users.noreply.github.com>
* Speed up Crystallize and Pointillize with cell-space rasterization
* Measure pixelate commands on unlocked layers and Background separately
* Record pixel-exact 24 MP filter and command benchmarks
- P62 is taken on main (File > New, #4017), and P63-P67 by aiongg/next
and #8529: with main merged, `cargo xtask scorecard --check` failed
with "duplicate scenario id P62". The scenario is now P68, listed
after the others.
- Peak RSS came from /proc on Linux and a powershell.exe call on
Windows, and was always empty on macOS, where the nightly perf runs.
The bench now uses photocraft_testkit::perf (RssSampler, row, report),
like the other --json benches.
- `--json --reps 5` took `--reps` as the output path (CodeRabbit); a
following option is now rejected.
- The printed median was the upper middle sample for an even --reps
(CodeRabbit); it now prints the same nearest-rank p50 xtask reports.
- The old `[n] [mp]` usage accepted 36 MP again (AGENTS.md benchmarks
at 24-36 MP); the PR had capped it at 24.
Tests: the new cases `--json --reps 5` (rejects_bad_benchmark_args)
and `4 36` (parses_old_positional_args_and_perf_runner_args) fail with
the fix reverted; `2 37` pins the new upper bound.
Co-authored-by: ersoynarin-code <340219279+ersoynarin-code@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crates/ui-egui/src/puppet_ui.rs: tests added by both sides in the same place; kept both whole (#6754's pin-deletion tests, then #6786's drag-preview tests).
With --reps > 1 the console line printed the last sample and called it the
median. Sort the samples and print the median (mean of the two middle values
for an even count); the JSON report is unchanged.
The four new scenarios also made docs/scorecard.md stale, which failed
'test (ubuntu-latest)': cargo xtask scorecard now lists P64-P67.
bench_filters2 timings for the heavy algo filters were invisible to the perf
harness: the example was never listed in perf/budgets.toml, so no budget, no
baseline and no regression check covered Oil Paint, Relight, Reduce Noise,
Smart Blur, the blur gallery, Crystallize or Color Halftone.
The example now takes --reps, --quick and --json (the report shape the harness
reads, hand-written so the crate does not grow a serde dependency), and four
scenarios track the worst rows at a 1 s target: Oil Paint 8.8 s, Smart Blur
r12 11.6 s, Relight 3.7 s, Reduce Noise 2.8 s on a 24 MP layer.
Neighbours are read at precomputed offsets into the window instead of
per channel through bounds-checked Image::get. Normal mode with 1-5
channels runs the interior (whole kernel in the window) offset-major
over each row with a branchless select: a rejected neighbour adds -0.0,
an exact identity, and every pixel sums in the same order, so the
output is bit-identical. Border pixels, the edge modes and 6+ channels
keep the per-pixel path.
24 MP RGBA8, High quality: r3 0.55 -> 0.23 s, r12 6.25 -> 1.78 s,
r100 3.64 -> 0.95 s. bench_filters2 gains r12 and r100 rows.
The old kernel stays as a test oracle, compared bit for bit across
colour modes, 1-8 channels, alpha, radii, qualities, modes, thresholds,
output rects and NaN/inf samples.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(photomerge): build multi-band bands in bounded batches (#7758)
panorama::multiband built every source's Laplacian and weight pyramids
at once and kept them all until accumulation, so Photomerge's peak
memory grew with the image count (~5 GB for four 24 MP sources). Build
the bands in batches under a 2 GiB estimate (at least one image) and
add each batch before building the next. Each pixel still adds the
bands in image order, so the output is bit-identical.
Planes now move into the pyramids instead of being cloned, and the
coverage and push-pull masks are freed once used: with one image built
at a time those clones were serial passes. seam_blend shifts its ROIs
in place instead of cloning every source for the blend.
Peak during the blend: 4x24 MP 5.04 -> 2.81 GB, 8x12 MP 5.50 -> 2.61 GB,
at +5% time (2x24 MP unchanged). New example bench_multiband measures it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(photomerge): let up to four 24 MP sources build their bands together
A 2 GiB band budget built every 24 MP source alone, which made the usual
2-4 image Photomerge 12-36% slower on a 32-thread desktop. The native
budget is now 5 GiB, so those still build side by side and only larger
stacks are batched. wasm32 has no threads, so it adds each band as soon
as it is built.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
From the second half of the adversarial review:
- Correction to the previous commit: mapping energies that aren't
numbers to +inf also changes output where the original computed NaN
energies from NaN-free input (infinite samples at the border or next
to each other, overflowing differences). The original's choice there
went through NaN costs; keeping it would bring NaN back into the seam
search, whose sign and payload aren't consistent across builds and
wasm. So the contract is: bit-identical for every input whose energy
stays a number (all finite images without overflow), deterministic
everywhere else. infinite_samples_carve_deterministically pins it.
- The height pass resampled the raw protection map, so an infinite
value (or neighbours whose difference overflows) became NaN, which
protects nothing: a row protected with +inf was carved away while 1.0
kept it. Where the plain resample gives NaN, the map clamped to 0..=1
is resampled instead (resample_protection); every other value is
unchanged. infinite_protection_protects_in_both_passes failed before.
- Values past w x h x ch are ignored through both passes.
- Docs: row_costs is what recomputes pixels; the reduced-height search
cuts the work 8-12 times at 24 MP, not about four; bench_seam's hash
is FNV-style over 32-bit words. Carver::new reserves its index.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LELc5BQzgV5dA7dxdMejkK
The reduced-height seam search for tall images (P28's path) had no
bit-exact test: output_bits_are_pinned and carver_matches_reference only
cover images under 2048 rows. Pin five proxy-path carves (widths and,
through the transposed pass, heights; with and without protection) from
the current code, so the speed work that follows can't change which
seams are chosen.
bench_seam times the carver alone on a synthetic 24 MP photo (P28's
width change, its height change) and two exact-path sizes, and prints a
hash of each output. Before (4 cores, release): 2279 ms, 4872 ms,
1542 ms and 658 ms p50.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LELc5BQzgV5dA7dxdMejkK
Liquify dabs were spaced a fifth of the brush radius apart and restarted
at every pointer event, so a fast mouse (few far-apart events) and a slow
one (many close ones) warped the same path differently, and a slow drag
piled up one dab per event. Dabs now fall every twentieth of the radius
by distance travelled along the whole stroke, carried from one segment
to the next, as in Photoshop: any sampling of a path gives the same
field. The stationary tools' per-dab strength is scaled to the new
spacing so their effect per distance travelled is unchanged.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Rasterize Extrude blocks and scatter Wind streaks once
* Prepare Spin Blur rotations and fixed-channel sampling
* Share Lens Correction interpolation across color and alpha
* Make wide prepress traps independent of radius
* Add full-operation timing for five imaging algorithms
* Record 24 full-operation benchmarks and exact-output checks
---------
Co-authored-by: Brandon Thomas <echelon@gmail.com>
* Reuse Facet quadrants and halftone dots without changing pixels
* Record full-image Pixelate timings and exact-output checks
---------
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Quick Selection is now one min cut around the brush footprint (Boykov & Jolly 2001; coarse to fine for
large windows, Lombaert et al. 2005), with costs fitted to Photoshop 25.4's masks measured as a black box
on 105 synthetic and public-domain cases (mean IoU 0.94 synthetic, 0.83 paintings), at Photoshop's
512x512 working-resolution rule. Replaces the colour-model flood, which selected far too much.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Radial Blur prepares its sample transforms once per filter (blur::radial::Plan) and shares them across output tiles, reading each bilinear tap once with channels kept together. Output is identical to the previous sampler at Draft, Good and Best, across colour models and depths (tests compare against the unchanged reference path); a failed table allocation falls back to that sampler. Measured on 24 MP RGBA8, Good, amount 1: Spin 66.1 -> 16.4 s, Zoom 19.2 -> 5.4 s (bench_radial example, docs/radial-blur-performance.md).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shape Blur now builds its span kernel once per operation instead of per tile. It folds
premultiplication into the f64 row prefix sums and adds whole output rows at a time, in the
same order as before. Output is bit-identical to the previous implementation, which stays in
the tests as an exact oracle. A 24 MP Circle r25 runs in 0.65 s instead of 1.04 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add the Red Eye tool to the J-group
Click a red pupil to neutralize the flash reflection. Pupil Size
sets the search window around the click; Darken Amount controls how
far corrected pixels go toward a darker, desaturated pupil.
Catchlights stay white. A miss reports an error instead of a silent
no-op. The kernel only reads a window plus a 5 px mask-filter halo.
* paint.redEye: write back only changed pixels, so CMYK/Lab stay untouched
write_rgba re-encoded every pixel of the click window through the naive
RGBA round trip, which regenerates K in CMYK and shifts Lab values. Now
untouched pixels keep their original channel data; only pixels whose RGB
changed are re-encoded. Adds a CMYK test checking untouched pixels inside
the window stay bit-exact.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* algo::redeye: cargo fmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Polish catalog rows for the Red Eye tool; regenerate docs/scorecard.md
pl.tsv landed on main and the coverage tests need every catalog to translate new UI strings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The neighbourhood radius was a 97 px constant (3σ+1 at σ=32) while softness
can drive σ to 96, so tiles seamed once the short side reached about 1600 px.
Halo is now 3σ+1 plus the finite-difference step, taken from the document's
σ (or the 96 cap when size is unknown).
The kernel used to copy the input unchanged above 8 MP of luma. Large rects
are split into overlapping bands instead, so an 8 MP+ layer is actually relit.
Replace the O(nσ) separable kernel with the three-box Gaussian already used
for other smoothing fields in this crate.
Blurs run as box passes now filter the whole area at once instead of tile by tile: the
horizontal passes run over the source rows only and the vertical passes over column strips,
with the canvas edge repeated virtually instead of materialising a 3-sigma margin around every
tile (at radius 500 that margin was ~25 MP of floats per 4 MP tile, copied and transposed
several times). The results are written to the layer's tile columns in parallel.
Output matches the previous running sums (8-bit: identical except 114 of 2.1 M samples one
level apart; 16-bit: within 2/65535) and a direct-convolution oracle at every depth.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
CI's `cargo fmt --all -- --check` has failed on every run because the
repo had no rustfmt config and was never formatted. Use the same settings
as EffectCraft/FilmCraft (max_width 160, use_small_heuristics Max), which
also keeps the churn small. Formatting only; no code changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>