Skip to content

Asd-g/avslibplacebo

Repository files navigation

Description

An AviSynth+ plugin interface to libplacebo - a reusable library for GPU-accelerated image/video processing primitives and shaders.

This is a port of the VapourSynth plugin vs-placebo.

Requirements:

  • Vulkan device

  • AviSynth+ r3688 (can be downloaded from here until official release is uploaded) or later

  • Microsoft VisualC++ Redistributable Package 2022 (can be downloaded from here)

Filters

Debanding
Resampling
Shader
Tone mapping

Debanding

Usage:

libplacebo_Deband(clip input, int "iterations", float "threshold", float "radius", float "grainY", float "grainC", int "dither", int "lut_size", bool "temporal", int[] "planes", int "device", bool "list_device", float[] "grain_neutral")

Parameters:

  • input
    A clip to process.
    It must be in 8, 16 or 32-bit planar format.

  • iterations
    The number of debanding steps to perform per sample.
    Each step reduces a bit more banding, but takes time to compute.
    Note that the strength of each step falls off very quickly, so high numbers (>4) are practically useless.
    Must be greater than or equal to 0.
    Default: 1.

  • threshold
    The debanding filter's cut-off threshold.
    Higher numbers increase the debanding strength dramatically, but progressively diminish image details.
    Must be greater than or equal to 0.0.
    Default: 4.0.

  • radius
    The debanding filter's initial radius.
    The radius increases linearly for each iteration.
    A higher radius will find more gradients, but a lower radius will smooth more aggressively.
    Must be radius must be greater than or equal to 0.0.
    Default: 16.0.

  • grainY, grainC
    Add some extra noise respectively to the luma and chroma plane.
    This significantly helps cover up remaining quantization artifacts.
    Higher numbers add more noise.
    Note: When debanding HDR sources, even a small amount of grain can result in a very big change to the brightness level.
    It's recommended to either scale this value down or disable it entirely for HDR.
    Must be greater than or equal to 0.0.
    When the clip is RGB, grainC doesn't have effect.
    Default: grainY = 6.0; grainC = grainY.

  • dither
    It's valid only for 8-bit clips.
    0: Disabled.

    1: PL_DITHER_BLUE_NOISE
    Dither with blue noise.
    Very high quality, but requires the use of a LUT.
    Warning: Computing a blue noise texture with a large size can be very slow, however this only needs to be performed once. Even so, using this with a lut_size greater than 6 is generally ill-advised.

    2: PL_DITHER_ORDERED_LUT
    Dither with an ordered (bayer) dither matrix, using a LUT.
    Low quality, and since this also uses a LUT, there's generally no advantage to picking this instead of PL_DITHER_BLUE_NOISE.
    It's mainly there for testing.

    3: PL_DITHER_ORDERED_FIXED
    The same as PL_DITHER_ORDERED_LUT, but uses fixed function math instead of a LUT.
    This is faster, but only supports a fixed dither matrix size of 16x16 (equal to a lut_size of 4).

    4: PL_DITHER_WHITE_NOISE
    Dither with white noise.
    This does not require a LUT and is fairly cheap to compute.
    Unlike the other modes it doesn't show any repeating patterns either spatially or temporally, but the downside is that this is visually fairly jarring due to the presence of low frequencies in the noise spectrum.

    Default: 1.

  • lut_size
    For the dither methods which require the use of a LUT.
    This controls the size of the LUT (base 2).
    Must be less than or equal to 8.
    Default: 6 (64x64).

  • temporal
    Enables temporal dithering.
    his reduces the persistence of dithering artifacts by perturbing the dithering matrix per frame.
    Warning: This can cause nasty aliasing artifacts on some LCD screens.
    Default: False.

  • planes
    Planes to process.
    1: Return garbage.
    2: Copy plane.
    3: Process plane. Always process planes when the clip is RGB.
    Format is [y, u, v].
    Default: [3, 2, 2].

  • device
    Sets target Vulkan device.
    Use list_device to get the index of the available devices.
    By default the default device is selected.

  • list_device
    Whether to draw the devices list on the frame.
    Default: False.

  • grain_neutral
    "Neutral" grain value for each channel being debanded.
    Grain application will be modulated to avoid disturbing colors close to this value.
    Set this to a value corresponding to black in the relevant colorspace.
    Must be greater than 0.0
    Default: [0, 0, 0].

Back to filters

Resampling

Usage:

