Quantcast Avisynth: Ads() a Function Using a Masked Denoising etc - digitalFAQ.com Forums [Archives]
  #1  
09-19-2004, 02:44 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
----
---------- Splitted from Thread "MA Script for one Movie DVD" ---------
----

Well I see that Removegrain does affect details in a bad way, so I did let perform that filter on a masked area where the details are left OUT.
We also do often use Temporal denoisers on clean sources but these "could" do harm on details in hairs and skins, so I did let perform a temporal work also on that masked area.
And finally to get even the details a bit more sharpened I used on thats same (now inverted) mask a general sharpener.

Here's the function to test:

ADS - Adaptive Denoiser & Sharpener

EDIT:
Latest version and explanation can be found here:

http://www.kvcd.net/forum/viewtopic....r=asc&start=52

....

where To is the Top border and Bo the bottom Border to get rid of (you can detect (not set!!) them using DVD2AVIs clip/resize function).
Ov is the Overscan.
Lb means if set to "true" then a Letteroxing from Anamorphic material to 4:3 will be performed.

So ADS(72, 72, 2, true) deletes on the Top and The bottom the orig 72px and 72px borders and does apply an overscan of 16px where the right borders for matching the final output size will be added afterwards (imge will be centered).

To or Bo have to be MOD8! So each border to delete has to be devidable by 8, as removegrain() only processes mod8 sources.

As I do determine the filter to its parent-plugin, for instance "Masktools_Edgemask(....)" ... use latest version of Avisynth as that version only supports that.

Plugins Needed:

RemoveGrain()
www.removegrain.de.tf

RemoveDirt()
www.removedirt.de.tf

Masktools
http://jourdan.madism.org/~manao/MaskTools-v1.5.1.zip
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
09-19-2004, 06:31 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Hi Inc. ,
Just tried ADS for the 1st time.
I downloaded and extracted Masktools v1.5.1, RemoveDirt v0.6 and RemoveGrain v0.6.1 to my avisynth plugins directory.
Then I used:
Code:
mpeg2source("c:\movie\mymovie.d2s")
ADS(16,16,2,false)
And I got a "Out of memory" from any tool I used to open that script.
You name it: MPC, WMP, VDMOD, etc.
I even erased all the stuff I had in the plugin dir and only left these 3 that I already mentioned and mpeg2dec3.dll.
Then I watched carefully your script and I decided to add unfilter.dll to the plugins dir.
But no way.
No way until I erased ADS.avsi which was copy pasted from this thread.
Can someone else replicate this?
Cheers
__________________
Rui
Reply With Quote
  #3  
09-20-2004, 12:38 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Try ro use that function in your script and not via avsi, maybe that helps

I used it yesterday and had no problems.

Are you shure you have all the latest builds (masktools avisynth!!). As some recent avisynth betas are known for these memory errors.



EDIT:

I found this:
http://forum.doom9.org/showthread.php?s=&threadid=82435

Maybe you should try that masktools 1.49 or so, but I do hope that it gots the same commands/parameters.

http://jourdan.madism.org/~manao/?M=D

Maybe that one?
http://jourdan.madism.org/~manao/MaskTools.dll

or this
http://www.avisynth.org/warpenterpri...l_20040423.zip
Reply With Quote
  #4  
09-20-2004, 01:15 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@incredible
Thanks a lot! Just tried your ADS routine and it looks VERY good!
The only "problem" I have is that the output seems to be 704x576 instead of 720x576 as I usually use. Not a big issue, I know, but if it's fixable... It's just that I feel more comfortable with using 720x576.
Thanks again!

PS. Since the output isn't 720 it looks as if ADS is cutting about 16 pixels from each side of the frame and then zoom in on it?! How do I fix that?



@rds_correia
I added a "}" to the end of the script since VDub said it was missing . And now it works for me.
__________________
AudioSlave
Reply With Quote
  #5  
09-20-2004, 02:13 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
@ Audioslave

Code:
cr=(W==720) ? 8 : 0
Change the line into ....

Code:
cr=(W==720) ? 0 : 0
As the function in there detects the source width so it cuts in case of 720 width 8px on each side, ... as I do see no sense in re-encoding 720.

I just fixed the script according to the "}"
Reply With Quote
  #6  
09-20-2004, 04:04 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@incredible

Quote:
I do see no sense in re-encoding 720.
Yes, you might be right .
However, this is not really the issue in my previous post...
When comparing a simple LanczosResize with the ADS script (both with overscan 2) ADS clearly shows less of the original frame than the LanczosResize. I hope you know what I mean .
If not, I'll post some screenshots when I get home from work .
__________________
AudioSlave
Reply With Quote
  #7  
09-20-2004, 04:47 AM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Hello ,
My thanks to both Henrik and Andrej for fixing the function.
I'll let you both know how it goes when I get home.
Cheers
__________________
Rui
Reply With Quote
  #8  
09-20-2004, 05:04 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@incredible
I tried ADS on the Scandinavian (PAL) version of "The Passion Of The Christ". It looks like a whole new movie! Well, the plot is the same but the picture is soooo much better with ADS! The original is VERY grainy and looks very "VHS" but after running the source through ADS it now looks like a DVD!
However, ADS sometime is a little too tough = loss in detail, for example beards and hair...

P.S. I still haven't figured out why the resizing is so wierd...
__________________
AudioSlave
Reply With Quote
  #9  
09-20-2004, 05:58 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Two notes about this ACS function :

- Removedirt seems to give problems to CCE when parameters are used. Does ACS works correctly ?

- please check this thread I did on my last attempts with RemoveDirt
http://www.kvcd.net/forum/viewtopic.php?t=14141
(this behaviour is perhaps reduced with usage of thresholds).
Reply With Quote
  #10  
09-20-2004, 06:08 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Resizing is not wired at all! ;-)

a) Almost every DVD Source I do keep at Full PAL, just cropping from 720 to 704 as it makes sense. On long Movies like 3h ones I sometimes choose letterboxing (Anamorph :arrow: 4:3 incl. Borders) to gain from better compression.
b) When Overscanning I like to choose Overlayed Overscan as many movies do come in 2.35:1 which means when using resized overscan, the moviearea even would get smaller on a regular Tv. So Overlayed is the best choice in case of DVD Movie sources.
c) And for shure I do crop the orig black borders before so the filtering affects only the main movie area, means better detection for some type of filters and for shure more speed as the effective movie area in a border cropped state is cropped effectively!

You can easely enter the script and add your own mods:

Code:
function ADS (clip c, int "To", int "Bo", Int "Ov", Bool "Lb" ) {
To=default(To,0)
Bo=default(Bo,0)
Ov=default(Ov,0)
Lb=default(Lb,false)
Here you see the parameter determination and the variables out of the commands/syntax and the determining of the defaults IF no parameters are set at like just "ADS()".

Code:
Ov=Ov*8
W=width(c)
H=height(c)
Ov is Overscan taken as 0 or 1 or 2, but we want real pixels to use with the follwing cropper, so we just multiply it by 8, so in case of Overscan =2 the result is 2*8 = 16px on each side .
We do parse the sources ORIG width and Height and set them to W and H.

Code:
cr=(W==720) ? 8 : 0
c= (To <= Ov && Bo <= Ov) ? crop(c,Ov+cr,Ov,-(Ov+cr),-Ov) : crop(c,Ov+cr,To,-(Ov+cr),-Bo)
The first line checks if W (orig width) is 720, if yes an extra cropping of 8 at each side is determined as cr=8, if not then cr=0. Followed by the cropping job using Crop(...)


Code:
c= ScriptClip(c,"nf = YDifferenceToNext()"+chr(13)+\
"m=masktools_EdgeMask(thY1 = 2, thY2 = 5, thC1 = 1, thC2 = 5, type= "+chr(34)+\
"roberts"+chr(34)+")"+chr(13)+\
"m=m.blur(0.2)"+chr(13)+\
Here we do set the edgemask and finally we do blur it so little details wont begin shimmring cause of to hard edge masked.
(The nf=Ydiff..... line Ill delet as its useless ;-) )


Code:
"f1=removegrain(8).RemoveDirt(mthreshold=125,cthreshold=30,pthreshold=20)"+chr(13)+\
f1 is the first filter job. It includes The spatial softening job Removedirt and Removegrain. Removedirt wont harm edges now as it will ONLY be performed on plain areas - cause of the edgemask ;-)


Code:
"f2=unfilter(0,80)"+chr(13)+\
The Second filter Job is f2 where Unfilter does enhance the edges in the movie



Code:
"masktools_MaskedMerge (f1,last,m)"+chr(13)+\
"masktools_MaskedMerge (last,f2,m) ")
Here we do apply the filtered areas to the original image depending on the mask, while the second merge is inverse last,f2,m instead of f1,last,m


Code:
c= (Lb == true) ? Lanczosresize(c,width(c)-cr*2,round(height(c)*0.75)) : c
Here I do check if the Lb boolean variable out of the command ADS() is set to true, if yes a anamorph to non anamorph resizing will be performed, if not, then leave the image as it is.


Code:
Addborders(c,(round(W-width(c)-cr*2)/2),(round(H-height(c))/2), \
(round(W-width(c)-cr*2)/2),(round(H-height(c))/2))
}
Finally I do check how much borders are needed to fit the final active movie area "centered" to the ORIGINAL size of the beginning inlc. respecting the cropping from 720 to 704.
So finally the borders will be added.

END.


You can for instance

"f1=removegrain(8).RemoveDirt(mthreshold=125,cthre shold=30,pthreshold=20)"

To

"f1=SpatialFilter(.......).TemporalFilter(.......) "

And

"f2=unfilter(0,80)"

To

"f2=SharpeningFilter()"

But be shure you use YV12 supporting filters, if not you need to perform colorspace changes which do let drop the color quality and for shure more cpu power is needed ;-)
Reply With Quote
  #11  
09-20-2004, 06:19 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
@ Phil
I do see your last post now in here.
And for shure the pics in the link you pointed me to (seems I lost that new "good bye" thread. Me and boulder (IMHO) haven't seen such problems, but maybe we didnt recognise them well !?
So do your testings with the thresholds I used, if they dont work, do choose other thresholds.
If that still wont work, we trash that one finally and change to a different PURE temporal denoiser like Tempsoften, ATC, TempCleaner etc.
The place where to change you can easely see above

Also in case of the Spatial denoiser/softener, maybe just Deen("a2d",x,x,x) "could" work ... BUT be careful as deen() in a conditional scripting will crash! in my cases! the result is a "access volation ....." as this filter deeply isnt correct coded IMHO. But there are also other pure spatial softeners around, but yep, Removegrain() does its Job very good. So testing temporal filters should be a real job.
Reply With Quote
  #12  
09-20-2004, 06:21 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@incredible


Thanks!

You're the man...
__________________
AudioSlave
Reply With Quote
  #13  
09-20-2004, 06:29 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
So do your testings with the thresholds I used, if they dont work, do choose other thresholds.
As I use CCE for my KDVD and RemoveDirt gives problems to ECLCEE, that is a "no way" . I will try with tmpgenc just for testing purpose.

But for me RemoveDirt suffer from a big problem : there are TOO MUCH parameters. And I'm not sure it will be easy to find values that will face to all situations.
Reply With Quote
  #14  
09-20-2004, 07:35 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
Originally Posted by Dialhot
As I use CCE for my KDVD and RemoveDirt gives problems to ECLCEE, that is a "no way" . I will try with tmpgenc just for testing purpose.
Yep I forgot that! So we should change to another temporal filter in case of EclCCE.

Quote:
But for me RemoveDirt suffer from a big problem : there are TOO MUCH parameters. And I'm not sure it will be easy to find values that will face to all situations.
Well I do think we both (and others to) got a testing spirit, so thats why you also found out optimal settings for convolution3d()

Whats about a temporal used StmedianFIlter() or even Convo3d() at temporal settings ?
I havent test them for a long time
Reply With Quote
  #15  
09-20-2004, 09:55 AM
J-Wo J-Wo is offline
Free Member
 
Join Date: Nov 2002
Location: Toronto, Canada
Posts: 454
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Dialhot
As I use CCE for my KDVD and RemoveDirt gives problems to ECLCEE, that is a "no way" . I will try with tmpgenc just for testing purpose.
I have never had any problems with RemoveDirt in CCE or ECLCCE...
Reply With Quote
  #16  
09-20-2004, 10:00 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by J-Wo
I have never had any problems with RemoveDirt in CCE or ECLCCE...
Try to use "RemoveDirt(mthreshold=50)" insteed of just "RemoveDirt()".
EclCCE answers : not abble to load the script. (CCE 2.67)
Reply With Quote
  #17  
09-20-2004, 10:04 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Phil, I do assume you did NOT your last screenshots using my masking function???

*IDEA*

Because this function does avoid that details/Edges even will be touched by the spatial or temporal smoother/denoiser! So that Arc in your test screenie wouldnt suffer (just IMHO).
So do use Removedirt() in that function without any parameters and do a test, as Im now at work (you probably too?!)
Reply With Quote
  #18  
09-20-2004, 10:08 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
Phil, I do assume you did NOT your last screenshots using my masking function???
No, I wasn't connected for all the we so I couldn't do that
(note: I give the script in my post, there is nothing more than the 2 filters).

Quote:
So do use Removedirt() in that function without any parameters and do a test, as Im now at work (you probably too?!)
I am but all the sources are on my laptop So I can try that.
Reply With Quote
  #19  
09-20-2004, 10:17 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
Originally Posted by Dialhot
(note: I give the script in my post, there is nothing more than the 2 filters).
Yep! You quoted that
Quote:
I am but all the sources are on my laptop So I can try that.
Nice company youre working in .... do they need another employee ???
[/quote]
Reply With Quote
  #20  
09-20-2004, 11:06 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, just did it there :
http://www.kvcd.net/forum/viewtopic.php?p=103824#103824
Note : I used ECLCEE with no problem even with the parameters used in RemoveDirt.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: No function called BlindPP ? WOWIEGURL Avisynth Scripting 4 04-02-2014 08:11 AM
Avisynth: PARanoia and ADS function comparison rds_correia Avisynth Scripting 10 10-09-2005 04:30 PM
Avisynth: Is is possible to use the trim() function with audio supermule Avisynth Scripting 3 09-10-2005 03:05 AM
Avisynth: funny denoising routines incredible Avisynth Scripting 44 11-15-2003 11:27 AM
Avisynth: Wavelet denoising? GFR Avisynth Scripting 28 01-08-2003 11:16 PM

Thread Tools



 
All times are GMT -5. The time now is 07:22 PM  —  vBulletin Jelsoft Enterprises Ltd