View Single Post
Old 19th December 2011, 17:25   #11  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Perhaps yes, perhaps no ... main interest = halo removal, sharpening not seriously considered:



Code:
# removegrain.dll
# medianblur.dll
# mt_masktools.dll

avisource("982x720-QTGMC-NNEDI-Spline36.avi")
pointresize(984,720,0,0,984,720) # need mod4 ...
converttoyv12( matrix="PC.601" ) # ... for YV12
o=last

small = o.bicubicresize(984-96,432,-.4,.2)
o.mt_makediff(mt_makediff(small,small.removegrain(20).removegrain(11)).bicubicresize(984,720),U=2,V=2)
o.repair(last,13)
o.repair(last,13)
xx=removegrain(11)
last.merge(last.sbr(),0.751).mt_adddiff(mt_makediff(xx,xx.minblur(3)),U=2,V=2)
last.mt_lutxy(o,"x y < x 1 + x y > x 1 - x ? ?",U=2,V=2)
smoothlevels(30,1.0,240,16,235)
interleave(o,last)

return(last)


#=====# Helper Functions #=====#

function sbr(clip o) 
{
rg11=o.removegrain(11)
rg11D=mt_makediff(o,rg11)
rg11DD=mt_makediff(rg11D,rg11D.removegrain(11)).mt_lutxy(rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?")
o.mt_makediff(rg11DD,U=2,V=2) 
}

function MinBlur(clip clp, int r, int "uv")
{
uv   = default(uv,3)
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

RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
 \    : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
 \    : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
 \    :          mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D  = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2)
 \    : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U=uv2,V=uv2)
 \    :          mt_makediff(clp,clp.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)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote