Files
filmcraft/crates/scopes/README.md
Brandon ThomasandClaude Opus 5.5 45b8c0c2a0 M8.9 + M12.6: Lumetri Scopes complete; Metadata, Timecode, Events, Progress, Reference Monitor panels
M8.9 (scopes):
- New L3 crate filmcraft-scopes (wasm-clean): Waveform RGB/Luma/YC/YC no Chroma,
  Parade RGB/YUV/RGB-White, Histogram, Vectorscope YUV (75/100 % targets, skin-tone
  line) and HLS; Rec. 601/709/2100 matrices, Clamp Signal, 8-bit/float/HDR (PQ cd/m2)
  scales; numeric summaries; density painting. < 1 ms per scope at 1080p.
- Lumetri Scopes panel rewritten: multi-scope grid, wrench / right-click menu (presets,
  scopes, parade/waveform type, targets, colour space, brightness, scale), footer
  (colour space, Clamp Signal, 8 Bit/Float/HDR). Settings in UiState::panels.
- scopes.read engine query returns levels, histogram bins, waveform/parade columns and
  vectorscope peaks.

M12.6 (panels):
- Metadata panel with editable Name/Label/log fields (metadata.get / metadata.set,
  one undo step, stored in ProjectItem::metadata; no schema change, stays v11).
- Timecode panel (rows: current/media/duration/in-out/remaining, any time display).
- Events panel on a new engine event log (failed/disabled commands, toasts, auto-save
  errors, jobs started/finished/failed/cancelled; events.list / events.clear).
- Progress panel (jobs with progress and Cancel).
- Reference Monitor (parked or ganged to Program; picture or scopes).
- All open from Window > menu, have automation ids; ui.set {"panels": ...} merges state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:32:22 -04:00

54 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# filmcraft-scopes
Video scope maths for the Lumetri Scopes panel (layer L3; depends only on `filmcraft-color` and
`serde`; no UI, builds for wasm32). The UI (`crates/ui-egui/src/panels/scopes.rs`) draws what this
crate computes; `scopes.read` (`crates/engine/src/scopes.rs`) returns it as numbers for agents.
| Item | What |
|---|---|
| `Signal` | a frame's R'G'B' code values, decimated by nearest-sample picking to at most 480 × 270 (`from_rgba8`, `from_rgba_f32_with` + `linear_to_pq` for HDR, `from_fn`) |
| `waveform` | RGB / Luma / YC / YC no Chroma: one count grid per trace (columns = signal width, `rows` levels) |
| `parade` | RGB / YUV / RGB-White traces (drawn side by side) |
| `histogram` | 256 bins of R', G', B', Y'; samples below 0 / above 1 counted separately |
| `vectorscope_yuv` | Cb right, Cr up, ±0.6; `targets(matrix, amplitude)` gives the six colour-bar targets, `SKIN_TONE_DEG` = 123° |
| `vectorscope_hls` | hue as the angle (red at the matrix's YUV red angle, then yellow, green, cyan, blue, magenta counter-clockwise), HLS saturation as the radius |
| `summary` | levels (min / max / mean in percent) per channel and per column range, densest vectorscope cells with angle and magnitude, coarse vectorscope |
| `paint` | count grids → premultiplied RGBA8 (log intensity, additive traces, Brightness gain; vectorscope points spread over 3 × 3) |
Settings types (all serde, camelCase): `ScopeKind`, `WaveformType`, `ParadeType`, `ColorSpace`
(Automatic / Rec. 601 / Rec. 709 / Rec. 2100 → BT.601 / BT.709 / BT.2020 NCL matrices),
`Scale` (8 Bit / Float / HDR), `Brightness`, `Targets` (75 % / 100 %).
## Definitions
- Y'CbCr from R'G'B' with the matrix's Kr/Kb (ITU-R BT.601-7, BT.709-6, BT.2020-2 NCL), Cb and Cr in
−0.5…0.5; YC chroma amplitude = √(Cb² + Cr²), plotted at Y' ± C.
- Waveform rows span 0…1 with Clamp Signal (values clamped first) or −0.1…1.1 without (values
outside are dropped). With 256 rows an 8-bit code value `c` lands on row `c`.
- HDR: linear working values (1.0 = 203 cd/m², BT.2408) → SMPTE ST 2084 PQ code values; the axis is
0…10 000 cd/m². SDR frames on the HDR scale use BT.1886 (γ 2.4, 100 cd/m² white).
## Tests
`src/tests.rs` uses generated frames with known values: a flat colour lands in exact histogram bins;
a 256-step ramp fills every bin and puts column `x` on row `x`; 75 % colour bars put each parade
column on its code value and each bar on its vectorscope target cell (BT.601, BT.709, BT.2020), with
the centre holding white + black; BT.709 red sits at (103, 21) on the 255² grid and 102.91°
(BT.601: 108.65°); HLS hues land at red + 60° steps on the outer ring; YC chroma brackets luma;
Clamp Signal; decimation; NaN and empty frames; summaries; painting.
## Speed
`cargo test --release -p filmcraft-scopes perf -- --ignored --nocapture` (1920×1080 RGBA8 noise,
Apple M4 Pro, one thread, machine shared with other builds):
| Step | ms |
|---|---|
| decimate 1080p → 480 × 270 | 0.30 |
| waveform RGB / YC | 0.75 / 0.88 |
| parade RGB-White | 0.67 |
| histogram | 0.35 |
| vectorscope YUV / HLS | 0.67 / 0.81 |
Every scope is well under the 3 ms budget; the UI recomputes only when the frame or a setting changes.