Vapoursynth Limiter

From wiki.selur.net
Revision as of 15:36, 14 November 2026 by Selur (talk | contribs) (Vapoursynth Limiter in Hybrid (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Limiter clamps every pixel value into a range: values below min are raised to min, values above max are lowered to max. Unlike Levels it does not stretch or remap anything, it only clips.

Filtering → Vapoursynth → Color → Levels

Limiter controls in Hybrid
Limiter controls in Hybrid

What it does

Typical uses:

  • keep values within broadcast-legal limits, for example 16–235,
  • cut off overshoots that earlier filters (sharpeners, resizers) left behind.

Settings

Control Parameter Range Hybrid default Meaning
Limits (min/max) min / max 0–255 0 / 255 Range all values are clamped to, on the 8-bit scale.
Planes planes all, chroma only, luma only luma only Planes that are processed; the others are copied unchanged. Only used without Use RGB.
Use RGB – on/off on Converts to RGB before filtering, so all three color channels are clamped.
Range signaling – unchanged, full, limited unchanged Overwrites the clip's color range flag before the filter.
Tools: Limiter – vszip, std, tune vszip Implementation: vszip's Limiter, VapourSynth's built-in std.Limiter, or tune (the faster one according to Hybrid's tools benchmark).

How Hybrid calls it

  • The limits are entered on the 8-bit scale. Hybrid scales them to the clip's bit depth: 255 becomes the format's maximum (1023 at 10 bit, 65535 at 16 bit), other values are shifted (16 becomes 64 at 10 bit). For 32-bit float RGB they are divided by 255.
  • With Use RGB Hybrid converts the clip to RGB first, if it isn't RGB already; all three planes are processed.
  • Without Use RGB the filter runs in YUV and Planes decides which planes are touched. Anything but luma only gives unexpected results in YUV; Hybrid writes a warning comment into the script in that case.
  • Limiter also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Example

Default settings (Use RGB on) on a 10-bit YUV 4:2:0 source:

# adjusting color space from YUV420P10 to RGB30 for vsLimiter
clip = core.resize.Bicubic(clip=clip, format=vs.RGB30, matrix_in_s="470bg", range_in_s="limited", range_s="full")
# adjusting color using Limiter
clip = core.vszip.Limiter(clip=clip, min=[0,0,0], max=[1023,1023,1023])
# adjusting output color from RGB30 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="limited")

Background

VapourSynth (std.Limiter)

std.Limiter(clip, min, max, planes) clamps samples into [min, max]. It accepts 8–16 bit integer and 32-bit float clips. min and max default to the lowest and highest legal value of the format and can be given per plane; planes that are not selected are copied unchanged.

vszip (Limiter)

vszip's Limiter is a faster version of std.Limiter with the same min, max and planes parameters. It also has tv_range (limited-range defaults) and mask (float chroma range), which Hybrid does not use.

AviSynth (Limiter)

AviSynth's Limiter takes separate luma and chroma limits and by default clamps to CCIR-601 levels (luma 16–235, chroma 16–240). With paramscale the limits are given on the 8-bit scale and scaled to the bit depth; a show mode highlights out-of-range pixels instead of clipping them.

Sources