Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Loads
- # Functions
- function HQDering(clip input, int "strength", int "overall", clip "smoother") {
- strength = Default(strength, 255) # strength, 0-255
- overall = Default(overall, 0) # overall smoothing, 0-255
- smoothed = defined(smoother) ? smoother : input.Deen("a3d",4,15,15,20) # filter that smooths
- normalmask=input.mt_edge(thY1=3, thY2=255, mode="sobel", chroma="none")
- amplifiedmask=normalmask.Levels(0, 3.3, 90, 0, 255).Blur(1.0)
- thickmask=normalmask.mt_inflate().mt_inflate().mt_inflate().Levels(0, 3.3, 90, 0, 255)
- \ .Blur(1.0).mt_inflate().mt_inflate().mt_inflate().Levels(0, 3.3, 255, 0, 255)
- \ .mt_inflate().mt_inflate()
- ringingmask=mt_lutxy(amplifiedmask.mt_invert(), thickmask, expr="x y * 255 /").Levels(60, 3.0, 140, overall, strength)
- mt_merge(input, smoothed, ringingmask)
- }
- function FastLineDarkenMOD( clip c, int "strength", int "luma_cap", int "threshold", int "thinning")
- {
- ## parameters ##
- str = string(default(strength, 48) /128.)
- lum = string(default(luma_cap, 191))
- thr = string(default(threshold, 4))
- thinning = default(thinning,24)
- thn = string(thinning /16.)
- ## filtering ##
- exin = c.mt_expand().mt_inpand()
- diff = mt_lutxy(c,exin,yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x",u=2, v=2)
- linemask= mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +").mt_convolution("1 1 1","1 1 1",y=3,u=0,v=0)
- thick = mt_lutxy(c, exin, yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x",u=2, v=2)
- thin = mt_lutxy(c.mt_expand(U=2,V=2),diff,yexpr="x y 127 - "+str+" 1 + * +",u=2, v=2)
- return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=2,v=2)
- }
- # Src
- DirectShowSource("F:\Umi ga Kikoeru (BD Remux).mkv")
- # Denoise/Dering
- RemoveGrain(17)
- KNLMeansCL(a=4,s=3,h=2.5)
- HQDering()
- # Stab & Crop
- Crop(0,22,0,-22)
- # Levels & Color correction
- ColorYUV(off_u=0,off_v=-1.4)
- SmoothTweak(0,1.1,0.95)
- AutoAdjust()
- # Sharpening
- #FastLineDarkenMOD()
- #MAA2()
- # Testing only!
- Trim(34000,34200)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement