pub struct Grade {Show 24 fields
pub input_color: ColorOverride,
pub input_lut: Option<LutStage>,
pub lut: Option<LutStage>,
pub rgb_gain: Option<[f32; 3]>,
pub tone_mapping: ToneMapping,
pub gamut_mapping: GamutMapping,
pub color_map: ColorMapTuning,
pub peak_detect: bool,
pub deband: Option<Deband>,
pub dither: Option<Dither>,
pub crop: Option<Crop>,
pub warp: Option<Warp>,
pub crops: Vec<Crop>,
pub place: Option<Crop>,
pub border: Border,
pub size: Option<Size>,
pub scaling: Scaling,
pub sharpen: f32,
pub hooks: Vec<Hook>,
pub shaders: Vec<PathBuf>,
pub denoise: Option<Denoise>,
pub grain: Option<Grain>,
pub output: ColorSpace,
pub output_hdr: Option<HdrMetadata>,
}Expand description
One libplacebo render pass: colour conversion (incl. tone and gamut mapping), crop/scale, LUT
and user shaders, ending in output.
Fields§
§input_color: ColorOverrideSource colour tags to override before anything else.
input_lut: Option<LutStage>Camera LUT (log -> Rec.709, ffcine_core::camera) on the source. With one set, lut
moves to the output side (libplacebo’s target LUT), so it grades the converted picture.
lut: Option<LutStage>§rgb_gain: Option<[f32; 3]>Per-channel gain on the decoded source RGB ahead of every LUT, clamped to 0..1 (ffmpeg’s
colorchannelmixer rr:gg:bb before lut3d). Folded into the first (normalized) LUT, or
an identity one without.
tone_mapping: ToneMapping§gamut_mapping: GamutMapping§color_map: ColorMapTuning§peak_detect: boolMeasure the HDR peak per frame (pl_peak_detect) instead of trusting metadata.
deband: Option<Deband>None disables debanding.
dither: Option<Dither>None truncates to the output depth.
crop: Option<Crop>§warp: Option<Warp>Stabilization warp, before the crop.
crops: Vec<Crop>Per-output-frame source crops, overriding crop: frame i uses crops[i], the last one
holds past the end (keyframed punch-ins, pushes, pans and aspect windows).
place: Option<Crop>Where the picture lands in the output, in output pixels (fit: contain); the rest of the
frame is black. None fills the frame.
border: BorderWhat fills the frame around a placed picture.
size: Option<Size>None keeps the input size.
scaling: Scaling§sharpen: f32ffmpeg unsharp=5:5:amount equivalent, after the LUT (see crate::shaders::unsharp).
hooks: Vec<Hook>Inline mpv .hook shaders (generated or vendored, see ffcine-hooks), after sharpen
and before shaders. libplacebo runs each at the stage it hooks; within a stage they run in
this order.
shaders: Vec<PathBuf>Extra mpv .hook shader files, applied in order.
denoise: Option<Denoise>Temporal + spatial denoise on the decoded planes, before the pass (ffcine-filters).
grain: Option<Grain>Film grain on the graded output (ffcine-filters).
output: ColorSpace§output_hdr: Option<HdrMetadata>HDR deliverable metadata, with a PQ or HLG output: libplacebo maps to its peak, and it
goes out as the stream’s mastering display and content light levels. The source’s own HDR
side data and Dolby Vision RPU never reach the output.
Implementations§
Source§impl Grade
impl Grade
Sourcepub fn merge_luts(&mut self)
pub fn merge_luts(&mut self)
Bakes a camera LUT and a normalized grade LUT into one source LUT (crate::bake), so
the grade LUT runs before the look hooks, as it does without a camera LUT, instead of on
the target after them. The lattice is the larger of the two, at least 33.
Sourcepub fn same_frame(&self, a: usize, b: usize) -> bool
pub fn same_frame(&self, a: usize, b: usize) -> bool
Whether frames a and b of this pass over an unchanging input (a still) render the
same pixels: the same crop and hook values, and nothing that moves by itself from frame
to frame (a warp, temporal dither, grain, a hook reading the frame index, shader files).
The renderer then reuses the layer’s texture instead of rendering it again.