Advertisement
mawen1250

Hunter X Hunter 2011 BD EP01 final2 by mawen1250

Mar 14th, 2012
281
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. #DSS2("D:\[BDMV][Hunter X Hunter][ハンターハンター Vol.1]\BDMV\STREAM\00004.m2ts")
  11.  
  12. downscale=false
  13. shstrength = downscale ? 0 : 60
  14. Tlimit = !downscale
  15. Tovershoot=2
  16. EdgeRepair = false
  17. OP1=0
  18. OP2=1918
  19. ED1=31649
  20. ED2=33567
  21.  
  22. src=last
  23. sw=src.width
  24. sh=src.height
  25. dw=sw*2/3
  26. dh=sh*2/3
  27. up=src.SoftCubicResize(sw*2, sh*2, soft=50)
  28. sm1=up.awarpsharp2(thresh=100,type=1,depth=16).Spline36Resize(sw, sh)
  29. sm2=up.awarpsharp2(thresh=100,type=1,depth=6).Spline36Resize(sw, sh)
  30. 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)
  31. sm3 = downscale ? sm3.ResampleHQ(dw, dh, srcmatrix= "TV.709", dstmatrix="TV.709", kernel="Spline36", chroma_kernel="Spline36") : sm3
  32. mask=sm3.tcanny(sigma=1.0, mode=1)
  33.  
  34. SoraThread(StackVertical(sm3,mask), 5, 10)
  35. sth=last.height/2
  36. src=last.crop(0,0,0,-sth)
  37. mask=last.crop(0,sth,0,0)
  38. sharpmask = shstrength == 0 ? NOP() : mask.mt_lut("x 48 < 0 x 144 >= 399 x - x 2 << 188 - ? ?",U=1,V=1)
  39.  
  40.    Sclp = shstrength == 0 ? src : 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) :
  41.    \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)
  42.  
  43.    srcMVS = Tlimit ? src.MSuper(hpad=0,vpad=0,pel=2,sharp=2,chroma=false) : NOP()
  44.    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()
  45.    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()
  46.    f1c      = Tlimit ? MCompensate(src, srcMVS, f1v, thSAD=300, thSCD1=300, thSCD2=100) : NOP()
  47.    b1c      = Tlimit ? MCompensate(src, srcMVS, b1v, thSAD=300, thSCD1=300, thSCD2=100) : NOP()
  48.    SAD_f1m = Tlimit ? MMask(src, f1v, kind=1, ml=300, gamma=0.999, Ysc=0) : NOP()
  49.    SAD_b1m = Tlimit ? MMask(src, b1v, kind=1, ml=300, gamma=0.999, Ysc=0) : NOP()
  50.    mM = Tlimit ? mt_average(SAD_f1m,SAD_b1m,U=1,V=1).mt_lut(expr="x 1.6 ^",U=1,V=1) : NOP()
  51.    mE = Tlimit ? mask.mt_lut(expr="x 1.5 ^",U=1,V=1) : NOP()
  52.    mL = Tlimit ? mt_logic(mM.invert(),mE,"min",U=1,V=1).removegrain(20,-1) : NOP()
  53.    Tmax = Tlimit ? src.mt_logic(f1c,"max",U=1,V=1).mt_logic(b1c,"max",U=1,V=1) : NOP()
  54.    Tmin = Tlimit ? src.mt_logic(f1c,"min",U=1,V=1).mt_logic(b1c,"min",U=1,V=1) : NOP()
  55.    shrp = Tlimit ? Sclp.mt_clamp(Tmax, Tmin, Tovershoot, Tovershoot, U=1, V=1) : NOP()
  56.    smA = Tlimit ? mt_merge(src,shrp,mL,U=1,V=1) : Sclp
  57.    
  58.    chroma=false
  59.    chr31 = chroma?3:1
  60.    #smB = Repair(Repair(src,smA.RemoveGrain(2,0),23),src.Dehalo_Alpha_mt(darkstr=0.0,brightstr=1.0,rx=downscale ? 1.0 : 1.5,ry=downscale ? 1.0 : 1.5),23)
  61.    smB = EdgeRepair ? Repair(src,smA.Dehalo_Alpha_mt(darkstr=0.0,brightstr=1.0,rx=downscale ? 1.0 : 1.5,ry=downscale ? 1.0 : 1.5),23) : NOP()
  62.    diff1 = EdgeRepair ? mt_makediff(src,smA,Y=3,U=1,V=1) : NOP()
  63.    diff2 = EdgeRepair ? mt_makediff(smB, smB.RemoveGrain((src.width > 1100) ? 20 : 11), U=chr31, V=chr31).Repair(mt_makediff(src, smB, U=chr31, V=chr31), 13) : NOP()
  64.    smC = EdgeRepair ? mt_adddiff(smB,diff2, U=chr31,V=chr31) : NOP()
  65.    #mC  = mt_lutxy(mask,diff1,"y 127 < x 1 << y 129 > x 1 << 0 ? ?",U=1,V=1)
  66.    mC  = EdgeRepair ? mt_lut(diff1,"x 127 < 255 0 ?",U=1,V=1) : NOP()
  67.    smD = EdgeRepair ? mt_merge(smA,smC,mC,luma=chroma?true:false,U=chr31,V=chr31) : smA
  68.    
  69. smE = smD
  70.  
  71. deband1 = smE.f3kdb(range= downscale ? 12 : 18 , Y=33, Cb=33, Cr=33, grainY=0, grainC=0, dither_algo=2, dynamic_grain=true, keep_tv_range=false, input_mode=0, output_mode=1, output_depth=16)
  72. deband2 = smE.f3kdb(range= downscale ? 12 : 18 , Y=42, Cb=38, Cr=38, grainY=0, grainC=0, dither_algo=2, dynamic_grain=true, keep_tv_range=false, input_mode=0, output_mode=1, output_depth=16)
  73. deband3 = smE.EPSlice(0,0,0,sth/2,sp1="f3kdb(range= 12 , 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)",
  74. \sp2="f3kdb(range= 12 , 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)")
  75. mask1    = mask.mt_lut("x 2 <= x x 6 << ?",U=1,V=1)
  76. mask2    = mask.mt_lut("x 3 <= x x 6 << ?",U=1,V=1)
  77. mask3    = mask.mt_lut("x 7 <= x x 5 << ?",U=1,V=1)
  78. db=Dither_merge16_8(
  79. \ 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),
  80. \ smD.Dither_convert_8_to_16(),
  81. \ 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),
  82. \ luma=true)
  83. Dither_merge16_8(
  84. \ db.GrainFL(lsb_in=true, lsb=true, th1=48, th2=64, th3=80, th4=96, g1str=4, g2str=3, g3str=0, g1shrp=60, g2shrp=66, g3shrp=80, g1size=1.00, g2size=1.50, g3size=1.75, g1soft=3,g2soft=4,g3soft=5),
  85. \ db,
  86. \ mask.mt_lut("x 3 <<",U=0,V=0),
  87. \ luma=false)
  88.  
  89. 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