Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetMemoryMax(3072)
- src = "D:\[BDMV][Hunter X Hunter][ハンターハンター Vol.1]\BDMV\STREAM\00004.m2ts"
- cf = src + ".ffindex"
- FFIndex(src, cachefile=cf, demuxer="lavf")
- FFVideoSource(src, cachefile=cf, seekmode=-1, threads=1)
- #DSS2("D:\[BDMV][Hunter X Hunter][ハンターハンター Vol.1]\BDMV\STREAM\00004.m2ts")
- downscale=true
- shstrength = downscale ? 0 : 80
- Tlimit = true
- Tovershoot=2
- EdgeRepair = false
- OP1=0
- OP2=1918
- ED1=31649
- ED2=33567
- src=last
- sw=src.width
- sh=src.height
- dw=sw*2/3
- dh=sh*2/3
- up=src.SoftCubicResize(sw*2, sh*2, soft=50)
- sm1=up.awarpsharp2(thresh=100,type=1,depth=16).Spline36Resize(sw, sh)
- sm2=up.awarpsharp2(thresh=100,type=1,depth=6).Spline36Resize(sw, sh)
- sm3 = MergeChroma(src, sm1.Trim(0,OP1+134)+sm2.Trim(OP1+135,OP1+440)+sm1.Trim(OP1+441,OP1+572)+sm2.Trim(OP1+573,OP2-1)+sm1.Trim(OP2,0),1.0)
- #sm3 = downscale ? sm3.ResampleHQ(dw, dh, srcmatrix= "TV.709", dstmatrix="TV.709", kernel="Spline36", chroma_kernel="Spline36") : sm3
- mask=src.tcanny(sigma=1.0, mode=1, plane=1)
- sharpmask = shstrength == 0 ? NOP() : mask.mt_lut("x 48 < 0 x 144 >= 399 x - x 2 << 188 - ? ?",U=1,V=1)
- dehalo = sm3.Dehalo_Alpha_mt(darkstr=0.2,brightstr=1.0,rx=1.8,ry=1.8,highsens=100,lowsens=30).binomialBlur(varY=0.5,varC=0.5,usemmx=true)
- #blurc = src.binomialBlur(varY=0.5,varC=0.5,usemmx=true)
- sm4 = mt_adddiff(dehalo, mt_makediff(dehalo, dehalo.RemoveGrain(20), U=3, V=3).Repair(mt_makediff(src, dehalo, U=3, V=3), 13), U=3,V=3)
- Sclp = shstrength == 0 ? sm4 : Tlimit ? LSFmod1(sm4,defaults="slow",Smode=5,Smethod=3,Lmode=4,strength=shstrength,sharpmask=sharpmask,preblur="OFF",secure=true,edgemode=0,soft=0,soothe=false,ss_x=1.00,ss_y=1.00) :
- \LSFmod1(sm4,defaults="slow",Smode=5,Smethod=3,Lmode=4,strength=shstrength,sharpmask=sharpmask,preblur="OFF",secure=true,edgemode=0,soft=-2,soothe=true,ss_x=1.00,ss_y=1.00)
- srcMVS = Tlimit ? src.MSuper(hpad=0,vpad=0,pel=2,sharp=2,chroma=false) : NOP()
- f1v = Tlimit ? MAnalyse(srcMVS, isb=false, delta=1, truemotion=false, blksize=16, overlap=8, pelsearch=2, search=2, searchparam=2, DCT=0, global=true, chroma=false) : NOP()
- b1v = Tlimit ? MAnalyse(srcMVS, isb=true, delta=1, truemotion=false, blksize=16, overlap=8, pelsearch=2, search=2, searchparam=2, DCT=0, global=true, chroma=false) : NOP()
- f1c = Tlimit ? MCompensate(src, srcMVS, f1v, thSAD=300, thSCD1=300, thSCD2=100) : NOP()
- b1c = Tlimit ? MCompensate(src, srcMVS, b1v, thSAD=300, thSCD1=300, thSCD2=100) : NOP()
- SAD_f1m = Tlimit ? MMask(src, f1v, kind=1, ml=300, gamma=0.999, Ysc=0) : NOP()
- SAD_b1m = Tlimit ? MMask(src, b1v, kind=1, ml=300, gamma=0.999, Ysc=0) : NOP()
- mM = Tlimit ? mt_average(SAD_f1m,SAD_b1m,U=1,V=1).mt_lut(expr="x 1.6 ^",U=1,V=1) : NOP()
- mE = Tlimit ? mask.mt_lut(expr="x 1.5 ^",U=1,V=1) : NOP()
- mL = Tlimit ? mt_logic(mM.invert(),mE,"min",U=1,V=1).removegrain(20,-1) : NOP()
- Tmax = Tlimit ? src.mt_logic(f1c,"max",U=1,V=1).mt_logic(b1c,"max",U=1,V=1) : NOP()
- Tmin = Tlimit ? src.mt_logic(f1c,"min",U=1,V=1).mt_logic(b1c,"min",U=1,V=1) : NOP()
- shrp = Tlimit ? Sclp.mt_clamp(Tmax, Tmin, Tovershoot, Tovershoot, U=1, V=1) : NOP()
- smA = Tlimit ? mt_merge(src,shrp,mL,luma=false,Y=3,U=4,V=4) : Sclp
- smE = mt_merge(src,smA,mask.mt_lut("x 24 < 0 x 2 << ?", U=1, V=1),luma=true,U=3,V=3)
- deband1 = smE.GradFun3( smode=1, thr=0.20, elast=2.5, ampn=0, radius=16, ampo=0.8, dthr=0.011, lsb=true, lsb_in=false, mask=0 )
- deband2 = smE.GradFun3( smode=2, thr=0.25, elast=2.5, ampn=0, radius=16, ampo=0.8, dthr=0.011, lsb=true, lsb_in=false, mask=0 ).f3kdb(range=24, Y=48, Cb=33, Cr=33, grainY=0, grainC=0, dither_algo=2, dynamic_grain=true, keep_tv_range=false, input_mode=1, output_mode=1, output_depth=16)
- deband3 = smE.EPSlice(0,0,0,sh/2,sp1="f3kdb(range=24, Y=120, Cb=64, Cr=64, grainY=0, grainC=0, dither_algo=2, dynamic_grain=true, keep_tv_range=false, input_mode=0, output_mode=1, output_depth=16)",
- \sp2="f3kdb(range=24, Y=40, Cb=48, Cr=48, grainY=0, grainC=0, dither_algo=2, dynamic_grain=true, keep_tv_range=false, input_mode=0, output_mode=1, output_depth=16)")
- deband = deband1.Trim(0,OP1+134)+deband2.Trim(OP1+135,OP1+235)+deband1.Trim(OP1+236,ED1+240)+deband2.Trim(ED1+241,ED1+492)+deband3.Trim(ED1+493,ED1+604)+deband1.Trim(ED1+605,0)
- mask1 = mask.mt_lut("x 2 <= x x 5 << ?",U=1,V=1)
- mask2 = mask.mt_lut("x 3 <= x x 1 - 5 << ?",U=1,V=1)
- mask3 = mask.mt_lut("x 6 <= x x 4 - 5 << ?",U=1,V=1)
- dbmask = mask1.Trim(0,OP1+134)+mask2.Trim(OP1+135,OP1+235)+mask1.Trim(OP1+236,ED1+240)+mask2.Trim(ED1+241,ED1+492)+mask3.Trim(ED1+493,ED1+604)+mask1.Trim(ED1+605,0)
- mM = Tlimit ? mt_average(SAD_f1m,SAD_b1m,U=1,V=1).mt_lut("x 1.8 ^",U=1,V=1) : NOP()
- mF = Tlimit ? mt_logic(mM,dbmask,"max",U=1,V=1) : dbmask
- db = Dither_merge16_8( deband, smE.Dither_convert_8_to_16(), mF, luma=true)
- final = downscale ? db.Dither_resize16(dw,dh,kernel="Spline36") : db
- final.f3kdb(range=0, Y=0, Cb=0, Cr=0, grainY=0, grainC=0, dither_algo=2, dynamic_grain=true, keep_tv_range=false, input_mode=1, output_mode=2, output_depth=10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement