Commit Graph
43 Commits
Author SHA1 Message Date
FredApps 29bf828ec2 Merge upstream main into reviewed performance integration
Preserve both UI parity status entries; retain all reviewed performance changes.
2026-10-29 23:35:19 +01:00
Khawar Zamman Wani 6c6cfc243a perf(stack): cache bounded entropy terms across pixels (#9622)
* perf(stack): cache bounded entropy terms across pixels

* test(stack): iterate entropy terms directly for Clippy

* ci: rerun checks
2026-10-29 12:10:12 -04:00
FredApps 53dbfe280c Integrate 16 reviewed performance and usability PRs
Includes #8472 #8488 #9461 #9793 #9809 #9813 #9814 #9822 #9826 #9847 #9850 #9852 #9921 #9924 #9961 #10080 at reviewed heads.

Preserves each PR head as a parent. Reconciles CI workflow inputs and benchmark jobs without dropping checks. Excludes #8536 #9825 #9969 #10129. Combined CI pending; no manual validation claimed.
2026-10-29 14:31:15 +01:00
Khawar Zamman Wani aae87d353a perf(algo): solve Adaptive Wide Angle's mesh with a factor-once direct solve
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.
2026-10-28 07:52:44 +05:30
Dylan M. Taylor 8bc939cf3b Refactor algo for strict Clippy checks 2026-10-27 23:47:06 +00:00
Khawar Zamman Wani d2263c6cf2 perf: retain uniform-mask shortcuts in bounded selection distances 2026-10-26 19:36:50 +05:30
Khawar Zamman Wani 977585aa24 test: retain allocation reuse in the Contract performance baseline 2026-10-26 18:41:04 +05:30
Khawar Zamman Wani 4244ec2b9e perf: crop selection morphology and bound small-radius distances 2026-10-26 18:33:35 +05:30
David Mann 8fe70c95d2 Merge PR #5236: perf(algo): Content-Aware Scale 2x faster, within its P28 budget (#211)
# Conflicts:
#	crates/algo/examples/bench_seam.rs
#	crates/algo/src/seam.rs
#	docs/gaps.md
#	docs/target-app-parity.md
#	perf/budgets.toml
2026-10-25 14:28:59 +01:00
David Mann e6cf04cf42 Merge PR #7873: perf(photomerge): track multiband timing and peak memory
# Conflicts:
#	docs/scorecard.md
#	perf/budgets.toml
2026-10-25 10:15:10 +01:00
ebosido444-aiandebosido444-ai b07b7fab55 perf(seam): the shrink proxy drops its original-column map, same pixels (−15 % at 24 MP) (#8526)
* 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>
2026-10-24 11:14:00 -04:00
Ayan 47d9266fa1 Make Crystallize 4x and Pointillize 3x faster on 24 MP layers (#6200)
* 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
2026-10-24 11:13:03 -04:00
David MannandClaude Opus 5.5 e0fed98f23 Merge PR #8529: perf(bench): run bench_filters2 from cargo xtask perf, four heavy filters now tracked (P64-P67)
docs/scorecard.md: conflict in generated file, kept ours (b7-base); regenerated later.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 23:39:17 +02:00
6b867deba2 Integration: renumber the Photomerge scenario, measure its peak on every OS (#7873)
- 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>
2026-10-22 20:03:55 +02:00
David MannandClaude Opus 5.5 af802da608 Integration: merge main, resolve conflicts (#7873)
docs/scorecard.md conflicted: main's version is kept here and
regenerated in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:00:26 +02:00
aiongg 48ccb21290 Merge PR #6786: Puppet warp: Fix discrepancy between preview and the final state
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).
2026-10-22 15:37:12 +00:00
ebosido444-ai 4c9626167a review: print the real median, regenerate the scorecard
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.
2026-10-22 15:20:54 +03:00
ebosido444-ai 1601148b31 perf(bench): run bench_filters2 from cargo xtask perf, with four #211 rows (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.
2026-10-22 14:59:13 +03:00
Khawar Zamman WaniandClaude Opus 5.5 d51202c5a4 Smart Blur: 3.5x faster at radius 12 with identical output (#7921)
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>
2026-10-20 13:50:17 +05:30
ersoynarin-code c9cbe6a416 docs(photomerge): document benchmark helpers 2026-10-20 02:22:44 +03:00
ersoynarin-code 7bf4cc0739 perf(photomerge): track multiband timing and peak memory 2026-10-20 01:54:27 +03:00
Khawar Zamman WaniandClaude Opus 5.5 81d5c514e2 perf(photomerge): build multi-band bands in bounded batches (#7758) (#7763)
* 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>
2026-10-19 13:31:33 -04:00
Sergey Arseev c1499b2037 Puppet warp: Fix discrepancy between preview and the final state 2026-10-16 23:28:03 +03:00
Claude 615f9d6658 fix(algo): seam carving review follow-ups; infinite protection protects in the height pass
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
2026-10-13 18:48:45 +00:00
Claude ce94ac430d test(algo): pin seam carving's tall-image output; bench_seam timing example
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
2026-10-13 14:24:55 +00:00
Brandon ThomasandClaude Opus 5.5 32552a61a1 fix(liquify): dab spacing runs on along the whole stroke, so pointer speed no longer changes the warp (#2606) (#4047)
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>
2026-10-12 05:56:09 -04:00
3360f6e442 Speed up Tilt-Shift with existing per-level halo trimming (#2880)
Co-authored-by: optimalbytee <optimalbytee@users.noreply.github.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-11 11:58:04 -04:00
AyanandBrandon Thomas acce8e0e99 Five exact-output speedups: dense Extrude 160s to 0.39s (#2685)
* 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>
2026-10-11 10:50:45 -04:00
AyanandBrandon Thomas 0a102eb920 Pixelate: CMYK Facet 13.7x faster, Lab halftone 5.0x faster (#2588)
* 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>
2026-10-10 14:03:03 -04:00
fa33712dd3 Speed up Iris Blur without changing output (#2578)
Co-authored-by: optimalbytee <optimalbytee@users.noreply.github.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-10 14:00:53 -04:00
UnemarsandClaude Opus 5.5 9da40a1c7a Quick Selection: Photoshop's behaviour, measured and fitted (#1966)
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>
2026-10-09 16:21:27 -04:00
optimalbyteeandClaude Opus 5.5 6ae2a8498c Optimize Radial Blur sampling without changing output (#1499)
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>
2026-10-09 14:41:52 -04:00
optimalbyteeandClaude Opus 5.5 f5a86628ed Speed up exact Shape Blur convolution (#1566)
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>
2026-10-09 01:19:09 -04:00
Willy Foo 83d1f3115d perf(algo): specialize photo blur and resample channel loops 2026-10-09 11:12:52 +07:00
869ecf3cff Red Eye tool in the J-group flyout (#1084)
* 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>
2026-10-08 19:57:14 -04:00
Matt Van Horn 649417af1d Relight: size the tile halo from σ, keep large images, speed up the blur (#895)
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.
2026-10-08 16:39:05 -04:00
304322960e Gaussian and Box Blur: large radii no longer slow down (live preview too) (#464) (#867)
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>
2026-10-07 21:16:38 -04:00
Brandon ThomasandClaude Opus 5.5 f7eb6ea9e7 Format: adopt the craft-family rustfmt.toml and format the workspace
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>
2026-10-04 11:31:17 -04:00
Brandon ThomasandClaude Opus 5.5 aa87012aab Analysis, notes, proof views, workspaces (+ in-progress work of other agents)
Image > Analysis (ruler, count, measurement scale/log/record, scale
marker), notes (PSD Anno round trip, Notes panel, import), Modifier Keys
panel, Proof Setup plates / Legacy Mac RGB / colour blindness (Vienot),
32-bit preview options, custom pixel aspect, extras options, New/Delete/
Lock Workspace. Parity 600/625, FLOOR 595.

Checkpoint: also contains compiling in-progress work from the parallel
panels, type styles, File menu, photo, filters, UI-parity and fidelity
agents, plus photocraft-cli serve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 22:49:07 -04:00
Brandon Thomas 6b44c393fa continued work 2026-10-01 09:16:17 -04:00
Brandon Thomas 536a7346fb more algorithms, progress 2026-10-01 08:25:06 -04:00
Brandon Thomas ae92ac20bf continued wip 2026-09-30 09:37:18 -04:00
Brandon Thomas 16941f7198 one-shot 2026-09-30 05:02:08 -04:00