Advertisement
mawen1250

Hunter X Hunter 2011 BD EP01 final by mawen1250

Mar 9th, 2012
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SetMemoryMax(3072)
  2. Import("LSFmod.v1.9 custom.avsi")
  3.  
  4. src = "D:\[BDMV][Hunter X Hunter][ハンターハンター Vol.1]\BDMV\STREAM\00004.m2ts"
  5. cf = src + ".ffindex"
  6.  
  7. FFIndex(src, cachefile=cf, demuxer="lavf")
  8. FFVideoSource(src, cachefile=cf, seekmode=-1, threads=1)
  9.  
  10. downscale=false
  11. shstrength = downscale ? 40 : 70
  12. Tlimit = !downscale
  13. Tovershoot=2
  14. EdgeRepair = downscale
  15. OP1=0
  16. OP2=1918
  17. ED1=31649
  18. ED2=33567
  19.  
  20. src=last
  21. sw=src.width
  22. sh=src.height
  23. dw=sw*2/3
  24. dh=sh*2/3
  25. up=src.SoftCubicResize(sw*2, sh*2, soft=50)
  26. sm1=up.awarpsharp2(thresh=100,type=1,depth=16).Spline36Resize(sw, sh)
  27. sm2=up.awarpsharp2(thresh=100,type=1,depth=6).Spline36Resize(sw, sh)
  28. 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)
  29. sm3 = downscale ? sm3.ResampleHQ(dw, dh, srcmatrix= "TV.709", dstmatrix="TV.709", kernel="Spline36", chroma_kernel="Spline36") : sm3
  30. mask=sm3.tcanny(sigma=1.0, mode=1)
  31.  
  32. SoraThread(StackVertical(sm3,mask), 5, 10)
  33. sth=last.height/2
  34. src=last.crop(0,0,0,-sth)
  35. mask=last.crop(0,sth,0,0)
  36. sharpmask=mask.mt_lut("x 48 < 0 x 144 >= 399 x - x 2 << 188 - ? ?",U=1,V=1)
  37.  
  38.    Sclp = Tlimit ? LSFmod1(src,defaults="slow",Smode=5,Smethod=3,Lmode=4,overshoot=0,overshoot2=0,undershoot=1,undershoot2=2,strength=shstrength,sharpmask=sharpmask,preblur="ON",secure=true,edgemode=0,soft=0,soothe=false,ss_x=1.00,ss_y=1.00) :
  39.    \LSFmod1(src,defaults="slow",Smode=5,Smethod=3,Lmode=4,overshoot=0,overshoot2=0,undershoot=1,undershoot2=2,strength=shstrength,sharpmask=sharpmask,preblur="ON",secure=true,edgemode=0,soft=-2,soothe=true,ss_x=1.25,ss_y=1.25)
  40.    srcMVS = Tlimit ? src.MSuper(hpad=0,vpad=0,pel=2,sharp=2,chroma=false) : NOP()
  41.    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()
  42.    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()
  43.    f1c      = Tlimit ? MCompensate(src, srcMVS, f1v, thSAD=300, thSCD1=300, thSCD2=100) : NOP()
  44.    b1c      = Tlimit ? MCompensate(src, srcMVS, b1v, thSAD=300, thSCD1=300, thSCD2=100) : NOP()
  45.    SAD_f1m = Tlimit ? MMask(src, f1v, kind=1, ml=300, gamma=0.999, Ysc=0) : NOP()
  46.    SAD_b1m = Tlimit ? MMask(src, b1v, kind=1, ml=300, gamma=0.999, Ysc=0) : NOP()
  47.    mM = Tlimit ? mt_average(SAD_f1m,SAD_b1m,U=1,V=1).mt_lut(expr="x 1.6 ^",U=1,V=1) : NOP()
  48.    mE = Tlimit ? mask.mt_lut(expr="x 1.5 ^",U=1,V=1) : NOP()
  49.    mL = Tlimit ? mt_logic(mM.invert(),mE,"min",U=1,V=1).removegrain(20,-1) : NOP()
  50.    Tmax = Tlimit ? src.mt_logic(f1c,"max",U=1,V=1).mt_logic(b1c,"max",U=1,V=1) : NOP()
  51.    Tmin = Tlimit ? src.mt_logic(f1c,"min",U=1,V=1).mt_logic(b1c,"min",U=1,V=1) : NOP()
  52.    shrp = Tlimit ? Sclp.mt_clamp(Tmax, Tmin, Tovershoot, Tovershoot, U=1, V=1) : NOP()
  53.    smB = Tlimit ? mt_merge(src,shrp,mL,U=1,V=1) : Sclp
  54.    
  55.    chroma=false
  56.    chr31 = chroma?3:1
  57.    #smC = Repair(Repair(src,smB.RemoveGrain(2,0),23),src.Dehalo_Alpha(darkstr=0.0,brightstr=1.0,rx=downscale ? 1.0 : 1.5,ry=downscale ? 1.0 : 1.5),23)
  58.    smC = EdgeRepair ? Repair(src,smB.Masked_DHA(darkstr=0.0,brightstr=1.0,rx=downscale ? 1.0 : 1.5,ry=downscale ? 1.0 : 1.5),23) : NOP()
  59.    diff1 = EdgeRepair ? mt_makediff(src,smB,Y=3,U=1,V=1) : NOP()
  60.    diff2 = EdgeRepair ? mt_makediff(smC, smC.RemoveGrain((src.width > 1100) ? 20 : 11), U=chr31, V=chr31).Repair(mt_makediff(src, smC, U=chr31, V=chr31), 13) : NOP()
  61.    smD = EdgeRepair ? mt_adddiff(smC,diff2, U=chr31,V=chr31) : NOP()
  62.    #mC  = mt_lutxy(mask,diff1,"y 127 < x 1 << y 129 > x 1 << 0 ? ?",U=1,V=1)
  63.    mC  = EdgeRepair ? mt_lut(diff1,"x 127 < 255 0 ?",U=1,V=1) : NOP()
  64.    smE = EdgeRepair ? mt_merge(smB,smD,mC,luma=chroma?true:false,U=chr31,V=chr31) : smB
  65.    
  66. deband1 = smE.f3kdb(range= downscale ? 12 : 18 , Y=33, Cb=33, Cr=33, ditherY=0, ditherC=0, precision_mode=3, dynamic_dither_noise=true, keep_tv_range=false, input_mode=0, output_mode=1, output_depth=16)
  67. deband2 = smE.f3kdb(range= downscale ? 12 : 18 , Y=42, Cb=38, Cr=38, ditherY=0, ditherC=0, precision_mode=3, dynamic_dither_noise=true, keep_tv_range=false, input_mode=0, output_mode=1, output_depth=16)
  68. deband3 = smE.EPSlice(0,0,0,sth/2,sp1="f3kdb(range= 12 , Y=120, Cb=64, Cr=64, ditherY=0, ditherC=0, precision_mode=3, dynamic_dither_noise=true, keep_tv_range=false, input_mode=0, output_mode=1, output_depth=16)",
  69. \sp2="f3kdb(range= 12 , Y=40, Cb=48, Cr=48, ditherY=0, ditherC=0, precision_mode=3, dynamic_dither_noise=true, keep_tv_range=false, input_mode=0, output_mode=1, output_depth=16)")
  70. mask1    = mask.mt_lut("x 2 <= x x 6 << ?",U=1,V=1)
  71. mask2    = mask.mt_lut("x 3 <= x x 6 << ?",U=1,V=1)
  72. mask3    = mask.mt_lut("x 7 <= x x 5 << ?",U=1,V=1)
  73. Dither_merge16_8(
  74. \ 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),
  75. \ smE.Dither_convert_8_to_16(),
  76. \ 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),
  77. \ luma=true)
  78.  
  79. f3kdb(range=0, Y=0, Cb=0, Cr=0, ditherY=0, ditherC=0, precision_mode=3, dynamic_dither_noise=true, keep_tv_range=false, input_mode=1, output_mode=2, output_depth=10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement