Skip to content

Instantly share code, notes, and snippets.

4re

Block or report user

Report or block 4re

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wkklist.py
#!/usr/bin/env python3
import json
import urllib3
import certifi
__version__ = '0.1.0'
def main():
apiroot = 'https://www.wanikani.com/api/v2'
@4re
4re / mpls.py
Last active Aug 13, 2019
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
import vapoursynth as vs
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.
View psharpen.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)
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 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:
@4re
4re / mcdegrainsharp.py
Last active Aug 13, 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,
@4re
4re / vshelpers.py
Last active Apr 5, 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 / scoll.py
Last active Apr 5, 2019
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 / sharpaamcmod.py
Last active Aug 13, 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:
You can’t perform that action at this time.