Skip to main content

Grade

Struct Grade 

Source
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: ColorOverride

Source 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: bool

Measure 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: Border

What fills the frame around a placed picture.

§size: Option<Size>

None keeps the input size.

§scaling: Scaling§sharpen: f32

ffmpeg 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

Source

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.

Source

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.

Source

pub fn crop_at(&self, i: usize) -> Option<Crop>

The source crop for output frame i: crops[i] (the last one past the end), else crop.

Trait Implementations§

Source§

impl Clone for Grade

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Grade

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Grade

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Grade

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Grade

Auto Trait Implementations§

§

impl Forget for Grade

§

impl Freeze for Grade

§

impl RefUnwindSafe for Grade

§

impl Send for Grade

§

impl Sync for Grade

§

impl Unpin for Grade

§

impl UnsafeUnpin for Grade

§

impl UnwindSafe for Grade

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.