From ea24405ba2aeb2dafad152c66862245ae7fa7a38 Mon Sep 17 00:00:00 2001 From: gramps Date: Thu, 5 Nov 2026 08:15:32 -0800 Subject: [PATCH] feat(chroma): offer to remove a green or blue screen, and key it in the decode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TASK 64 slices D and E: the feature is usable end to end. - Add a video file → one frame is probed (new `IChromaProbe`/`FfmpegChromaProbe`, one ffmpeg pass at 160x90, off the UI thread) and the layer gets an offer: "Looks like a green screen — Remove it", with the measured colour as a swatch. - Accepting it turns the offer into settings (Amount / Softness / Fringe) that reach ffmpeg as `colorkey` + `despill` + `format=bgra`, so the key is computed in the pipe and both consumers (the shared preview bitmap and the compositor's frame) carry the same alpha. - Media sessions are now keyed by **path + look** (`MainViewModel.MediaSessionKey`), so two layers with the same settings still share one decoder, and changing the look releases the old session and starts the new one. Removal, load reconciliation, loop and audio settings all move to the same key. - Settings persist on the `Source` row (six ALTER TABLE guards + SELECT/INSERT), so a keyed layer comes back keyed. - Panel section is plain creator words: Green/Blue Screen, Amount, Softness, Fringe. Test: `ChromaKeyApplyTests` — the pipe asks ffmpeg to key (and does not when off); a green-screen clip is offered, accepting it starts a keyed session, the layer's resolver then reads that session rather than the old one; the setting survives a save. Docs: TASK 64 D/E ticked with slice F (auto-apply setting + alert clips) left open; frame-pipeline records the decode-option design; HANDOFF rewritten. verify.sh: 544 passed, 0 failed, 0 warnings. --- Controls/LeftPanel.xaml | 41 ++++ HANDOFF.md | 32 +-- Models/Source.cs | 109 +++++++++ Services/ChromaProbe.cs | 74 +++++++ Services/LayoutStore.Load.cs | 14 +- Services/LayoutStore.Migrations.cs | 38 ++++ Services/LayoutStore.Save.cs | 20 +- Services/MediaVideoSource.cs | 9 +- Services/MediaVideoSourceManager.cs | 17 +- Services/VideoClipPipe.cs | 7 +- TASKS.md | 2 +- TASKS/task-64-green-blue-screen.md | 6 +- ViewModels/MainViewModel.Media.cs | 193 +++++++++++----- ViewModels/MainViewModel.Sources.cs | 8 +- ViewModels/MainViewModel.cs | 28 ++- docs/ai/frame-pipeline.md | 7 + ytLive.Tests/ChromaKeyApplyTests.cs | 219 +++++++++++++++++++ ytLive.Tests/MediaSourceAudioTests.cs | 2 +- ytLive.Tests/MediaVideoSourceManagerTests.cs | 12 +- 19 files changed, 732 insertions(+), 106 deletions(-) create mode 100644 Services/ChromaProbe.cs create mode 100644 ytLive.Tests/ChromaKeyApplyTests.cs diff --git a/Controls/LeftPanel.xaml b/Controls/LeftPanel.xaml index 30af66c..fd054b8 100644 --- a/Controls/LeftPanel.xaml +++ b/Controls/LeftPanel.xaml @@ -761,6 +761,47 @@ + + + + + + + + +