Advertisement
mawen1250

Hunter X Hunter 2011 BD EP01 final3 by mawen1250

Apr 16th, 2012
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SetMemoryMax(3072)
  2.  
  3. src = "D:\[BDMV][Hunter X Hunter][ハンターハンター Vol.1]\BDMV\STREAM\00004.m2ts"
  4. cf = src + ".ffindex"
  5.  
  6. FFIndex(src, cachefile=cf, demuxer="lavf")
  7. FFVideoSource(src, cachefile=cf, seekmode=-1, threads=1)
  8.  
  9. #DSS2("D:\[BDMV][Hunter X Hunter][ハンターハンター Vol.1]\BDMV\STREAM\00004.m2ts")
  10.  
  11. downscale=true
  12. shstrength = downscale ? 0 : 80
  13. Tlimit = true
  14. Tovershoot=2
  15. EdgeRepair = false
  16. OP1=0
  17. OP2=1918
  18. ED1=31649
  19. ED2=33567
  20.  
  21. src=last
  22. sw=src.width
  23. sh=src.height
  24. dw=sw*2/3
  25. dh=sh*2/3
  26. up=src.SoftCubicResize(sw*2, sh*2, soft=50)
  27. sm1=up.awarpsharp2(thresh=100,type=1,depth=16).Spline36Resize(sw, sh)
  28. sm2=up.awarpsharp2(thresh=100,type=1,depth=6).Spline36Resize(sw, sh)
  29. 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)
  30. #sm3 = downscale ? sm3.ResampleHQ(dw, dh, srcmatrix= "TV.709", dstmatrix="TV.709", kernel="Spline36", chroma_kernel="Spline36") : sm3
  31. mask=src.tcanny(sigma=1.0, mode=1, plane=1)
  32.  
  33. sharpmask = shstrength == 0 ? NOP() : mask.mt_lut("x 48 < 0 x 144 >= 399 x - x 2 << 188 - ? ?",U=1,V=1)
  34. 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)
  35. #blurc = src.binomialBlur(varY=0.5,varC=0.5,usemmx=true)
  36. 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)
  37.  
  38.    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) :
  39.    \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)
  40.  
  41.    srcMVS = Tlimit ? src.MSuper(hpad=0,vpad=0,pel=2,sharp=2,chroma=false) : NOP()
  42.    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()
  43.    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()
  44.    f1c      = Tlimit ? MCompensate(src, srcMVS, f1v, thSAD=300, thSCD1=300, thSCD2=100) : NOP()
  45.    b1c      = Tlimit ? MCompensate(src, srcMVS, b1v, thSAD=300, thSCD1=300, thSCD2=100) : NOP()
  46.    SAD_f1m = Tlimit ? MMask(src, f1v, kind=1, ml=300, gamma=0.999, Ysc=0) : NOP()
  47.    SAD_b1m = Tlimit ? MMask(src, b1v, kind=1, ml=300, gamma=0.999, Ysc=0) : NOP()
  48.    mM = Tlimit ? mt_average(SAD_f1m,SAD_b1m,U=1,V=1).mt_lut(expr="x 1.6 ^",U=1,V=1) : NOP()
  49.    mE = Tlimit ? mask.mt_lut(expr="x 1.5 ^",U=1,V=1) : NOP()
  50.    mL = Tlimit ? mt_logic(mM.invert(),mE,"min",U=1,V=1).removegrain(20,-1) : NOP()
  51.    Tmax = Tlimit ? src.mt_logic(f1c,"max",U=1,V=1).mt_logic(b1c,"max",U=1,V=1) : NOP()
  52.    Tmin = Tlimit ? src.mt_logic(f1c,"min",U=1,V=1).mt_logic(b1c,"min",U=1,V=1) : NOP()
  53.    shrp = Tlimit ? Sclp.mt_clamp(Tmax, Tmin, Tovershoot, Tovershoot, U=1, V=1) : NOP()
  54.    smA = Tlimit ? mt_merge(src,shrp,mL,luma=false,Y=3,U=4,V=4) : Sclp
  55.  
  56. smE = mt_merge(src,smA,mask.mt_lut("x 24 < 0 x 2 << ?", U=1, V=1),luma=true,U=3,V=3)
  57.  
  58. 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 )
  59. 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)
  60. 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)",
  61. \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)")
  62. 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)
  63. mask1    = mask.mt_lut("x 2 <= x x 5 << ?",U=1,V=1)
  64. mask2    = mask.mt_lut("x 3 <= x x 1 - 5 << ?",U=1,V=1)
  65. mask3    = mask.mt_lut("x 6 <= x x 4 - 5 << ?",U=1,V=1)
  66. 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)
  67. mM = Tlimit ? mt_average(SAD_f1m,SAD_b1m,U=1,V=1).mt_lut("x 1.8 ^",U=1,V=1) : NOP()
  68. mF = Tlimit ? mt_logic(mM,dbmask,"max",U=1,V=1) : dbmask
  69. db = Dither_merge16_8( deband, smE.Dither_convert_8_to_16(), mF, luma=true)
  70. final = downscale ? db.Dither_resize16(dw,dh,kernel="Spline36") : db
  71.  
  72. 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