View Full Version : New challenge: Trigun modern restoration
tormento
20th June 2022, 11:19
Perhaps it's time to challenge again the community against one of the most abused DVD in history: Trigun.
It's told nobody could really fix it, since decades.
Is there any brave AVS user able to fix it and properly create a 23.976 good restoration?
Here (https://krakenfiles.com/view/8uBav3EFm0/file.html)a clip.
SaurusX
24th June 2022, 14:29
I've seen a pretty good AI upscale of Trigun. But what seems to be the general problem with it? You mention 23.976, so is there something off in regards to way pulldown is implemented?
ChaosKing
24th June 2022, 16:49
I think the biggest challenge are the halos.
My quick encode https://www.dropbox.com/s/ke7jgc9ent48ls3/trigun.mkv?dl=1
Encoded with x264 medium, so don't expect ultra quality.
I think some antialiasing should be applied too.
Selur
25th June 2022, 07:53
@ChoasKing: Vapoursynth VSGAN(2x_LD-Anime_Skr_v1.0)+DeHalo_Alpha, does a good job with the halos (but is horribly slow on my gpu old, 0.1-0.3fps): https://imgsli.com/MTE0MDU0
tormento
25th June 2022, 09:10
so is there something off in regards to way pulldown is implemented?
Look at the clip.
tormento
25th June 2022, 09:14
does a good job with the halos
Nothing available with AVS+?
You did a good job but I see lot of detail loss.
There is the deinterlace/pulldown issue to to be solved properly.
tormento
25th June 2022, 09:15
My quick encode
Please post script too.
Selur
25th June 2022, 13:26
You did a good job but I see lot of detail loss.
If it's just about cleaning the lines, you could simply mask vsgan with an edgemask. :) (probably best apply DeHalo_Alpha also masked)
in Avisynth: DeHalo + LUTDeRainbow might be worth a try.
ChaosKing
25th June 2022, 15:39
Please post script too.
import vapoursynth as vs
import lvsfunc
core = vs.core
clip = core.lsmas.LWLibavSource(r'D:\Download\VTS_01_7.VOB')
clip = clip.vivtc.VFM(0)
clip = clip.vivtc.VDecimate()
o=clip
clip = core.fmtc.bitdepth(clip, bits=16)
r = haf.SMDegrain(clip, tr=3, prefilter=2).avs.DGDenoise(strength=0.1, blend=0.1)
clip = core.fmtc.bitdepth(clip, bits=32)
clip = clip.bm3dcuda.BM3D(sigma=3, radius=4, ref=core.fmtc.bitdepth(r, bits=32)).bm3d.VAggregate(radius=4)
clip = lvsfunc.dehalo.masked_dha(clip, ref=None, rx=1.77, ry=1.77, brightstr=1.0, darkstr=0.0, lowsens=50, highsens=50, rfactor=3.0, maskpull=48, maskpush=192, show_mask=False)
clip = lvsfunc.dehalo.fine_dehalo(clip, rx=2.2, ry=2.2)
Nothing fine tuned, just quick and dirty test.
w2xncnnvk.Waifu2x() upscale looks also not bad.
@Selur looks good, will try it next. Have you also tried 2x_BIGOLDIES_415000_G.pth ? The sexample looks very good https://imgsli.com/MzI0MDc
kedautinh12
25th June 2022, 16:32
Sample script 100% vapoursynth. Any relate avs+??
ChaosKing
25th June 2022, 17:25
Sample script 100% vapoursynth. Any relate avs+??
Same scripts exist for avs+ too. Use brain.exe to convert :D
kedautinh12
25th June 2022, 18:04
I know but script from Selur need VSGAN(don't support avs+ too)
ChaosKing
25th June 2022, 18:30
Time to learn something new 😀. Or simply use vapoursource...
tormento
25th June 2022, 19:03
As we are talking about... Waifu or GAN?
Any chance to see native portings?
Selur
26th June 2022, 05:10
Waifu2x is available for Avisynth (https://github.com/sunnyone/Waifu2xAvisynth), but probably a lot slower than the Vapoursynth version since from the looks of it it has not gpu support.
@Selur looks good, will try it next. Have you also tried 2x_BIGOLDIES_415000_G.pth ?
-> https://imgsli.com/MTE0MTgz has even more detail loss in the background but cleans it up nice
tormento
26th June 2022, 09:01
Waifu2x is available for Avisynth
Can you post me some example scripts for VS and GAN + WAIFU?
I am totally newbie in that regard.
Selur
26th June 2022, 10:59
Here's an example where I load and apply 2x_AnimeClassics_UltraLite_510K with VSGAN and downscale to the original resolution afterwards:
# Imports
import vapoursynth as vs
import os
import sys
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'i:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# Import scripts
import mvsfunc
# source: 'G:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip = core.ffms2.Source(source="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# Setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=5)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# changing range from limited to full range
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# adjusting color space from YUV420P8 to RGB24 for vsVSGAN
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="full")
# resizing using VSGAN
from vsgan import ESRGAN
vsgan = ESRGAN(clip=clip,device="cuda")
model = "I:/Hybrid/64bit/vsgan_models/2x_AnimeClassics_UltraLite_510K.pth"
vsgan.load(model)
vsgan.apply() # 1280x704
clip = vsgan.clip
# resizing 1280x704 to 640x352
# changing range from full to limited range
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=640, h=352, kernel="lanczos", interlaced=False, interlacedd=False)
# adjusting output color from: RGB48 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 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
Here I use Waifu through VSGAN:
# Imports
import vapoursynth as vs
import os
import sys
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'i:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# Import scripts
import mvsfunc
# source: 'G:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip = core.ffms2.Source(source="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# Setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=5)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# changing range from limited to full range
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# adjusting color space from YUV420P8 to RGB24 for vsVSGAN
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="full")
# resizing using VSGAN
from vsgan import ESRGAN
vsgan = ESRGAN(clip=clip,device="cuda")
model = "I:/Hybrid/64bit/vsgan_models/4x_WaifuGAN_v3_30000.pth"
vsgan.load(model)
vsgan.apply() # 2560x1408
clip = vsgan.clip
# resizing 2560x1408 to 640x352
# changing range from full to limited range
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=640, h=352, kernel="lanczos", interlaced=False, interlacedd=False)
# adjusting output color from: RGB48 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 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
Here's an example where I use Waifu2x nvk:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/Waifu2x-cnn/waifu2x-ncnn-Vulkan.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# source: 'G:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip = core.ffms2.Source(source="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# Setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=5)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# adjusting color space from YUV420P8 to RGBS for vsWaifu2xNvk
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# resizing using Waifu2xNvk
# forcing model to 'cunet', upconv can not be used without upscaling
# no resizing only filtering using Waifu2X nvk
clip = core.w2xncnnvk.Waifu2x(clip=clip, scale=1, model=2, fp32=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 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
Cu Selur
ChaosKing
26th June 2022, 11:33
You should format your code as php, it's much more readable this way bcs comments are highlighted differently.:thanks:
Selur
26th June 2022, 13:08
adjusted post code -> php
tormento
26th June 2022, 14:35
Cu Selur
Thanks!
Can you please tell me the differences between the upscaling types and what can support CUDA? I have a 1660 SUPER with 6GB of memory. I don't even know if it's enough or I should limit VS threads in some way.
Why don't you apply any IVTC of pulldown or deinterlace of any sort? The DVD source is awful.
Selur
26th June 2022, 15:39
Why don't you apply any IVTC of pulldown or deinterlace of any sort? The DVD source is awful.
That were just example calls. :)
For the trigun example I used:
# Imports
import vapoursynth as vs
import os
import sys
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'i:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import mvsfunc
import havsfunc
# source: 'C:\Users\Selur\Desktop\VTS_01_7.mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine
# Loading C:\Users\Selur\Desktop\VTS_01_7.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/VTS_01_7.mkv", format="YUV420P8", cache=0, prefer_hw=0)
# Setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=5)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 29.970
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
clip2clip = clip
# Deinterlacing using TIVTC
clip = core.tivtc.TFM(clip=clip, clip2=clip2clip)
clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976
# make sure content is preceived as frame based
clip = core.std.SetFieldBased(clip, 0)
# cropping the video to 700x480
clip = core.std.CropRel(clip=clip, left=16, right=4, top=0, bottom=0)
clip = havsfunc.DeHalo_alpha(clip)
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# adjusting color space from YUV420P8 to RGB24 for vsVSGAN
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="full")
# resizing using VSGAN
from vsgan import ESRGAN
vsgan = ESRGAN(clip=clip,device="cuda")
model = "I:/Hybrid/64bit/vsgan_models/2x_LD-Anime_Skr_v1.0.pth"
vsgan.load(model)
vsgan.apply() # 1400x960
clip = vsgan.clip
# resizing 1400x960 to 720x556
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=720, h=556, kernel="lanczos", interlaced=False, interlacedd=False)
# adjusting output color from: RGB48 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 23.976fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Output
clip.set_output()
Can you please tell me the differences between the upscaling types and what can support CUDA?
Nowadys VSGAN should tile the content if need be, depending on the model setting an overlap would be recommended.
At least for me the VRAM usage doesn't seem to change in regard to the vs threads.
mastrboy
26th June 2022, 15:57
vs-mlrt also has a waifu2x implementation: https://github.com/AmusementClub/vs-mlrt/wiki/waifu2x
Shinkiro
27th June 2022, 17:44
Something like that
https://workupload.com/file/gDGErXYRRRG
tormento
27th June 2022, 19:03
Something like that
Please post your script, not results only. ;)
I can see some shimmering on horizontal lines left, such as walls.
Very nice result, anyway.
Shinkiro
27th June 2022, 22:15
Please post your script, not results only. ;)
I can see some shimmering on horizontal lines left, such as walls.
Very nice result, anyway.
tr=8
setmemorymax(8192)
DGSource("VTS_01_7.dgi")
Bifrost(interlaced=true).TComb(mode=0,fthreshL=4,othreshL=5,scthresh=12)
ASTDRmc(strength=5, tempsoftth=30, tempsoftrad=3, tempsoftsc=3, blstr=0.5, tht=255, FluxStv=75, dcn=15, edgem=false)
TFM(mode=4,pp=1,MI=25,display=false, slow=2,cthresh=8,mthresh=6,chroma=false,ubsco=false,hint=true,opt=4,metric=0)
TDecimate(mode=1)
TurnLeft().vsLGhost(mode=1, shift=1, intensity=-26).TurnRight()
EdgeCleaner(strength=10, rep=false, rmode=17, smode=0, hot=false)
nnedi3_rpow2(rfactor=2, nsize=0, nns=4, qual=2, etype=0, pscrn=4, cshift="spline36resize", threads=tr)
ConvertTo16bit()
FineDehalo(rx=3.0, ry=3.0, thmi=80, thma=128, thlimi=50, thlima=100, darkstr=0.0, brightstr=1.4, showmask=0, contra=0.0, excl=true)
FineDehalo(rx=2.8, ry=2.8, thmi=80, thma=128, thlimi=50, thlima=100, darkstr=0.0, brightstr=1.2, showmask=0, contra=0.0, excl=true)
LSFmod(ss_x=1.0,ss_y=1.0,strength=6,Smode=5)
mthr = 16
bi = BitsPerComponent(last)
mthrHBD = ex_bs(mthr, 8, bi, true)
mlight1=last.flatmask(2, scale=7.0, lo=4, MSR=60, invert=false)
mdark1=last.flatmask(4, scale=7.0, lo=4, MSR=50, invert=false)
mask=last.ConditionalFilter(mlight1, mdark1, "AverageLuma()",">","60").ex_lut(Format("x {mthrHBD} <= x 0.5 * x 2 * ?"), UV=1).RemoveGrain((980>960) ? 20 : 11, -1)
deg1 = last.MCTemporalDenoise(settings="very low", edgeclean=true, ecrad=4, stabilize=true, maxr=3, strength=30, GPU=false)
deg2 = last.SMDegrain(tr=2,thSAD=121, thSADC=50, thSCD1=156,thSCD2=96, contrasharp=false, refinemotion=true, chroma=true, plane=4)
deg=ConditionalFilter(deg1, deg2, "AverageLuma()",">","60")
ex_merge(deg ,last ,mask, luma=true, Y=3, UV=3)
ConvertToStacked().TAAmbk(aatype=1, preaa=-1, postaa=false, sharp=0.0, mtype=0, cycle=0, dark=0.0,lsb_in=true , lsb_out=true).ConvertFromStacked()
Blackmanresize(948, 720, taps=4,14,0,-4,0)
ContinuityFixer(left=4, top=0, right=3, bottom=0, radius=0)
db=last.neo_f3kdb(sample_mode=2, Y=68, Cb=68, Cr=68, grainy=56, grainC=56, range=15, dynamic_grain=true)
ex_merge(db, last, mask, luma=true, Y=3, UV=3)
z_ConvertFormat(colorspace_op="470bg:601:470bg:f=>709:709:709:f",dither_type="none")
ConvertBits(bits=10)
Prefetch(tr)
Blankmedia
28th June 2022, 01:55
https://workupload.com/file/w9adMvevMFk
chemin = "D:\A encoder\Trigun\VTS_01_7.d2v"
DGDecode_mpeg2source(chemin, info=3).Converttoyv12()
#~ RoboCrop(LeftAdd=0, TopAdd=0, RightAdd=0, BotAdd=0)
#~ RequestLinear(clim=100)
Tcomb()
fmtc_bitdepth(bits=16)
/*
A=QTGMCp( Preset="very slow",sourcematch=3, Sharpness=0.0, lossless=2 ).selecteven()
B=QTGMCp( Preset="very slow",sourcematch=3, Sharpness=0.0, lossless=2 ).selectodd()
C=Tfm(field=1,Mode=5,PP=2,cthresh=2,mthresh=2,clip2=A,micmatching=0,chroma=true,display=false, d2v=chemin, slow=2)
D=Tfm(field=0,Mode=5,PP=2,cthresh=2,mthresh=2,clip2=B,micmatching=0,chroma=true,display=false, d2v=chemin, slow=2)
Interleave(C,D)
*/
SimpsonsDesentrelace("D:\A encoder\Trigun\VTS_01_7.d2v")
oo = last
a = NNEDI3(Field=-2, qual=2, etype=1, nns=4, pscrn=3)
a = Merge(a.SelectEven(), a.SelectOdd())
D1 = mt_makediff(oo,a)
D2 = mt_makediff(a,a.removegrain(11,-1))
mt_adddiff(D2.repair(D1,13).mt_lutxy(D2,"x 32768 - y 32768 - * 0 < 32768 x 32768 - abs y 32768 - abs < x y ? ?"),U=2,V=2)
a = QTGMC(Preset="slow", InputType=1, sourcematch=3, MatchEnhance=0.45 )
ex_repair(a,oo, mode="Temp1")
source=last
#~ x1 = source.ex_BM3D(sigma=10,radius=1,UV=1,tv_range=False)
x1 = source.fluxsmootht(3)
x2 = source.removegrain(11,-1).Extracty().Converttoyuv422()
x22 = source.mt_makediff(mt_makediff(x2,x2.removegrain(20,-1))).MinMapBlur()
x222 = x22.removegrain(4,-1)
x222 = x222.ex_sbr().merge(x222,0.25)
enhD = ex_lutxy(x22.removegrain(27).fmtc_bitdepth(bits=8, dmode=1),x222.fmtc_bitdepth(bits=8, dmode=1),"128 x y - abs 2 / 1 1.6 / ^ 2.51 * x y - x y - abs 0.1 + / * +",UV=2).frfun7(lambda=1.1, T=6.0, Tuv=2.0,P=2).fmtc_bitdepth(bits=16)
enh = source.mt_adddiff(enhD,U=2,V=2)
BLK = 8
ME1 = 5
ME2 = 8
_DCT = 5
sup1 = x1.removegrain(11).MSuper(hpad=16, vpad=16, pel=2, sharp=0)
sup2 = enh.MSuper(hpad=16, vpad=16, pel=2, levels=0, sharp=1)
bv3 = MAnalyse(sup1,delta=3,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=true, dct=_DCT)
bv2 = MAnalyse(sup1,delta=2,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=true, dct=_DCT)
bv1 = MAnalyse(sup1,delta=1,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=true, dct=_DCT)
fv1 = MAnalyse(sup1,delta=1,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=false,dct=_DCT)
fv2 = MAnalyse(sup1,delta=2,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=false,dct=_DCT)
fv3 = MAnalyse(sup1,delta=3,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=false,dct=_DCT)
bv4 = MAnalyse(sup1,delta=4,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=true, dct=_DCT)
fv4 = MAnalyse(sup1,delta=4,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=false,dct=_DCT)
#~ source.mdegrain3(sup2,bv1,fv1,bv2,fv2,bv3,fv3, thSAD=300, thSCD1=256, thSCD2=96, limit=135, plane=0)
#~ source.mdegrain2(sup2,bv1,fv1,bv2,fv2, thSAD=250, thSCD1=256, thSCD2=96, limit=135, plane=0)
source.mdegrain4(sup2,bv1,fv1,bv2,fv2,bv3,fv3,bv4,fv4,thSAD=300, thSCD1=256, thSCD2=96, limit=135, plane=0)
lsfplus(preset="slow", strength=10, smode=5, edgemode=1, preblur="FFT3Dfilter(sigma=4,plane=0)")
masklisse = HQderingmod(mrad=2,minp = 2 , nrmode =3, sharp = 0, show=False).ex_median("IQM").blur(0.5).neo_f3kdb(15,preset="very high",grainy=0, grainc=0, blur_first=true, sample_mode=4).Flatmask(lo=4,MSR=45,scale=5)
a = masklisse.ex_expand(4,"disk").ex_median("STWM")
b = masklisse.ex_inflate().ex_expand(2,"disk")
masque = ex_makediff(a,b,dif=false).maa2()
mt_merge(last, ex_median("smart2").neo_minideen(2),luma=True,masque).maa2()
masked_dha(rx=1.77, ry=1.77, brightstr=1.0, darkstr=0.0, lowsens=50, highsens=50, msk_pull=48, msk_push=192, ss=3, show_msk=False)
FineDehalo(rx=2.2, thmi=50, thma=100, thlimi=50, thlima=100, darkstr=1, brightstr=1, showmask=0, contra=0.1, excl=true) # ajout
neo_f3kdb(preset="high", sample_mode=4, range=10, dynamic_grain = True, grainy=48, grainc=48)
edit:
function SimpsonsDesentrelace( clip IN, string "chemin" )
{
A=QTGMC(IN, Preset="very slow",sourcematch=3, Sharpness=0.0, lossless=2 ).selecteven()
TFM(IN, Order=-1,Mode=5,PP=2,Clip2=A,Slow=2,MChroma=False,Ubsco=False,CThresh=12,mthresh=2,Chroma=True,micmatching=0, d2v=chemin)
TDecimate(Mode=1)
}
Blankmedia
29th June 2022, 21:11
I was kind of hoping someone would chip in and correct if I'm doing something wrong or something I do could be done better.
@Tormento do you like it?
tormento
29th June 2022, 23:00
@Tormento do you like it?
I will post the findings I am doing around in the next days.
Can I invite every script author in this thread to provide the output video to have a fair comparison?
ChaosKing
16th July 2022, 00:49
masked dha + upscale with esrgan (~2fps). Starting to look like a bluray :p
https://www.dropbox.com/s/lwhwhjihdcq82ha/trigun_2.mkv?dl=1
kedautinh12
16th July 2022, 01:25
masked dha + upscale with esrgan (~2fps). Starting to look like a bluray :p
https://www.dropbox.com/s/lwhwhjihdcq82ha/trigun_2.mkv?dl=1
What masked dha mean??
Reel.Deel
16th July 2022, 01:45
What masked dha mean??
Search is your friend :search:
http://avisynth.nl/index.php/External_filters#Dehaloing
tormento
17th July 2022, 10:51
masked dha + upscale with esrgan (~2fps). Starting to look like a bluray :p
Please post your script too :)
PoeBear
18th July 2022, 09:19
I wonder how AiUpscale (https://forum.doom9.org/showthread.php?t=181665) would fare over Waifu2x. It's got some comparisons against Waifi2x on its github page, and the HQ model seems to compete pretty well. The HQ Sharp might even offer a more pleasing presentation, depending on what it picks to sharpen
ChaosKing
18th July 2022, 18:04
@tormento
clip = lvsfunc.dehalo.masked_dha(clip, rx=2, ry=2)
from vsgan import ESRGAN
vsgan = ESRGAN(clip=clip,device="cuda")
model = "some-anime-model.pth" # forgot which one, test some anime models from here https://upscale.wiki/wiki/Model_Database
vsgan.load(model)
vsgan.apply()
@PoeBear
It would be at least much faster than Waifu2x.
I tried many esrgan models from here https://upscale.wiki/wiki/Model_Database and depending on the source (and what the model was trained on) the results were much much^2 better than any waifu upscale I've ever seen.
+ Waifu was made / trained for more modern art, not 80s / 90s animations. In my tests waifu looks kinda "good" when used with a stronger denoise parameter, but at the same time it destroys all details.
FSRCNNX should be better and less destructive.
Now I have to learn how to train my own esrgan model :D
Dogway
18th July 2022, 18:16
Yeah, how I wished I could use esrgan (basicvsrpp, rife, dpir, etc) for video, last time I tried a month ago or so I had issues installing some tensor api for Python 38 (Win7 here).
I have tested some models with images and I digged these two, give them a try.
2X_DigitalFilmV5_Lite.pth (sharpener for soft lines, no need to downscale before AI)
2x_LD-Anime_Skr_v1.0.pth (for ringing, rainbowing, aliasing)
Reel.Deel
18th July 2022, 20:46
masked dha + upscale with esrgan (~2fps). Starting to look like a bluray :p
https://www.dropbox.com/s/lwhwhjihdcq82ha/trigun_2.mkv?dl=1
Finally had a look at this, the result is pretty good. I think it would help out to get rid of the the small jitter that is common is these old cartoons. CelStabilize (http://avisynth.nl/index.php/CelStabilize) does a very good job of that but unfortunately the source code for CelBackground was never published. I tried contacting the author like a year ago but the email no longer works :(.
Dogway
18th July 2022, 21:14
Finally had a look at this, the result is pretty good. I think it would help out to get rid of the the small jitter that is common is these old cartoons. CelStabilize (http://avisynth.nl/index.php/CelStabilize) does a very good job of that but unfortunately the source code for CelBackground was never published. I tried contacting the author like a year ago but the email no longer works :(.
CelStabilise was very good actually and my main "dejitter" for anime, but it came with many added artifacts in form of color shifts/clipping, and it didn't work on pans/tilts or across scenes. (btw another good lost filter is JPEGSource() )
I have been thinking for some time on creating a dejitter function to replace the old Stabilization Tools Pack, it's basically supersampling and differentiating, the trick being making it robust enough.
Reel.Deel
18th July 2022, 21:56
CelStabilise was very good actually and my main "dejitter" for anime, but it came with many added artifacts in form of color shifts/clipping, and it didn't work on pans/tilts or across scenes. (btw another good lost filter is JPEGSource() )
I have been thinking for some time on creating a dejitter function to replace the old Stabilization Tools Pack, it's basically supersampling and differentiating, the trick being making it robust enough.
Yeah CelStabilise has a few issues, and also has a resolution limit (I tried processing an HD clip and it crashed). But, it worked really well on SD static scenes that only had jitter. Sadly there is no replacement that I've seen for it. Regarding JPEGSource, I contacted SEt some months ago about it. I saw that PictureView3 (https://plugring.farmanager.com/plugin.php?pid=693&l=en) was now available in x64 (which shares code from JpegSource). So I asked him if would be possible to provide an x64 version. He replied: "It's definitely possible, bit I haven't touched AviSynth development in a long while. I'll keep in mind that there is such interest and try to find time for that." - I have not heard back from him nor have I bothered him again.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.