Skip to main content

Crate ffcine_hooks

Crate ffcine_hooks 

Source
Expand description

.hook shaders (roadmap step 9, docs/design.md#roadmap, docs/hooks.md): mpv user shaders run in the libplacebo grade pass through pl_mpv_user_shader_parse, as ffcine_render::Hooks with their //!PARAMs set from the timeline.

  • Vendored: ADAPTIVE_SHARPEN (BSD-2-Clause, header kept), the default sharpen, replacing the generated unsharp hook (ffcine_render::shaders::unsharp), which stays for prototype diffs (Sharpen::Unsharp); ArtCNN’s luma doublers (ARTCNN_C4F16, MIT).
  • Not vendored (GPL/LGPL): KrigBilateral and FSRCNNX are known by name (EXTERNAL) and loaded from user-supplied files on the shader path (shader_path).
  • Timeline: ffcine.fx.shader/1 {shader, params} with shader an alias in metadata.ffcine.project.shaders, a vendored name or a path; params constants or keyframes (shader).
  • Order: order sorts a grade’s hooks by stage, then geometry, sharpen, user shaders and the review overlay within a stage.

Our own filters (denoise, grain) are compute passes in ffcine-filters instead.

Re-exports§

pub use parse::HookInfo;
pub use parse::ParamInfo;
pub use parse::ParamKind;
pub use parse::parse;
pub use shader::ShaderEffect;

Modules§

grade
A resolved timeline grade (GradeParams) as a GPU Grade: the grade LUT mixed by lut_strength, the post-LUT look hook, extra filters as hooks, rgb_gain and sharpen. Shared by timeline shots (ffcine render, looks, still) and comp layers’ grade, so the same grade renders the same pixels in both.
parse
Just enough of the mpv .hook format to check a shader before libplacebo sees it: the stages it hooks and its //!PARAMs (name, type, bounds, default).
shader
ffcine.fx.shader/1 {shader, params}: an mpv .hook shader on a clip, its //!PARAMs set from the timeline.

Structs§

External
A shader known by name whose licence keeps it out of ffcine (Apache-2.0): the user downloads file from url into a shader_path directory.

Enums§

Sharpen
Which sharpener a sharpen amount drives.

Constants§

ADAPTIVE_SHARPEN
bacondither’s Adaptive-sharpen (mpv port by igv) at PREOUTPUT, with curve_height and overshoot_ctrl as //!PARAMs. Licence: BSD-2-Clause (header in the file).
ARTCNN_C4F16
ArtCNN C4F16 (Artoriuz), a CNN luma doubler at LUMA: runs when the output is more than 1.3x the source on both axes. Licence: MIT (header in the file, shaders/LICENSE-ArtCNN).
ARTCNN_C4F16_DS
ARTCNN_C4F16 trained to also denoise and sharpen.
EXTERNAL
Shaders loaded by name from the shader_path, not shipped.
SHARPEN_HOOK

Functions§

external
The EXTERNAL shader name’s path and text, from the first of dirs holding its file. None if name isn’t external; an error naming the download if no directory has it.
named
A shader by name, vendored or EXTERNAL (on the shader_path), as a Hook named after it. None if the name is neither.
order
Sorts hooks by their first stage (parse::STAGES), then by role; stable otherwise. libplacebo runs each hook at its own stage regardless, so this only decides the order of hooks sharing a stage, and makes the array read in pipeline order.
retarget_output
Moves //!HOOK OUTPUT passes to PREOUTPUT. mpv runs OUTPUT on RGB; libplacebo runs it after encoding to the target’s colour system, which for ffcine’s YUV outputs is YCbCr, so an RGB shader there would sharpen chroma and tint the picture. PREOUTPUT is the RGB stage mpv shaders expect.
shader_path
Directories searched for EXTERNAL shaders: FFCINE_SHADER_PATH (:-separated), then $XDG_DATA_HOME/ffcine/shaders (default ~/.local/share/ffcine/shaders).
sharpen
Sets grade’s sharpening to amount (0 = off) with kind, replacing any earlier one.
vendored
Vendored shaders by name.