Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FUNCTION ContraSharpening(clip filtered, clip original)
- {
- # contra-sharpening: sharpen the denoised clip, but don't add more to any pixel than what was removed previously.
- # script function from Didee from the VERY GRAINY thread
- s = filtered.minblur(1,1) # damp down remaining spots of the denoised clip
- allD = mt_makediff(original,filtered) # the difference achieved by the denoising
- ssD = mt_makediff(s,s.removegrain(11,-1)) # the difference of a simple kernel blur
- ssDD = ssD.repair(allD,1) # limit the difference to the max of what the denoising removed locally.
- ssDD = SSDD.mt_lutxy(ssD,"x 128 - abs y 128 - abs < x y ?") # abs(diff) after limiting may not be bigger than before.
- RETURN (filtered.mt_adddiff(ssDD,U=2,V=2)) # apply the limited difference. (sharpening is just inverse blurring)
- }
- FUNCTION MinBlur(clip input, int r, int "uv")
- {
- # Taken from MCBob.avs:
- uv = default(uv,3)
- # process chroma if uv==3, otherwise just luma
- uv2 = (uv==2) ? 1 : uv
- rg4 = (uv==3) ? 4 : -1
- rg11 = (uv==3) ? 11 : -1
- rg20 = (uv==3) ? 20 : -1
- medf = (uv==3) ? 1 : -200
- # make our blur clips, r controls amount ...keep the best blur pixel from each
- RG11D = (r==1) ? mt_makediff(input,input.removegrain(11, rg11),U=uv2,V=uv2)
- \ : (r==2) ? mt_makediff(input,input.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
- \ : mt_makediff(input,input.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
- RG4D = (r==1) ? mt_makediff(input,input.removegrain(4,rg4),U=uv2,V=uv2)
- \ : (r==2) ? mt_makediff(input,input.medianblur(2,2*medf,2*medf),U=uv2,V=uv2)
- \ : mt_makediff(input,input.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
- DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
- RETURN (input.mt_makediff(DD,U=uv,V=uv))
- }
Add Comment
Please, Sign In to add comment