Skip to main content

Module extra

Module extra 

Source
Expand description

A grade’s raw ffmpeg filters (extra, after the grade) as GPU hooks: the colour filters the prototype’s edits use, parsed from ffmpeg’s filter syntax (name=k=v:k=v, positional arguments, comma-separated chains) and run as PREOUTPUT hooks in chain order, so nothing falls back to the CPU.

Supported: eq (contrast, brightness, saturation, gamma, gamma_r/g/b, gamma_weight), hue (h, s, H, b), colorbalance (rs..bh, pl), curves (preset, master/red/green/blue/all point lists, natural spline), unsharp (luma and chroma sizes and amounts), vignette (angle) and colorlevels (per-channel input and output black and white points). eq, hue and unsharp work on BT.601 limited-range YUV code values, as ffmpeg’s auto-inserted conversion from RGB gives them; vignette and colorlevels work on RGB. hooks reports anything else and doesn’t apply it; strict_hooks and filter_hook (comp layers’ filters) refuse it. colorlevels is layer-only for now: hooks (timeline extra, whose cache keys predate it) still skips it.

Structs§

Curves
curves as per-channel tables over 0..=1 with the master curve folded in.
Filter
One filter of a chain: its name and arguments, (None, value) for positional ones.

Constants§

CURVE_SAMPLES
Samples per channel of a Curves table.

Functions§

colorbalance
ffmpeg’s colorbalance: shadows/midtones/highlights offsets per channel weighted by the input’s max + min (ffmpeg’s weights, see crate::shaders::look), and with pl ffmpeg’s lightness preservation (HSL, at the input’s lightness).
colorlevels
ffmpeg’s colorlevels on RGB: per channel (v − imin) / (imax − imin) · (omax − omin) + omin, clamped to 0..1.
eq
ffmpeg’s eq on BT.601 code values: per plane v = k (v − ½) + ½ + b (luma: contrast and brightness; chroma: saturation), then v (1 − w) + v^(1/gamma) w, 0 below 0, 1 above.
eval
Evaluates a constant ffmpeg expression: numbers, PI, PHI, E, + - * /, parentheses.
filter_hook
One filter’s hook; an error if it isn’t supported, or any of its options isn’t.
hooks
The hooks for a grade’s extra filter strings, in order, and what isn’t applied.
hue
ffmpeg’s hue: chroma rotated by hue radians and scaled by sat, luma code values moved by bright × 25.5 / 255.
parse
Parses a filter chain (eq=contrast=1.1:saturation=0.9,hue=s=0). Link labels ([in]) are dropped; graphs (;) are an error.
strict_hooks
The hooks for filter chains, in order; an error for anything hooks would skip or warn about (comp layers’ filters: never silently dropped).
unsharp
ffmpeg’s unsharp with luma lx x ly and chroma cx x cy matrices (sizes), the binomial blur ffmpeg’s repeated [1 2 1] passes give, amounts luma and chroma as params: luma on BT.601 Y (the same delta on R, G and B), chroma on the rest of the pixel.
vignette
ffmpeg’s vignette: RGB times cos(angle · d)^4, d the distance from the middle over the half diagonal.