Quantcast Avisynth: Wavelet Noise Reduction? - digitalFAQ.com Forums [Archives]
  #1  
07-03-2003, 08:14 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
I've been playing since yesterday with a filter that's floating around the net, which there is no English documentation. Here's the filter: www.kvcd.net/wnr.zip

It's a VirtualDub filter, but it can be made to work with AviSynth. The quality is just amazing, but it's SLOW and I mean SLOOOOWWWW.
But here it is so you can try it, and see for yourself the quality gained and file size dropped:

Just add these lines to your script:

Code:
# Include the following line where you normally load your plugins.
LoadVirtualdubPlugin("c:\wnr.vdf", "VD_wnr", 0)
#
Mpeg2Source("Your_Source_Here")
ConvertToRGB()
VD_wnr(7710, 7454, 7710, 0, 0, 0, 0, 0, 0)
ConvertToYV12()
#
# The rest of your script.
undot() 
Limiter()
Etc., ,etc., etc.
Here are instructions on how to get parameters from Vdub, and change them to use with AviSynth scripts: http://www.avisynth.org/index.php?pa...rom+VirtualDub

-kwag
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  
07-03-2003, 08:34 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Let's start the fun

This will apply wavelet noise reduction ONLY where temporalsoften is being applied.

Code:
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \ 
TemporalSoften(4, round(1/nf) , round(3/nf) ,0, 2).ConvertToRGB().VD_wnr(7710, 7454, 7710, 0, 0, 0, 0, 0, 0).ConvertToYV12() ")
Now the speed increase is GiGANTIC
The values 7710, 7454, 7710 are experimental

Have fun
-kwag
Reply With Quote
  #3  
07-03-2003, 08:41 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Corrected to this:

ConvertToRGB().VD_wnr( 20, 20, 20, 0, 0, 0, 0, 0, 0)

Code:
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \ 
TemporalSoften(4, round(1/nf) , round(3/nf) ,0, 2).ConvertToRGB().VD_wnr( 20, 20, 20, 0, 0, 0, 0, 0, 0).ConvertToYV12() ")
-kwag
Reply With Quote
  #4  
07-03-2003, 09:40 PM
ovg64 ovg64 is offline
Free Member
 
Join Date: Jan 2003
Location: Puerto Rico
Posts: 423
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ovg64
Quote:
I've been playing since yesterday with a filter that's floating around the net, which there is no English documentation. Here's the filter: www.kvcd.net/wnr.zip

It's a VirtualDub filter, but it can be made to work with AviSynth. The quality is just amazing, but it's SLOW and I mean SLOOOOWWWW.
But here it is so you can try it, and see for yourself the quality gained and file size dropped:
English Documents inside zip here: http://www.avisynth.org/~warpenterprises/
Reply With Quote
  #5  
07-03-2003, 10:56 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
This filter doesn't work correctly in a dynamic adaptive nature
It was fun to test, but the current adaptive script filter combination just beats the crap out of it
Bye Bye WNR

Edit: Using it alone as a static filter, it does work, but after comparing clips with the current script, the file size is way smaller with the current script WITHOUT the WNR filter.

-kwag
Reply With Quote
  #6  
07-04-2003, 04:42 AM
sh0dan sh0dan is offline
Free Member
 
Join Date: Mar 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
I have no idea if this is anything even slightly similar:

VagueDenoiser 0.11: Wavelet based denoiser.

But you might give it a whirl.
__________________
Regards, sh0dan // VoxPod
Reply With Quote
  #7  
07-04-2003, 10:03 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks sh0dan,

Apparently it is
I just can't get the thing to work.
It calls for two parameters, but I get "Invalid argument to function "VagueDenoiser" when I try to open it in Vdub.
Time to look at the source

-kwag
Reply With Quote
  #8  
07-04-2003, 10:12 AM
ovg64 ovg64 is offline
Free Member
 
Join Date: Jan 2003
Location: Puerto Rico
Posts: 423
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ovg64
Yeah I cann't get to work either
Reply With Quote
  #9  
07-04-2003, 11:34 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, I got it working. I had the .dll in the plugins directory of AviSynth, and I guess autoload didn't work correctly.
I specified the hard path, and now it works.

LoadPlugin("C:\Filters25\VagueDenoiser.dll") as usual, and then VagueDenoiser(0.8, 2) after the source line ( that's where I'm testing ).

-kwag
Reply With Quote
  #10  
07-04-2003, 12:07 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Well, here are the results. The filter is SUPERB Look at the file size drop on the 9 second clip
But now we need a 10Ghz computer to encode

Here are the benchmarks and samples:

Current adaptive script ONLY:
http://www.kvcd.net/nonr.mpg
Encode time: 23s. Clip size: 9 seconds. File size: 1,083KB

Current adaptive script+wavelet noise filter VagueDenoiser(0.8, 1):
http://www.kvcd.net/nr1.mpg
Encode time: 1m:59s. Clip size: 9 seconds. File size: 1,053KB

Current adaptive script+wavelet noise filter VagueDenoiser(0.8, 2):
http://www.kvcd.net/nr2.mpg
Encode time: 1m:44s. Clip size: 9 seconds. File size: 1,055KB

-kwag
Reply With Quote
  #11  
07-04-2003, 12:33 PM
Jellygoose Jellygoose is offline
Free Member
 
Join Date: Jun 2002
Location: Germany
Posts: 1,288
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Well, here are the results. The filter is SUPERB Look at the file size drop on the 9 second clip
But now we need a 10Ghz computer to encode

Here are the benchmarks and samples:

Current adaptive script ONLY:
http://www.kvcd.net/nonr.mpg
Encode time: 23s. Clip size: 9 seconds. File size: 1,083KB

Current adaptive script+wavelet noise filter VagueDenoiser(0.8, 1):
http://www.kvcd.net/nr1.mpg
Encode time: 1m:59s. Clip size: 9 seconds. File size: 1,053KB

Current adaptive script+wavelet noise filter VagueDenoiser(0.8, 2):
http://www.kvcd.net/nr2.mpg
Encode time: 1m:44s. Clip size: 9 seconds. File size: 1,055KB

-kwag
Time to get a new CPU...
I'd love to try this out on a full movie since I'm gonna be out of town until tomorrow evening.
__________________
j3llyG0053
Reply With Quote
  #12  
07-04-2003, 12:37 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Jellygoose

Time to get a new CPU...
Where in the current script would you put that line? I'd love to try this out on a full movie since I'm gonna be out of town until tomorrow evening.
Sorry I forgot to mention that
Right after your source line, before resizing. You can try it after resizing too. I haven't yet

Edit: Works like a charm AFTER GripSize Time dropped to 1m:5s

-kwag
Reply With Quote
  #13  
07-04-2003, 12:45 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Anyone who wants to try the script, here it is:

Code:
## DLL Section ## 
# 
LoadPlugin("C:\Filters25\MPEG2Dec3.dll") 
LoadPlugin("C:\Filters25\GripFit_YV12.dll") 
LoadPlugin("C:\Filters25\STMedianFilter.dll") 
LoadPlugin("C:\Filters25\asharp.dll") 
LoadPlugin("C:\Filters25\unfilter.dll") 
LoadPlugin("C:\Filters25\undot.dll") 
LoadPlugin("C:\Filters25\VagueDenoiser.dll") 
# 
#### 

## Defined Variables and Constants ## 
# 
MaxTreshold = 1.50 
nf =  0 # Current frame. 
# 
#### 

## Main section and static filters ### 
# 
Mpeg2Source("Your_D2V_Source_Here") 
# 
undot() 
Limiter() 
asharp(2, 4) 
GripCrop(Your_GripCrop_Parameters_Here) 
GripSize(resizer="BicubicResize") 
VagueDenoiser(0.8,2)
STMedianFilter(8, 32, 0, 0 ) 
MergeChroma(blur(MaxTreshold)) 
MergeLuma(blur(0.2)) 
# 
# 

## Linear Motion Adaptive Filtering ## 
# 
# ( Portions from AviSynth's manual ) - This will apply temporalsoften to 
# very static scenes, and apply variable blur on moving scenes. 
# We also assign a variable - and this is why a line break is inserted: 

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \ 
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) ,0, 2) ") 

# 
# 
# 

GripBorders() 
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker! 
Limiter() 

# 
# 
## Functions ### 

function fmin( int f1, int f2) { 
  return ( f1<f2 ) ? f1 : f2 
} 

# 
####
-kwag
Reply With Quote
  #14  
