Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
15th February 2011, 01:36 | #1 | Link |
Leader of Dual-Duality
Join Date: Aug 2010
Location: America
Posts: 134
|
DeFreqChroma4E : DFC4E
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 Code:
#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) } 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
__________________
I'm Mr.Fixit and I feel good, fixin all the sources in the neighborhood My New filter is in the works, and will be out soon Last edited by TheProfileth; 17th February 2011 at 01:20. |
15th February 2011, 10:45 | #2 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Perhaps what you mean is Code:
try { prefiltered = Eval(prefilter + "(c, " + params1 + ")") } catch(err_msg) { prefiltered = Eval(prefilter + "(c.removegrain(0))") # or perhaps just prefiltered = c.removegrain(0) ??? } |
|
15th February 2011, 13:30 | #3 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,389
|
Compare to "HQdering.avs" by mf, dating back to year 2003:
Code:
###### ## ## HQDering v0.1 by mf ## ## Applies derining by using a smart smoother near edges (where ringing occurs) only. ## ## Usage: Import("HQDering-v0.1.avs") ## HQDering() ## #### function HQDering(clip input, int "strength", int "overall", string "smoother", string "params") { strength = Default(strength, 255) # strength, 0-255 overall = Default(overall, 0) # overall smoothing, 0-255 smoother = Default(smoother, "Deen") # filter that smooths #params = default defined below # filter parameters - use Chr(34) for quotes defaultnull = Default(params, "") defaultdeen = Default(params, Chr(34)+"a3d"+Chr(34)+", 4, 15, 15, 20") params = (smoother=="Deen") ? defaultdeen : defaultnull try { smoothedwparams = Eval(smoother + "(input, " + params + ")") } catch(err_msg) { smoothedwoparams = Eval(smoother + "(input)") } smoothed = (params=="") ? smoothedwoparams : smoothedwparams input.EdgeMask(3, 255, 255, 255, "sobel", Y=3, V=1, U=1) normalmask = last [ ... ] Un- or related, for those studying old scripts based on MaskTools-v1: Code:
YV12Layer(clip1,clip2,"mul") Code:
mt_lutxy(clip1,clip2,"x y * 255 /")
__________________
- 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!) |
15th February 2011, 14:08 | #4 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Code:
smoothed = Eval("input."+smoother+"("+params+")") |
|
16th February 2011, 00:30 | #5 | Link |
Leader of Dual-Duality
Join Date: Aug 2010
Location: America
Posts: 134
|
sorry for the delayed response
I only used that because it is the only thing I had on hand that could be used to allow user input parameters and check for invalid parameters, if there is an alternative way to allow that to happen I would be happy to change it. Besides that issue are there any function abnormalities with the actual performance of this filter that you can find/see? also let me get those comparisons
__________________
I'm Mr.Fixit and I feel good, fixin all the sources in the neighborhood My New filter is in the works, and will be out soon Last edited by TheProfileth; 16th February 2011 at 00:33. |
16th February 2011, 00:59 | #6 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
What do you actually want the function to do when params is a) empty, or b) invalid for the specified (or defaulted) pre- or post-filter |
|
16th February 2011, 01:00 | #7 | Link | |
Leader of Dual-Duality
Join Date: Aug 2010
Location: America
Posts: 134
|
Quote:
http://screenshotcomparison.com/comparison/28666 http://screenshotcomparison.com/comparison/28667 Edit: ok I changed them to empty and took out all the excess removegrain(0), I remeber why I put those in now (silly me) During the beginning stage of when I was making the filter I was getting syntax errors so I decided to put removegrain(0) in just to make things a bit easier to keep track of, I forgot to remove them after I was done. let me update the script Edit2: alright link updated with newest version
__________________
I'm Mr.Fixit and I feel good, fixin all the sources in the neighborhood My New filter is in the works, and will be out soon Last edited by TheProfileth; 16th February 2011 at 01:23. |
|
16th February 2011, 01:58 | #8 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
I think you can replace all the code above by: Code:
params1 = Default(params1, prefilter=="sfm5" ? "Sstr=1,Slimit=6" : "") prefiltered = Eval("c." + prefilter + "(" + params1 + ")") |
|
16th February 2011, 06:29 | #10 | Link |
Leader of Dual-Duality
Join Date: Aug 2010
Location: America
Posts: 134
|
Alright I changed it and fixed a tiny error that I missed before, should be fine now.
__________________
I'm Mr.Fixit and I feel good, fixin all the sources in the neighborhood My New filter is in the works, and will be out soon |
16th February 2011, 11:08 | #11 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
There are still a couple of errors:
Code:
prefiltered = (params1=="") ? Prewoparams: Prewparams Code:
prefiltered = Eval("f2." + postfilter + "(" + params2 + ")") Since the function doesn't work at all in this form, it looks like you never tested it, or more likely you just screwed up when editing the post. |
17th February 2011, 01:08 | #12 | Link | |
Leader of Dual-Duality
Join Date: Aug 2010
Location: America
Posts: 134
|
Quote:
BTW it REQUIRES the dependencies in the mediafire link because it calls like 5 other scripts. Let me fix those errors that you mentioned and update the download link btw thanks a lot Gavino for helping with this and giving feedback I really appreciate it. edit: alright the version I have up works fine now and I have updated the download link Edi2: I should probably leave chroma off on default as I suppose most people do not have nlmeanscl, still deciding on that, because hopefully people will read the info in the script before they try to run it
__________________
I'm Mr.Fixit and I feel good, fixin all the sources in the neighborhood My New filter is in the works, and will be out soon Last edited by TheProfileth; 17th February 2011 at 01:24. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|