Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import os
- import sys
- import vapoursynth as vs
- # getting Vapoursynth core
- core = vs.core
- # Import scripts folder
- scriptPath = 'I:/Hybrid/64bit/vsscripts'
- sys.path.append(os.path.abspath(scriptPath))
- # Loading Plugins
- core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
- core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
- core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
- core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
- # Import scripts
- import edi_rpow2
- # source: 'C:\Users\Selur\Desktop\SFE-Complete.demuxed.m2v'
- # current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine (soft)
- # Loading C:\Users\Selur\Desktop\SFE-Complete.demuxed.m2v using DGSource
- clip = core.dgdecodenv.DGSource("E:/Temp/m2v_640d95887baddb54af12f6963f913c88_853323747.dgi",fieldop=2)
- # making sure input color matrix is set as 470bg
- clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
- # making sure frame rate is set to 29.97
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
- # Setting color range to TV (limited) range.
- clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
- clip2clip = clip
- # Deinterlacing using TIVTC
- clip = core.tivtc.TFM(clip=clip, slow=2, clip2=clip2clip)
- org = clip
- # adjusting color space from YUV420P8 to RGBS for DPIR
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
- from vsdpir import DPIR
- # def DPIR(clip: vs.VideoNode, strength: float=None, task: str='denoise', device_type: str='cuda', device_index: int=0) -> vs.VideoNode:
- # DPIR: Deep Plug-and-Play Image Restoration
- # Parameters:
- # clip: Clip to process. Only planar format with float sample type of 32 bit depth is supported.
- # strength: Strength for deblocking or denoising. Must be greater than 0. Defaults to 50.0 for 'deblock' task, 5.0 for 'denoise' task.
- # task: Task to perform. Must be 'deblock' or 'denoise'.
- # device_type: Device type on which the tensor is allocated. Must be 'cuda' or 'cpu'.
- # device_index: Device ordinal for the device type.
- clip = DPIR(clip=clip,task='denoise',strength=2)
- clip = DPIR(clip=clip,task='deblock',strength=25)
- # contrast sharpening using CAS
- clip = core.cas.CAS(clip=clip, sharpness=0.8)
- # resizing using NNEDI3CL
- clip = edi_rpow2.nnedi3cl_rpow2(clip=clip, rfactor=4, nns=4, qual=1)
- clip = core.fmtc.resample(clip=clip, w=1440, h=1080, kernel="lanczos", interlaced=False, interlacedd=False)
- org = core.fmtc.resample(clip=org, w=1440, h=1080, kernel="lanczos", interlaced=False, interlacedd=False)
- # adjusting output color from: RGBS to YUV420P10 for x265Model (i420@10)
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited")
- org = core.resize.Bicubic(clip=org, format=vs.YUV420P10)
- clip = core.sub.Subtitle(clip=clip, text='filtered')
- org = core.sub.Subtitle(clip=org, text='original')
- clip = core.std.StackHorizontal([org,clip])
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement