Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from vapoursynth import core, GRAY8, GRAY16
- from math import ceil
- w, h =
- b, c =
- cw, ch = ceil(w), ceil(h)
- avs = "c.DeBicubicResizeMT({w}, {h}, {b} ,{c}, 0, 0, {sw}, {sh})".format(w=cw, h=ch, b=b, c=c, sw=w, sh=h)
- debic = core.avsw.Eval(avs, clips=[clip], clip_names=["c"])
- upscaled = debic.std.Transpose()
- upscaled = upscaled.nnedi3.nnedi3(1, True, 0, nsize=0, nns=4, qual=2)
- upscaled = upscaled.std.Transpose()
- upscaled = upscaled.resize.Spline36(height=1920, src_top=-0.5, src_height=w*2)
- upscaled = upscaled.nnedi3.nnedi3(1, True, 0, nsize=0, nns=4, qual=2)
- upscaled = upscaled.resize.Spline36(height=1080, src_top=-0.5, src_height=h*2)
- rebic = debic.resize.Bicubic(1920, 1080, filter_param_a=b, filter_param_b=c, src_width=w, src_height=h)
- error = core.std.Expr([clip,rebic],'x y - abs 2560 < 0 255 ?', GRAY8)
- error = error.std.Maximum().std.Maximum().std.Maximum()
- error = error.std.Inflate().std.Inflate().std.Inflate()
- edges = upscaled.whatever_the_fuck()
- mask = core.std.Expr([edges, error],'x y 257 * -',)
- clip = clip.std.MaskeMerge(upscaled, mask)
- '''
- cw, ch = [x * 2 for x in [ceil(w/2), ceil(h/2)]]
- avs = "c.ConvertToYV12().DebicubicY16({w}, {h}, 0, 0, {sw}, {sh}, True, {b}, {c}, iter=True, Y8=True)".format(w=cw, h=ch, b=b, c=c, sw=1920 / w * cw, sh=1080 / h * ch)
- debic = core.avsw.Eval(avs, clips=[core.fmtc.nativetostack16(clip)], clip_names=["c"]).fmtc.stack16tonative()
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement