Skip to content

Instantly share code, notes, and snippets.

View nnedi3_rpow2.py
from vapoursynth import core
__version__ = "1.1.0"
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, upsizer=None):
"""nnedi3_rpow2 is for enlarging images by powers of 2.
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: 2020-11-03
from vapoursynth import core, GRAY, YUV
def spline(x, coordinates):
def get_matrix(px, py, l):
@4re
4re / sharpaamcmod.py
Last active Nov 3, 2020
Avisynth's SharpAAMCmod.avsi port to Vapoursynth
View sharpaamcmod.py
# sharpaamcmod.py 2020-11-03
from vapoursynth import core, VideoNode, GRAY
import havsfunc as haf
__version__ = "1.1.1"
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
@4re
4re / mcdegrainsharp.py
Last active Nov 3, 2020
mcdegrainsharp ported to vapoursynth
View mcdegrainsharp.py
from vapoursynth import core
def _sharpen(clip, strength, planes):
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,
thsad=400, plane=4):
View knlm.py
from vapoursynth import core, GRAY, YUV
__version__ = "1.0.3"
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.
View psharpen.py
from vapoursynth import core, GRAY
__version__ = "1.1.1"
def _clamp(minimum, value, maximum):
return int(max(minimum, min(round(value), maximum)))
def _m4(value, mult=4.0):
View hdr2sdr.py
from vapoursynth import core, RGBS, YUV444PS
__version__ = '1.1.1'
def hdr2sdr(clip, source_peak=1000, ldr_nits=100, output_foramt=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:
@4re
4re / mpls.py
Last active Nov 3, 2020
Ugly hack to load mpls in vapoursynth
View mpls.py
"""Parse blu-ray .mpls
Code from https://gist.github.com/dk00/0a0634c5666cf1b8ab9f
"""
import os
import collections
import io
import struct
import json
import argparse
from vapoursynth import core
@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)