TheProfileth
15th February 2011, 01:36
This being my the 4th attempt at trying to make a filter using avisynth, I decided to go with a simple approach and ended up yielding very good results. I would like criticism and feedback and hopefully ways to improve the filter.
Thank you as always for your feedback
#DeFreqChroma4Ever
#version 4E
#Release candidate
#Full working params and everything
#thr and thr2 are the amount that the clips being compared are allowed to change
#blurlevel allows you to change what blur type is being used
#practical values are 11,12,19,20 <- that is ascending order of strength
#strong add a very fast high pass noise remover which helps with compression by a great amount
#only side effect is slight blurring, and maybe some detail loss but usually not
#pref and postf are true false triggers for wether or not to use a pre or post filter
#prefiltering tends to keep the most detail (when sharpening at least) but hurts compression
#params1 goes to prefilter and params2 goes to postfilter correct param input looks like
#prefilter="filtername" and then fill in the parameters with params="what ever they should be"
#only issue is if there are quotes will fix this eventually
#while postfiltering tends to be the best average option which is why I have it on default
#chroma calls nlmeanscl to do some nice chroma filtering for you and then merge that clip in at the end
#if nlmeanscl works for you then you should be fine, otherwise just use a different filter after or before to filter chroma
#
#Credits
#Didee for Flux5frames and Tmedian and SBR and for the original idea that sparked this
#http://forum.doom9.org/showthread.php?p=1127757#post1127757 <-- that
#Nikos for bringing my attention to it
#Thank you Kassandro for making removegrain and removegraint
#Nephilis for the sharpening mode which I modded for compatibility and have called SFM5
#Thank you Torque,Telepathic,Light,Sashamaru,Evilliveshere, Chevy787 and for their support and help testing
#
#
#
#
#Changelog
#Version 4E
#Added parameters to combine all 3 modes
#Added blurlevel
#Added pre and post filter params
#Added chroma toggle
#Added strong mode toggle
#Changed thr so that it can be independently set for the first and second
#Borrowed a sharpening script from MCGRMultiSE, and modded it to work with better compatibility
#great job on that Nephilis
#
#
#
#
#
#Version 4
#Optimized a small amount increased strength
#
#
#
#Version 3
#Safer and more accurate and with different modes, but in separate avsi files
#
#
#
#Version 2
#Faster more accurate and safer
#still more of a blur than anything
#
#
#
#Version 1 was interested in script found on doom9
#Slight modifying
#
#
#
#
function DFC4E(clip, int "thr",int "thr2",bool "strong",bool "chroma",float "blurlevel",bool "PreF", string "prefilter", string "params1"\
,bool "PostF", string "postfilter", string "params2"){
thr = default(thr,4)
thr2 = default(thr2,thr)
blurlevel default( blurlevel, 12 )
PreF = default( PreF , false )
PostF = default( PostF , true )
chroma = default( chroma , true )
strong = default( strong , true )
prefilter= Default(prefilter, "sfm5")
postfilter= Default(postfilter, "sfm5")
c=clip
params1 = Default(params1, prefilter=="sfm5" ? "Sstr=1,Slimit=6" : "")
prefiltered = Eval("c." + prefilter + "(" + params1 + ")")
prefilt = PreF ? prefiltered : c
c2=prefilt
f = c2.removegrain(blurlevel,0)
t = c2.Flux5framesT()
chr = chroma ? c.nlmeanscl(plane=3,h=0.5,hc=0.5,b=1) : c
f1=mt_LutXY(f,t,"x "+string(thr)+" + y < x "+string(thr)+" + x "+string(thr)+" - y > x "+string(thr)+" - y ? ?",U=2,V=2)
f2=temporalrepair(f1,c,mode=1)
params2 = Default(params2, postfilter=="sfm5" ? "Sstr=1,Slimit=6" : "")
postfiltered = Eval("f2." + postfilter + "(" + params2 + ")")
pstfilt = PostF ? postfiltered : f2
str = strong ? pstfilt.sbr : pstfilt.removegrain(1,0)
final=mt_LutXY(c,str,"x "+string(thr)+" + y < x "+string(thr2)+" + x "+string(thr2)+" - y > x "+string(thr2)+" - y ? ?",U=2,V=2)
rep=repair(c,final,mode=18).mergechroma(chr)
return(rep)
}
File and dependencies
http://www.mediafire.com/?o7cktjyx92ods56
Hopefully this time I won't disappoint Didee
(well I can always dream can't I)
Edit: Here are some comparison shots
http://screenshotcomparison.com/comparison/28666
http://screenshotcomparison.com/comparison/28667
Thank you as always for your feedback
#DeFreqChroma4Ever
#version 4E
#Release candidate
#Full working params and everything
#thr and thr2 are the amount that the clips being compared are allowed to change
#blurlevel allows you to change what blur type is being used
#practical values are 11,12,19,20 <- that is ascending order of strength
#strong add a very fast high pass noise remover which helps with compression by a great amount
#only side effect is slight blurring, and maybe some detail loss but usually not
#pref and postf are true false triggers for wether or not to use a pre or post filter
#prefiltering tends to keep the most detail (when sharpening at least) but hurts compression
#params1 goes to prefilter and params2 goes to postfilter correct param input looks like
#prefilter="filtername" and then fill in the parameters with params="what ever they should be"
#only issue is if there are quotes will fix this eventually
#while postfiltering tends to be the best average option which is why I have it on default
#chroma calls nlmeanscl to do some nice chroma filtering for you and then merge that clip in at the end
#if nlmeanscl works for you then you should be fine, otherwise just use a different filter after or before to filter chroma
#
#Credits
#Didee for Flux5frames and Tmedian and SBR and for the original idea that sparked this
#http://forum.doom9.org/showthread.php?p=1127757#post1127757 <-- that
#Nikos for bringing my attention to it
#Thank you Kassandro for making removegrain and removegraint
#Nephilis for the sharpening mode which I modded for compatibility and have called SFM5
#Thank you Torque,Telepathic,Light,Sashamaru,Evilliveshere, Chevy787 and for their support and help testing
#
#
#
#
#Changelog
#Version 4E
#Added parameters to combine all 3 modes
#Added blurlevel
#Added pre and post filter params
#Added chroma toggle
#Added strong mode toggle
#Changed thr so that it can be independently set for the first and second
#Borrowed a sharpening script from MCGRMultiSE, and modded it to work with better compatibility
#great job on that Nephilis
#
#
#
#
#
#Version 4
#Optimized a small amount increased strength
#
#
#
#Version 3
#Safer and more accurate and with different modes, but in separate avsi files
#
#
#
#Version 2
#Faster more accurate and safer
#still more of a blur than anything
#
#
#
#Version 1 was interested in script found on doom9
#Slight modifying
#
#
#
#
function DFC4E(clip, int "thr",int "thr2",bool "strong",bool "chroma",float "blurlevel",bool "PreF", string "prefilter", string "params1"\
,bool "PostF", string "postfilter", string "params2"){
thr = default(thr,4)
thr2 = default(thr2,thr)
blurlevel default( blurlevel, 12 )
PreF = default( PreF , false )
PostF = default( PostF , true )
chroma = default( chroma , true )
strong = default( strong , true )
prefilter= Default(prefilter, "sfm5")
postfilter= Default(postfilter, "sfm5")
c=clip
params1 = Default(params1, prefilter=="sfm5" ? "Sstr=1,Slimit=6" : "")
prefiltered = Eval("c." + prefilter + "(" + params1 + ")")
prefilt = PreF ? prefiltered : c
c2=prefilt
f = c2.removegrain(blurlevel,0)
t = c2.Flux5framesT()
chr = chroma ? c.nlmeanscl(plane=3,h=0.5,hc=0.5,b=1) : c
f1=mt_LutXY(f,t,"x "+string(thr)+" + y < x "+string(thr)+" + x "+string(thr)+" - y > x "+string(thr)+" - y ? ?",U=2,V=2)
f2=temporalrepair(f1,c,mode=1)
params2 = Default(params2, postfilter=="sfm5" ? "Sstr=1,Slimit=6" : "")
postfiltered = Eval("f2." + postfilter + "(" + params2 + ")")
pstfilt = PostF ? postfiltered : f2
str = strong ? pstfilt.sbr : pstfilt.removegrain(1,0)
final=mt_LutXY(c,str,"x "+string(thr)+" + y < x "+string(thr2)+" + x "+string(thr2)+" - y > x "+string(thr2)+" - y ? ?",U=2,V=2)
rep=repair(c,final,mode=18).mergechroma(chr)
return(rep)
}
File and dependencies
http://www.mediafire.com/?o7cktjyx92ods56
Hopefully this time I won't disappoint Didee
(well I can always dream can't I)
Edit: Here are some comparison shots
http://screenshotcomparison.com/comparison/28666
http://screenshotcomparison.com/comparison/28667