Advertisement
Guest User

DDColor

a guest
Dec 14th, 2023
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. # getting Vapoursynth core
  4. import site
  5. import ctypes
  6. import sys
  7. import os
  8. core = vs.core
  9. # Import scripts folder
  10. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  11. sys.path.insert(0, os.path.abspath(scriptPath))
  12. # Loading Support Files
  13. Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  14. # Adding torch dependencies to PATH
  15. path = site.getsitepackages()[0]+'/torch_dependencies/bin/'
  16. ctypes.windll.kernel32.SetDllDirectoryW(path)
  17. path = path.replace('\\', '/')
  18. os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
  19. # Loading Plugins
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  32. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  33. # Import scripts
  34. import muvsfunc
  35. import SpotLess
  36. import havsfunc
  37. # source: 'C:\Users\Selur\Desktop\KC Clip.mkv'
  38. # current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
  39. # Loading C:\Users\Selur\Desktop\KC Clip.mkv using DGSource
  40. clip = core.dgdecodenv.DGSource("J:/tmp/2023-12-14@20_30_47_2610.dgi",fieldop=0)# 25 fps, scanorder: top field first
  41. # Setting detected color matrix (470bg).
  42. clip = core.std.SetFrameProps(clip, _Matrix=5)
  43. # Setting color transfer info (470bg), when it is not set
  44. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  45. # Setting color primaries info (BT.601 PAL), when it is not set
  46. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  47. # Setting color range to TV (limited) range.
  48. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  49. # making sure frame rate is set to 25
  50. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  51. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2) # tff
  52. # Deinterlacing using QTGMC
  53. clip = havsfunc.QTGMC(Input=clip, Preset="Faster", TFF=True, opencl=True) # new fps: 50
  54. # Making sure content is preceived as frame based
  55. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  56. # adjusting color space from YUV420P8 to RGBH for vsDDColor
  57. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
  58. # adding colors using DDColor
  59. from vsddcolor import ddcolor
  60. clip = ddcolor(clip=clip, model=0, input_size=256)
  61. # Quality enhancement using BasicVSR++
  62. from vsbasicvsrpp import basicvsrpp as BasicVSRPP
  63. clip = BasicVSRPP(clip=clip, model=4, length=100)
  64. # adjusting color space from RGBH to YUV444P16 for vsSpotLess
  65. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited")
  66. # Spot removal using SpotLess
  67. clip = SpotLess.SpotLess(clip=clip, radT=3, pel=1)
  68. # adjusting frame count and rate with sRestore
  69. clip = muvsfunc.srestore(source=clip, frate=18.0000)
  70. # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
  71. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
  72. # set output frame rate to 18fps (progressive)
  73. clip = core.std.AssumeFPS(clip=clip, fpsnum=18, fpsden=1)
  74. # Output
  75. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement