Skip to content

Instantly share code, notes, and snippets.

View finesharp.py
# finesharp.py - finesharp module for VapourSynth
# Original author: Didee (http://forum.doom9.org/showthread.php?t=166082)
# Requirement: VapourSynth r48 or later
# Rev: 2019-11-03
import vapoursynth as vs
def spline(x, coordinates):
def get_matrix(px, py, l):
View resamplehq.py
import vapoursynth as vs
__version__ = '2.0.0'
def resample_hq(clip, width=None, height=None, kernel='spline36', matrix='709', transfer='709',
src_left=None, src_top=None, src_width=None, src_height=None, descale=False,
filter_param_a=None, filter_param_b=None, range_in=None, precision=1):
"""Gamma correct resizing in linear light (RGB).
@4re
4re / sharpaamcmod.py
Last active Sep 14, 2019
Avisynth's SharpAAMCmod.avsi port to Vapoursynth
View sharpaamcmod.py
# sharpaamcmod.py 2016-10-23
import vapoursynth as vs
import havsfunc as haf
def sharpaamcmod(orig, dark=20, thin=10, sharp=0, smooth=0, stabilize=False,
tradius=2, aapel=2, aaov=None, aablk=None, aatype='sangnom'):
"""Ported from: http://forum.doom9.org/showthread.php?p=1673928
Args:
@4re
4re / scoll.py
Last active Mar 20, 2020
scoll Scritp Collection for Vapoursynth
View scoll.py
""" scoll.py +++ Script Collection for VapourSynth: ++++++++++++++++++++++++++++++++++++++++++++++
"""
import vapoursynth as vs
try:
import havsfunc as haf
except:
HAS_HAF = False
else:
HAS_HAF = True
try:
@4re
4re / vshelpers.py
Last active Sep 14, 2019
vshelpers, Vapoursynth helpers
View vshelpers.py
import vapoursynth as vs
def clamp(minimum, x, maximum):
return int(max(minimum, min(round(x), maximum)))
def m4(x, m=4.0):
return 16 if x < 16 else int(round(x / m) * m)
@4re
4re / mcdegrainsharp.py
Last active Sep 14, 2019
mcdegrainsharp ported to vapoursynth
View mcdegrainsharp.py
import vapoursynth as vs
def _sharpen(clip, strength, planes):
core = vs.get_core()
blur = core.tcanny.TCanny(clip, sigma=strength, mode=-1, planes=planes)
return core.std.Expr([clip, blur], "x x + y -")
def mcdegrainsharp(clip, frames=2, bblur=0.3, csharp=0.3, bsrch=True,
View knlm.py
import vapoursynth as vs
def knlm_yuv(clip, d=[None, None, None], a=[None, None, None], s=[None, None, None], cmode=None, wmode=None,
h=[None, None, None], rclip=None, device_type=None, info=None, planes=[0]):
"""
Enhanced version of knlmeanscl that supports filtering of all planes on the same call and
pads the image so borders don't be left unfiltered.
Args:
View nnedi3_rpow2.py
import vapoursynth as vs
def nnedi3_rpow2(clip, rfactor=2, width=None, height=None, correct_shift=True,
kernel="spline36", nsize=0, nns=3, qual=None, etype=None, pscrn=None,
opt=True, int16_prescreener=None, int16_predictor=None, exp=None):
"""nnedi3_rpow2 is for enlarging images by powers of 2.
Args:
rfactor (int): Image enlargement factor.
View psharpen.py
import vapoursynth as vs
__version__ = '1.1.0'
def _clamp(minimum, value, maximum):
return int(max(minimum, min(round(value), maximum)))
def _m4(value, mult=4.0):
View hdr2sdr.py
import vapoursynth as vs
__version__ = '1.1'
def hdr2sdr(clip, source_peak=1000, ldr_nits=100, output_foramt=vs.YUV420P8, input_range='limited', output_range='limited', dither='error_diffusion'):
"""Converts HDR footage to SDR.
https://forum.doom9.org/showthread.php?p=1800667#post1800667
Args:
ldr_nits: Set at 150 or 200 to lower the brightness.
You can’t perform that action at this time.