07-04-2003, 01:26 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
And for using the wavelet filter only on the adaptive part of the script, use this:
Code:
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \ 
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) ,0, 2).VagueDenoiser(0.8,2) ")
That will speed things up quite a bit
Remember to remove the VagueDenoiser(0.8,2) on the top of your script after GripSize

Edit: The last parameter of VagueDenoiser (Type of wavelet) must be 0 or 1.

From the docs:

"Two types of wavelets are used here:
-Symmlet8: Daniel Lemire algorithm (use wavelet=0)
-Daubechies4: Ian Kaplan algorithm (use wavelet=1)"

So use 0 or 1. Not 2 as I had tested

-kwag
Reply With Quote
  #15  
07-04-2003, 02:08 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Here's a sample with adaptive wavelet filter in full action.
You'll see the value of "nf" on the top of the screen, and remember that when the value is greater or equal to 2, the wavelet and temporal filters are not operational. Only on values below 2 is that the temporal and the wavelet filters are functioning. I used wavelet type 1 (Ian Kaplan algorithm), because the sample size was 1KB smaller that with type 0 (Daniel Lemire algorithm)
http://www.kvcd.net/adaptive-vague-1.mpg

Happy testing ,
-kwag
Reply With Quote
  #16  
07-04-2003, 02:24 PM
vhelp vhelp is offline
Free Member
 
Join Date: Jan 2003
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
@ Kwag..

sheesh.. gimmie a chance to D/L your first sample

Edit: just got fist clip. Looks great here.

Now on to others..

I'll give your latest scrip-snip a go shortly.

Thanks for the newbie items.
-vhelp
Reply With Quote
  #17  
07-04-2003, 02:28 PM
vhelp vhelp is offline
Free Member
 
Join Date: Jan 2003
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
Kwag..

What class does that Filter fall under ??

Color space:
* YUV, YV12

AVIsynth:
* v2.52, v2.50 or older v2x

So that I can plut in its right place, where I keep my DLL's ie,
* \dlls\.. for old v2x, and
* \dlls252\.. for latest YV12 and AVIsynth v2.52

Tanks,
-vhelp
Reply With Quote
  #18  
07-04-2003, 02:30 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
From the docs:

"Required:
Avisynth 2.52
YV12 colorspace"

-kwag
Reply With Quote
  #19  
07-04-2003, 04:57 PM
phibertron phibertron is offline
Free Member
 
Join Date: Feb 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Code:
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \ 
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) ,0, 2).VagueDenoiser(0.8,2) ")
i downloaded the filter, but it is up .13 now
and tried the above, VagueDenoiser(0.8,1)
either .13 has a memory leak, or gremlins are hard at work

my systems page file kept growing and growing and growing...
it got up to like 4Gigs and my system ran out of memory

if i dont put it in the adaptive section, then my system only uses 250Mb of page file, and it works fine
so maybe it isnt the gremlins

just figured i would pass this along

-phibertron
Reply With Quote
  #20  
07-04-2003, 05:07 PM
vhelp vhelp is offline
Free Member
 
Join Date: Jan 2003
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, I agree.

Definate "memory leak". I got to the point where my system crashed in
one instance, and while another, I got a warning that my HD was filled and
to close apps and things. naturally, I stop TMPG's encoding. This was only
based on a 1 minute clip I was test encoding (which took approx. 5 minutes
to complete)

But I am noticing something in the final quality sage. "chizels" on solid
scenes where you can see "hatches" or "blocks" float around. I'm still
debuggin this, as it's still to "bright" in my workroom - - its ben sunny
all day here. Its harder to judge w/ too much sun is shining hehe..

-vhelp
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: Plugin that matches TMPG's noise reduction? sToRm Avisynth Scripting 1 02-17-2004 10:05 AM
Avisynth: Additional Noise Reduction for Optimal Script Jellygoose Avisynth Scripting 4 10-21-2003 06:43 PM
TMPGEnc noise reduction filter for AVIsynth? jamz Avisynth Scripting 4 09-01-2003 03:37 AM
Wavelet Noise Reduction for VirtualDub kwag Video Encoding and Conversion 3 03-15-2003 12:23 AM
Avisynth: noise reduction, lot of mosquito noise? yauman Avisynth Scripting 8 02-02-2003 02:41 PM

Thread Tools



 
All times are GMT -5. The time now is 07:02 AM  —  vBulletin © Jelsoft Enterprises Ltd