Skip to content

Limiter

Julek edited this page Jan 22, 2025 · 1 revision

A faster version of core.std.Limiter.

Usage

vszip.Limiter(vnode clip[, float[] min, float[] max, bool tv_range=False])

Parameters:

  • clip:
    A clip to process.
  • min:
    Lower bound. Defaults to the lowest allowed value for the input. Can be specified for each plane individually.
  • max:
    Upper bound. Defaults to the highest allowed value for the input. Can be specified for each plane individually.
  • tv_range: (Default: False)
    Changes min/max defaults values to LIMITED.

Warning

Using tv_range arg instead of passing min/max values is a bit faster, thanks to Zig comptime optimizations.

BENCHMARK

from vstools import vs, core, get_peak_value
core.num_threads = 1

src16 = core.std.BlankClip(None, 3840, 2160, format=vs.YUV420P16, length=10000, keep=True)
src32 = core.std.BlankClip(None, 3840, 2160, format=vs.YUV420PS, length=10000, keep=True)

src16.std.Limiter().set_output(1)
# Output 10000 frames in 62.17 seconds (160.85 fps)

src16.akarin.Expr(f"x 0 {get_peak_value(src16)} clip").set_output(2)
# Output 10000 frames in 14.71 seconds (679.86 fps)

src16.vszip.Limiter().set_output(3)
# Output 10000 frames in 4.59 seconds (2176.81 fps)

src32.std.Limiter().set_output(4)
# Output 10000 frames in 34.11 seconds (293.21 fps)

src32.akarin.Expr(f"x 0 {get_peak_value(src32)} clip").set_output(5)
# Output 10000 frames in 13.88 seconds (720.46 fps)

src32.vszip.Limiter().set_output(6)
# Output 10000 frames in 14.12 seconds (708.44 fps)
Clone this wiki locally