Thread: Waifu2x-w2xc
View Single Post
Old 12th December 2019, 05:16   #23  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Adjusted my test script to:
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("I:/Hybrid/64bit/vsfilters/ResizeFilter/Waifu2x/w2xc.dll")
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/ResizeFilter/Waifu2x/Waifu2x-w2xc.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading C:\Users\Selur\Desktop\test3.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/test3.mkv", format="YUV420P10", cache=0, prefer_hw=0)

#limited
limited = clip
limited = core.resize.Point(limited, matrix_in_s="470bg",range_s="limited")
limited = core.std.AssumeFPS(limited, fpsnum=24000, fpsden=1001) # making sure frame rate is set to 23.976
limited = core.std.SetFrameProp(clip=limited, prop="_ColorRange", intval=1) # Setting color range to TV (limited) range.
limited = core.resize.Bicubic(clip=limited, format=vs.YUV420P16, matrix_s="470bg", range_s="limited") # to YUV420P16
limited = core.hist.Classic(clip=limited) # add histogram

# limited with waifu2x
limitedw = clip
limitedw = core.resize.Point(limitedw, matrix_in_s="470bg",range_s="limited")
limitedw = core.std.AssumeFPS(limitedw, fpsnum=24000, fpsden=1001) # making sure frame rate is set to 23.976
limitedw = core.std.SetFrameProp(clip=limitedw, prop="_ColorRange", intval=1) # Setting color range to TV (limited) range.
limitedw = core.resize.Bicubic(clip=limitedw, format=vs.RGBS, matrix_in_s="470bg", range_s="limited") # adjusting color space from RGBS to RGB48 for Waifu2x-w2xc
limitedw = core.w2xc.Waifu2x(clip=limitedw, scale=1) # using Waifu2x
limitedw = core.resize.Bicubic(clip=limitedw, format=vs.YUV420P16, matrix_s="470bg", range_s="limited") # to YUV420P16
limitedw = core.hist.Classic(clip=limitedw) # add histogram

# full
full = clip
full = core.resize.Point(full, matrix_in_s="470bg",range_s="full")
full = core.std.AssumeFPS(full, fpsnum=24000, fpsden=1001) # making sure frame rate is set to 23.976
full = core.std.SetFrameProp(clip=full, prop="_ColorRange", intval=0) # Setting color range to PC (full) range.
full = core.resize.Bicubic(clip=full, format=vs.YUV420P16, matrix_s="470bg", range_s="full") # 16bit
full = core.hist.Classic(clip=full) # add histogram


# full with waifu2x
fullw = clip
fullw = core.resize.Point(fullw, matrix_in_s="470bg",range_s="full")
fullw = core.std.AssumeFPS(fullw, fpsnum=24000, fpsden=1001) # making sure frame rate is set to 23.976
fullw = core.std.SetFrameProp(clip=fullw, prop="_ColorRange", intval=0) # Setting color range to PC (full) range.
fullw = core.resize.Bicubic(clip=fullw, format=vs.RGBS, matrix_in_s="470bg", range_s="full") # adjusting color space from YUV420P10 to RGB48 for Waifu2x-w2xc
fullw = core.w2xc.Waifu2x(clip=fullw, scale=1) # using Waifu2x
fullw = core.resize.Bicubic(clip=fullw, format=vs.YUV420P16, matrix_s="470bg", range_s="full") # 16bit
fullw = core.hist.Classic(clip=fullw) # add histogram

limitedstack = core.std.StackHorizontal([limited,limitedw])
fullstack = core.std.StackHorizontal([full,fullw])
clip = core.std.StackVertical([limitedstack,fullstack])

# Output
clip.set_output()
using RGBS does seem to fix the problem! THANKS!

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 12th December 2019 at 05:47.
Selur is offline