View Full Version : The power of Avisynth: restoring old 8mm films.
johnmeyer
1st July 2012, 00:13
A good place to find answers about film itself:
8mm Film Forum (http://8mmforum.film-tech.com/)
Does you film smell like vinegar? If so, it has "vinegar syndrome." (https://www.google.com/search?q=%22VINEGAR+syndrome%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a#hl=en&client=firefox-a&hs=XCU&rls=org.mozilla:en-US%3Aofficial&sclient=psy-ab&q=%22vinegar+syndrome%22&oq=%22vinegar+syndrome%22&gs_l=serp.3..0l4.35350.36325.0.36776.8.8.0.0.0.7.267.1658.0j4j4.8.0...0.0.8Sq7pbR-FWM&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=f02dca5de27feb08&biw=1067&bih=509) This is where the acetate base of the film breaks down and "out-gasses" acetic acid. The smell will be quite obvious. A smell of camphor (mothballs) is normal and of no concern.
Any film affected by vinegar syndrome cannot be salvaged, nor can it be made supple and flexible again. Your scanning solution may or may not work because the film generally does not shrink uniformly, and also because the film tends to not only shrink and get brittle, but also it usually curls.
You can Google "vinegar syndrome" and get more information on the problem and also, perhaps, other people's ideas on what can be done about it.
I have received about half a dozen cans over the past few years that have been infected with this problem. I tried one time to do a transfer, but it didn't work. I then had to thoroughly clean my transfer system because any infected film tends to infect good film that comes in contact with the dust left behind by the disintegrating film.
There are several products, such as Film Renew and FilmGuard, that will clean film and make it more supple. I have not had any need to use it, so I don't have any.
millercentral
1st July 2012, 04:22
Thanks John, that is super helpful information. I do believe some of this film suffers from vinegar syndrome unfortunately. We'll see if I have any success.
Again, I really appreciate the help. I'll followup once I get my rig setup and start attempting the captures.
Gargamel
3rd July 2012, 21:14
Hello Fred,
Thank you for your last edition ! [Sorry, I wasn't here for some days...]
A lot of new tests to perform now ;-))
stoffal
4th July 2012, 14:47
Hi Fred! Just a short question regarding the dirt removal plugin you are using: Have you also tested the "SpotRemoval" plugin as an alternative? Any experiences or comparisons? It looks interesting and is still actively developed. http://spotremoverfilter.com/
videoFred
5th July 2012, 11:28
Hi Fred! Just a short question regarding the dirt removal plugin you are using: Have you also tested the "SpotRemoval" plugin as an alternative? Any experiences or comparisons? It looks interesting and is still actively developed. http://spotremoverfilter.com/
Hello Stoffal,
RemoverdirtMC() works very well, there is no need for an alternative.
Fred.
em66
25th July 2012, 11:14
Hello,
Just a few words to say I spent some time trying the script and was very impressed with the results. The noise / grain reduction and the dust busting especially. I really thought I would lose more details with de-graining.
The result is very interesting with 16mm films, and even 35mm film transferts. There're always a few issues, like the behaviour of RemovedirtMC on black and white films with flicker (deformation of parts of the picture) but I hope I'll find a suitable setting. I'll try DeSpot too.
I tried to combine the script with DeScratch, and it worked not so bad for the actual scratches, but produces too many artifacts on vertical elements that are not scratches, so I guess it's not a process that can be fully automated successfully.
Congratulations to videoFred and the other helpers.
Thank you for sharing your work.
Gargamel
26th July 2012, 08:56
Hi em66,
I use DeScratch sometimes too. It can help to minimize vertical scratches, but only ".DeScratch(mindif=1,maxwidth=1)" works OK for me, without noticeable artifacts.
".DeScratch(mindif=1)" is too strong here, and always wipes a lot of vertical lines which aren't scratches on my 8mm footages.
em66
26th July 2012, 12:41
Hi em66,
I use DeScratch sometimes too. It can help to minimize vertical scratches, but only ".DeScratch(mindif=1,maxwidth=1)" works OK for me, without noticeable artifacts.
".DeScratch(mindif=1)" is too strong here, and always wipes a lot of vertical lines which aren't scratches on my 8mm footages.
Hi Gargamel,
Thank you for the advice. There are less artifacts indeed with maxwidth=1, but some of the scratches, a bit wide, are not processed. I guess it depends on the film.
Gargamel
27th July 2012, 12:31
I guess it depends on the film.
Sure !
Probably very difficult to wipe wide scratches without artifacts.
But often DeScratch works well when scratches are thin.
jkf123
15th August 2012, 07:19
Hi Fred,
first of all I also want to say thank you for the great script. The results are amazing. Old N8 movies are looking like HD Video now !
After I restored maybe 10 films with great results, I faced a strange problem now. The processed film has some kind of triangle with green stripes on the right corner, like you can see in the picture. Also changing the parameters of the script does not solve this. ( I also reinstalled all involved software, tried it on another PC and tested the beta version of avisynth, but the triangle is still there).
Does anybody has a clue what I do wrong ?
Thx for your help and your great work
Kristian
videoFred
15th August 2012, 08:15
Hi JFK123,
This problem is very easy to solve. All clip dimensions must be divisible by 16.
For example if we have a clip of 720x576 and we crop 20 pixels on each side, we will have a 680x536 clip. That's not good because both width and height are not divisible by 16. But if we crop 16 pixels on each side, we have a 588x544 clip and these values are divisible by 16.
Fred.
em66
22nd August 2012, 16:01
Hi,
I'm still pleased and impressed with the possibilities offered by this script.
It was even able to restore bad video tapes (interlaced material !) with many drop-outs on the pictures. When the drop outs are only on one frame/field, there're removed just like dirt. And the denoising works well for video too.
There's still one thing that I can't do properly : dealing with b&w film. I get strange pumping (deformation) on parts of the picture, on some shots. It seems to happen where there is flicker.
The problem is caused by RemoveDirtMC. Is it because it normally works with color information ? Does anyone know what setting should be changed ?
Thanks !
videoFred
23rd August 2012, 12:47
There's still one thing that I can't do properly : dealing with b&w film. I get strange pumping (deformation) on parts of the picture, on some shots. It seems to happen where there is flicker.
The problem is caused by RemoveDirtMC. Is it because it normally works with color information ? Does anyone know what setting should be changed ?
Thanks !
We need a sample clip to analyze this. It is not caused by the lack of color. Do you have this effect when returning result4 too?
Fred.
johnmeyer
23rd August 2012, 17:02
I get strange pumping (deformation) on parts of the picture, on some shots. It seems to happen where there is flicker.I suspect that you are using the "frame interpolation" script which gives you 30 fps frame rate from 16, 18, or 24 fps original material. This uses MVTools to synthesize the intermediate frames, and this can definitely cause the problems you describe. I understand and appreciate what this technique can do, and sometimes use it myself, but I find that far too often the artifacts introduced are far worse than the "juddering" that is inherent in the low-fps original frame rates. So, I always recommend just adding pulldown (duplicated fields). I am not sure whether any of VideoFred's current scripts do that (field blending is not the same thing).
FWIW, pulldown is how film has been shown on TV since television was invented.
I'm not knocking or disparaging either motion interpolation or field blending, but just pointing out that one has morphing issues and the other will result in "soft" intermediate frames. Pulldown has neither of those problems and it shows the film just almost exactly like it would have looked if projected. However, when the camera pans, it will judder: that's just the nature of low-fps image projection.
videoFred
24th August 2012, 06:47
I find that far too often the artifacts introduced are far worse than the "juddering" that is inherent in the low-fps original frame rates. So, I always recommend just adding pulldown (duplicated fields). I am not sure whether any of VideoFred's current scripts do that (field blending is not the same thing).
I have included a frame blending script, but this can easily be changed to frame duplicating by changing "BlendFPS(final_framerate, frame_blend)" to "ChangeFPS(final_framerate)".
Can you show a code example of how to add duplicated fields John? This means introducing interlacing or am I wrong here?
Anyhow, lately I play my transfered film files straight from a portable USB HD to my flatscreen 40" Sony Bravia, at the original framerate (16, 18 or 24). It plays remarkable smooth. I use XVid for the codec. Perhaps the TV hardware is doing something to make it look smoother, I do not know. I can not skip frame-by-frame on that TV. Also, the internal upscaling from the TV to full HD works remarkable well too. For example a 960x720 (4:3) clip will be upscaled to 1440x1080 and the TV will show two black borders, no need to add them in the clip.
However, when the camera pans, it will judder: that's just the nature of low-fps image projection.
Yes. And in those cases the interpolation works remarkable well without the "rubber" artefacts, if the panning is not to fast.
Fred.
johnmeyer
24th August 2012, 19:19
Can you show a code example of how to add duplicated fields John? This means introducing interlacing or am I wrong here?
I am still showing my work on television sets, and while modern TV sets can deal with progressive, much of the intermediate chain still expects interlaced (other than for 24 fps film). Also, many people still watch TV on an interlaced TV set (CRT). So, my code is all designed to produce 29.97 interlaced output. Here is the code for various input framerates, along with a generalized way of accomplishing the same thing using ChangeFPS (the last code snippet below).
# Pulldown for 24 fps
# separatefields()
# SelectEvery(8, 0,1, 2,3,2, 5,4, 7,6,7)
# weave()
# Pulldown for 18 fps using repeats normal-repeat-normal-weave-normal
# separatefields()
# selectevery(6, 0,1, 0,1, 2,3, 2,5, 4,5)
# weave()
# Pulldown for 18 fps using all weaves normal-weave-normal-weave-normal (I like this the best)
# separatefields()
# selectEvery(6, 0,1, 0,3, 2,3, 2,5, 4,5)
# weave()
# Pulldown for 16 fps using all weaves
# separatefields()
# SelectEvery(16, 0,1, 0,3, 2,3, 2,5, 4,5, 4,7, 6,7, 6,9, 8,9, 8,11, 10,11, 10,13, 12,13, 12,15, 14,15)
# weave()
# Pulldown to go from 16 fps to 18 fps
# separatefields()
# selectEvery(16, 0,1, 2,3, 4,5, 6,7, 6,9, 8,9, 10,11, 12,13, 14,15)
# weave()
# Pulldown from ANY fps using a technique in the Doom forums (seems to produce same as above)
# Seems to work well and should be able to handle ANY input frame rate
# Designed for 29.97 interlaced output
# ChangeFPS(59.94) #Double the final framerate
# AssumeTFF() # or BFF, as required
# SeparateFields()
# SelectEvery(4, 0, 3) #selectevery(4,1,2) can be used if you get field reversal, although TFF/BFF above should do the same thing, I think
# weave()
em66
3rd September 2012, 16:10
Hi and thank you for your answers, videoFred and johnmeyer.
We need a sample clip to analyze this. It is not caused by the lack of color. Do you have this effect when returning result4 too?
The effect is the same with result4.
I did a sample focusing on the zone which causes a problem.
It's short and small but I think it's enough to see the matter. It's actually not a 8mm film but a raw transfer of a very old 35mm movie :
http://wtrns.fr/oQ1UT1yYkRtTMU
I suspect that you are using the "frame interpolation" script which gives you 30 fps frame rate from 16, 18, or 24 fps original material.
I didn't use any frame interpolation, and "BlendFPS" is not even in the script I used.
There's no artefact if I don't use RemoveDirt so I'm pretty sure it's the cause, I just wonder if there's a setting to avoid this issue. Maybe de-flickering before RemoveDirt ? I'm not sure where the DeFlicker is used in the script.
videoFred
3rd September 2012, 16:43
It's a difficult one. If the flickering is on the original film, then the grain pattern is changing constantly between bright and dark frames. We need an example of the original transfer!
Fred.
johnmeyer
3rd September 2012, 18:01
Your original description made me think you were having a different problem.
I don't know what versions of the script you are using. The version I created changed everything to MVTools2 instead of MVtools. In that version, the MAnalyze calls have a parameter called "dct." For flicker, you change this from the default dct=0 to dct=1. Since the dct parameter is not included in the parameters setting of the script, you have to add it yourself to each instance of MAnalyze. I also used the deflicker function. With both of these enabled, here is the result I was able to get:
Deflickered Result (http://dl.dropbox.com/u/1561578/test.avi)
My personal taste would be to not do any grain reduction. The problem is that the grain is so large in size that you end up losing detail when trying to eliminate it and you are inevitably left with the grain morphing effect that is not particularly pleasant. I don't think this is necessarily a defect in the script but rather the result of the size of the structure that you are attempting to remove. The result I have posted above does have the grain removal enabled and you can see that it creates a somewhat unpleasant "gooey" effect. However, the flicker is almost entirely removed, as is the major "pumping" that you saw in your clip.
em66
4th September 2012, 13:10
Thanks again for your answers.
Yes the film is flickering a lot...(1928 !).
I'm using a script based on "01_A_Film_Restoring_Frame_Interpolation.avs" downloaded in the first post. Where is your version johnmeyer ?
If I set the "denoising_strenght" to "0", I get the same effect.
However, with "dirt_strenght=0", the annoying effect is gone. That's why I really think it has to do with RemoveDirtMC.
I don't mind a bit of grain and flicker, but I was trying to clean some of the dust without getting any obvious artefact like this picture deformation.
I posted only a portion of the picture where the artefact was very visible. Of course, the full picture doesn't look as grainy, but the original film has some grain for sure.
TheoRI
13th September 2012, 14:34
Have a look at the restoration of the oldest "color" film
http://youtu.be/XekGVQM33ao
Jenyok
14th September 2012, 16:04
RemoveDirt functions...
.
#
#
# File: RemoveDirt.avsi
#
# RemoveTempGrain, RemoveDirt and moution compensated RemoveDirt functions
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveTempGrain(clip clp, int "_mode")
#
# function RemoveDirt(clip clp, int "limit", bool "_grey")
# function RemoveDirtMC(clip clp, int "limit", bool "_grey", int "Vectors")
#
# function RemoveDirt2(clip clp, int "limit", int "rgrain", bool "_grey")
# function RemoveDirtMC2(clip clp, int "limit", int "rgrain", bool "_grey", int "Vectors")
#
# function RemoveDirt_HQ(clip clp, int tlimit, int rgrain, bool "_grey")
# function RemoveDirt_HQMC(clip clp, int "limit", int "rgrain", bool "_grey", int "Vectors")
#
# function RemoveDirtCareful(clip clp, int "th", bool "show")
# function RemoveDirtCarefulMC(clip clp, int "th", bool "show", int "Vectors")
#
# function RemoveDirtS(clip clp, int "limit", bool "_grey")
# function RemoveDirtSMC(clip clp, int "limit", bool "_grey", int "Vectors")
# function HQ_FilterS(clip clp, int "Vectors")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\YLEVELS\ylevels.avsi")
function NullClip(clip clp)
{
return (BlankClip(clp, length=0))
}
# =============================================================================
#
#
function RemoveTempGrain(clip clp, int "_mode")
{
_mode = Default(_mode, 17)
rg = RemoveGrain(clp, mode=_mode)
clp = TemporalRepair(rg, clp)
return clp
}
# =============================================================================
#
#
function RemoveDirt(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 16)
clmode = 17
clensed = Clense(clp, grey=_grey, cache=4)
sbegin = ForwardClense(clp, grey=_grey, cache=-1)
send = BackwardClense(clp, grey=_grey, cache=-1)
alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=limit, modeU = _grey ? -1 : limit)
restore = Repair(clensed, clp, mode=limit, modeU = _grey ? -1 : limit)
corrected = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
clp = RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode)
return clp
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC(clip clp, int "limit", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt(clp, limit=limit, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDirt2(clip clp, int "limit", int "rgrain", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
_dgr1 = 0.35 + rgrain * 0.3
_dgr2 = 0.45 + rgrain * 0.4
repmode = 1
clensed = Clense(clp, grey=_grey, cache=4)
restore = clp.FluxSmoothST(3 + 3 * rgrain, rgrain)
restore = Repair(restore, clp, 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 = clp.VagueDenoiser(threshold=_dgr2, chromaT=_dgr2, nsteps=7, percent=100).RemoveGrain(5)
clp = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, \
pthreshold=4 + 2 * rgrain, cthreshold=6 + 2 * rgrain, gmthreshold=40, \
dist=1, dmode=2, debug=false, noise=limit, noisy=12, grey=_grey)
# Alternative settings
#
# clp = RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=4, cthreshold=6, gmthreshold=40, dist=1, dmode=2, \
# debug=false, noise=limit, noisy=12, grey=_grey, show=true)
#
# clp = RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=6, cthreshold=8, gmthreshold=40, dist=3, \
# tolerance=12, dmode=2, debug=false, noise=limit, noisy=12, grey=_ grey, show=false)
return clp
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC2(clip clp, int "limit", int "rgrain", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt2(clp, limit=limit, rgrain=rgrain, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDirt_HQ(clip clp, int "limit", int "rgrain", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
_dgr = 0.4 + rgrain * 0.25
clensed = clp.RemoveTempGrain(1).FluxSmoothST(limit, rgrain)
restore = clp.VagueDenoiser(threshold=_dgr, nsteps=6, chromaT=_dgr, percent=100).RemoveGrain(1)
alt = restore
clp = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, pthreshold=3 + 2 * rgrain, \
cthreshold=3 + 2 * rgrain, gmthreshold=40, dist=1, dmode=1, debug=false, \
noise=limit + 1, noisy=12, grey=_grey)
return clp
}
function RemoveDirt_HQMC(clip clp, int "limit", int "rgrain", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt_HQ(clp, limit=limit, rgrain=rgrain, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDirtCareful(clip clp, int "th", bool "show")
{
th = Default(th, 16)
show = Default(show, false)
dirtless = clp.RemoveDirt()
# dirtless = clp.RemoveDirt2()
maskd = yv12lutxy(clp, dirtless, yexpr="x y - abs 16 > 255 0 ?", Y=3, U=-128, V=-128)
maskd = maskd.expand().reduceby2().reduceby2().expand(Y=3, U=-128, V=-128)
dirtless = (show == true) ? dirtless.subtitle("removedirt-ed") : dirtless
clp = Conditionalfilter(maskd, clp, dirtless, "Ydifferencefromprevious()+Ydifferencetonext()", "greaterthan", string(th))
# scriptclip(maskd, "subtitle(string(Ydifferencefromprevious()+Ydifferencetonext()))")
return clp
}
function RemoveDirtCarefulMC(clip clp, int "th", bool "show", int "Vectors")
{
th = Default(th, 16)
show = Default(show, false)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirtCareful(clp, th=th, show=show)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:05
RemoveDirt functions continuos...
.
# =============================================================================
#
#
function RemoveDirtS(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
clensed = clp.Clense(grey=_grey, cache=4)
alt = clp.RemoveGrain(2)
clp = RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=4, cthreshold=6, gmthreshold=40, \
dist=1, dmode=2, debug=false, noise=limit, noisy=16, grey=_grey)
return clp
}
function RemoveDirtSMC(clip clp, int "limit", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirtS(clp, limit=limit, _grey=_grey)
dnc = RemoveTempGrain(clp, 1)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
dnc = (Vectors == 1) ? SelectEvery(dnc, 3, 1) : \
(Vectors == 2) ? SelectEvery(dnc, 5, 2) : \
SelectEvery(dnc, 7, 3)
clp = clp.SeeSaw(dnc, Sstr=0.26, Szp=12, SdampHi=20, bias=40)
return clp
}
function HQ_FilterS(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveDirtSMC(limit=6, Vectors=Vectors)
clp = clp.YlevelsS(0, 1.05, 255, 0, 255)
clp = clp.LimitedSharpenFaster(Smode=4, strength=18, overshoot=1, wide=false)
return clp
}
Jenyok
14th September 2012, 16:06
RemoveDust functions...
.
#
#
# File: RemoveDust.avsi
#
# RemoveDust and moution compensated RemoveDust functions
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveDustOld(clip clp, int "_mode", bool "_grey")
#
# function RemoveDustOldMC(clip clp, int "_smooth", bool "_grey")
#
# function RemoveDust(clip clp, int "_mode", bool "_grey")
# function RemoveDustMC(clip clp, int "mode", bool "_grey", int "Vectors")
#
# function RemoveDust2(clip clp, int "repmode", int "_smooth", bool "_grey")
# function RemoveDustMC2(clip clp, int "mode", int "smooth", bool "_grey", int "Vectors")
#
# function RemoveDust3(clip clp, int "repmode", int "TRsmooth", int "RGmode", int "RGmodeChroma", bool "_grey")
# function RemoveDustMC3(clip clp, int "mode", int "smooth", int "RGmode", int "RGmodeChroma", bool "_grey", int "Vectors")
#
# function LRemoveDust_YUY2(clip clp, int "clmode", int "limit")
# function LRemoveDust_YUY2MC(clip clp, int "mode", int "limit", int "Vectors")
#
# function LRemoveDust_YV12(clip clp, int "clmode", int "limit")
# function LRemoveDust_YV12MC(clip clp, int "mode", int "limit", int "Vectors")
#
# function LRemoveDust(clip clp, int "_mode", int "limit")
# function LRemoveDustMC(clip clp, int "mode", int "limit", int "Vectors")
#
# function RemoveDustDirt(clip clp, int "repmode", int "clmode", int "limitY", int "limitUV")
# function RemoveDustDirtMC(clip clp, int "mode", int "clmode", int "limitY", int "limitUV", int "Vectors")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\ssetools.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
function NullClip(clip clp)
{
return BlankClip(clp, length=0)
}
# =============================================================================
#
#
function RemoveDustOld(clip clp, int "_mode", bool "_grey")
{
_grey = Default(_grey, false)
_mode = Default(_mode, 5)
repmode = 2
_modeU = (_grey) ? -1 : repmode
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=_modeU)
clp = RemoveGrain(rep, mode=_mode, modeU=_modeU)
return clp
}
# =============================================================================
#
#
function RemoveDustOldMC(clip clp, int "_smooth", bool "_grey")
{
_smooth = Default(_smooth, 0)
_grey = Default(_grey, false)
repmode = 2
clmode = 4
quad = Quadruple(clp, grey=_grey) # each pixel is quadrupled, SSETools are needed
qpel = RemoveGrain(quad, mode=12, modeU=-1) # blur the luma for searching motion vectors
super = MSuper(qpel, pel=2, sharp=2)
bvec1 = MAnalyse(super, isb=true, blksize=8, delta=1, overlap=4, truemotion=true, lambda=200)
fvec1 = MAnalyse(super, isb=false, blksize=8, delta=1, overlap=4, truemotion=true, lambda=200)
backw1 = MCompensate(quad, super, bvec1)
forw1 = MCompensate(quad, super, fvec1)
clensed = Clense(quad, backw1, forw1, grey=_grey).shrinkby2(grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=clmode, modeU=(_grey) ? -1 : clmode)
clp = TemporalRepair(rg, rep, grey=_grey, smooth=_smooth)
return clp
}
# =============================================================================
#
#
function RemoveDust(clip clp, int "_mode", bool "_grey")
{
_grey = Default(_grey, false)
_mode = Default(_mode, 5)
_smooth = 0
repmode = 2
_modeU = (_grey) ? -1 : repmode
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=_modeU )
rg = RemoveGrain(rep, mode=_mode, modeU=_modeU)
clp = TemporalRepair(rg, rep, grey=_grey, smooth=_smooth)
return clp
}
function RemoveDustMC(clip clp, int "mode", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
mode = Default(mode, 5)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDust(clp, _mode=mode, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDust2(clip clp, int "repmode", int "_smooth", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 16)
_smooth = Default(_smooth, 0)
clmode = 4
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=clmode, modeU=(_grey) ? -1 : clmode)
clp = TemporalRepair(rg, rep, grey=_grey, smooth=_smooth)
return clp
}
function RemoveDustMC2(clip clp, int "mode", int "smooth", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
mode = Default(mode, 16)
smooth = Default(smooth, 0)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDust2(clp, repmode=mode, _smooth=smooth, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDust3(clip clp, int "repmode", int "TRsmooth", int "RGmode", int "RGmodeChroma", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 9)
TRsmooth = Default(TRsmooth, 0)
RGmode = Default(RGmode, 2) # 1, 2, 5, 17, 18
RGmodeChroma = Default(RGmodeChroma, 1) # 1, 2, 5, 17, 18
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=RGmode, modeU=(_grey) ? -1 : RGmodeChroma, modeV=(_grey) ? -1 : RGmodeChroma)
clp = TemporalRepair(rg, rep, grey=_grey, smooth=TRsmooth)
return clp
}
function RemoveDustMC3(clip clp, int "mode", int "smooth", int "RGmode", int "RGmodeChroma", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
mode = Default(mode, 9)
smooth = Default(smooth, 0)
RGmode = Default(RGmode, 2) # 1, 2, 5, 17, 18
RGmodeChroma = Default(RGmodeChroma, 1) # 1, 2, 5, 17, 18
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDust3(clp, repmode=mode, TRsmooth=smooth, RGmode=RGmode, RGmodeChroma=RGmodeChroma, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:07
RemoveDust functions continuos...
.
# =============================================================================
#
#
function LRemoveDust_YUY2(clip clp, int "clmode", int "limit")
{
clmode = Default(clmode, 17)
limit = Default(limit, 2)
repmode = 2
clensed = Clense(clp, grey=true)
rep = Repair(clensed, clp, mode=repmode, modeU=-1)
rg = RemoveGrain(rep, mode=clmode, modeU=-1)
clp = LimitChange(rg, clp, limit, limitU=255)
return clp
}
function LRemoveDust_YUY2MC(clip clp, int "mode", int "limit", int "Vectors")
{
mode = Default(mode, 17)
limit = Default(limit, 2)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = LRemoveDust_YUY2(clp, clmode=mode, limit=limit)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function LRemoveDust_YV12(clip clp, int "clmode", int "limit")
{
clmode = Default(clmode, 17)
limit = Default(limit, 2)
repmode = 2
clensed = Clense(clp)
rep = Repair(clensed, clp, mode=repmode)
rg = RemoveGrain(rep, mode=clmode)
clp = LimitChange(rg, clp, limit)
return clp
}
function LRemoveDust_YV12MC(clip clp, int "mode", int "limit", int "Vectors")
{
mode = Default(mode, 17)
limit = Default(limit, 2)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = LRemoveDust_YV12(clp, clmode=mode, limit=limit)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function LRemoveDust(clip clp, int "_mode", int "limit")
{
_mode = Default(_mode, 2)
limit = Default(limit, 4)
repmode = 2
LL = string(limit)
STR = "x " + LL + " + y < y " + LL + " - x " + LL + " - y > y " + LL + " + x ? ?"
clensed = Clense(clp)
rep = Repair(clensed, clp, mode=repmode)
rg = RemoveGrain(rep, mode=_mode)
trep = TemporalRepair(rg, rep)
trep2 = isyuy2(clp) ? trep.ConvertToYV12() : trep
input2 = isyuy2(clp) ? clp.ConvertToYV12() : clp
clp = (limit != 0) ? yv12lutxy(trep2, input2, yexpr=STR, U=2, V=2) : clp
clp = isyuy2(clp) ? clp.ConvertToYUY2().MergeChroma(trep) : clp
return clp
}
function LRemoveDustMC(clip clp, int "mode", int "limit", int "Vectors")
{
mode = Default(mode, 2)
limit = Default(limit, 4)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = LRemoveDust(clp, _mode=mode, limit=limit)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDustDirt(clip clp, int "repmode", int "clmode", int "limitY", int "limitUV")
{
repmode = Default(repmode, 16)
clmode = Default(clmode, 5)
limitY = Default(limitY, 5)
limitUV = Default(limitUV, 255)
clensed = Clense(clp)
repaired = Repair(clensed, clp, mode=repmode)
degrained = RemoveGrain(repaired, mode=clmode)
clp = mt_lutxy(degrained, clp, \
expr="x y - abs " + string(limitUV + 1) + " < x x y - 128 + 128 < y " + string(limitUV) + " - y " + string(limitUV) + " + ? ?", \
yexpr="x y - abs " + string(limity + 1) + " < x x y - 128 + 128 < y " + string(limity) + " - y " + string(limity) + " + ? ?", \
Y=3, U=3, V=3)
return clp
}
function RemoveDustDirtMC(clip clp, int "mode", int "clmode", int "limitY", int "limitUV", int "Vectors")
{
mode = Default(mode, 16)
clmode = Default(clmode, 5)
limitY = Default(limitY, 5)
limitUV = Default(limitUV, 255)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDustDirt(clp, repmode=mode, clmode=clmode, limitY=limitY, limitUV=limitUV)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:09
RemoveNoise functions...
.
#
#
# File: RemoveNoise.avsi
#
# Moution compensated RemoveNoise and variuos filters functions, used RemoveNoise
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", bool "_grey", int "Vectors")
#
# function HQ_Filter(clip clp, int "Vectors")
# function MQ_Filter(clip clp, int "Vectors")
# function LQ_Filter(clip clp, int "Vectors")
#
# function RemoveNoise_HQMC(clip clp, int "tlimit", int "rgrain", float "csharp", int "Vectors")
# function HQ_Filter2(clip clp, int "Vectors")
#
# function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", bool "_grey", int "Vectors")
#
# function VLQ_Filter(clip clp, int "Vectors")
# function VLQ_Filter_Ultimate(clip clp, int "Vectors")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\ZZZ_OLD\DEEN_25_DLL_20030813\deen.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEBLOCK_25_DLL_20060214\deblock.dll")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_LIMITEDSHARPENFASTER\limitedsharpenfaster.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SEESAW\seesaw.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.avsi")
function NullClip(clip clp)
{
return BlankClip(clp, length=0)
}
# =============================================================================
#
#
function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", \
bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
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)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
csharpen = (sharp) ? csharpen : csharpen + 0.08
_dgr = 0.45 + rgrain * 0.4
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
super = MSuper(clp, pel=2, sharp=csh)
bvec3 = MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
bvec2 = MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec2 = MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec3 = MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
backw3 = ((Vectors == 3) && (rdlimit > 13)) ? ((Vectors == 3) && (rdlimit > 20)) ? \
MFlow(clp, super, bvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec3).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = ((Vectors >= 2) && (rdlimit > 13)) ? ((Vectors >= 2) && (rdlimit > 20)) ? \
MFlow(clp, super, bvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec2).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, bvec1)
forw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, fvec1)
forw2 = ((Vectors >= 2) && (rdlimit > 13)) ? ((Vectors >= 2) && (rdlimit > 20)) ? \
MFlow(clp, super, fvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec2).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = ((Vectors == 3) && (rdlimit > 13)) ? ((Vectors == 3) && (rdlimit > 20)) ? \
MFlow(clp, super, fvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec3).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt2(clp, limit=rdlimit, rgrain=rgrain, _grey=_grey)
dnc = RemoveTempGrain(clp, rgrain)
dnc = (Vectors == 1) ? SelectEvery(dnc, 3, 1) : \
(Vectors == 2) ? SelectEvery(dnc, 5, 2) : \
SelectEvery(dnc, 7, 3)
dnc = (denoise == 0) ? dnc : NullClip(clp)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
dnc = (denoise == 0) ? dnc : MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, \
thSAD=190 + 15 * denoise, 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
}
# for slight noisy video or spot/dirt removing only
#
function HQ_Filter(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=6, rgrain=1, denoise=0, Vectors=Vectors)
clp = clp.LimitedSharpenFaster(Smode=4, strength=18, overshoot=0, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# medium noise, higher grain:
#
function MQ_Filter(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=10, rgrain=2, denoise=8, Vectors=Vectors)
clp = clp.LimitedSharpenFaster(Smode=4, strength=20, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# high noise or analog capture:
#
function LQ_Filter(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=18, rgrain=3, denoise=14, Vectors=Vectors)
clp = clp.VagueDenoiser(threshold=0.6, nsteps=6, chromaT=0.6, percent=75)
clp = clp.deen("a3d", rad=3, thrY=3, thrUV=5, min=0.25, tthY=2, tthUV=3, scd=6)
clp = clp.LimitedSharpenFaster(Smode=4, strength=24, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# =============================================================================
#
#
function RemoveNoise_HQMC(clip clp, int "tlimit", int "rgrain", float "csharp", int "Vectors")
{
tlimit = Default(tlimit, 4)
rgrain = Default(rgrain, 1)
csharp = (rgrain > 1) ? Default(csharp, 0.14) : Default(csharp, 0.13)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
cbs = 4
ccf = cbs * cbs / 64
cpn = (tlimit > 6) ? 70 * ccf : 75 * ccf
super = MSuper(clp, pel=2, sharp=1)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
dnc = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
dnc = RemoveDirt_HQ(dnc, tlimit, rgrain)
dnc = (Vectors == 1) ? SelectEvery(dnc, 3, 1) : \
(Vectors == 2) ? SelectEvery(dnc, 5, 2) : \
SelectEvery(dnc, 7, 3)
clp = (csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40)
return dnc
}
function HQ_Filter2(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC_HQ(tlimit=4, rgrain=1, Vectors=Vectors)
clp = clp.LimitedSharpenFaster(Smode=4, strength=15, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
Jenyok
14th September 2012, 16:09
RemoveNoise functions continuos...
.
# =============================================================================
#
#
function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", \
bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 24)
rgrain = Default(rgrain, 3)
denoise = Default(denoise, 15)
csharp = (rgrain > 2) ? Default(csharp, 0.32) : Default(csharp, 0.28)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
_dgr = 0.7 + rgrain * 0.5
cbs = 8
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : 57 * ccf
super = MSuper(clp, pel=2, sharp=0)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
backw3 = ((Vectors == 3) && (rdlimit > 20)) ? MFlow(clp, super, bvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors == 3) ? MFlow(clp, super, bvec3).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
backw2 = ((Vectors >= 2) && (rdlimit > 20)) ? MFlow(clp, super, bvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors >= 2) ? MFlow(clp, super, bvec2).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
backw1 = (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw1 = (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw2 = ((Vectors >= 2) && (rdlimit > 20)) ? MFlow(clp, super, fvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors >= 2) ? MFlow(clp, super, fvec2).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
forw3 = ((Vectors == 3) && (rdlimit > 20)) ? MFlow(clp, super, fvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors == 3) ? MFlow(clp, super, fvec3).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt2(clp, limit=rdlimit, rgrain=rgrain, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
dnc = MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, thSAD=160 + 12 * denoise, \
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")
clp = ((csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40))
return clp
}
function VLQ_Filter(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, csharp=0.3, Vectors=Vectors)
clp = clp.VagueDenoiser(threshold=1.0, nsteps=6, chromaT=1.2, percent=75)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
clp = clp.LimitedSharpenFaster(Smode=4, strength=28, overshoot=1, wide=false, ss_x=1.2, ss_y=1.2)
return clp
}
function VLQ_Filter_Ultimate(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, csharp=0.48, Vectors=Vectors)
clp = clp.fft3dfilter(sigma=1.2, sharpen=0.4, plane=4)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
return clp
}
Jenyok
14th September 2012, 16:10
RemoveSpots functions...
.
#
#
# File: RemoveSpots.avsi
#
# RemoveSpots and moution compensated RemoveSpots functions
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveSpots(clip clp, int "limit", bool "_grey")
# function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
#
# function RemoveSpotsMC2(clip clp, int "type", bool "show", int "Vectors")
#
# function RemoveSpotsMC3(clip clp, int "Vectors", int "Show")
#
# function RemoveSpotsMC4(clip clp, int "Vectors", int "Show")
#
# function RemoveSpotsMC5(clip clp, int "Vectors", int "Show")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEFLICKER_25_DLL_20040816\deflicker.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DESPOT_3_6_1\despot.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V2_0A48\mt_masktools-25.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V1_5_8\masktools.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEPAN_20061128\depan.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEPAN_20061128\depanestimate.dll")
(_use_VDub_ == true) ? LoadVirtualDubPlugin("C:\PROGRAM FILES\VIRTUALDUB 1.9.11\PLUGINS\spotremover.vdf", "SpotRemover", 11) : NOP()
function NullClip(clip clp)
{
return BlankClip(clp, length=0)
}
# =============================================================================
#
#
function RemoveSpots(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 16)
clmode = 17
clensed = Clense(clp, grey=_grey, cache=4)
sbegin = ForwardClense(clp, grey=_grey, cache=-1)
send = BackwardClense(clp, grey=_grey, cache=-1)
alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=limit, modeU = _grey ? -1 : limit)
restore = Repair(clensed, clp, mode=limit, modeU = _grey ? -1 : limit)
clp = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return clp
}
function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 16)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveSpots(clp, limit=limit, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
# SpotRemover() function VirtualDub
#
function RemoveSpotsMC2(clip clp, int "type", bool "show", int "Vectors")
{
# Constant
#
TypeMax = 4
# Variables
#
type = Default(type, 1)
show = Default(show, false)
Vectors = Default(Vectors, 2)
type = (type < 1) ? 1 : (type > TypeMax) ? TypeMax : type
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
# create auxialiary smooth clip for easier motion detection
#
filter = clp.DeFlicker(noise=6).Blur(1.58)
# this is for internal use by MVtools functions. MVtools' version must be 2.0 or higher.
#
super = MSuper(clp, pel=2, sharp=2)
superfi = MSuper(filter, pel=2, sharp=2)
# calculate the motion vectors
#
bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, search=3, truemotion=true) : NullClip(clp)
bvec2 = MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, search=3, truemotion=true)
bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, search=3, truemotion=true)
fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, search=3, truemotion=true)
fvec2 = MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, search=3, truemotion=true)
fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, search=3, truemotion=true) : NullClip(clp)
# create 6 additional clips: two predicted backward and two predicted forward
#
backw3 = (Vectors == 3) ? MCompensate(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MCompensate(clp, super, bvec2) : NullClip(clp)
backw1 = MCompensate(clp, super, bvec1)
forw1 = MCompensate(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MCompensate(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MCompensate(clp, super, fvec3) : NullClip(clp)
# clpdeg = (Vectors <= 2) ? MDegrain2(clp, superfi, bvec1, fvec1, bvec2, fvec2, plane=4, thsad=400) : \
# MDegrain3(clp, superfi, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, plane=4, thsad=400)
clpdeg = clp
# combine the 5 frames (2 + 1 + 2), the central one undergoes the degrain filter
# combine the 3 frames (1 + 1 + 1), the central one undergoes the degrain filter
# combine the 7 frames (3 + 1 + 3), the central one undergoes the degrain filter
#
clp = (Vectors == 1) ? interleave(backw1, clpdeg, ff1) : \
(Vectors == 2) ? interleave(backw2, backw1, clpdeg, forw1, forw2) : \
interleave(backw3, backw2, backw1, clpdeg, forw1, forw2, forw3)
# run SpotRemover over each block of 5 (3, 7) frames
# removing spots only, no smoothing
# !!! change to DSD:0 to turn the debug mode off
# !!! change to DSD:1 to turn the debug mode on
#
# SSI - Smooth Strength Intensity
# SSC - Smooth Strength Color
# SKW - Smooth Kernel Width
# SLI - Smooth Locking level for Intensity
# SLC - Smooth Locking level for Color
# SLD - Smooth Locking Debug
# DLS - Detect Level for Spot detection
# DLC - Detect Level for Clearance
# DPC - Detect Perimeter Clearance
# DSF - Detect Spot Fullness factor
# DSD - Detect Spot Debug
# MTX - Motion Table X (columns)
# MTY - Motion Table Y (columns)
# MTL - Motion Table Level to flag cells
# MDX - Motion Distance X
# MDY - Motion Distance Y
# MIH - Motion Interrupted History
# CBR - Color BRightness
# CCO - Color COntrast
# CSA - Color SAturation
# CBA - Color Balance
# CSR - Color Shift Red
# CSB - Color Shift Blue
# FCI - Frame Control Interlaced
clp = clp.ConvertToRGB32()
clp = (type == 1) ? (show == false) ? \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:0 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "") : \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:1 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "") : clp
clp = (type == 2) ? (show == false) ? \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:15 DPC:14 DSF:1 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:15 DPC:14 DSF:1 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
clp = (type == 3) ? (show == false) ? \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
clp = (type == 4) ? (show == false) ? \
clp.SpotRemover( "SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
clp.SpotRemover( "SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
# clp = clp.ConvertBackToYUY2()
clp = clp.ConvertToYV12()
# discard extra frames, keep only the central one
#
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
# compensate for the SpotRemover lag. We will loose the last frame in the movie, but the audio will be in sync
#
# clp = clp.Trim(1, 0) # Maybe not needed
# enhance the contrast (optional)
#
# clp = clp.ColorYUV(gain_y=0, off_y=10, gamma_y=0, cont_y=80, cont_u=0, cont_v=0)
return clp
}
Jenyok
14th September 2012, 16:12
RemoveSpots functions continuos...
.
global Width2 = 768
global Height2 = 576
# =============================================================================
#
# DeSpot() function
#
function RemoveSpotsMC3(clip clp, int "Vectors", int "Show")
{
# Constants
#
_thSCD1 = 400
Vectors = Default(Vectors, 3)
Show = Default(Show, 0)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
filter = DeFlicker(clp, border=150, percent=70, lmin=5, lmax=240)
super = MSuper(clp, pel=2, sharp=2)
superfi = MSuper(filter, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, truemotion=true)
bvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, truemotion=true)
bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, truemotion=true)
fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, truemotion=true)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3, thSCD1=_thSCD1) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2, thSCD1=_thSCD1) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1, thSCD1=_thSCD1)
forw1 = MFlow(clp, super, fvec1, thSCD1=_thSCD1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2, thSCD1=_thSCD1) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3, thSCD1=_thSCD1) : NullClip(clp)
# clpdeg = (Vectors <= 2) ? MDegrain2(clp, superfi, bvec1, fvec1, bvec2, fvec2, plane=4, thsad=400) : \
# MDegrain3(clp, superfi, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, plane=4, thsad=400)
clpdeg = clp
clp = (Vectors == 1) ? Interleave(backw1, clpdeg, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clpdeg, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clpdeg, forw1, forw2, forw3)
clp = clp.Deflicker(percent=99, lag=5, scene=15, info=false)
# ==== большие черные пятна ====
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
# ==== большие белые пятна ====
clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0)
# ==== маленькие точки и пыль ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
# ==== Маленькие компактные пятна ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
# ==== линии, входящие в контакт с движением, избегите области движения ====
clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
# ====================================
clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
motpn=true, fitluma=true, mark_v=255)
clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
motpn=true, mark_v=255)
clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, mark_v=255)
clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
blur=2, ranked=true, interlaced=false, mark_v=255)
clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
show=Show, mark_v=255)
clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, mark_v=255)
clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
motpn=true, fitluma=true, blur=1, mark_v=255)
clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, \
blur=1, mark_v=255)
clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
# big black spots
# clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show, mark_v=255)
# thin white lines
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show, mark_v=255)
# thick hair lines (avoid real hair)
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show, mark_v=255)
# lines contacting motion, avoid motion areas
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show, mark_v=255)
# small dots and dust
# clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show, mark_v=255)
# Long horizontal scratches
# clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show, mark_v=255)
# Small compact spots
# clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show, mark_v=255)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:15
RemoveSpots functions continuos...
.
# =============================================================================
#
# DeSpot() function
#
function RemoveSpotsMC4(clip clp, int "Vectors", int "Show")
{
# Constants
#
_thSCD1 = 400
_ml = 100
Vectors = Default(Vectors, 1)
Show = Default(Show, 0)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
filter = FFT3Dfilter(clp, sigma=6, plane=4, bw=32, bh=32, ow=8, oh=8, bt=3)
super = MSuper(clp, pel=2, sharp=2)
superfi = MSuper(filter, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3, thSCD1=_thSCD1) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2, thSCD1=_thSCD1) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1, thSCD1=_thSCD1)
forw1 = MFlow(clp, super, fvec1, thSCD1=_thSCD1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2, thSCD1=_thSCD1) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3, thSCD1=_thSCD1) : NullClip(clp)
sadb = MMask(clp, bvec1, ml=_ml, gamma=1, kind=1, thSCD1=_thSCD1)
sadf = MMask(clp, fvec1, ml=_ml, gamma=1, kind=1, thSCD1=_thSCD1)
msadb = MT_Binarize(sadb, 20, upper=true)
msadf = MT_Binarize(sadf, 20, upper=true)
msad = MT_Logic(msadf, msadb, "or")
msad = MT_Expand(msad)
msadi = Interleave(msad, msad, msad)
clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
# ==== большие черные пятна ====
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== большие белые пятна ====
clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== толстые линии типа волос (избегают реальных волос) ====
clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=24, interlaced=false, median=false, p1=15, p2=13, \
pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== линии, входящие в контакт с движением, избегите области движения ====
clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== маленькие точки и пыль ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== Длинные горизонтальные затиры ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
pwidth=100, pheight=2, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== Маленькие компактные пятна ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
# ====================================
clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
motpn=true, fitluma=true, extmask=msadi)
clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
motpn=true, extmask=msadi)
clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, extmask=msadi)
clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, extmask=msadi)
clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, extmask=msadi)
clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
blur=2, ranked=true, interlaced=false, extmask=msadi)
clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
color=true, motpn=true, extmask=msadi)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
show=Show, extmask=msadi)
clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, \
extmask=msadi)
clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
motpn=true, fitluma=true, blur=1, extmask=msadi)
clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, \
extmask=msadi)
clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, blur=1, \
mark_v=255, extmask=msadi)
clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255, \
extmask=msadi)
# big black spots
# clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show, extmask=msadi)
# thin white lines
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show, extmask=msadi)
# thick hair lines (avoid real hair)
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show, extmask=msadi)
# lines contacting motion, avoid motion areas
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show, extmask=msadi)
# small dots and dust
# clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show, extmask=msadi)
# Long horizontal scratches
# clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show, extmask=msadi)
# Small compact spots
# clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show, extmask=msadi)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:15
RemoveSpots functions continuos...
.
# =============================================================================
#
# DeSpot() function
#
function RemoveSpotsMC5(clip clp, int "Vectors", int "Show")
{
Vectors = Default(Vectors, 1)
Show = Default(Show, 0)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
d = clp.DePanEstimate(trust=3, range=1)
clp = clp.DePanInterleave(data=d, prev=Vectors, next=Vectors)
# ==== большие черные пятна ====
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
# ==== большие белые пятна ====
clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0)
# ==== маленькие точки и пыль ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
# ==== Маленькие компактные пятна ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
# ==== линии, входящие в контакт с движением, избегите области движения ====
clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
# ====================================
clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
motpn=true, fitluma=true, mark_v=255)
clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
motpn=true, mark_v=255)
clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, mark_v=255)
clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
blur=2, ranked=true, interlaced=false, mark_v=255)
clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
show=Show)
clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
show=Show, mark_v=255)
clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, mark_v=255)
clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
motpn=true, fitluma=true, blur=1, mark_v=255)
clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, blur=1, \
mark_v=255)
clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
# big black spots
# clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show)
# thin white lines
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show)
# thick hair lines (avoid real hair)
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show)
# lines contacting motion, avoid motion areas
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show)
# small dots and dust
# clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show)
# Long horizontal scratches
# clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show)
# Small compact spots
# clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
johnmeyer
12th October 2012, 22:26
I posted an update to my version of VideoFred's script over in his newer film restoration thread:
Capturing and restoring old 8mm films - Newest version of my variation of Fred's Script (http://forum.doom9.org/showthread.php?p=1595606#post1595606)
juliuskarli
8th December 2012, 15:17
hey.
i am totally new with virtualdub and avisynth. but i want to try this scripts. has anybody a good walkthrough? or tutorials? i just want to put my digitalized 8mm films into this powerful tool.
thank you,
jules
videoFred
10th December 2012, 07:50
Hi Jules,
You are welcome here. :)
Please learn some Avisynth basics first, before using my script.
many greetings,
Fred.
juliuskarli
11th December 2012, 17:08
hey. thank you fred.
i just worked on the basics and can run the scripts via virtualdubmod. very nice!
just on the output i can`t get rid of this "dual screen" and the yellow text on it ... ?
where can i turn this off?
thank you very much
videoFred
13th December 2012, 09:10
Hi Jules,
:readfaq:
;)
Fred.
papcom
5th February 2013, 21:06
Big Thank You for Your Scripts and Your efforts.
I am new with AVISynth Scripts but have some experience with VirtualDub, I can run Your scripts but I always have the comparison mode dual window as the videoresult at the rendered output.
I did not find out how to change this in order that I have my 720 x 576 pixel output.
You wrote that one has to read the FAQ to find out about this item. But Where is the FAQ? In the package with Your scripts there are 3 helpfiles but no further FAQ.
Thank You for the hint.
fpp
5th February 2013, 21:13
Near the beginning of the script, where all the variables are declared, you must change the
result = ...
line and set the value according to what you want to see.
The different result values are described inside the script.
HTH,
Fred (the other one)
papcom
5th February 2013, 21:28
thank You @fpp - I have seen this line but I did not check the relation between e.g. "resultS2" und "result2" - Now it's clear, thanks a lot for the hint.
papcom
7th February 2013, 14:29
I tried these Scripts on 25p uncompressed video from frame synchronized Filmtransfer. It worked very well and gives quite
interesting results. I am not very well into Avysynth and programming but I understand partially what's going on.
Anyway I cannot find an easy solution when I want to mute out or add certain functions in the script. E.G. If I would like to "skip" the stabilizer oder if I would like to adapt the script for 1080P Video (1920x1080pixel). Or otherwise add a horizontal flip function, or adapt the script for 25 fps Output.
Is anybody willing to help me finding the appropriate changements in the script in order to achive my goals? Thank You very much.
juliuskarli
18th February 2013, 16:57
hey fred.
would it be possible to add (film)grain to the footage? is there a plugin for this? can you add it to your scripts?
it would be great to add a script line where a videofile with realgrain is located on your harddisk and is appending to the 8mm footage.
this would avoid and hide artefacts and add a little bit of history ;)
this would be so great fred :)
thnx jules
basil3w
18th March 2013, 16:25
Here's what I hope will wind up as a totally Noob question:
I wish to post-process some 8mm to avi files that I have captured and that are currently in raw form. When I was looking
for ideas for my capture machine I found examples of VideoFred's capture and process work,(Wow!). Working from there, I
finally tracked down this forum and the amazing work you people are doing. Long story short: I was familiar with
VirturalDubMod but decided to take Fred's advice and learn some AviSynth basics. After doing that I downloaded
VirturaFred's scripts and the bottom seemed to fall out...
I installed the folder per Fred's instructions, qued up a small .avi, edited the source clip line and gave the .avs file
a go in VDubMod. I immediately received an Avisynth Open Failure message:
LoadPlugin: unable to load "plugins/removegrain.dll" (C:\Fred\20Film_Restoring_vs_06_2012
\01_A_Film_Restoring_Frame_Interpolation.avs, line 132)
I tried the other scripts and got the same error in scripts b and c, but received a similar message for warpsharp.dll in
script d, (script e seemed to work just fine). I noticed that script d didn't contain removegrain.dll, so I went back to
script a and commented out the loadplugin line for removegrain.dll. I ran that and got the same error for removedirt.dll,
I commented that line out and received the same error for warpsharp.dll.....
The other plugins from the plugin subdirectory appear to be loading and fuctioning normally but not removegrain,
removedirt or warpsharp. (I've read that removedirt has a problematic history but no one has commented on this forum
regarding any problems the plugin included with Fred's script package).
I've scoured the web looking at the AviSynth and VDub FAQ's, troubleshooters and tutorials, I've Googled for similar
problems but no luck. I've uninstalled and removed and reinstalled Avisynth, VDubMod and Fred's download, run a good
registry cleaner, tried both AviSynth 2.58 and 2.6 and the avisynth.dll is in the System32 folder. My machine (Win XPPro) runs fine, virus free and no other problems.
I know you guys are busy solving real video processing problems, but I seem to have hit the wall. If anyone has had a
similar problem or has a suggestion, I'd really appreciate the help!
Thanks,
-George
StainlessS
18th March 2013, 16:41
RemoveGrain has dependency on MSVCR71.dll from Visual Studio Toolkit 3
I normally just copy a dll of that name into system32 (although MS advise is to have it in the
local directory of the program that requires it)
The one I normally use it 348,160 bytes in size, do a search on your 'Programs Files' folder, you are likely
to find many copies (of perhaps differing sizes) there.
EDIT: Removedirt has same dependency, although Warpsharp does not (leastwise not my version).
Also, some plugs require AVSRecursion.dll in System32, not sure if RemoveGrain et al is one of them (EDIT: No its not).
Not sure if used in Fred's script but, other filters (FFT3DFilter and dfttest) need fftw3.dll and libfftw3f-3.dll in System32,
they are actually the same dll but named differently.
basil3w
18th March 2013, 21:00
StainlesS-
Thanks so much for the quick reply! I checked on the MSVCR70.dll file and it IS in the system32 folder (344,064 bytes). The fftw3.dll is in Fred's scripts folder, the libfftw3-3 is not. I checked, but did not find AVSRecursion.dll file in System32.
I'm willing to re-format and reinstall Windows, but at this point I'm really not sure that is where the problem lies... I'll keep on trying!
Thanks again for your suggestion!
-George
StainlessS
18th March 2013, 21:19
MSVCR70.dll is I think from VS Dot Net 2002, not the correct one, ie MSVCR71.dll is required one.
from Docs/english/faq.htm
WarpSharp, Xsharpen, UnsharpMask, KenKunNR, KenKunNRT, UVTimingH, UVTimingV, LoadAviUtlInputPlugin, LoadAviUtlFilterPlugin, ConvertYUY2ToAviUtlYC, ConvertAviUtlYCToYUY2, EraseGhost, SearchGhost, EraseGhostV, SearchGhostV, Auto24FPS, AutoDeint, FrameCache, AVIEncodeVideo, LoadPluginEx (by our Japanese friend): Ported VirtualDub filters and AviUtl filters. Some documentation can be found [here]. You need to copy the [msvcp71.dll/msvcr71.dll] (Microsoft C Runtime Library, v7) to your windows system directory. [YV12, YUY2]
http://www.geocities.com/wilbertdijkhof/71.cab
EDIT: Leave MSVCR70.dll one alone, it is required for something else.
DO NOT REFORMAT, just need to sort out the requisite dll's.
johnmeyer
18th March 2013, 23:35
When you unzip the files from Fred's zip file, you must preserve all the paths in the Zip file.
As an alternative, you can modify the script to explicitly load each DLL (i.e., give the full disk/path).
As a third alternative, you can put all the DLLs into whatever folder you have designated as the default AVISynth folder.
basil3w
19th March 2013, 02:31
StainlessS-
You are the MAN! Thank You so very much! I sourced those msvcr_71 files and dropped them in the System32 folder and it was 'Off to the Races!'. Fred's script fired right up! I am very excited to be able to start my new learning process, (I apologize in advance for the 'new' questions I'm sure to have).
I truly appreciate what you did for me, you didn't have to stop what you were doing and do the research for a stranger, but you did -Thanks!
Now I'll spend a few hours learning...
-George
basil3w
19th March 2013, 02:43
JohnMeyer-
Thanks very much for your suggestions.
I did keep Fred's file structure intact.
I didn't think of absolute addressing (good idea!)
I did try putting removegrain.dll into the avisynth plugin subfolder but it still didn't seem to work.
This forum seems to be populated by a bunch of very knowledgeable (and friendly), members!
-George
StainlessS
19th March 2013, 12:46
basil3w,
See here for Depends.exe (part of an MS package) which shows you what dll's an executable has dependence
upon, its quite handy to have (normally comes with full VS).
Some plugins depend upon other C++ runtimes, eg VS 2005, 2008 & 2010 (no doubt 2012 in future)
and seem rarely to point out their dependency in docs.
http://support.microsoft.com/kb/198038
EDIT: Here is a link to the latest version, Vista+W7 compatible, + 64bit versions:
http://www.dependencywalker.com/ Get This one.
basil3w
20th March 2013, 04:35
StainlessS-
An excellent link, you treat me all too well!
Many Thanks,
-George
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.