Commit Graph
905 Commits
Author SHA1 Message Date
gmrmad1andFredApps 389894e69b gpu: run Content-Aware Fill's PatchMatch and flow on the GPU (#1856)
* gpu: run Content-Aware Fill's PatchMatch on the device

Content-Aware Fill's synthesis is the stage that makes the tool slow: at
1920×1080 with a 300×200 hole, PatchMatch costs ≈ 1.1 s per frame on the CPU,
and it is what Object, Surface and every refining frame spend their time in.

Add a `FillBackend` trait to `effectcraft-raster` whose stages (the membrane
solve, the flow fields, PatchMatch) default to the CPU reference, and
`Accelerator::inpaint()` on the compositor, which is how the engine asks for a
device backend. `effectcraft_gpu::inpaint` implements PatchMatch: the
multi-scale pyramid, the EM rounds, the propagation (a two-pass checkerboard
instead of the CPU's scan order), the random search, the SSD, the
histogram-based σ² and the weighted vote, as compute kernels in
`shaders/inpaint.wgsl`.

The fill's frames are read back to the CPU before it runs (analyses composite
on the CPU by design), so the backend is about the fill's own work; the
orchestration, the flow-guided propagation and the per-frame flow control stay
on the CPU. Only the hole's bounds cross back to the CPU, which is what makes
the offload pay.

Measured on an Intel Arc (MTL) iGPU, 1920×1080, 300×200 hole:

  CPU 1087 ms   GPU 397 ms   (2.7×, 41.0 dB PSNR against the CPU's synthesis)

The membrane (harmonic) solve deliberately stays on the CPU: the same
measurement has it at ≈ 90 ms on the device against ≈ 55 ms on the CPU,
because a fill's full-frame data movement (upload, the known pyramid, a copy)
does not shrink with the hole, while the relaxation does. The device takes only
the stage where its parallel search pays; `membrane_tex` still runs on the
device inside PatchMatch, where it is the coarsest level's start and never
crosses back.

Closes #1839.

* gpu: fix the fill's vote histogram and run its flow on the device

Review follow-ups on the Content-Aware Fill GPU port, plus the fill's flow.

Fixes:

* imp_hist kept about one sample in 256: each of the 256 threads scanned a
  strided subset of the pixels and retained only those whose bin selected it,
  so the vote's sigma² came from a sample correlated with the pixel index (and
  a small hole usually fell back to 1.0, making the weights near-uniform). One
  workgroup now accumulates the whole population through shared atomic bins,
  with a test that pins the sample count.
* imp_pm_prop and imp_pm_rand were dispatched over grow(near, 1) but with
  near's origin, so the ring's left column and top row were never written
  (NaN under test, stale pooled data in production) while a strip past it was.
  `over` now derives the shader's origin from the box it sizes the dispatch
  from, so a dispatch's region and its origin can no longer disagree.
* Gpu::inpaint() requires its kernels to have built. Otherwise every stage
  paid an upload and a failed dispatch to fall back to the CPU, while the fill
  still reported the GPU path.
* imp_rnd's XOR chain parenthesises its multiplicative terms: WGSL's grammar
  makes each XOR operand a unary expression, so `a * b ^ c * d` is rejected
  by spec-compliant parsers (naga accepts it).
* FillBackend documents that its stages may be called concurrently.
* The coarsest membrane's sweep count (64, against the CPU's 200) is now
  justified: matching 200 measured ~6% slower over the fill with no change in
  the result.

And the flow: Gpu::flow runs block_flow's coarse-to-fine search, sub-pixel fit
and vector median on the device. The luma is the CPU's (flow::luma_pair), so
the field matches block_flow's to a float rounding and the propagation sees
the same motion; the hole completion stays on the CPU with the membrane. A
four-frame 1920x1080 fill goes from 1.27x to 1.42x against the CPU, and the
device path is covered for holes from 16x16 to 300x200.

* gpu: keep the fill vote's histogram range on HDR input

imp_hist binned every distance at a fixed 256 bins per unit and clamped to
1023, so the vote's sigma2 topped out at 3.998. A 32-bpc frame's channels can
exceed 1, and masked_frame forwards them unclamped: a patch distance of 1600
then reported sigma2 ~ 4, exp(-1600/(2*sigma2)) rounded to zero in f32, and
imp_pm_vote kept the prior image instead of synthesising.

The histogram now reports the largest finite distance it saw (atomicMax on the
float bits, carried in bin 0's unused .g channel). SDR input keeps the fixed
0..4 range with identical bins; HDR input is re-binned over the observed range
and percentile() maps the bin centre back through it. Nothing clamps the input.

Also group over/sweeps/pm_level's arguments into small structs: the workspace
denies too_many_arguments and the lint policy (#2496) does not allow new
#[allow]s. No behaviour change on those paths.

* engine: don't report Edge Blend fills as device fills

Edge Blend calls only the membrane, which the GPU backend leaves to the CPU
reference, so run_plan's "Filling (GPU)" status was wrong for it whenever a
backend was present. Object and Surface still run the flow and PatchMatch on
the device and keep the label.

CodeRabbit's #1856 finding.

* gpu: run the fill's device stages inside error scopes

An allocation or validation failure inside patch_image/flow_image left an
invalid texture whose later use raised an uncaptured error, retiring the
shared compositor instead of falling back to the CPU for that frame. Wrap both
stages in Gpu::within_memory, whose scopes are native thread-local, so the
fill's rayon workers do not share them.

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-03 22:24:42 +01:00
Brandon ThomasandClaude Opus 5.5 d16c720e59 Follow-up to #2981: a missing Chinese effect row draws English instead of failing the build, the font probe sees effect and category characters, coverage totals recounted
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 09:52:40 -05:00
Brandon Thomas 3ae9c8dbc2 Merge PR #2981 2026-11-03 09:41:24 -05:00
SHXJ b77db389af #2037: complete the Traditional Chinese effect-name catalog
Add 308 Traditional Chinese effect names and 21 category labels, written from the English source with Taiwan creative-software terms. Update the completeness tests to require the zh-hant table and recount the localization docs.
2026-11-03 22:34:55 +08:00
Brandon Thomas f5e81cd1f9 Merge PR #2957 2026-11-03 09:08:08 -05:00
Brandon Thomas 6334d07fe1 Merge PR #2872
# Conflicts:
#	apps/effectcraft-cli/tests/it/cli.rs
2026-11-03 09:05:01 -05:00
Brandon Thomas 3170c0e34f Merge PR #2905 2026-11-03 09:04:45 -05:00
Matej Kozlovský 0d1c5c08bf Docs: the Cryptomatte Selection is picked in the viewer (#473)
effects-parity.md and gaps.md: the Selection is picked in the viewer. control-protocol.md: the
viewer.cryptoPick element ids. footage.md: a paragraph on the eyedropper.
2026-11-03 07:37:53 +01:00
JonRC 50e5a7970e SAM 2: read the wgpu env variables and refuse adapters without compute shaders (#2900)
SAM 2's instance now reads wgpu's environment variables, as the render context's does, so a driver such as
Mesa's Dozen (WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER=1) is visible to it, and WGPU_POWER_PREF applies.
An adapter without compute shaders is refused before a device is made on it, so the CPU takes over with one
line instead of a validation error per kernel. The refused adapter is kept for the life of the process, as
the device on it was: dropping it crashed the tests on WSL2's GL driver. Gpu::shared no longer repeats
"SAM 2 compute:" in its errors.
2026-11-02 20:18:18 -03:00
JonRC 33156f4119 G2: --save runs on one project take turns, so no edit is lost (#2851)
A run reads the project, edits it and writes the whole file back, so two
at once silently dropped the edits of whichever saved first. A run that
saves over the file it opened (--save, or --save-as the same file) now
holds an OS lock on `.<name>.lock` next to the project from before its
read until it exits. The next run says so on stderr, waits, then edits
what the first one saved. Ported from filmcraft-cli
(storytold/filmcraft#3926).

The OS drops the lock however the process ends, so a crash leaves nothing
stale. If the lock can't be taken the run warns and saves as it did
before. A missing project stops the run before it opens anything, with
the same error opening gives, so a project created in between is never
saved without the lock. The desktop app and `mcp` don't take this lock.
2026-11-02 13:00:47 -03:00
JonRC a2f6cd3ed5 3D Camera Tracker: a partial solve is not reported as solved (#2822)
camera.solveStatus said `solved: true` for any stored solve, but the solver
keeps the frames it cannot resect as unsolved and interpolates the camera
there. `solved` now needs every frame, the same check camera.exportBlender
makes, and `partial` marks a solve with gaps, next to `solvedFrames`.
2026-11-02 09:15:05 -03:00
Brandon Thomas a658ec736a Merge PR #1266 2026-11-01 21:50:53 -05:00
Brandon Thomas 83b4e36e9b Merge PR #2343
# Conflicts:
#	crates/ui-egui/src/i18n/effects.rs
#	crates/ui-egui/src/i18n/ui.rs
2026-10-31 10:55:46 -04:00
Brandon Thomas d3001efade Merge PR #2731 2026-10-31 10:54:52 -04:00
Brandon Thomas 738f9a3055 Merge PR #1541 2026-10-31 10:54:51 -04:00
Brandon Thomas d3897efd86 Merge PR #2719 2026-10-31 10:54:51 -04:00
dotCooCoo 1fe1058d34 Scripting: Offset Paths and Zig Zag properties resolve by their match names
Offset Paths' Amount, Line Join, Miter Limit, Copies and Copy Offset,
and Zig Zag's Size, Ridges per segment and Points reported their
internal ids as matchName, so property("ADBE Vector Offset Amount") and
the other documented names returned null. They now report and resolve
by ADBE Vector Offset Amount, Line Join, Miter Limit, Copies and Copy
Offset, and ADBE Vector Zigzag Size, Detail and Points. Lookups by
display name and internal id still work.
2026-10-31 02:01:29 -07:00
adikshan11andClaude Opus 5.5 45b737455a automation: a confined project can't show footage from outside the roots (#2131 F-11, "Indirect reads")
The command checks look at the paths an agent gives, but a project it opens or
imports from a read root names its own footage, which was read wherever it is
when the project rendered: render_frame returned its pixels.

Backend::confine now wraps a headless session's footage and services:
ConfinedFootage reads frames, audio, aux channels, models and vector frames
only for footage inside the read roots (problem() says why the rest shows
nothing), and ConfinedServices checks read_file, exists, stamp, list_dir and
is_dir the same way. Writes are left to the command checks.

Test: automation_roots_confine_the_footage_a_project_names covers an absolute
path, `../`, a linked file and a linked folder, each opened and imported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:16:36 +05:30
aiongg 23a38b6627 docs: tidy wording 2026-10-31 04:25:49 +00:00
aiongg d4ddedddaf docs: tidy agent, contributor and asset docs 2026-10-31 04:17:22 +00:00
Florent Siegenthaler d85a5249c7 i18n(fr): translate the strings main added since (300 entries) 2026-10-30 21:22:56 +01:00
Florent Siegenthaler e3467dd4a6 Merge branch 'main' into fr-complete-catalog 2026-10-30 21:17:33 +01:00
bflatastic 334bf0f785 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	crates/engine/Cargo.toml
2026-10-30 17:22:12 +07:00
BFlat 3d285116d8 Merge pull request #1539 from nanox333/feat/sam2-roto-tracker
Roto Brush: follow the object with SAM 2.1 (Tiny, Small, Base+, Large; optional models)
2026-10-30 17:02:45 +07:00
pravdomilandClaude Opus 5.5 189f31d6d1 Shortcuts: panel and context scopes, one chord per scope
A shortcut belongs to the application, a panel or a context (editing text, a paint or
camera tool active, a mask selected). The narrowest active scope runs a chord: an active
context, the focused panel, the panel sharing its shortcuts (Timeline and Composition),
the application. A context's shortcuts never run outside it.

- shortcuts.rs: scope table for engine commands and menu entries, scope_rank,
  scope_label; UiCommand can state its scope.
- Conflicts: the same chord in two scopes is an override (both keep working), reported
  with overrides: true; shortcuts.conflicts lists same-scope pairs only.
- Scoped now, keys unchanged: Remember / Apply Interpretation and Delete Without
  Confirmation (Project), Duplicate Render Item (Render Queue).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 10:57:09 +01:00
bflatastic 2a72f03872 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	apps/effectcraft-cli/tests/it/cli.rs
#	crates/engine/src/output_guard.rs
#	docs/agents.md
2026-10-30 16:38:01 +07:00
bflatastic 672c49ab4a Merge remote-tracking branch 'refs/remotes/pr/1829' into HEAD 2026-10-30 16:37:00 +07:00
Patrik LermonandClaude Opus 5.5 46881e0d5f Swedish interface translation (sv)
Adds Swedish (Svenska) as an interface language in the menu, panel and
effect catalogs, written from the English source. The effect rows are
partial like Japanese and Georgian: an effect without a Swedish row draws
its English name, so a new effect does not block other PRs (#2244).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 10:35:36 +01:00
Kristian Myram b7d97c20e9 #1743: check final storage overflow destinations for queued outputs 2026-10-30 09:55:49 +01:00
bflatastic 0623340c62 Merge remote-tracking branch 'refs/remotes/pr/1539' into HEAD 2026-10-30 15:42:28 +07:00
bflatastic f558305795 Merge remote-tracking branch 'refs/remotes/pr/1830' into HEAD 2026-10-30 15:42:23 +07:00
Kristian Myram 41148e9b72 #1743: validate background and bridged exports in their owning session 2026-10-30 09:41:38 +01:00
Kristian Myram efb53c31fc #1539: clarify saved model identity and runtime fallback warnings 2026-10-30 09:34:23 +01:00
bflatasticandClaude Opus 5.5 ee6830fefb sam2: integration tests in one binary (tests/it/main.rs)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:01:40 +07:00
bflatastic 279b0ab4e3 Merge remote-tracking branch 'origin/main' into HEAD 2026-10-30 15:00:43 +07:00
bflatastic eed23ffa48 Merge remote-tracking branch 'origin/main' into HEAD 2026-10-30 15:00:42 +07:00
Kristian Myram c5671f6569 #1830: require exporter support before skipping duplicate frames 2026-10-30 08:59:53 +01:00
Kristian Myram 76f82d7d55 #1539: clarify fallback visibility and benchmark correction rounds 2026-10-30 08:53:17 +01:00
Kristian Myram baa1ca31b3 #1539: preserve stroke corrections and current main APIs 2026-10-30 08:49:47 +01:00
Kristian Myram a21b9b175e #1539: retain checkpoint provenance and clarify model waits 2026-10-30 08:43:33 +01:00
Kristian Myram 33f545cf64 #1539: keep SAM2 weights install-only until mirrored 2026-10-30 08:43:33 +01:00
Kristian Myram c4dc558a98 Roto Brush: validate GPU layouts and align object outlines (#1539) 2026-10-30 08:43:33 +01:00
Kristian Myram 365abf0f2d Roto Brush: discard failed tracks and bound SAM2 caches (#1539) 2026-10-30 08:43:33 +01:00
Claude 66d8e5e948 SAM 2 roto tracker: review fixes (direction-limited tracking, non-blocking model reload, per-object start passes, loader dispatch, CLI errors, hints)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RDvxCS8xcR28VArjzn1x7U
2026-10-30 08:43:32 +01:00
Kristian Myram 8a6d48cdc8 S2.74: bound pending multi-object tracking masks 2026-10-30 08:43:32 +01:00
Kristian MyramandClaude Sonnet 5.5 a0ec3e2da4 S2.73: Tiny is the recommended size (benchmarked per size); stroke count and remove button per object; download test
bench --roto per size: no larger size tracked better on the synthetic clips and
Large lost the object after it re-entered; the hints say what was measured.
The bar shows the current object's stroke count and can remove its strokes.
An env-gated test runs the in-app download of a size.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 08:43:32 +01:00
Kristian MyramandClaude Sonnet 5.5 4e2b2b7e5d S2.71: the boundary view outlines each object in its own colour
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 08:43:32 +01:00
Kristian MyramandClaude Sonnet 5.5 f67a17e765 S2.70: each object keeps its own matte; Show Object outputs one of them
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 08:43:32 +01:00
Kristian MyramandClaude Sonnet 5.5 08bf6e43fe S2.69: several objects in one Roto Brush instance, tracked in one SAM 2 pass
Strokes carry an object (0 for older projects, nothing written for 0). The
tracker follows every object in one pass and the mattes are united; the
confidence of a frame is the least sure object's. Object picker in the Layer
panel's bar; roto.options/stroke/clearStrokes/status take or report objects.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 08:43:32 +01:00
Kristian MyramandClaude Sonnet 5.5 fd1d6e623f S2.68: document the recommended size, half-precision weights and the decoder measurements
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 08:43:32 +01:00