Advertisement
Zastin

nnedi3 chroma upscaler (VS)

Dec 10th, 2017
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import kagefunc as kgf
  2. import vapoursynth as vs
  3. core = vs.core
  4.  
  5. def to444(clip, w=None, h=None, join=True):
  6.    
  7.     uv = [nnedi3x2(c) for c in kgf.split(clip)[1:]]
  8.    
  9.     if w in (None, clip.width) and h in (None, clip.height):
  10.         uv = [core.fmtc.resample(c, sy=0.5, flt=0) for c in uv]
  11.     else:
  12.         uv = [core.resize.Spline36(c, w, h, src_top=0.5) for c in uv]
  13.    
  14.     return core.std.ShufflePlanes([clip] + uv, [0]*3, vs.YUV) if join else uv
  15.  
  16. def nnedi3x2(clip):
  17.     if hasattr(core, 'znedi3'):
  18.         return clip.std.Transpose().znedi3.nnedi3(1, 1, 0, 0, 4, 2).std.Transpose().znedi3.nnedi3(0, 1, 0, 0, 4, 2)
  19.     else:
  20.         return clip.std.Transpose().nnedi3.nnedi3(1, 1, 0, 0, 3, 1).std.Transpose().nnedi3.nnedi3(0, 1, 0, 0, 3, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement