Commit Graph
580 Commits
Author SHA1 Message Date
David Mann b04cdbda50 Merge pull request #12287 from DuBearte/fix/12018-gradient-sample-point
Gradient tool: sample each pixel where the reference application does, fixing Angle and Radial values
2026-11-11 13:19:53 +01:00
Tanish Manku e20f343b07 Merge pull request #11013 from jayzed80/fix/liquify-extreme-stroke
fix(algo): Liquify replays a stroke with an absurd brush size or position without overflowing
2026-11-11 00:26:19 -07:00
Tanish Manku 4ed05762c0 Merge pull request #10426 from ebosido444-ai/perf/box-line-kernel
perf(algo): gather a strip before walking box-blur columns
2026-11-11 00:18:50 -07:00
Tanish Manku 5c2bdf8688 Merge pull request #10425 from ebosido444-ai/perf/box-row-clamp
perf(algo): drop the per-sample clamp from the box-blur row pass
2026-11-11 00:18:27 -07:00
Tanish Manku 8549a3eba3 Merge pull request #9997 from ljkx/fix/clouds-no-clipping
Clouds: compress the histogram's tails instead of clipping them to the colours (#9959)
2026-11-11 00:11:45 -07:00
Tanish Manku 5f321ec9c9 Merge pull request #9868 from dotCooCoo/fix/art-history-alpha-sampling
Preserve Art History Brush colors at transparent edges
2026-11-11 00:10:35 -07:00
Tanish Manku 254000acaa Merge pull request #7020 from fjamesprice/perf/camera-raw-gpu-texture-dehaze
perf(camera-raw): develop Dehaze, Clarity and Texture on the GPU in the preview (#6916)
2026-11-10 23:58:06 -07:00
Tanish Manku 1d6cd334ba Merge pull request #6951 from fjamesprice/perf/camera-raw-gpu-local-tone
perf(camera-raw): develop Shadows and Highlights on the GPU in the preview (#6916)
2026-11-10 23:57:54 -07:00
Terra854 453ea8c9ca [Extend XCF import into native PhotoCraft documents 1/6] Persist import conversion data and bounded native filter foundations
Imported documents need durable conversion evidence and native pixel operations before XCF conversion can produce editable PhotoCraft data. This adds bounded document/report types, lossless pattern construction and `.pcraft` persistence, plus native HDR, percentile, noise, convolution, Average, coverage and matting kernels and checked Smart-filter mixing. Runtime color models/depths are retained; source attachments remain inert. Native SVG operations retain parsing, lowering, rendering and parser-tree destruction on one bounded worker, including nested resources; WebAssembly reports a controlled error for depths requiring native isolation.

Native filter corrections cover matte black points and signed HDR, extent-wide Smart-filter coverage, flat-image identity Auto Levels, opaque FillHoles capability, exact unselected channel preservation, coverage-preserving Average selection and bounded pattern expansion. Checked Smart-filter mixing rejects nonfinite native F32 samples, preserves unchanged Normal pixels without regenerating CMYK separations, and recovers representable alpha mixtures after an overflowing difference. HDR blend overflow retries use cold F64 arithmetic while retaining ordinary finite results and integer-depth behavior. Both opaque and alpha-bearing F32 mask recovery retain signed/HDR colors.

Stored pattern declarations remain lossless and inert. Dense PSD/PAT/ASL pattern export now checks dimensions and one shared plane-allocation budget before conversion. PAT/ASL report conversion errors; PSD/PSB report named omission warnings. Matching raw PSD pattern blocks remain verbatim. CMYK offsets retain the established brightness convention.

Command registration, XCF decoding and frontend workflows follow in dependent parts. The contributor entry is the author's existing chosen entry.

<!-- native-foundations-fixes-20261107:start -->
Small noise, convolution and point-operation edits admit their clipped work area on large owners while retaining output/workspace limits and whole-owner FillHoles bounds. HDR toning retains skipped transparent native samples. Normal Smart-filter strength interpolates stored CMYK/Lab/ink planes with premultiplied coverage, preserving unchanged channels. Bitmap Custom Pattern reads compact patterns in bounded row bands and ranks the complete map once. Embedded SVG isolation failures propagate independently of strict mode; ordinary invalid images can still be omitted, and private native parses share the complete-operation worker. The import-report regression now primes the layer blob cache and requires its specific limit diagnostic.
<!-- native-foundations-fixes-20261107:end -->

<!-- adversarial-5810371597:start -->
Import-report accounting uses portable fixed costs. HDR scene means use F64. Bitmap pattern ranking preflights a 256 MiB input/order/output budget, uses fallible allocation and heap-scratch-free sorting. Average uses the supplied image domain and retains one global mean across output tiles. Non-Normal Smart-filter coverage is classified once across the complete mixing extent. A fallible filter dispatcher and engine error conversion preserve checked native diagnostics and cancellation. Smart-filter engine integration remains in part 5 (#11032).
<!-- adversarial-5810371597:end -->

## Six-part series

Each branch is hosted in Terra854/photocraft, and every PR targets storytold/photocraft:main. Merge in the order below. Later drafts currently show cumulative diffs while prerequisites are unmerged; their descriptions link to isolated comparisons. Rebase each part onto current upstream main after its prerequisites merge, including squash-merge ancestry, and rerun affected checks before requesting review.

| Part | Upstream PR | Fork branch | Scope |
| --- | --- | --- | --- |
| 1 | [#11009](https://github.com/storytold/photocraft/pull/11009) | xcf-support-v2-01-import-data | Document/native-format data and pixel foundations |
| 2 | [#11029](https://github.com/storytold/photocraft/pull/11029) | xcf-support-v2-02-decoder | Bounded transport/records, precision, metadata, editable text and paths |
| 3 | [#11030](https://github.com/storytold/photocraft/pull/11030) | xcf-support-v2-03-effects-core | Native effect frames and primary tone/color/spatial/resource/transform adapters |
| 4 | [#11031](https://github.com/storytold/photocraft/pull/11031) | xcf-support-v2-04-effects-graphs | Remaining adapters, bounded graph lowering, coverage installation and source evidence |
| 5 | [#11032](https://github.com/storytold/photocraft/pull/11032) | xcf-support-v2-05-engine | Native commands, import preparation, historical choices, editing and persistence workflows |
| 6 | [#11033](https://github.com/storytold/photocraft/pull/11033) | xcf-support-v2-06-frontends | Desktop/web UI, CLI/MCP, translations, GPU diagnostics and qualification/docs |

The full integration remains preserved on `xcf-support-v2`; original #7098 remains available for reference.

## Validation

<!-- main-catchup-0d08cb7dd:start -->
Updated to upstream `main` at `0d08cb7dd` and restacked all six branches. Part 1 is `640a01f43`; full integration is `24cd17301`. The final six-part tree exactly matches the full integration tree.

The merge preserves both upstream's new tests/crop translations and the XCF historical-open tests/report labels. The automation adapter now preserves import-source protection across multiple granted read roots: relative source names cover every matching candidate so newly shadowing files cannot expose the original to overwrite, while absolute source names remain precise. Existing ordered reads and implicit-save provenance are retained. Read-only import source identity is kept independently of whether its library root grants an implicit Save target. Focused regressions cover source aliases, removed files, denied candidates, changing root precedence, and read-only library imports; the Windows escape fixture also uses a real junction when symlink privileges are unavailable. The new upstream UI import fixture also uses the native import outcome type.

Local validation passed affected host all-target checks, core and native frontend/automation unit and integration suites, forced-Vulkan GPU unit and integration suites, pinned IO corpora, strict all-target Clippy, formatting, layering, panel command dispatch, WASM, adversarial command tests, and the quick CPU performance harness. Offscreen historical-XCF prompt and conversion-report captures were reviewed. The first two PR boundaries also passed independent all-target engine checks. Tests used the pinned craft-fonts input, four Rayon workers, serial tests for large fixtures and opt-level=0 for engine/UI test glue; pixel/format crates retained their repository settings. Quick mode uses small documents and does not enforce full-size budgets. The part 1 push triggered fresh [CI](https://github.com/storytold/photocraft/actions/runs/42885527754) and [SonarCloud](https://github.com/storytold/photocraft/actions/runs/42885527740) runs. After upstream approval, CI passed the Linux gate, Windows unit/integration tests, no-HEIF tests, pinned corpora and web build. SonarCloud's instrumented archive, coverage shards and actual scan remain skipped behind its token guard; its outer green status does not mean coverage ran. Catching up with main therefore retriggered normal tests but did not remove that SonarCloud skip. Older validation below remains evidence for its explicitly named earlier commits.
<!-- main-catchup-0d08cb7dd:end -->

<!-- average-no-extent-4517477902:start -->
Average no-extent follow-up at part 1 `f8ddb626f` (full integration `882def329`), carried through all six branches. The checked Average dispatcher now uses the requested `area` when no owner extent is supplied; an explicit extent retains its existing clipping behavior. Other filters, the Average pixel kernel and resource admission are unchanged.

The new regression fails against the preceding revision and passes with the fix. It covers `apply`, one-pixel explicit tiling, and the cancellable tiled API at 8/16/32-bit, signed/HDR colors, hidden RGB, native alpha preservation, unchanged source data and pixels outside the requested area. Validation passed the algorithm unit/integration suite (935 tests; 27 existing ignored), strict all-target algorithm Clippy, formatting, layering, WASM (24 crates plus HEIF), and independent all-target engine checks of the first two PR boundaries. The broader suites below remain evidence for their named earlier commits and were not rerun for this dispatcher-only follow-up.
<!-- average-no-extent-4517477902:end -->

<!-- review-20261110:start -->
Review follow-up at part 1 `a3144d559` (full integration `b5fd3e211`), carried through all six branches. Average admits long thin regions within its existing pixel/workspace budgets, clamps finite selection coverage, and uses owner extents for off-canvas replay. HDR Toning also adapts over the owner extent. Pattern GPU uploads now use bounded bands; the warning-free `document_to_psd` API returns `Result` on pattern export failure and reuses prepared pattern blocks. Warning-enabled exports retain explicit omission warnings.

Five filter regressions fail against the previous revision and pass with the fixes. Local validation passed 1,597 algorithm/compositor/GPU tests with Vulkan, all 129 GPU integration tests separately on DX12 with FXC (the app uses FXC when no bundled DXC is present), a separate forced DX12 pattern upload/readback test, 1,144 IO unit and 675 pinned IO integration tests, 10 affected engine tests, strict all-target Clippy, formatting, layering, WASM and quick CPU performance checks. The first two PR boundaries passed independent all-target engine checks. This Intel driver's DX12/DXC configuration rejects the unchanged `fs_adjust` pipeline (`0x80070057`); DX12/FXC and Vulkan both pass. The full workspace suite was not rerun; earlier broad evidence below remains tied to its named commits. Quick performance mode does not enforce full-size budgets.

A separate 24 MP signed/HDR RGBA32F public Average-kernel probe retained exact mean RGB and original alpha. Three alternating runs had medians of 1,274.713 ms before and 1,259.885 ms after; this small difference is within run variation and is not a speedup claim.

The Minor/Poor-tradeoff report-deserialization finding remains open and documented. Encoded records are capped at 32 MiB and individual arrays are bounded, but compact targets can still amplify transient decoded memory before aggregate validation rejects the report. Early shared-budget deserialization is not implemented in this follow-up.
<!-- review-20261110:end -->

<!-- main-catchup-7c64653d5:start -->
Updated to upstream `main` at `7c64653d5` and restacked all six branches. Part 1 is `cbf068d5f`; full integration is `206f71012`. The full integration tree exactly matches part 6.

The merge retains main's alpha-preserving Average behavior with bounded checked processing, and uses it consistently for XCF coverage conversion and native replay. Historical XCF normalization and import preparation now run through main's resumable Place flow and Open as Smart Object; regression tests cover source byte order and native Edit Contents. XCF report/filter labels also cover the seven languages main promoted to menu-complete status.

The current tree passed affected host all-target checks, core/IO, GPU, engine and frontend suites, strict all-target Clippy, formatting, layering, panel command dispatch, WASM and the web build, adversarial command tests, pinned IO corpora and the quick CPU performance harness. Offscreen historical-XCF prompt and conversion-report captures were reviewed. The first two PR boundaries also passed independent all-target engine checks. Tests used CI-pinned craft-fonts `b076417b5880bd4154bd22f00695b1d28c6bea83`, four Rayon workers, serial tests for RAM-heavy suites and opt-level=0 for engine/UI test glue; pixel and format crates kept repository settings. Quick performance mode uses smaller documents and does not enforce full-size budgets. Older measurements below remain evidence for their named earlier commits.
<!-- main-catchup-7c64653d5:end -->

<!-- percentile-owner-4502952267:start -->
Percentile owner-bounds follow-up at part 1 `93946db04` (full integration `f7264af14`): nonempty owner bounds now supply edge samples without a dense whole-owner admission check. The unchanged preflight still bounds clipped output, padded halo, workspace and CPU work; dense-image adapter limits remain in place. Two new regressions failed with `InvalidGeometry` before the fix and pass afterward, covering small edits on 81 MP and wider sparse owners, clamped-edge oracles, fractional selections, source preservation, clipped requests, invalid domains, oversized output, work limits and cancellation.

This follow-up passed 903 algorithm tests (887 unit + 16 integration; 27 existing ignored), all-target strict algorithm Clippy, formatting, layering and WASM (24 crates plus the HEIF configuration). Only sampling-bound admission changed; percentile processing and resource-preflight code are byte-for-byte unchanged. The broader qualification below remains tied to its explicitly named earlier commits; the full workspace suite was not rerun for this one-file follow-up.
<!-- percentile-owner-4502952267:end -->

<!-- native-foundations-validation-20261107:start -->
The production fixes at part 1 `c16e274b8` (full integration `6f8349cd5`) passed 7,245 affected algorithm/compositor/document/engine/native-format/IO tests across 46 binaries, with 65 existing ignored tests, plus doctests, affected all-target strict Clippy, layering, WASM, adversarial command tests, formatting and the pinned IO corpus (1,107 unit + 661 integration tests, 26 existing ignored). The final diagnostics regressions also passed independently on the foundation and full integration branches. The first PR passed an independent all-target engine check. Tests used four Rayon/test workers and the existing CI font pin; engine test glue used opt-level=0, and the foundation-only diagnostic probe also used opt-level=0 for its algorithm dependency. The full integration tree exactly matches the final sixth branch.

Paired 24 MP release probes used three timed repetitions per version after warm-ups, alternating order, matching inlining controls, opaque parameters and a current public-API control, with four Rayon workers. Timings are completed operations on this host.

| Probe | Before (ms) | After (ms) | Public API (ms) |
| --- | ---: | ---: | ---: |
| HDR toning | 830.3 | 834.4 | 791.2 |
| Rgb-Normal | 1070.5 | 1069.3 | 1079.7 |
| Cmyk-Normal | 683.0 | 669.7 | 691.5 |
| Rgb-Multiply | 1103.1 | 1303.3 | 1297.5 |

The extent-wide coverage prepass adds 200.2 ms (18.2%) in the alpha-preserving Multiply case. This is the measured cost of applying one consistent coverage rule; the Normal RGB/CMYK controls remain near baseline.

The uniform HDR probe's middle-gray output changed from 0.200004 to 0.180000 (target 0.18); the public control agrees. Mixer probes check native colors and alpha at sampled positions. The quick CPU application harness also completed; its saved cross-machine comparison was skipped, and quick mode does not apply full-size budgets. No budgets or baselines changed.
<!-- native-foundations-validation-20261107:end -->

Earlier validation of full integration `c003e3f50`, before these follow-up fixes, completed the upstream `main` catch-up at `c101cbfb7` on 2026-11-07. The cumulative series passed affected host all-target checks, foundation and IO suites, GPU, engine and frontend suites, strict Clippy, layering, WASM, adversarial command tests, formatting, pinned IO corpora and the quick CPU performance harness. Offscreen historical-XCF prompt and conversion-report captures were reviewed. Local tests used CI-pinned craft-fonts `b076417b5880bd4154bd22f00695b1d28c6bea83`, four Rayon workers and temporary opt-level=0 overrides for engine/UI test glue; pixel and format crates retained repository settings. The full UI library passed 5,330 tests, and the final dialog-dispatch cleanup passed 945 focused dialog tests.

The decoder and engine PR boundaries also passed independent all-target checks. The full `xcf-support-v2` integration tree matches the final sixth branch exactly. SVG stack regressions retain their 512 KiB caller, isolated complete native lifecycle and 100 retained group levels.

The matched performance figures below were measured before this main integration; the HDR recovery arithmetic and bounded tile implementation are preserved.

Forward filter-mask mixing retains its existing four-buffer allocation optimization and arithmetic. Its matched 24 MP RGBA32F probes measured opaque pixels at 392.410→182.842 ms, semitransparent pixels at 383.321→179.916 ms, and signed HDR pixels at 373.696→183.903 ms (five-run medians, 50–53% faster).

Inverse filter-mask recovery now processes at most eight native tiles in parallel, with four reusable scratch buffers per slot and ordered surface publication. Small inputs, one-worker operation and WebAssembly use the same serial tile helper. All F64 and integer pixel arithmetic is unchanged. Bitwise regressions compare full/partial/missing tiles, negative coordinates, differing defaults and hidden/zero-alpha outputs across 30 format combinations; an explicit one-worker/two-worker comparison checks both execution paths.

Matched 24 MP HDR inverse-recovery public-API probes measured 166.972→90.565 ms (opaque, 45.8% faster), and 433.325→130.707 ms (semitransparent, 69.8% faster). Five-run medians use four Rayon workers on this host; all runs assert recovered HDR samples at three positions. The existing F64 precision and HDR saturation bounds are preserved.

Mask recovery retains signed/HDR colors, extreme finite values, subnormals and exact full coverage. The PSD/PSB regression uses a real blur on spatially varying HDR pixels and partial masks; raw exported channels must match the unmasked filter result, and reimported Smart caches must match independently authored masked values.

The prior quick CPU application harness completed. Its saved cross-machine baseline comparison was skipped, so the paired public-API measurements above provide the direct before/after evidence. No performance budgets or baselines changed.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
  * Added image adjustments and filters for averaging, channel noise, convolution, percentile effects, alpha and coverage editing, black matte removal, HDR toning, and automatic tone, contrast, and color correction.
  * Added Smart-filter blending controls for opacity and blend modes.
  * Import-conversion information is preserved when saving and reopening documents.

* **Improvements**
  * Improved handling of deeply nested SVGs and large patterns, with bounded pattern processing and warnings when pattern export is not possible.
  * Improved stability when blending extreme HDR values and applying filters to HDR images.
  * Improved transparency handling for channel-selective filters and added clearer feedback when image processing or export cannot be completed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 07:35:40 +01:00
ljkxandClaude Fable 5.2 d709a86819 Merge main into fix/clouds-no-clipping
Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-11 02:05:33 +01:00
David Mann 7539e14dce Merge pull request #12869 from Raghav2012Code/fix/12852-object-transparent-layer
fix(engine): Object Selection finds objects on a transparent layer (#12852)
2026-11-11 01:56:43 +01:00
David Mann 3bc90a79ce Merge remote-tracking branch 'origin/main' into pr-12287 2026-11-11 01:49:44 +01:00
ljkxandClaude Fable 5.2 ad5d898757 Merge main into fix/clouds-no-clipping
Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-10 23:03:05 +01:00
DingusMcRinkyDinkyandClaude 54ea149f2f Warp: working out a fold's order can't stall the thread pool
Tiles are drawn on the thread pool, and the first tile that meets a fold works
out the fold's order while the others that need it wait. The order's sort was
shared with the pool, so while the working thread waited for its halves the
pool could hand it another folded tile, which then waited for the order on the
same thread: the warp never finished. It needed some tiles folding and others
not, and showed about once in ten 24 MP warps on 16 threads.

The sort now runs on the working thread alone. It costs nothing measurable:
a 24 MP fold in stacking order takes 0.28 s, as before.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01EZbgszHyuEuWAzxaamteuU
2026-11-10 18:36:10 +01:00
Raghav Krishna 184cc1d912 fix(engine): Object Selection finds objects on a transparent layer (#12852)
Object Finder's click sampled the layer composited over 50 % grey, so a fully transparent pixel read as mid grey. A mid-grey object then sat within the growth's colour distance of the empty area, the region reached the canvas edge, and object_in rejected it as background. Red and blue are far from 0.5 grey, which is why only they were found.

Sampler gains rgba_scaled, which keeps alpha at working resolution. object_in reads through it once, never grows into a non-opaque working pixel, and gives transparency hard background in the trimap; a click on a transparent pixel finds nothing. rgb_scaled is untouched, so Quick Selection, Select Subject, sky, focus and the rectangle mode keep their results.

Tests: the issue's 800x600 document and the Grayscale one in a new test file; both fail without the fix.
2026-11-10 17:34:37 +05:30
DingusMcRinkyDinkyandClaude Opus 5.5 24c81eb486 Merge main into pr-fold-layers
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EZbgszHyuEuWAzxaamteuU
2026-11-09 21:43:36 +01:00
jayzed80andClaude 165cab50ad Liquify test: document the stroke helper and the replay test
Co-Authored-By: Claude <[email protected]>
2026-11-09 20:38:58 +00:00
jayzed80andClaude 7d5f68ddc6 Liquify test: require the far-off Freeze dab to change the field
Review on #11013: the check on the reported area no longer depends on a condition.

Co-Authored-By: Claude <[email protected]>
2026-11-09 20:30:58 +00:00
jayzed80andClaude 200f38f7b6 Liquify: a huge far-off dab writes no NaN and reports the area it changed
Review on #11013. A dab whose centre and size are both huge gave infinity
over infinity for a node's distance, and the NaN slipped past the falloff
check. The changed rectangle is now worked out in f64 before the cast, so
a far-off centre with a radius reaching the image no longer reports empty.

Co-Authored-By: Claude <[email protected]>
2026-11-09 20:19:40 +00:00
jayzed80 d84bb2e84c Merge upstream main into fix/liquify-extreme-stroke
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	crates/algo/src/liquify.rs
2026-11-09 20:02:27 +00:00
2999174c6b Liquify: Forward Warp and Push Left follow the pointer; stationary tools use real time (#10690)
* Liquify: Forward Warp and Push Left follow the pointer; stationary tools use real time

Forward Warp and Push Left only changed the image once every dab spacing (a twentieth of
the brush radius), so a slow drag moved in jumps. The stationary tools (Twirl, Pucker,
Bloat, ...) ticked at a fixed 30 per second and stalled while the brush crept.

Points may now carry a fourth number, the milliseconds since the previous point. A segment
ending on such a live point applies the motion left over after the last dab as a
provisional dab that is taken back before the next segment, so a slow and a fast pointer
give the same warp. The stationary tools apply the larger of elapsed time and distance
travelled. The dialog records every point live and feeds every pointer position reported
in a frame. Points without times replay exactly as before.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cargo fmt

* Liquify: correct two comments to describe the provisional dab

* Liquify: keep a pointer detour that returns to its start; skip the provisional dab at zero strength

* Liquify: also cover a zero stroke pressure in the live-segment test

* Liquify: test that the next live segment takes back the provisional dab

* Liquify: tighten the take-back test (repaint area, continuation with strength)

* Liquify: check that the take-back covers the area the first segment repainted

* Liquify: a dab far off the field touches no nodes instead of panicking

node_span converted a far-off centre to an index before checking the overlap: the lower index saturated to usize::MAX, read back as -1 it passed the check, and the provisional dab's snapshot then subtracted past zero (debug) or sliced out of range (release). The overlap is now decided in f64 before any conversion, NaN included. Tests: a timed stroke far off the field, on both axes and every side, for every brush tool; node_span on and off the grid.

* Liquify: a frame's batched pointer moves share its time evenly

The dialog handles a frame's queued moves one after another, and each read the clock: the first got nearly the whole frame and the rest only processing time, so a stationary tool's strength and where it landed depended on how the platform batched the moves. The frame's time since the last point is now shared evenly by its moves, as if they had arrived one per frame; after a stall the frame counts for at most MAX_LIVE_MS in all, as one point would. Tests: batched and one-per-frame moves give the same field (Freeze at 10 %, Twirl, Bloat, Forward Warp); a stalled frame's moves total MAX_LIVE_MS.

---------

Co-authored-by: terminalgate <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
2026-11-09 15:50:20 +01:00
David Mann 34c9662c6b Merge pull request #12421 from slafebre/fix/11798-perspective-crop-free-size
fix(engine): a free Perspective Crop takes the quad's perspective size (#11798)
2026-11-09 15:45:51 +01:00
David Mann 1372bae3ea Merge pull request #9077 from ArjenS-LA/fix/average-smart-filters
Execute Average on Smart Objects and imported PSD smart filters
2026-11-09 14:23:56 +01:00
DingusMcRinkyDinkyandClaude Opus 5.5 51760ec0be Warp: only tiles where the picture folds are drawn in the fold's order
A warp draws each tile in row order, as one that can't fold does, and notes
whether two parts of the picture meet at a pixel; only such a tile is drawn
again in the fold's order, with its layers composited, and the order is
worked out the first time a tile needs it. Without a fold the order makes no
difference, so such a warp costs what it did before folds stacked.

24 MP layer, release, best of three: main 0.22 s without a fold, 0.23 s with
one; now 0.20 s and 0.26 s (was 0.24 s and 0.29 s).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EZbgszHyuEuWAzxaamteuU
2026-11-09 11:32:15 +01:00
DingusMcRinkyDinkyandClaude Opus 5.5 6687b4514e Warp: a fold reads its source in parts, not one window across it
Timing a 24 MP Warp showed folds cost five times main's time (1.23 s
against 0.22 s): a tile where the dragged part lies over the rest samples
two distant parts of the source, and its one window spanned everything
between them (230 MP read per render against 31 MP). A tile's samples are
now grouped into connected regions of the source on a coarse grid, each
read as a window of its own; a tile whose samples lie close together stays
one window, without the grid. A fold's layers are kept in one linked list
per tile instead of a list per folded pixel, and the cells are sorted in
parallel.

24 MP layer, release, best of three: main 0.22 s without a fold and
0.23 s with one; before 0.28 s and 1.23 s; now 0.24 s and 0.29 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EZbgszHyuEuWAzxaamteuU
2026-11-09 11:05:45 +01:00
Sven Lafebre 0a8eb9d6c8 fix(algo): keep the edges when a pixel of click error swings a free Perspective Crop (#11798)
A corner moved one pixel could take a quad across the parallel-sides limit and the output from 602 x 400 to 719 x 289. The estimate now has to survive one pixel of error on every corner, with its proportions moving by no more than 10 %. Also test the commit path with W and H empty, and a known rectangle seen by a camera model.
2026-11-09 10:22:12 +01:00
fjamespriceandClaude Opus 5.5 e48829afc1 test(camera-raw): a Gaussian below 0.3 px leaves the image alone
7d1a7d69 moved gauss's early return for sigma < 0.3 into
spatial::gauss_radii, which returns no radii there, and box_means with
no radii returns its input. This tests both, and that Texture on a
proxy that small leaves the develop unchanged, as the early return
did. Removing the 0.3 guard from gauss_radii fails it.

Part of #6916.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014nuVUg57HqXLARdhymFiTc
2026-11-09 02:42:52 -05:00
fjamespriceandClaude Opus 5.5 b02d952e76 perf(camera-raw): the GPU Dehaze opens the dark channel like the CPU (#9273)
main's #9316 opens Dehaze's dark channel (a maximum filter of the same
radius after the minimum) and scales the 0.95 weight by the ratio of the
two means, so a sky beside a dark object clears instead of keeping a
bright halo. The GPU pass built the transmission from the minimum alone,
so its preview kept the halo that OK no longer applied.

The pass now does the same: fs_min gains a maximum mode for the opening,
fs_air sums the dark channel and its opening per tile and then turns the
sums into the weight, and the packing pass reads the weight from that
texel instead of a constant.

The CPU mean is now summed in f64. Its f32 running sum over the copy's
few hundred thousand cells drifted by about 1e-5, which the low
transmission beside haze multiplied past the GPU tests' 1/4096 (2.7e-4 in
clarity_texture_and_dehaze_with_shadows_highlights_and_per_pixel_stages);
with f64 the GPU matches to 1.6e-5 on the halo scene.

New test dehaze_opens_the_dark_channel_like_the_cpu develops #9316's
scene (a clear sky and a dark tower) both ways at three strengths. Dehaze
+40 on the 858x572 proxy: 5.1-7.7 ms on the GPU vs 17.7 ms on the CPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 02:42:52 -05:00
fjamespriceandClaude Opus 5.5 6025c504cf perf(camera-raw): develop Dehaze, Clarity and Texture on the GPU in the preview (#6916)
Step 3 of #6916. Dehaze, Clarity and Texture run as fragment passes
(box, minimum and guided filters) around step 2's Shadows and
Highlights, so every setting but Detail develops on the GPU with one
readback.

- algo: camera_raw::spatial resolves Dehaze, Clarity and Texture per
  frame; develop builds them the same way (130 output hashes unchanged,
  same speed). PerPixel gains the three stages, per_pixel() refuses only
  Detail, and Whites/Blacks are measured after any spatial stage.
- gpu: camera_raw_filters.wgsl; the tone frame's pyramid is made on
  demand; plans record four segments around the main shader's passes.
  Dehaze's light uses two exact selections (cutoff value, then cutoff
  index among its ties). Its <=768 px copy comes from the CPU
  (Dehaze::cells, develop's own code), cached per source and white
  balance: on WARP the GPU's copy split CPU ties at the cutoff and moved
  the light by 5.7e-3.
- GPU vs CPU at most 7.6e-5 (Vulkan, DX12, WARP), tolerance 1/4096.
  858x572: Dehaze +40 6.0 ms vs 29 ms, Clarity +50 3.5 vs 16 ms,
  Texture +50 3.4 vs 10 ms, everything 19 ms vs 650-690 ms (Vulkan).

Part of #6916.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 02:42:52 -05:00
fjamespriceandClaude Opus 5.5 e13e8e8afd fix(camera-raw): Shadows and Highlights on a 2 px proxy develop on the CPU
per_pixel sent Shadows and Highlights to the GPU on frames 2 pixels on
the short side, whose pyramid has one level. The pass refused them, and
CameraRawGpu::develop took that as a GPU failure, so the dialog stayed
on the CPU for every later preview. A layer about 450 times wider than
tall has such a proxy. per_pixel now returns None for these frames, so
the CPU develops them and the GPU stays on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 02:41:55 -05:00
fjamespriceandClaude Opus 5.5 a60090fff5 perf(camera-raw): develop Shadows and Highlights on the GPU in the preview (#6916)
Step 2 of #6916: the local Laplacian filter behind Shadows and Highlights
(Paris, Hasinoff, Kautz 2011, sampled as in Aubry et al. 2014, as
local_tone.rs does) as wgpu fragment passes, chained in front of step 1's
per-pixel pass with no readback in between.

- algo: local_tone exposes its constants and resolves the sliders into
  LocalTone / TonePass (the remapping is a method); the CPU filter runs
  those passes. PerPixel gains local_tone and measure_whites_blacks;
  whites_blacks_model() exposes the Whites and Blacks tables;
  quantile_rank() is the one rank rule. CPU output unchanged bit for bit
  (86 hashes, 8-bit and float, 171x113 to 2100x1300) and as fast.
- gpu: camera_raw_tone.rs/.wgsl. Pyramid levels are R32Float textures; the
  remapped pyramids of up to 96 references sit in one Rgba32Float atlas per
  level, four per tile. The filter's quantiles, and Whites and Blacks'
  points after it, are exact order statistics on the GPU (16 thresholds per
  round, 8 rounds); a pass renders the Whites and Blacks rows into the
  table texture. Textures, passes and bind groups are planned once per
  frame size. Pipelines build with the rest on the existing thread.
- ui-egui: the proxy worker sends Shadows and Highlights frames to the GPU;
  Dehaze, Texture, Clarity and Detail still use the CPU for the frame.

GPU vs CPU at 8, 16 and 32 bits: at most 9.9e-6 (RTX 5060 Ti, Vulkan and
DX12), 1.03e-5 (WARP); tests keep 1/4096. 858x572 proxy, release: Shadows
+50 8.7 ms (Vulkan) / 10.6 ms (DX12) vs 147-300 ms on the CPU.

Part of #6916.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 02:41:55 -05:00
DingusMcRinkyDinky 5cb4856607 Merge remote-tracking branch 'upstream/main' into pr-fold-layers 2026-11-09 07:32:41 +01:00
Sven Lafebre 3e81a3bcc4 fix(engine): a free Perspective Crop takes the quad's perspective size (#11798)
With W and H empty the output is the rectangle the quad shows in
perspective: the width is the largest horizontal scale at a corner and
the height follows from the recovered aspect ratio. Quads whose sides
are nearly parallel, that no camera at the document centre can see as a
rectangle, or whose estimate is implausible take their longest edges.
A size set in W or H behaves as before.
2026-11-09 01:24:13 +01:00
Sven Lafebre 25d6041ab5 fix(algo): partly transparent colours keep the per-channel limit (#11995)
The spread was measured on opaque colours only, and the issue keeps
today's behaviour for partly transparent ones, in the match and in the
anti-alias fringe.
2026-11-08 22:53:30 +01:00
David Mann 0523777541 Merge origin/main into fix/average-smart-filters 2026-11-08 22:24:23 +01:00
Sven Lafebre e0ca582b97 fix(engine): the Magic Eraser measures Tolerance by colour spread (#11995)
On 8-bit RGB a pixel now matches the clicked colour when the spread of
{0, dR, dG, dB} is within the Tolerance, so opposite changes in two
channels count double and green and blue stay at Tolerance 255. The
anti-alias fringe uses the same distance. The Magic Wand, the Paint
Bucket and other modes and depths keep the per-channel limit.
2026-11-08 22:11:51 +01:00
David Mann 4e5f150eb4 Merge pull request #12146 from hectorviov/fix/wand-antialias-fringe
Magic Wand: Anti-alias keeps the region whole and softens only near-matching neighbours (#11776)
2026-11-08 19:49:41 +01:00
David Mann e5decd0b85 Merge remote-tracking branch 'origin/main' into pr-11848 2026-11-08 14:54:13 +01:00
DuBearteandClaude Opus 5.5 f9e77bbad7 Gradient tool: sample pixels where the reference application does (#12018)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 00:12:00 -05:00
David Mann d95faebaa3 Merge remote-tracking branch 'origin/main' into pr-9077
# Conflicts:
#	docs/gaps.md
#	docs/target-app-parity.md
2026-11-08 03:04:43 +01:00
5de6aa4e04 Merge origin/main into feat/psd-puppet-warp-2 (PR #8140)
Conflicts: psd_import.rs (main's vector_preview field kept, the SmartObject
still built as a binding so pin_puppet_meshes runs), smart_cmds/rendering.rs
(main's JobCtx argument kept next to the PR's placed_puppet_params).

Co-Authored-By: Tungtono <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 20:18:37 +01:00
Hector Villarreal e25be5e77b Magic Wand: Anti-alias keeps the region whole and softens only near-matching neighbours (#11776) 2026-11-07 12:00:07 -06:00
7f09b2013d Merge current main into #9077 (Average on Smart Objects)
Resolves the status-line conflicts in docs/gaps.md and
docs/target-app-parity.md (both sides kept) and the module list in
crates/engine/tests/it/main.rs.

Co-Authored-By: arjen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 18:48:12 +01:00
DuBearteandClaude Opus 5.5 0e0d99d0b2 fix(engine): Magic Wand Subtract and Intersect grow from the seed through the selection (#11779)
Alt-click (Subtract) and Shift+Alt-click (Intersect) with the Magic Wand
took the seed's whole region, wherever the seed was, so a click outside
the selection still cut into it. With Contiguous on, the region now
grows from the seed through selected pixels only: a seed outside the
selection subtracts nothing and intersects to nothing, and a seed
inside gives the same results as before. Contiguous off is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 01:29:32 -05:00
DingusMcRinkyDinkyandClaude Opus 5.5 d788adac8c Warp: the part a fold turns over lies on top
A fold's layers were stacked by how far the warp moved them, so the part
dragged furthest was on top. That's right for a corner, an edge or an
edge's handles dragged across the picture, but not for the middle pulled
out past an edge: there the edge row folds back over the middle and lies
on top of it. The cells a fold turns over (their outline mirrored from
where they'd be without the warp) now go on top, like a folded-back flap,
and the cells moved furthest still go on top within each kind.

cell_order takes the warped and rest positions so it can tell; the render
and Warp mode's preview both use it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EZbgszHyuEuWAzxaamteuU
2026-11-06 22:27:32 +01:00
Nikolai Nyegaard ec7e86b371 i18n: carry the renamed keys in the ar, bs, da, fi and sv catalogs
The five partial catalogs landed on main after this branch was cut and
still listed the renamed strings under their old keys. Rekey them the same
way as the full catalogs, point the two toolbar swatch tooltips at the
Photoshop labels, and drop the rows whose replacement key already existed.
The two selection colour-matching errors added since read color too.
2026-11-06 18:25:30 +01:00
FredApps aee46a2fc6 Merge remote-tracking branch 'origin/main' into fix/10164-final-prune-u2 2026-11-06 17:28:48 +01:00
FredApps 086c250d7c Keep final resize pruning cooperative
Visit at most four output tiles per closing work unit and honor the caller's deadline between batches. Sparse images with distant opaque corners otherwise make one final poll scan the whole resized surface.

Add a sparse-output regression at 8, 16 and 32-bit requiring multiple closing polls, identical pixels, and removal of the same empty tiles. Formatting and whitespace checks passed; compilation and test execution await hosted CI.
2026-11-06 17:28:13 +01:00
David Mann a9de7ebee8 Merge remote-tracking branch 'origin/main' into HEAD 2026-11-06 14:03:38 +01:00
David Mann ec5eb1e2d0 Merge commit 'refs/fixprs/main' into HEAD 2026-11-06 10:21:59 +01:00