View Full Version : script function RemoveNoiseMC
Heini011
16th April 2006, 23:05
Hi folks,
i wrote a little script function as a better alternative for the old Dust. it is optimized for removing noise with only a little lost of details. it removes larger spots and other dirt also.
this script works in YV12 color mode only. the video-clip must have a mod 8 resolution.
i suggest to insert in the first line of the avisynth-script:
SetMemoryMax(128) # for 512MB RAM
or
SetMemoryMax(256) # for >=1024 MB RAM
if you want to remove only a little bit of noise from a high quality movie, please look at RemoveNoiseMC_HQ (http://forum.doom9.org/showthread.php?p=832213#post832213)
function RemoveTempGrain(clip input, int _mode)
{
rg = RemoveGrain(input, mode=_mode)
return TemporalRepair(rg, input)
}
function RemoveDirt(clip input, int limit, int rgrain, bool "_grey")
{
_grey = default(_grey, false)
_dgr1 = 0.35+rgrain*0.3
_dgr2 = 0.45+rgrain*0.4
repmode = 1
clensed = Clense(input, grey=_grey, cache=4)
restore = input.FluxSmoothST(3+3*rgrain,rgrain)
restore = Repair(restore, input, mode=repmode, modeU= _grey ? -1 : repmode)
restore = rgrain==0 ? restore.RemoveGrain(1) : \
restore.VagueDenoiser(threshold=_dgr1, chromaT=_dgr1, nsteps=7, percent=75).RemoveGrain(1)
alt = input.VagueDenoiser(threshold=_dgr2, chromaT=_dgr2, nsteps=7, percent=100).RemoveGrain(5)
return RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, pthreshold=4+2*rgrain, cthreshold=6+2*rgrain, gmthreshold=40, dist=1, dmode=2, debug=false, noise=limit, noisy=12, grey=_grey)
}
global idx_c = 25
function RemoveNoiseMC(clip,int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", bool "_grey")
{
rdlimit = default(rdlimit,11)
rgrain = default(rgrain,2)
denoise = default(denoise,8)
sharp = (rgrain<1) ? default(sharp,true) : default(sharp,false)
csharpen = (rgrain>2) ? default(csharpen,0.17) : (rgrain>1) ? default(csharpen,0.15) : default(csharpen,0.13)
csharpen = sharp ? csharpen : csharpen+0.08
_grey = default(_grey,false)
_dgr = 0.45+rgrain*0.4
dummy = clip.BlankClip(length=0)
global idx_c = idx_c+1
cbs = 8
cov = (cbs>4) ? cbs/4 : 0
ccf = cbs*cbs/64
cpn = (denoise>12) ? 50*ccf : (denoise>8) ? 58*ccf : (denoise>5) ? 66*ccf : 72*ccf
csh = sharp ? 1 : 0
bvec2 = clip.MVAnalyse(isb=false, blksize=cbs, delta=2, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
fvec2 = clip.MVAnalyse(isb=true, blksize=cbs, delta=2, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
backw1 = rdlimit>13 ? \
rdlimit>20 ? \
clip.MVFlow(bvec1, idx=idx_c).Deblock(quant=22, aOffset=6, bOffset=6) : \
clip.MVFlow(bvec1, idx=idx_c).Deblock(quant=16, aOffset=4, bOffset=4) : \
clip.MVFlow(bvec1, idx=idx_c)
forw1 = rdlimit>13 ? \
rdlimit>20 ? \
clip.MVFlow(fvec1, idx=idx_c).Deblock(quant=22, aOffset=6, bOffset=6) : \
clip.MVFlow(fvec1, idx=idx_c).Deblock(quant=16, aOffset=4, bOffset=4) : \
clip.MVFlow(fvec1, idx=idx_c)
clp = interleave(backw1,clip,forw1)
clp = clp.RemoveDirt(rdlimit,rgrain,_grey)
dnc = denoise==0 ? clp.RemoveTempGrain(rgrain).SelectEvery(3,1) : dummy
clp = clp.SelectEvery(3,1)
dnc = denoise==0 ? dnc : \
clp.MVDenoise(bvec2, bvec1, fvec1, fvec2, thT=denoise, thSAD=190+15*denoise, thmv=40, thSCD1=230+5*denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=7, percent=75)
vid_mo = rgrain==1 ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
clp = clp.SeeSaw(dnc, Sstr=csharpen, Szp=12, SdampHi=20, bias=40)
return clp
}
some examples:
for slight noisy video or spot/dirt removing only:
function hq_filter(clip c)
{
c=c.RemoveNoiseMC(rdlimit=6,rgrain=1,denoise=0)
c=c.LimitedSharpenFaster(Smode=4,strength=18,overshoot=0,wide=false,ss_x=1.3,ss_y=1.3)
return c
}
medium noise, higher grain:
function mq_filter(clip c)
{
c=c.RemoveNoiseMC(rdlimit=10,rgrain=2,denoise=8)
c=c.LimitedSharpenFaster(Smode=4,strength=20,overshoot=1,wide=false,ss_x=1.3,ss_y=1.3)
return c
}
high noise or analog capture:
function lq_filter(clip c) {
c=c.RemoveNoiseMC(rdlimit=18,rgrain=3,denoise=14)
c=c.VagueDenoiser(threshold=0.6, nsteps=6, chromaT=0.6, percent=75)
c=c.deen("a3d",rad=3,thrY=3,thrUV=5,min=0.25,tthY=2,tthUV=3,scd=6)
c=c.LimitedSharpenFaster(Smode=4,strength=24,overshoot=1,wide=false,ss_x=1.3,ss_y=1.3)
return c
}
the extreme case with a modded function for high denoise values:
function RemoveHighNoiseMC(clip clip,int "rdlimit", int "rgrain", int "denoise", float "csharp", bool "_grey")
{
rdlimit = default(rdlimit,24)
rgrain = default(rgrain,3)
denoise = default(denoise,15)
csharp = (rgrain>2) ? default(csharp,0.32) : default(csharp,0.28)
_grey = default(_grey, false)
_dgr = 0.7+rgrain*0.5
global idx_c = idx_c + 1
cbs = 8
ccf = cbs*cbs/64
cpn = (denoise>12) ? 50*ccf : 57*ccf
bvec3 = clip.MVAnalyse(isb=false, blksize=cbs, delta=3, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
bvec2 = clip.MVAnalyse(isb=false, blksize=cbs, delta=2, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
fvec2 = clip.MVAnalyse(isb=true, blksize=cbs, delta=2, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
fvec3 = clip.MVAnalyse(isb=true, blksize=cbs, delta=3, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
backw1 = rdlimit>20 ? \
clip.MVFlow(bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
clip.MVFlow(bvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw1 = rdlimit>20 ? \
clip.MVFlow(fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
clip.MVFlow(fvec1).Deblock(quant=16, aOffset=4, bOffset=4)
clp = interleave(backw1, clip, forw1)
clp = clp.RemoveDirt(rdlimit,rgrain,_grey)
clp = clp.SelectEvery(3,1)
dnc = clp.MVDenoise(bvec3, bvec2, bvec1, fvec1, fvec2, fvec3, thT=denoise, thSAD=160+12*denoise, thmv=40, thSCD1=255+4*denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=6, percent=75)
vid_mo = rgrain==1 ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
return csharp==0 ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40)
}
function vlq_filter(clip c) {
c=c.RemoveHighNoiseMC(rdlimit=24,rgrain=3,denoise=16,csharp=0.3)
c=c.VagueDenoiser(threshold=1.0, nsteps=6, chromaT=1.2, percent=75)
c=c.deen("a3d",rad=3,thrY=4,thrUV=7,min=0.25,tthY=2,tthUV=3,scd=7)
c=c.LimitedSharpenFaster(Smode=4,strength=28,overshoot=1,wide=false,ss_x=1.2,ss_y=1.2)
return c
}
needed plugins:
Latest MVTools 1.4, DeBlock 1.2 and VagueDenoiser 0.35.1 from Fizick's Page (http://avisynth.org.ru/fizick.html)
RemoveGrain (http://home.arcor.de/kassandro/RemoveGrain/RemoveGrain.rar) pre 1.0
RemoveDirt (http://www.removedirt.de.tf/) 0.9
FluxSmooth 1.1a from warpenterprises (http://www.avisynth.org/warpenterprises/files/fluxsmooth_25_dll_20040729.zip)
SeeSaw (http://home.arcor.de/dhanselmann/_stuff/SeeSaw_2006.01.02.rar) 2006.01.02, therefor MaskTools 1.5.8 (http://manao4.free.fr/MaskTools-v1.5.8.zip)
for my examples
LimitedSharpenFaster (http://www.avisynth.org/LimitedSharpen#LimitedSharpenFaster), therefor MaskTools v2.0a30 (http://manao4.free.fr/masktools-v2.0a30.zip)
deen 1.0 beta 1 (old version)
suggestions for parameter selection:
- set rdlimit=0, denoise=0 and rgrain according to the examples above
- look for a very bad frame
- increase rdlimit until the big noise is gone
- increase denoise until the remaining noise is minimized
- set sharp=true for a video with high resolution of fine details, which you want to encode using a high bitrate
set sharp=false for older film material or tv captures
revisions:
april 19th:
-RemoveHighNoiseMC clean-up
april 20th:
-deen 1.0 beta 1 attachment added
-hints for parameter selection added
-minor removedirt parameter change
may 10th:
- spatial filtering for moving block areas in RemoveDirt
- minor parameter changes
may 29th: deen parameter in vlq_filter example
june 12th:
- improved scene switch behaviour
june 24th:
- minor script error corrected (quality unchanged), thanks to Alain2
august 15th:
- bicubic subpixel interpolation in mvanalyze. much better sharpness thanks to Fizick new MVTools!
august 16th:
- adjustments for sharp subpixel interpolation
november 28th:
- sharp option for sharp subpixel interpolation added for manual selection
.
Heini011
16th April 2006, 23:48
sample picture: vlq_filter
danpos
16th April 2006, 23:51
@Heini011
Hi there! It seems quite interesting, so thanks for share it with us. I just have a suggestion: posting all filters dependencies in order to get the script working, because of maybe some users can to have some difficulty to know what filters/versions are necessary to get it working properly.
Cheers,
danpos
17th April 2006, 01:50
@Heini011
Well done, thanks! :)
Cheers,
Heini011
17th April 2006, 13:18
sample picture: lq_filter
Heini011
17th April 2006, 13:35
sample picture: hq_filter
(from a pre version of this filter, not exactly the same...)
danpos
17th April 2006, 19:13
@Heini011
Good examples. They show that the propers 'filters' perform a really good job on the 'dusts' in each case ...
Cheers,
Alain2
18th April 2006, 22:45
Thanks Heini011 for sharing your script, it proves to be rather good on some materials I have and was struggling on with other methods ; motion compensation seems to be very efficient at keeping details while doing a good job at denoising!
[edit] I just noticed you changed the vlq_filter from the initial one, introducing the RemoveHighNoiseMC, and also you changed denoise=6 to denoise=0 in the hq_filter... If you make other mods in the future, please let us know or we will miss them ^^
rfmmars
19th April 2006, 07:22
Thank for the great documentaion that is ever so missing in some other posts. It help a dumby like me.
Richard
foxyshadis
19th April 2006, 13:17
Another thing I can suggest is to package it into a single file, so people can just download it right to their avs folder. You're more than welcome to upload it to avisynth's wiki and link it from there (though the link will change anytime you update your script, except when linking from the wiki), or you can ask richard for a bit of space. I have a video I'd like to test this out on soon!
Morpheus_xx
19th April 2006, 15:08
Great functions! I tried it for my tv-capture and I really like the results!
During encoding on my AMD X2 dual core cpu, the load goes only up to 58%.
Could somebody tell me, where in the script I could put the "SetMTMode" commands properly, so that it can be faster?
I tried this, but got green dots over the image:
SetMTMode(2)
mq_filter()
Any suggestions?
Alain2
20th April 2006, 00:19
I didn't have a problem without the deblock function from fizick, but I realize that i have also dgdecode.dll in avisynth plugins directory, which contains a deblock() function as well ; maybe it could be a good idea to rename one of these functions to avoid confusion between the 2 (as it's likely that a lot of people have dgdecode.dll in their plugins), or maybe change the script for deblock functions, to be called with the syntaxe deblock_deblock() to specifically call fizick'dll deblock function... (This is probably not a real issue as from fizick's and neuron2's changelogs it appears they didn't really touch manao's core deblock function)
Heini011
20th April 2006, 01:12
Hi,
for thresholds > 0.6 fft3dfilter makes a better job than vaguedenoiser. here is an example for an improved vlq_filter:
function vlq_filter_ultimate(clip c) {
c=c.RemoveHighNoiseMC(rdlimit=24,rgrain=3,denoise=16)
c=c.fft3dfilter(sigma=1.2, sharpen=0.4, plane=4)
c=c.deen("a3d",rad=3,thrY=4,thrUV=7,min=0.25,tthY=2,tthUV=3,scd=7)
return c
}
needed plugins:
fft3dfilter185.zip (http://avisynth.org.ru/fft3dfilter/fft3dfilter185.zip), therefor fftw3.dll (ftp://ftp.fftw.org/pub/fftw/fftw3win32mingw.zip)
@Morpheus_xx:
SetMTMode(2) should, according to avisynth documentation, be in the first line of your avs-script to support multi-threading.
@moderator:
please approve my deen 1.0 beta 1 attachmend in the first post.
greetings.
Morpheus_xx
20th April 2006, 07:13
@Morpheus_xx:
SetMTMode(2) should, according to avisynth documentation, be in the first line of your avs-script to support multi-threading.
yes, I know. But this gives me green dots over the image...
I think one of the many used filters does not work so well with MTMode(2). That why I've asked where to "tweak" these functions.
Mr. Brown
20th April 2006, 13:08
@ Heini011
thank you for RemoveNoiseMC it's good
aBra
20th April 2006, 14:12
I can't use the script with the latest MVTools 0.9.9.1. :(
foxyshadis
20th April 2006, 19:41
That's the latest pre-1.0 version. You need 1.1 (http://www.avisynth.org/fizick/mvtools/mvtools.htm).
Alain2
20th April 2006, 23:14
1.2.2 (http://avisynth.org.ru/mvtools/mvtools.html) (with deblock removed from package and left in the separate plugin, as described in the needed plugins in the first post) ; use the links provided by Heini011 to find the correct plugins versions
Wilbert
21st April 2006, 08:32
@Heini011,
I approved your attachment. I'm sorry that I didn't notice it.
Disabled
21st April 2006, 16:55
Well it took me some time to get it running, but now I got it and its a fantastic script!
I did a quick test with chapter 29 from Matrix and everything looked great, besides this:
http://img359.imageshack.us/img359/9139/orig5aa.th.png (http://img359.imageshack.us/my.php?image=orig5aa.png) http://img57.imageshack.us/img57/9381/rnmc3qg.th.png (http://img57.imageshack.us/my.php?image=rnmc3qg.png)
There is a flashlight in red for just one frame and it gets detected as dirt. I'm impressed by the quality, as even the face is cleared from the light. Really, this is no BS, no color conversion between the both and no other tuning, this is just RNMC working!
I'm using the mq_filter preset...
*edit*
some more examples:
http://img192.imageshack.us/img192/9641/orig21ea.th.png (http://img192.imageshack.us/my.php?image=orig21ea.png) http://img160.imageshack.us/img160/5318/rnmc21zp.th.png (http://img160.imageshack.us/my.php?image=rnmc21zp.png)
http://img100.imageshack.us/img100/8537/orig34cd.th.png (http://img100.imageshack.us/my.php?image=orig34cd.png) http://img154.imageshack.us/img154/8467/rnmc33rk.th.png (http://img154.imageshack.us/my.php?image=rnmc33rk.png)
Conclusion: This might be a pretty cool script for slow movies, but extreme action and fog is a no no, as it kills major detail
And by the way: I'm using the mq preset as hq didn't remove enough noise. But I'm trying my own settings now.
Fizick
21st April 2006, 22:13
Small comment. Generally, I prefer do not use too many (>2) denoisers in one chain of script. Every denoiser kills some details, and deforms noise spectrum - some denoisers are developed to deal with un-denoised video.
And whole noise removal is not optimal (at least for non-anime video).
Alain2
22nd April 2006, 01:31
I agree for the lower qual filters were deen is involved for instance, but nethertheless I am still impressed by what can be achieved with this motion denoising script; I used the hq filter on a grainy film I had and wanted to denoise with the least detail loss, and this filter chain gave me the best compromise :) And on animation the low settings are rather good as well
I've avoided so far diving into the mvtools, I mostly used the masktools for playing with my scripts, I think I'll start having a look to the mvtools as well ;)
Disabled
22nd April 2006, 09:49
After trying a lot more settings I think that any rdlimit over 2 kills small objects just flashing in, like the reflections in my second set of screens.
You wont notice it until you know what is missing, but that is too much for me.
rdlimit=2,rgrain=1,denoise=4 still kills detail in the rocks in set 2 & 3 but its a fast action scene and you wont notice anyway. And it kills some major noise in still scenes. I think I'll encode some more with these settings!
*edit*
Oh and with 2-3 fps its kinda fast for me :)
Heini011
22nd April 2006, 13:25
@Disabled
pleae notice my small paramester selection guide, added in the first posting.
rgrain=3 is aimed only for analog capture or really poor quality sources. for high quality sources you could trying to set cpn=75*ccf in the script.
flashing in objects are in conflict with the aim of dirt dection/removing. this script is not aimed for high quality action movies. use the mvdenoise part of this script instead.
@Fizick:
good denoising is not only a matter of taste but means high compressibility too. therefore we need temporal and spatial filtering. a single temporal filter is hardly good enough for very strong noise. deen with weak parameters is a good extension for vaguedenoiser, cause it removes some dirt on bigger homogeneous surfaces.
Disabled
22nd April 2006, 19:12
Yeah thanks Heini, I already noticed your parameter guide, but As I said I notice major object deletion with settings as low as rdlimit=3,rgrain=1,denoise=3. With rdlimit=3,rgrain=0,denoise=0 still some objects get removed.
Oh and with rdlimit=0 objects get removed too. I guess thats some bug, as its as strong as with rdlimit>=3
I experimented with the rest of the script too, but I think I still have a long way to go, but results are quite promising.
Thanks a lot for the script!
hartford
3rd May 2006, 03:15
I tried this two ways; progressive works, interlaced gives exception. Perhaps an avisyth problem?
I'm using Avisynth v2.5.6.0
This causes an Avisynth exception:
LoadPlugin("d:\plugins\mt_masktools_2.0a28.dll")
LoadPlugin("d:\plugins\MaskTools-1.5.8.dll")
LoadPlugin("d:\plugins\Deen.dll")
LoadPlugin("d:\plugins\FluxSmooth-1.1.dll")
LoadPlugin("d:\plugins\mvtools-1.2.2.dll")
LoadPlugin("d:\plugins\RemoveDirt-0.9.dll")
LoadPlugin("d:\plugins\RemoveGrainS-09.dll")
LoadPlugin("d:\plugins\Repair-09.dll")
LoadPlugin("d:\plugins\VagueDenoiser-0.35.1.dll")
LoadPlugin("d:\plugins\deblock-1.2.dll")
LoadPlugin("d:\plugins\RemoveGrainS-1a.dll")
import("d:\plugins\import\RemoveNoiseMC.avsi")
import("d:\plugins\import\SeeSaw.avsi")
avisource("d:\ALL_This.avi").convertToYV12(interlaced=true)
separatefields()
Selectodd().RemoveNoiseMC(rdlimit=6,rgrain=1,denoise=6)
Selecteven().RemoveNoiseMC(rdlimit=6,rgrain=1,denoise=6)
Weave()
==
If I remove the "separatefields()" stuff, it works.
I'm not saying that there is anything "wrong" with your script.
What version of Avisynth are you using?
Mr. Brown
3rd May 2006, 20:20
Yeah thanks Heini, I already noticed your parameter guide, but As I said I notice major object deletion with settings as low as rdlimit=3,rgrain=1,denoise=3. With rdlimit=3,rgrain=0,denoise=0 still some objects get removed.
Oh and with rdlimit=0 objects get removed too. I guess thats some bug, as its as strong as with rdlimit>=3
I experimented with the rest of the script too, but I think I still have a long way to go, but results are quite promising.
Thanks a lot for the script!
The removed object's is not a bug it's a problem that affect all Dirt removers.
The big problem for the filter is to difference in middle - high motion what is Dirt and what is Object/Detail.
In the end you must live with a compromise between Dirt Remove and Object/Detail Lost.
DarkNite
12th May 2006, 08:34
I have to say this gives amazing results with animated sequences. Well, it is not so kind to CGI in high motion when certain effects are used, but that's to be expected. Thankfully there's always filtering by section as a scripting option.
The hq settings almost always play nicely with content imported from my camera, and that's my main concern. With some simple tweaking this is very versatile. Nicely done.
Heini011
25th May 2006, 11:59
Hi folks,
i wrote a simpler and less brutal script function for denoising modern high quality movies. it was aimed as a better replacement for mvdenoise.
you can modify the mvtools blocksize:
cbs = 4 sometimes better denoising caused by better block-matching, less blocking
cbs = 8 much faster and may preserve slightly more sharpness
function RemoveTempGrain(clip input, int _mode)
{
rg = RemoveGrain(input, mode=_mode)
return TemporalRepair(rg, input)
}
function RemoveDirt_HQ(clip input, int tlimit, int rgrain, bool "_grey")
{
_dgr = 0.4+rgrain*0.25
clensed = input.RemoveTempGrain(1).FluxSmoothST(tlimit,rgrain)
restore = input.VagueDenoiser(threshold=_dgr, nsteps=6, chromaT=_dgr, percent=100).RemoveGrain(1)
alt = restore
return RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, pthreshold=3+2*rgrain, cthreshold=3+2*rgrain, gmthreshold=40, dist=1, dmode=1, debug=false, noise=tlimit+1, noisy=12, grey=false)
}
global idx_c = 4
function RemoveNoiseMC_HQ(clip,int "tlimit", int "rgrain", float "csharp")
{
tlimit = default(tlimit,4)
rgrain = default(rgrain,1)
csharp = rgrain>1 ? default(csharp,0.14) : default(csharp,0.13)
global idx_c = idx_c + 1
cbs = 4
ccf = cbs*cbs/64
cpn = tlimit>6 ? 70*ccf : 75*ccf
bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=1, overlap=0, truemotion=true, pnew=cpn, idx=idx_c)
fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=1, overlap=0, truemotion=true, pnew=cpn, idx=idx_c)
backw1 = clip.MVFlow(bvec1, idx=idx_c)
forw1 = clip.MVFlow(fvec1, idx=idx_c)
dnc = interleave(backw1,clip,forw1)
dnc = dnc.RemoveDirt_HQ(tlimit,rgrain)
dnc = dnc.SelectEvery(3,1)
return csharp==0 ? dnc : \
clip.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40)
}
function hqfilter(clip c)
{
c=c.RemoveNoiseMC_HQ(tlimit=4,rgrain=1)
c=c.LimitedSharpenFaster(Smode=4,strength=15,overshoot=1,wide=false,ss_x=1.3,ss_y=1.3)
return c
}
27. may: very small update @ seesaw
Alain2
25th May 2006, 20:49
I will try :)
Question: Am I obliged to put global idx_c = 4 ? it was 25 in the previous functions you gave, and as I understand it this number is just a ref number for idx in mvtools, so it's starting point not very important ? (I ask because I want to keep all your functions in the same .avsi)
Heini011
25th May 2006, 21:54
Hi Alain2,
the only importance for idx_c is this: there shouldn't be another mvtools function call in your avisynth script with the same idx value.
Clown shoes
27th May 2006, 11:33
Hi there. Please excuse my scripting ignorance, but I am having a problem with the usage of the simple script. My .avs is reporting; There is no function named "TemporalRepair" I am imagining this is due to incorrect usage rather than incorrect .dlls, although I could be wrong. I am trying to use this in conjunction with LimitedSharpener. My script is as follows;
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpenFaster.avsi")
import("C:\Program Files\AviSynth 2.5\plugins\RemoveNoiseSimple.avsi")
import("C:\Program Files\AviSynth 2.5\plugins\SeeSaw.avsi")
avisource("E:\test.avi", audio=false)
#colorMatrix()
AssumeFPS(24,1,true)
#addborders(0,32,0,32)
Levels(0, 1.2, 255, 0, 255)
Tweak(bright=1.3, sat=1.2, cont=1.05 )
RemoveNoiseMC_HQ(tlimit=4,rgrain=1)
LimitedSharpen(dest_x=368,dest_y=208,ss_x=1.5,ss_y=1.5,Smode=3,strength=100,wide=true,special=true)
Would someone be good enough to point out where I am going wrong.
Thanks in advance
Rich
Alain2
27th May 2006, 12:56
Look at the first post of this thread, the needed plugins section
Clown shoes
27th May 2006, 13:16
I have them all in my plugins folder as far as I can tell. Is TemporalRepair refering to the lack or non functioning of a particular plugin?
foxyshadis
27th May 2006, 14:09
Repair.dll and its auxillaries are in the removegrain.rar linked in the first post. You may also need SSETools from the official 0.9 (http://home.pages.at/kassandro/RemoveGrain/RemoveGrain.zip).
This is the best script for denoise I've ever used and with a good speed also. But I want an advice. I use this especialy on low light videos from my pal camera (the ones in day light doesn't have much noise). So please tell me which are the best settings for using with videos on low light and what ways are you using for bright the videos (I use HDRAGC for now with good results, but I want to know if is something better). Thank you.
Heini011
27th May 2006, 22:37
Hi Clown shoes,
foxyshadis answered already: you need the Repair.dll from RemoveGrain 1.0 pre package, linked in the first posting of the removenoisemc thread. if it still doesn't work, copy RepairS.dll in your avisynth plugin directory.
hi myck,
all filters used in my script have absolute thresholds. so there is little to tweak for low light scenes, sadly. but you could use didee's great ylevels script to enhance the brightness.
greetings.
Clown shoes
28th May 2006, 01:35
Thanks guys, yes that works. I also had to move the dlls out of the Avisynth plugin folder, as they were conflicting with other dlls and causing a crash each time I opened a script. I do have one other question though. Your script calls on the SeeSaw script. Does that then make my use of Limited Sharpen redundant, or am I getting myself a little confused.
I am using your simple action script with cbs = 8
and my script is now;
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\Deen.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\FluxSmooth.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\RemoveDirt.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\RemoveGrainS.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\VagueDenoiser.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpenFaster.avsi")
Import("C:\Program Files\AviSynth 2.5\plugins\RemoveNoiseSimple.avsi")
Import("C:\Program Files\AviSynth 2.5\plugins\SeeSaw.avsi")
avisource("E:\test.avi", audio=false)
#colorMatrix()
AssumeFPS(24,1,true)
#addborders(0,32,0,32)
Levels(0, 1.2, 255, 0, 255)
Tweak(bright=1.3, sat=1.2, cont=1.05 )
RemoveNoiseMC_HQ(tlimit=4,rgrain=1)
LimitedSharpen(dest_x=368,dest_y=208,ss_x=1.5,ss_y=1.5,Smode=3,strength=100,wide=true,special=true)
I am using your Remove noise script instead of; hqdn3d(3,2,4,4,5)
Could you see any purpose to using both denoisers, or is that just unnecesary overkill?
Sorry. I forgot one more stupid question. I am a little new to using longer complicated scripting, and I am confused by the addition at the end of your script of these lines;
c=c.RemoveNoiseMC_HQ(tlimit=4,rgrain=1)
c=c.LimitedSharpenFaster(Smode=4,strength=15,overshoot=1,wide=false,ss_x=1.3,ss_y=1.3)
return c
Are they active in the script? And does that mean I can just make my adjustments to Limited Sharpen within your Remove Noise script?
Apologies if these are very stupid questions. I am still quite new to this and there is quite a steep, initial learning curve.
Thanks again
Clown Shoes
:stupid:
DarkNite
28th May 2006, 06:57
I am using your Remove noise script instead of; hqdn3d(3,2,4,4,5)
Could you see any purpose to using both denoisers, or is that just unnecesary overkill?
I'm almost certain that would be overkill, but you could always try it and compare.
I am confused by the addition at the end of your script of these lines;
c=c.RemoveNoiseMC_HQ(tlimit=4,rgrain=1)
c=c.LimitedSharpenFaster(Smode=4,strength=15,overshoot=1,wide=false,ss_x=1.3,ss_y=1.3)
return c
Are they active in the script? And does that mean I can just make my adjustments to Limited Sharpen within your Remove Noise script?
Generally a function or plugin call that isn't commented out, and is followed by a return call is active.
Just comment out the original LimitedSharpenFaster line, and create a dupicate line in your script. Edit the duplicate line in the script to match your destination settings. If that doesn't work well enough for you then start adding your other settings in as well.
Example:
#c=c.LimitedSharpenFaster(Smode=4,strength=15,overshoot=1,wide=false,ss_x=1.3,ss_y=1.3)
c=c.LimitedSharpenFaster(dest_x=368,dest_y=208,Smode=4,strength=15,overshoot=1,wide=false,ss_x=1.3,ss_y=1.3)
That way you won't lose the original line if something goes wrong or you're not pleased with the results.
Clown shoes
28th May 2006, 12:10
Thank you for your help Darknite, but I am clearly still doing something wrong! If I comment out the function lines in my script and use the lines in the remove grain script, neither lines work and the file plays unfiltered! If I comment out the lines in the remove grain script and replace them in mine, it seems to work properly. I'm sure I should just be thankful I can get the filters working, but I want to understand what it is that's going wrong. If I post up the two scripts that are not working, maybe someone could point out where I am going wrong?
My Script;
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\Deen.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\FluxSmooth.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\RemoveDirt.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\RemoveGrainS.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Remove Noise Simple\VagueDenoiser.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpenFaster.avsi")
Import("C:\Program Files\AviSynth 2.5\plugins\RemoveNoiseMC.avsi")
Import("C:\Program Files\AviSynth 2.5\plugins\SeeSaw.avsi")
avisource("E:\test.avi", audio=false)
#colorMatrix()
AssumeFPS(24,1,true)
#addborders(0,32,0,32)
Levels(0, 1.2, 255, 0, 255)
Tweak(bright=1.3, sat=1.2, cont=1.05 )
#RemoveNoiseMC_HQ(tlimit=4,rgrain=1)
#LimitedSharpenFaster(dest_x=368,dest_y=208,ss_x=1.3,ss_y=1.3,Smode=3,strength=100,wide=true,special=true)
Remove Noise Script
function RemoveTempGrain(clip input, int _mode)
{
rg = RemoveGrain(input, mode=_mode)
return TemporalRepair(rg, input)
}
function RemoveDirt_HQ(clip input, int tlimit, int rgrain, bool "_grey")
{
_dgr = 0.35+rgrain*0.2
clensed = input.RemoveTempGrain(1).FluxSmoothST(tlimit,rgrain)
restore = input.VagueDenoiser(threshold=_dgr, nsteps=6, chromaT=_dgr, percent=100).RemoveGrain(1)
alt = restore
return RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, pthreshold=3+2*rgrain, cthreshold=3+2*rgrain, gmthreshold=40, dist=1, dmode=1, debug=false, noise=tlimit+1, noisy=12, grey=false)
}
global idx_c = 4
function RemoveNoiseMC_HQ(clip,int "tlimit", int "rgrain", float "csharp")
{
tlimit = default(tlimit,4)
rgrain = default(rgrain,1)
csharp = (rgrain>1) ? default(csharp,0.28) : default(csharp,0.26)
global idx_c = idx_c + 1
cbs = 8
ccf = cbs*cbs/64
cpn = (tlimit>6) ? 72*ccf : 76*ccf
bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, truemotion=true, pnew=cpn, idx=idx_c)
fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, truemotion=true, pnew=cpn, idx=idx_c)
backw1 = clip.MVFlow(bvec1, idx=idx_c)
forw1 = clip.MVFlow(fvec1, idx=idx_c)
dnc = interleave(backw1,clip,forw1)
dnc = dnc.RemoveDirt_HQ(tlimit,rgrain)
dnc = dnc.SelectEvery(3,1)
return csharp == 0 ? dnc : \
dnc.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40)
}
function hqfilter(clip c)
{
c=c.RemoveNoiseMC_HQ(tlimit=4,rgrain=1)
#c=c.LimitedSharpenFaster(Smode=4,strength=15,overshoot=1,wide=false,ss_x=1.3,ss_y=1.3)
c=c.LimitedSharpenFaster(dest_x=368,dest_y=208,ss_x=1.3,ss_y=1.3,Smode=3,strength=100,wide=true,special=true)
return c
}
I'm sure, I'm doing something silly wrong here, but I would like to understand what that is, so as I can learn more about quality scripting.
The only other thing I am confused about is the use of SeeSaw in the Remove Noise Script. Is it actually being called upon?
Heini011
28th May 2006, 12:56
Hi Clown shoes,
you have marked out the calls to RemoveNoiseMC_HQ and LimitedSharpenFaster with the fist '#' character. please take a look in the avisynth documentation for such questions!
LimitedSharpenFaster doesn some other kind of sharpening as SeeSaw, which i use mainly for detail enhancement. just try it out.
Clown shoes
28th May 2006, 14:57
Sorry Heini011, I don't think I am explaining myself properly. I was trying to follow what Darknite said and adapting the functions at the end of your RemoveNoise script. I deliberatly commented them out in my script to see if they are active at the end of the RemoveNoise script. Would I be right in thinking, you are telling me the end of the RemoveNoise script is there purely as a guide to what I should be using in my script?
I hope I am on the right lines here. Do you think someone might be able to show me an example of one of thier scripts? I'm sorry if I'm still asking stupid questions but this seems like such a good filter and I would love to get it working correctly.
Please tell me if you feel I am clogging up the thread with my questions, as I really don't want to be a pain. :o
foxyshadis
28th May 2006, 15:44
The line you replaced is encapsulated in a function, which is never used unless you explicitly call it. You must either add hqfilter() in your main script, or uncomment the two lines which do the exact same thing anyway.
Clown shoes
28th May 2006, 15:57
Thanks so much Foxyshadis. It all makes perfect sense now and better still, the script works perfectly! :D
What I was failing to do was call the function in my main script with hqfilter() Obvious when it's spelt out for you :rolleyes:
I shall now have much fun tweaking this great looking filter.
Thank you one and all for you patience.
ClownShoes
:thanks:
ObeewanVOB
28th May 2006, 18:10
All I can say Heini is :eek: ! I've been trying to use a combination of filters to help improve some captures with "acceptable" but not great results so far. I was just starting to toy around using Didee's SeeSaw function until I came along this. Obviously there is no way to make an old and degrading analog transfer look perfect but with the functions and examples you've provided here alone it's a night and day difference! Keep it up guys, my many thanks to you and Didee!
demonicos
29th May 2006, 05:41
Id like to say to Heini011 that this is a bloody awesome script although im not too familiar with it all and probably have the wrong settings but the results im seeing in TORA TORA TORA are incredible and is worth the 4-6 fps im getting ;)
Alain2
23rd June 2006, 22:36
I've just lost a few hours understanding what was wrong in my script (I had strange errors, and initially thought it was because i was doing directshouwsource on a wmv9 I420 file, which I never done before), but in the end the problem was coming from the scripts here : function RemoveNoiseMC(clip,....
should be replace by function RemoveNoiseMC(clip clip,......
Strangely I never had any problem from mpeg2source clips, but it wasn't working with the wmv9 yv12 clip imported from directshowsource ; in case it helps others ;)
Heini011
24th June 2006, 19:44
Hi,
@Alain2,
thank you for your hint! strange, this error caused no problems for me.
@all:
i added a few lines for a improved scene-change behaviour. further filter improvements would require a replacement of vaguedenoiser. any suggestions for a still better pure spatial anti-grain denoiser ?
deblock is not very effective also, but fortunately not very important for this script.
greetings.
Eretria-chan
25th June 2006, 16:31
I just tried this, but I get a syntax error in LimitedSharpFaster.avs, line 30, column 19. I copied all the code for LimitedSharpenFaster from the link into that script but as I import it, I get syntax error.
This filter looks really nice and I'd love to try it out, but this syntax error keeps me from doing it. I have no idea why it fails. Can anyone help?
Adub
25th June 2006, 17:47
What exactly is your error?
Are you sure that you have all of the required plugins to run the filter smoothly?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.