Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
11th December 2019, 17:41 | #19 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Not totally sure whether I make a mistake in using Waifu2x or if this is a bug.
When I use limited range input and feed it to Waifu2x the histogram is compressed. To illustrate the problem I created the following script: 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.RGB48, matrix_in_s="470bg", range_s="limited") # adjusting color space from YUV420P10 to RGB48 for Waifu2x-w2xc 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.RGB48, matrix_in_s="470bg", range_s="limited") # adjusting color space from YUV420P10 to RGB48 for Waifu2x-w2xc limitedw = core.fmtc.bitdepth(clip=limitedw,bits=32) # adjusting bit depth to 32bit 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.RGB48, matrix_in_s="470bg", range_s="full") # adjusting color space from YUV420P10 to RGB48 for Waifu2x-w2xc fullw = core.fmtc.bitdepth(clip=fullw,bits=32) # adjusting bit depth to 32bit 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() I uploaded the script I used and the source to my GoogleDrive as test.mkv and Waifu2x_Test.vpy So my question is: Is this a bug or am I doing something wrong? In case I'm doing something wrong it would be nice if someone could post how to properly handle limited sources with Waifu2x. Thanks! Cu Selur |
|
|