This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[HELP] FeMaSR processing
#5
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import site
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("C:/Program Files/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# Adding torch dependencies to PATH
path = site.getsitepackages()[0]+'/torch_dependencies/bin/'
ctypes.windll.kernel32.SetDllDirectoryW(path)
path = path.replace('\\', '/')
os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
# loading plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import havsfunc
import validate
# Source: 'M:\Hybrid Vapoursynth\Master\The Comic Strip Presents... - 1x06- Five go mad on Mescalin.mkv'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x576, frame rate: 25fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg
# Loading M:\Hybrid Vapoursynth\Master\The Comic Strip Presents... - 1x06- Five go mad on Mescalin.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="M:/Hybrid Vapoursynth/Master/The Comic Strip Presents... - 1x06- Five go mad on Mescalin.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
# setting color transfer (170), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
# setting color primaries info (to 470), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=2) # tff
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True) # new fps: 50
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
from vsfemasr import femasr as FeMaSR
# adjusting color space from YUV420P8 to RGBS for vsFeMaSR
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# Step 1: current: 720x576, target: 1808x1440
# resizing using FeMaSR
clip = FeMaSR(clip=clip, model=1, device_index=0) # 2880x2304
# resizing 2880x2304 to 1808x1440
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=1808, h=1440, kernel="lanczos", interlaced=False, interlacedd=False)
# denoising stepped resize using RemoveGrain
# adjusting color space from RGBS to YUV444P16 for vsRemoveGrain
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
# removing grain using RemoveGrain
clip = core.rgvs.RemoveGrain(clip=clip, mode=2)
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# sharpening stepped resize using LSFMod
# adjusting color space from RGBS to YUV444P16 for vsLSFMod
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
clip = havsfunc.LSFmod(input=clip)
# adjusting color space from YUV444P16 to RGBS for vsFeMaSR
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# Step 2: current: 1808x1440, target: 2880x2304
# resizing using FeMaSR
clip = FeMaSR(clip=clip, model=1, device_index=0) # 7232x5760
# resizing 7232x5760 to 2880x2304
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=2880, h=2304, kernel="lanczos", interlaced=False, interlacedd=False)
# adjusting output color from: RGBS to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
# set output frame rate to 50fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
# output
clip.set_output()
You are using "stepped resizing" with FeMaSR, thus calling FeMasR two times!
Last time is on 1808x1440 content, that is bound to take ages.
=> disable stepped resizing

Cu Selur
Reply


Messages In This Thread
FeMaSR processing - by MikeMcI - 17.07.2024, 23:30
RE: FeMaSR processing - by Selur - 18.07.2024, 05:13
RE: FeMaSR processing - by MikeMcI - 19.07.2024, 02:05
RE: FeMaSR processing - by MikeMcI - 19.07.2024, 03:43
RE: FeMaSR processing - by Selur - 19.07.2024, 05:44
RE: FeMaSR processing - by MikeMcI - 21.07.2024, 01:45

Forum Jump:


Users browsing this thread: 3 Guest(s)