libplacebo_Resample(clip input, int width, int height, string "filter", float "radius", float "clamp", float "taper", float "blur", float "param1", float "param2", float "sx", float "sy", float "antiring", bool "sigmoidize", bool "linearize", float "sigmoid_center", float "sigmoid_slope", int "trc", int "cplace", int "device", bool "list_device", float "src_width", float "src_height")

Parameters:

  • input
    A clip to process.
    It must be in 8, 16 or 32-bit planar format.

  • width
    The width of the output.

  • height
    The height of the output.

  • filter The used filter function.

    • spline16 (2 taps)
    • spline36 (3 taps)
    • spline64 (4 taps)
    • nearest (AKA box)
    • bilinear (AKA triangle) (resizable)
    • gaussian (resizable)

    Sinc family (all configured to 3 taps):

    • sinc (unwindowed) (resizable)
    • lanczos (sinc-sinc) (resizable)
    • ginseng (sinc-jinc) (resizable)
    • ewa_jinc (unwindowed) (resizable)
    • ewa_lanczos (jinc-jinc) (resizable)
    • ewa_lanczossharp (jinc-jinc) (resizable)
    • ewa_lanczos4sharpest (jinc-jinc) (resizable)
    • ewa_ginseng (jinc-sinc) (resizable)
    • ewa_hann (jinc-hann) (resizable)
    • ewa_hanning (ewa_hann alias)

    Spline family:

    • bicubic
    • triangle (bicubic alias)
    • hermite
    • catmull_rom
    • mitchell
    • mitchell_clamp
    • robidoux
    • robidouxsharp
    • ewa_robidoux
    • ewa_robidouxsharp

    Default: ewa_lanczos

  • radius
    It may be used to adjust the function's radius.
    Defaults to the the radius needed to represent a single filter lobe (tap).
    If the function is not resizable, this doesn't have effect.
    Must be between 0.0..16.0.

  • clamp
    Represents a clamping coefficient for negative weights:
    0.0: No clamping.
    1.0: Full clamping, i.e. all negative weights will be clamped to 0.
    Values between 0.0 and 1.0 can be specified to apply only a moderate diminishment of negative weights.
    Higher values would lead to more blur.
    Default: 0.0.

  • taper
    Additional taper coefficient.
    This essentially flattens the function's center.
    The values within [-taper, taper] will return 1.0, with the actual function being squished into the remainder of [taper, radius].
    Must be between 0.0..1.0.
    Default: 0.0.

  • blur
    Additional blur coefficient.
    This effectively stretches the kernel, without changing the effective radius of the filter radius.
    Values significantly below 1.0 may seriously degrade the visual output, and should be used with care.
    Must be between 0.0..100.0.
    Default: 0.0.

  • param1, param2
    These may be used to adjust the function.
    Defaults to the function's preferred defaults. if the relevant setting is not tunable, they are ignored entirely.

  • sx
    Cropping of the left edge.
    Default: 0.0.

  • sy
    Cropping of the top edge.
    Default: 0.0.

  • antiring
    Antiringing strength.
    A value of 0.0 disables antiringing, and a value of 1.0 enables full-strength antiringing.
    Only relevant for separated/orthogonal filters.
    Default: 0.0.

  • sigmoidize, linearize
    Whether to linearize/sigmoidize before scaling.
    Only relevant for RGB formats.
    When sigmodizing, linearize should be true
    Default: True.

  • sigmoid_center
    The center (bias) of the sigmoid curve.
    Must be between 0.0 and 1.0.
    Default: 0.75.

  • sigmoid_slope
    The slope (steepness) of the sigmoid curve.
    Must be between 1.0 and 20.0.
    Default: 6.5.

  • trc
    The colorspace's transfer function (gamma / EOTF) to use for linearizing.
    0: UNKNOWN

    Standard dynamic range:
    1: BT_1886 (ITU-R Rec. BT.1886 (CRT emulation + OOTF))
    2: SRGB (IEC 61966-2-4 sRGB (CRT emulation))
    3: LINEAR (Linear light content)
    4: GAMMA18 (Pure power gamma 1.8)
    5: GAMMA20 (Pure power gamma 2.0)
    6: GAMMA22 (Pure power gamma 2.2)
    7: GAMMA24 (Pure power gamma 2.4)
    8: GAMMA26 (Pure power gamma 2.6)
    9: GAMMA28 (Pure power gamma 2.8)
    10: PRO_PHOTO (ProPhoto RGB (ROMM))
    11: ST428 (Digital Cinema Distribution Master (XYZ))

    High dynamic range:
    12: PQ (ITU-R BT.2100 PQ (perceptual quantizer), aka SMPTE ST2048)
    13: HLG (ITU-R BT.2100 HLG (hybrid log-gamma), aka ARIB STD-B67)
    14: V_LOG (Panasonic V-Log (VARICAM))
    15: S_LOG1 (Sony S-Log1)
    16: S_LOG2 (Sony S-Log2)

    Default: 1.

  • cplace
    Chroma sample position in YUV formats.
    0: left
    1: center
    2: topleft
    Default: 0.

  • device
    Sets target Vulkan device.
    Use list_device to get the index of the available devices.
    By default the default device is selected.

  • list_device
    Whether to draw the devices list on the frame.
    Default: False.

  • src_width
    Sets the width of the clip before resizing.
    Must be greater than 0.0.
    Default: Source width.

  • src_height
    Sets the height of the clip before resizing.
    Must be greater than 0.0.
    Default: Source height.

Back to filters

Shader

Usage:

libplacebo_Shader(clip input, string shader, int "width", int "height", int "chroma_loc", int "matrix", int "trc",  string "filter", float "radius", float "clamp", float "taper", float "blur", float "param1", float "param2", float "antiring", bool "sigmoidize", bool "linearize", float "sigmoid_center", float "sigmoid_slope", string "shader_param", int "device", bool "list_device")

Parameters:

  • input
    A clip to process.
    It must be YUV 16-bit planar format.
    The output is YUV444P16. This is necessitated by the fundamental design of libplacebo/mpv’s custom shader feature: the shaders aren’t meant (nor written) to be run by themselves, but to be injected at arbitrary points into a rendering pipeline with RGB output.
    As such, the user needs to specify the output frame properties, and libplacebo will produce a conforming image, only running the supplied shader if the texture it hooks into is actually rendered. For example, if a shader hooks into the LINEAR texture, it will only be executed when linearize = true.

  • shader
    Path to the shader file.

  • width
    The width of the output.
    Default: Source width.

  • height
    The height of the output.
    Default: Source height.

  • chroma_loc
    Chroma location to derive chroma shift from.
    0: UNKNOWN
    1: LEFT
    2: CENTER
    3: TOP_LEFT
    4: TOP_CENTER
    5: BOTTOM_LEFT
    6: BOTTOM_CENTER
    Default: 1.

  • matrix
    0: UNKNOWN
    1: BT_601 (ITU-R Rec. BT.601 (SD))
    2: BT_709 (ITU-R Rec. BT.709 (HD))
    3: SMPTE_240M (SMPTE-240M)
    4: BT_2020_NC (ITU-R Rec. BT.2020 (non-constant luminance))
    5: BT_2020_C (ITU-R Rec. BT.2020 (constant luminance))
    6: BT_2100_PQ (ITU-R Rec. BT.2100 ICtCp PQ variant)
    7: BT_2100_HLG (ITU-R Rec. BT.2100 ICtCp HLG variant)
    8: YCGCO (YCgCo (derived from RGB)) Default: 2.

  • trc
    The colorspace's transfer function (gamma / EOTF) to use for linearizing.
    0: UNKNOWN

    Standard dynamic range:
    1: BT_1886 (ITU-R Rec. BT.1886 (CRT emulation + OOTF))
    2: SRGB (IEC 61966-2-4 sRGB (CRT emulation))
    3: LINEAR (Linear light content)
    4: GAMMA18 (Pure power gamma 1.8)
    5: GAMMA20 (Pure power gamma 2.0)
    6: GAMMA22 (Pure power gamma 2.2)
    7: GAMMA24 (Pure power gamma 2.4)
    8: GAMMA26 (Pure power gamma 2.6)
    9: GAMMA28 (Pure power gamma 2.8)
    10: PRO_PHOTO (ProPhoto RGB (ROMM))
    11: ST428 (Digital Cinema Distribution Master (XYZ))

    High dynamic range:
    12: PQ (ITU-R BT.2100 PQ (perceptual quantizer), aka SMPTE ST2048)
    13: HLG (ITU-R BT.2100 HLG (hybrid log-gamma), aka ARIB STD-B67)
    14: V_LOG (Panasonic V-Log (VARICAM))
    15: S_LOG1 (Sony S-Log1)
    16: S_LOG2 (Sony S-Log2)

    Default: 1.

  • filter The used filter function.

    • spline16 (2 taps)
    • spline36 (3 taps)
    • spline64 (4 taps)
    • nearest (AKA box)
    • bilinear (AKA triangle) (resizable)
    • gaussian (resizable)

    Sinc family (all configured to 3 taps):

    • sinc (unwindowed) (resizable)
    • lanczos (sinc-sinc) (resizable)
    • ginseng (sinc-jinc) (resizable)
    • ewa_jinc (unwindowed) (resizable)
    • ewa_lanczos (jinc-jinc) (resizable)
    • ewa_lanczossharp (jinc-jinc) (resizable)
    • ewa_lanczos4sharpest (jinc-jinc) (resizable)
    • ewa_ginseng (jinc-sinc) (resizable)
    • ewa_hann (jinc-hann) (resizable)
    • ewa_hanning (ewa_hann alias)

    Spline family:

    • bicubic
    • triangle (bicubic alias)
    • hermite
    • catmull_rom
    • mitchell
    • mitchell_clamp
    • robidoux
    • robidouxsharp
    • ewa_robidoux
    • ewa_robidouxsharp

    Default: ewa_lanczos

  • radius
    It may be used to adjust the function's radius.
    Defaults to the the radius needed to represent a single filter lobe (tap).
    If the function is not resizable, this doesn't have effect.
    Must be between 0.0..16.0.

  • clamp
    Represents a clamping coefficient for negative weights:
    0.0: No clamping.
    1.0: Full clamping, i.e. all negative weights will be clamped to 0.
    Values between 0.0 and 1.0 can be specified to apply only a moderate diminishment of negative weights.
    Higher values would lead to more blur.
    Default: 0.0.

  • taper
    Additional taper coefficient.
    This essentially flattens the function's center.
    The values within [-taper, taper] will return 1.0, with the actual function being squished into the remainder of [taper, radius].
    Must be between 0.0..1.0.
    Default: 0.0.

  • blur
    Additional blur coefficient.
    This effectively stretches the kernel, without changing the effective radius of the filter radius.
    Values significantly below 1.0 may seriously degrade the visual output, and should be used with care.
    Must be between 0.0..100.0.
    Default: 0.0.

  • param1, param2
    These may be used to adjust the function.
    Defaults to the function's preferred defaults. if the relevant setting is not tunable, they are ignored entirely.

  • antiring
    Antiringing strength.
    A value of 0.0 disables antiringing, and a value of 1.0 enables full-strength antiringing.
    Only relevant for separated/orthogonal filters.
    Default: 0.0.

  • sigmoidize, linearize
    Whether to linearize/sigmoidize before scaling.
    Only relevant for RGB formats.
    When sigmodizing, linearize should be true
    Default: True.

  • sigmoid_center
    The center (bias) of the sigmoid curve.
    Must be between 0.0 and 1.0.
    Default: 0.75.

  • sigmoid_slope
    The slope (steepness) of the sigmoid curve.
    Must be between 1.0 and 20.0.
    Default: 6.5.

  • shader_param
    This changes shader's parameter set by #define XXXX YYYY on the fly.
    Format is: param=value.
    The parameter is case sensitive and must be the same as in the shader file.
    If more than one parameter is specified, the parameters must be separated by space.

    Usage example: if the shader has the following parameters:

    • #define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
    • #define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number

    shader_param="INTENSITY_SIGMA=0.15 SPATIAL_SIGMA=1.1"

  • device
    Sets target Vulkan device.
    Use list_device to get the index of the available devices.
    By default the default device is selected.

  • list_device
    Whether to draw the devices list on the frame.
    Default: False.

Back to filters

Tone mapping

Usage:

libplacebo_Tonemap(clip input, int "src_csp", float "dst_csp", float "src_max", float "src_min", float "dst_max", float "dst_min", bool "dynamic_peak_detection", float "smoothing_period", float "scene_threshold_low", float "scene_threshold_high", float "percentile", float "black_cutoff", string "gamut_mapping_mode", string "tone_mapping_function", string[] "tone_constants", int "metadata", float "contrast_recovery", float "contrast_smoothness", bool "visualize_lut", bool "show_clipping", bool "use_dovi", int "device", bool "list_device", string "cscale", string "lut", int "lut_type", int "dst_prim", int "dst_trc", int "dst_sys")

Parameters:

  • input
    A clip to process.
    It must be 16-bit planar format. (min. 3 planes)
    The output is YUV444P16 if the input is YUV.

  • src_csp, dst_csp
    Respectively source and output color space.
    0: SDR
    1: HDR10
    2: HLG
    3: DOVI
    Default: src_csp = 1; dst_csp = 0.

    For example, to map from [BT.2020, PQ] (HDR) to traditional [BT.709, BT.1886] (SDR), pass src_csp=1, dst_csp=0.

  • src_max, src_min, dst_max, dst_min
    Source max/min and output max/min in nits (cd/m^2).
    The source values can be derived from props if available.
    Default: max = 1000 (HDR)/203 (SDR); min = 0.005 (HDR)/0.2023 (SDR)

  • dynamic_peak_detection
    Enables computation of signal stats to optimize HDR tonemapping quality.
    Default: True.

  • smoothing_period
    Smoothing coefficient for the detected values.
    This controls the time parameter (tau) of an IIR low pass filter. In other words, it represent the cutoff period (= 1 / cutoff frequency) in frames. Frequencies below this length will be suppressed.
    This helps block out annoying "sparkling" or "flickering" due to small variations in frame-to-frame brightness.
    Default: 20.0.

  • scene_threshold_low, scene_threshold_high
    In order to avoid reacting sluggishly on scene changes as a result of the low-pass filter, we disable it when the difference between the current frame brightness and the average frame brightness exceeds a given threshold difference.
    But rather than a single hard cutoff, which would lead to weird discontinuities on fades, we gradually disable it over a small window of brightness ranges. These parameters control the lower and upper bounds of this window, in dB.
    To disable this logic entirely, set either one to a negative value.
    Default: scene_threshold_low = 1.0; scene_threshold_high = 3.0

  • percentile
    Which percentile of the input image brightness histogram to consider as the true peak of the scene.
    If this is set to 100 (or 0), the brightest pixel is measured. Otherwise, the top of the frequency distribution is progressively cut off.
    Setting this too low will cause clipping of very bright details, but can improve the dynamic brightness range of scenes with very bright isolated highlights.
    The default of 99.995% is very conservative and should cause no major issues in typical content.

  • black_cutoff
    Black cutoff strength.
    To prevent unnatural pixel shimmer and excessive darkness in mostly black scenes, as well as avoid black bars from affecting the content, (smoothly) cut off any value below this (PQ%) threshold.
    Setting this to 0.0 (or a negative value) disables this functionality.
    Default: 1.0 (1% PQ).

  • gamut_mapping_mode
    Specifies the algorithm used for reducing the gamut of images for the target display, after any tone mapping is done.

    • clip: Hard-clip to the gamut (per-channel). Very low quality, but free.

    • perceptual: Performs a perceptually balanced gamut mapping using a soft knee function to roll-off clipped regions, and a hue shifting function to preserve saturation.

    • softclip: Performs a perceptually balanced gamut mapping using a soft knee function to roll-off clipped regions, and a hue shifting function to preserve saturation.

    • relative: Performs relative colorimetric clipping, while maintaining an exponential relationship between brightness and chromaticity.

    • saturation: Performs simple RGB->RGB saturation mapping. The input R/G/B channels are mapped directly onto the output R/G/B channels. Will never clip, but will distort all hues and/or result in a faded look.

    • absolute: Performs absolute colorimetric clipping. Like relative, but does not adapt the white point.

    • desaturate: Performs constant-luminance colorimetric clipping, desaturing colors towards white until they're in-range.

    • darken: Uniformly darkens the input slightly to prevent clipping on blown-out highlights, then clamps colorimetrically to the input gamut boundary, biased slightly to preserve chromaticity over luminance.

    • highlight: Performs no gamut mapping, but simply highlights out-of-gamut pixels.

    • linear: Linearly/uniformly desaturates the image in order to bring the entire image into the target gamut.

    Default: perceptual.

  • tone_mapping_function

    • clip: Performs no tone-mapping, just clips out-of-range colors.
      Retains perfect color accuracy for in-range colors but completely destroys out-of-range information.
      Does not perform any black point adaptation.

    • st2094-40: EETF from SMPTE ST 2094-40 Annex B, which uses the provided OOTF based on Bezier curves to perform tone-mapping.
      The OOTF used is adjusted based on the ratio between the targeted and actual display peak luminances.
      In the absence of HDR10+ metadata, falls back to a simple constant bezier curve.

    • st2094-10: EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal average luminance in addition to the maximum/minimum.
      Note: This does not currently include the subjective gain/offset/gamma controls defined in Annex B.3.

    • bt2390: EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear segment.

    • bt2446a: EETF from ITU-R Report BT.2446, method A.
      Can be used for both forward and inverse tone mapping.

    • spline: Simple spline consisting of two polynomials, joined by a single pivot point.
      Simple spline consisting of two polynomials, joined by a single pivot point, which is tuned based on the source scene average brightness (taking into account HDR10+ metadata if available).
      This function can be used for both forward and inverse tone mapping.

    • reinhard: Very simple non-linear curve.
      Named after Erik Reinhard.

    • mobius: Generalization of the reinhard tone mapping algorithm to support an additional linear slope near black.
      The name is derived from its function shape (ax+b)/(cx+d), which is known as a Möbius transformation.
      This function is considered legacy/low-quality, and should not be used.

    • hable: Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
      Popularized by its use in video games with HDR rendering.
      Preserves both dark and bright details very well, but comes with the drawback of changing the average brightness quite significantly.
      This is sort of similar to reinhard with reinhard_contrast=0.24.
      This function is considered legacy/low-quality, and should not be used.

    • gamma: Fits a gamma (power) function to transfer between the source and target color spaces, effectively resulting in a perceptual hard-knee joining two roughly linear sections.
      This preserves details at all scales fairly accurately, but can result in an image with a muted or dull appearance.
      This function is considered legacy/low-quality and should not be used.

    • linear: Linearly stretches the input range to the output range, in PQ space.
      This will preserve all details accurately, but results in a significantly different average brightness.
      Can be used for inverse tone-mapping in addition to regular tone-mapping.

    • linearlight: Like linear, but in linear light (instead of PQ).
      Works well for small range adjustments but may cause severe darkening when downconverting from e.g. 10k nits to SDR.

    Default: bt2390.

  • tone_constants
    Tone mapping constants for tuning tone_mapping_function.
    Format is tone_constants=["option=xxx", "option1=xxx", "option2=xxx"]. For example, tone_constants=["exposure=0.25"].

    • knee_adaptation: Configures the knee point, as a ratio between the source average and target average (in PQ space).
      An adaptation of 1.0 always adapts the source scene average brightness to the (scaled) target average, while a value of 0.0 never modifies scene brightness.
      Must be between 0.0..1.0.
      Affects all methods that use the ST2094 knee point determination (currently ST2094-40, ST2094-10 and spline).
      Default: 0.4.

    • knee_minimum, knee_maximum: Configures the knee point minimum and maximum, respectively, as a percentage of the PQ luminance range.
      Provides a hard limit on the knee point chosen by knee_adaptation.
      knee_minimum must be between 0.0..0.5.
      knee_maximum must be between 0.5..1.0.
      Default: knee_minimum 0.1; knee_maximum 0.8.

    • knee_default: Default knee point to use in the absence of source scene average metadata.
      Normally, this is ignored in favor of picking the knee point as the (relative) source scene average brightness level.
      Must be between knee_minimum and knee_maximum.
      Default: 0.4.

    • knee_offset: Knee point offset (for BT.2390 only).
      Note that a value of 0.5 is the spec-defined default behavior, which differs from the libplacebo default of 1.0.
      Must be between 0.5..2.0.

    • slope_tuning, slope_offset: For the single-pivot polynomial (spline) function, this controls the coefficients used to tune the slope of the curve.
      This tuning is designed to make the slope closer to 1.0 when the difference in peaks is low, and closer to linear when the difference between peaks is high.
      slope_tuning must be between 0.0..10.0.
      slope_offset must be between 0.0..1.0.
      Default: slope_tuning 1.5; slope_offset 0.2.

    • spline_contrast: Contrast setting for the spline function.
      Higher values make the curve steeper (closer to clip), preserving midtones at the cost of losing shadow/highlight details, while lower values make the curve shallowed (closer to linear), preserving highlights at the cost of losing midtone contrast.
      Values above 1.0 are possible, resulting in an output with more contrast than the input.
      Must be between 0.0..1.5.
      Default: 0.5.

    • reinhard_contrast: For the reinhard function, this specifies the local contrast coefficient at the display peak.
      Essentially, a value of 0.5 implies that the reference white will be about half as bright as when clipping. (0,1). Must be between 0.0..1.0.
      Default: 0.5.

    • linear_knee: For legacy functions (mobius, gamma) which operate on linear light, this directly sets the corresponding knee point.
      Must be between 0.0..1.0
      Default: 0.3.

    • exposure: For linear methods (linear, linearlight), this controls the linear exposure/gain applied to the image.
      Must be between 0.0..10.0.
      Default: 1.0.

  • metadata
    Data source to use when tone-mapping.
    Setting this to a specific value allows overriding the default metadata preference logic.
    0: ANY
    1: NONE
    2: HDR10 (HDR10 static mastering display metadata)
    3: HDR10PLUS (HDR10+ dynamic metadata)
    4: CIE_Y (CIE Y derived dynamic luminance metadata)

  • contrast_recovery
    Contrast recovery strength.
    If set to a value above 0.0, the source image will be divided into high-frequency and low-frequency components, and a portion of the high-frequency image is added back onto the tone-mapped output.
    May cause excessive ringing artifacts for some HDR sources, but can improve the subjective sharpness and detail left over in the image after tone-mapping.
    Must be equal to or greater than 0.0.
    Default: 0.3.

  • contrast_smoothness
    Contrast recovery lowpass kernel size.
    Increasing or decreasing this will affect the visual appearance substantially.
    Must be equal to or greater than 0.0.
    Default: 3.5.

  • visualize_lut
    Visualize the tone-mapping curve / LUT. (PQ-PQ graph)
    Default: False.

  • show_clipping
    Graphically highlight hard-clipped pixels during tone-mapping (i.e. pixels that exceed the claimed source luminance range).
    Note that the difference between this and gamut_mode=1 is that the latter only shows out-of-gamut colors (that are inside the monitor brightness range), while this shows out-of-range colors (regardless of whether or not they're in-gamut).
    Default: False.

  • use_dovi
    Whether to use the Dolby Vision RPU for ST2086 metadata.
    Defaults to true when tonemapping from Dolby Vision.

  • device
    Sets target Vulkan device.
    Use list_device to get the index of the available devices.
    By default the default device is selected.

  • list_device
    Whether to draw the devices list on the frame.
    Default: False.

  • cscale
    The scaler for chroma planes.
    This is used when the input is YUV420/YUV422.

    • spline16 (2 taps)
    • spline36 (3 taps)
    • spline64 (4 taps)
    • nearest (AKA box)
    • bilinear (AKA triangle) (resizable)
    • gaussian (resizable)

    Sinc family (all configured to 3 taps):

    • sinc (unwindowed) (resizable)
    • lanczos (sinc-sinc) (resizable)
    • ginseng (sinc-jinc) (resizable)
    • ewa_jinc (unwindowed) (resizable)
    • ewa_lanczos (jinc-jinc) (resizable)
    • ewa_lanczossharp (jinc-jinc) (resizable)
    • ewa_lanczos4sharpest (jinc-jinc) (resizable)
    • ewa_ginseng (jinc-sinc) (resizable)
    • ewa_hann (jinc-hann) (resizable)
    • ewa_hanning (ewa_hann alias)

    Spline family:

    • bicubic
    • triangle (bicubic alias)
    • hermite
    • catmull_rom
    • mitchell
    • mitchell_clamp
    • robidoux
    • robidouxsharp
    • ewa_robidoux
    • ewa_robidouxsharp

    Default: spline36.

  • lut
    Path to the color mapping LUT.
    If present, this will be applied as part of the image being rendered.
    src_csp and dst_csp should be used to indicate the color spaces.
    Default: not specified.

  • lut_type
    Controls the interpretation of color values fed to and from the LUT.
    1: native (Applied to raw image contents in its native RGB colorspace (non-linear light), before conversion to the output color space.)
    2: normalized (Applied to the normalized RGB image contents, in linear light, before conversion to the output color space.)
    3: conversion (Fully replaces the conversion from the input color space to the output color space. It overrides options related to tone mapping and output colorimetry (dst_prim, dst_trc etc.))
    Default: 3.

  • dst_prim
    Target primaries.
    dst_trc must be also specified.
    dst_csp has no effect.

    Standard gamut:
    1: BT_601_525 (ITU-R Rec. BT.601 (525-line = NTSC, SMPTE-C))
    2: BT_601_625 (ITU-R Rec. BT.601 (625-line = PAL, SECAM))
    3: BT_709 (ITU-R Rec. BT.709 (HD), also sRGB)
    4: BT_470M (ITU-R Rec. BT.470 M)
    5: EBU_3213 (EBU Tech. 3213-E / JEDEC P22 phosphors)
    Wide gamut:
    6: BT_2020 (ITU-R Rec. BT.2020 (UltraHD))
    7: APPLE (Apple RGB)
    8: ADOBE (Adobe RGB (1998))
    9: PRO_PHOTO (ProPhoto RGB (ROMM))
    10: CIE_1931 (CIE 1931 RGB primaries)
    11: DCI_P3 (DCI-P3 (Digital Cinema))
    12: DISPLAY_P3 (DCI-P3 (Digital Cinema) with D65 white point)
    13: V_GAMUT (Panasonic V-Gamut (VARICAM))
    14: S_GAMUT (Sony S-Gamut)
    15: FILM_C (Traditional film primaries with Illuminant C)
    16: ACES_AP0 (ACES Primaries #0 (ultra wide))
    17: ACES_AP1 (ACES Primaries #1)

    Default: not specified.

  • dst_trc
    Target transfer function.
    dst_prim must be also specified.
    dst_csp has no effect.

    Standard dynamic range:
    1: BT_1886 (ITU-R Rec. BT.1886 (CRT emulation + OOTF))
    2: SRGB (IEC 61966-2-4 sRGB (CRT emulation))
    3: LINEAR (Linear light content)
    4: GAMMA18 (Pure power gamma 1.8)
    5: GAMMA20 (Pure power gamma 2.0)
    6: GAMMA22 (Pure power gamma 2.2)
    7: GAMMA24 (Pure power gamma 2.4)
    8: GAMMA26 (Pure power gamma 2.6)
    9: GAMMA28 (Pure power gamma 2.8)
    10: PRO_PHOTO (ProPhoto RGB (ROMM))
    11: ST428 (Digital Cinema Distribution Master (XYZ))
    High dynamic range:
    12: PQ (ITU-R BT.2100 PQ (perceptual quantizer), aka SMPTE ST2048)
    13: HLG (ITU-R BT.2100 HLG (hybrid log-gamma), aka ARIB STD-B67)
    14: V_LOG (Panasonic V-Log (VARICAM))
    15: S_LOG1 (Sony S-Log1)
    16: S_LOG2 (Sony S-Log2)

    Default: not specified.

  • dst_sys
    The underlying color representation.
    This has no effect if both dst_prim and dst_trc are not specified.
    This has effect only for YUV input.
    1: BT_601 (ITU-R Rec. BT.601 (SD))
    2: BT_709 (ITU-R Rec. BT.709 (HD))
    3: SMPTE_240M (SMPTE-240M)
    4: BT_2020_NC (ITU-R Rec. BT.2020 (non-constant luminance))
    5: BT_2020_C (ITU-R Rec. BT.2020 (constant luminance))
    6: BT_2100_PQ (ITU-R Rec. BT.2100 ICtCp PQ variant)
    7: BT_2100_HLG (ITU-R Rec. BT.2100 ICtCp HLG variant)
    8: DOLBYVISION (Dolby Vision (see pl_dovi_metadata))
    9: YCGCO (YCgCo (derived from RGB))
    Default: not specified.

Back to filters

Building:

Requirements:
    - CMake
    - Ninja
    - Vulkan SDK (https://vulkan.lunarg.com/sdk)
    - Clang-cl (https://github.com/llvm/llvm-project/releases) (Windows)
Steps:
    Install Vulkan SDk.

    Clone the repo:
        git clone --recurse-submodules --depth 1 --shallow-submodules https://github.com/Asd-g/avslibplacebo

    Set prefix:
        cd avslibplacebo
        set prefix="%cd%\deps" (Windows)
        prefix="$(pwd)/deps" (Linux)

    Build dolby_vision:
        cd dovi_tool/dolby_vision
        cargo install cargo-c
        cargo cinstall --release --prefix %prefix% (Windows)
        cargo cinstall --release --prefix $prefix (Linux)

    Building libplacebo:
        cd ../../libplacebo
        set LIB=%LIB%;C:\VulkanSDK\1.3.268.0\Lib (Windows)
        meson setup build -Dvulkan-registry=C:\VulkanSDK\1.3.283.0\share\vulkan\registry\vk.xml --default-library=static --buildtype=release -Ddemos=false -Dopengl=disabled -Dd3d11=disabled --prefix=%prefix% (Windows)
        meson setup build --default-library=static --buildtype=release -Ddemos=false -Dopengl=disabled -Dd3d11=disabled --prefix=$prefix (Linux)
        ninja -C build
        ninja -C build install

    Building plugin:
        cd ../
        cmake -B build -G Ninja -DCMAKE_PREFIX_PATH="c:\VulkanSDK\1.3.283.0;%prefix%" (Windows)
        cmake -B build -G Ninja -DCMAKE_PREFIX_PATH=$prefix (Linux)
        ninja -C build

Back to top