View Full Version : MC noise removal script
Spuds
30th October 2007, 03:45
Well in an effort to first learn more about avisynth scripting capabilities and secondly to learn more about what you can do with mvtools I created a MC noise reduction script. Nothing really new here but I figured I'd post it since others may find it useful.
To use it you import it just like any other script and call it with its various parameters. To make it easy I have presets which set lots of things so you don't have to. You can use a preset plus override part of it by specifying the individual parameter as well.
Those more familiar with scripting and mvtools and some of other functions that I used, please let me know what mistakes I'm making since I'm trying to learn.
The basic calling syntax is: mc_spuds(frames=(1-4),strength=(1-6))
The higher the strength and frames the stronger the denoising effect. As you increase strength you change block size and overlap in mvanalyse and fft3dfilter, plus turn on pre and post processing. The settings are in the script.
A good starting place for a noisy capture is mc_spuds(frames=2,strength=3or4or5). You have to be insane to use frames=4,strength=6 but its there if you have the time. Use debug=1-7 to see some of the settings and masks being used. I use mc_spuds(frames=2,strength=3) on some pretty bad vhs clips with very good results.
The full syntax is a bit more complex :)
mc+spuds(clip clp, int "frames", int "strength", int "blocksize", int "overlap", int "thsad", int "dct", int "ml", bool "chro", bool "postprocess", bool "preprocess", bool "aggressive",int "debug",bool "edgeclean")
What the script does:
- optional pre process for motion vector detection (supersample and denoise for search)
- Gets the motion vectors
- For frames = 1 or 2 use the motion vectors to mvdegrain, for frames = 3 to 4 use the vectors to mvflow.
- Optional for frames 3-4 is to first mvdegrain as if frames = 1-2 then do an mvflow.
- create a motion mask for the new degrained frame
- apply removegrain to the motion mask
- apply limitedsharpenfaster to the inverse (static) mask
- compute an edgemask and dering
- optional post process
The pre process does some simple cleaning and up sizing of the clip to help with the motion vector calculation. The post process is a bit of a jumble of remove dirt and dust scripts which needs improvement and/or simplification but seems to work. With post I was really trying to limit what changed since at that point the clip been worked on quite a bit.
There are also various debug views (debug=1-5) I like 4 and 5 the most.
Script will be in the next post, give it a try, tell me whats not working and what would work better.
Spuds
30th October 2007, 03:47
Old script removed, get the latest here (http://www.rcboataholic.com/MC_Spuds.zip)
Chipstra
30th October 2007, 15:50
*Spuds:
- mt_masktools ------>> version ??
- removegrain ------>> version ??
- mvtools ------>> version ??
and where can I find the correct version?
error: mvanalyse does not have the named argument "sharp" - line 116
Spuds
30th October 2007, 16:56
I'll update the header in the script in a bit, but for now here is what you need to have installed to have this run.
required filters:
- mt_masktools -- version: 2.0.32 or later
code: http://manao4.free.fr/masktools-v2.0a32.zip
discussion: http://forum.doom9.org/showthread.php?t=98985
- removegrain -- version: 0.9 or later
code: http://www.removegrain.de.tf/
discussion: http://forum.doom9.org/showthread.php?s=&threadid=79751
- removedirt -- version 0.9 or later
code: http://www.removedirt.de.tf/
discussion: http://forum.doom9.org/showthread.php?s=&threadid=70856
- mvtools -- version: 1.8.4 or later
code: http://avisynth.org.ru/fizick.html
discussion: http://forum.doom9.org/showthread.php?t=84770
- limitedsharpenfaster -- in mt_masktools
- ff3dfilter -- version 2.1.1 or later
code: http://avisynth.org.ru/fizick.html
discussion: http://forum.doom9.org/showthread.php?t=85790
- ttempsmooth -- version: 0.8.4 or later
code: http://bengal.missouri.edu/~kes25c/
discussion: http://forum.doom9.org/showthread.php?t=77856
- deblock -- version 1.2 or later
code http://avisynth.org.ru/fizick.html
discussion: http://forum.doom9.org/showthread.php?t=110352
Didée
30th October 2007, 18:00
This definetly qualifies for the "complex script" category, congratulations. :)
Small bug found in line 78:
# make a mask based on the new motion vectors
idx = idx + 1 should be: global idx = idx + 1
Apart of that, I looked close if there are any "idx" mistakes in the script - could happen easily, with the multitude of different options and possible combinations. For a minute, I thought you trapped in with the "preprocess" thingy, then I saw you escaped with "supersample". Cheeese.
AFAICS, all idx usage seem to be correct.
But one last thing:
global idx = rand()Funny idea, but not really good, IMO. Do not randomize that. Even if it's unlikely, it might give idx collisions if someone combines your script with other MVTools-based functions. (Often a silent(!) collision without error message, only a sub-optimal endresult, that is.)
EuropeanMan
30th October 2007, 19:37
^ any ideas on the speeds for this?
i'll assume this simplifies things? -scriptwise...for example:
setmemmax...
dgdecode...
colormatrix...
deinterlacing...
cropping...
resizing...
mc_spuds(....)
that'll do the denoising plus sharpening? sort of like integrated imaging p?
Didée
30th October 2007, 20:06
Bug for frames=3|4:
To my understanding, the implementation for frames=3 and 4 is flawed. In a nutshell, it does not do temporal processing over +/- 3|4 frames, but only over +/-1 (when frames=3) or over +/-2 (when frames=4). Also, maskmotion/maskstatic cannot yield to the wished result in this case.
IF frames > 2:
1) clp2 is firstly created as a long interleaved sequence of MVFlow compensations. (For frames=1|2, at this stage MVDegrain1|2 is applied. For frames=3|4, it is not. Only the interleave is done.)
2) Next, f34_phase2 is called on the long interleaved clip. Here, new vectors are calculated on the long interleaved clip. This means that the already-compensated (by MVFlow) wing frames are searched once more against the original center frame. Then, MVDegrain1|2 is applied to the long interleaved clip.
3) Now, a new vector search is done to build maskmotion. Since the working clip is still the long interleaved clip (with already compensated, and now even denoised wing frames), there should be virtually no motion to be detected around the center frame: maskmotion becomes useless.
4) Lastly, the center frame is Select()'ed out of the long interleaved clip again.
Suggestions: (for frames=3|4)
- the steps 3) and 4) are swapped. You first have to Select() the center out of the interleave, and then build maskmotion.
- Step 1 would have to be split in step 1a and step 1b: First do a MVDegrain over 2 frames, then call flow() on that degrained clip, then MVDegrain once more.
(Or something similar ... doing such "long distance" processing by means of MVDegrain is tricky.)
However, the denoising power of this function is really good, already with frames=2. Good work!
^ any ideas on the speeds for this?
Pretty slow. That's impossible to avoid when doing advanced MVTools stuff. If you're interested in speed, rather stay with more simple filters.
Fizick
30th October 2007, 20:21
about frames=3.
It is quite possible that you will see MVdegrain3 soon...
;)
Didée
30th October 2007, 20:31
OT - if you're at it, maybe consider to give MVDegrain two thresholds: thSAD_low and thSAD_high. thSAD_high the same as thSAD is now, and thSAD_low defining a lower thresh, allowing for full averaging strength if block SAD is below that. (I.e. the way like ttempsmooth is working.)
Just an idea, if it's not too difficult to do.
Spuds
31st October 2007, 02:10
This definetly qualifies for the "complex script" category, congratulations :) I was quite impressed with what you could do with the scripting language in avisynth, pretty powerful. I did a couple of things that were not good "practice" but was trying to test out what I could do.
Small bug found in line 78: ah yes, thanks for catching that, i'll make the update. I'll also change the idx=rand initialization and use some number that should be safe like 25. That way its at least deterministic.
On your analysis of the frames 3-4, I think I understand what you are saying. I was looking for a way to integrate mvdegrain with mvflow and went a little off track. Its working but I'm not getting all of the benefit out of the cpu time ... let me work with your suggestions and see what I can come up with. Greatly appreciate the analysis.
However, the denoising power of this function is really good, already with frames=2. Good work! :thanks:
Spuds
2nd November 2007, 04:06
I've made some changes over the last couple of days, v0.2b has been posted in post number 2.
The changes are:
a couple of bug fixes with global idx as discussed above.
change with idx in the main function to increment in case mc_spuds was called more than once in the same script to ensure no collisions.
changed the pre filter noise function from remove grain to fft3dfilter to allow the noise vector prefilter to respect the chroma search flag.
changed the blocksize of smoothed mask noise filter (increased) so it was not as aggressive. Makes increasing of strength more linear (less of a jump between 3 and 4).
changed frames = 3 or 4 function to first do mvdegrain then mvflow and hold that flowed clip through mask and post functions.
fixed dct not being used on user input, only default was being used. Improved default selection values.
TheRyuu
2nd November 2007, 05:03
I get an error when trying to use strength=4-6 (4 through 6).
I forgot the exact wording.
Spuds
2nd November 2007, 15:56
Thats not much of a hint to go work on :)
Are you saying all other modes worked or those are the only ones you tested and you received an error?
The most obvious error that could get thrown is if the video is not in yv12 colorspace or if you are missing one of the required plugins. If you could post the error I can help a lot more.
For a vhs clip you should have something like this:
load_stdcall_plugin(plugin + "yadif.dll")
Import("mc_spuds.avs") # MC noise removal
AVISource("somevideo.avi")
ConvertToYV12(interlaced=true)
AssumebFF()
yadif(mode=1,order=-1)
mc_spuds(frames=2,strength=4,debug=0)
AssumebFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
Spuds
5th November 2007, 00:57
I updated post number 2 with rev 0.3 of the script. I had to change the code a bit to get proper results out of frames=3 or 4. Didee first pointed out the error in my logic and it took me some time to wrap my head around the basic issue.
Anyway I had to add an option to the frames =3 or =4 call and its called aggressive. MC_spuds(frames=3,strength=2,aggressive=true)
With aggressive off the script will first mvflow a clip, then apply fft3d and temporalsoften to the now long flowed clip, then pull out the denoised frame and use that frame back in the original clip sequence to generate the masks.
If you turn aggressive on it will first get motion vectors and process the clip with mvdegrain2, then get new motion vectors and do a mvflow on the mv denoised frame. That will then be temporalsoftened and then the center frame pulled back out and used in the original sequence and mv masks generated.
With aggressive on you can use a low strength such as 2 and get quite good denoising. I'll post some example clips with various calls in a bit.
Spuds
7th November 2007, 21:07
Some examples of what the script can do:
Original image vs mc_spuds(frames=1,strength=4)
http://img138.imageshack.us/img138/8395/frame1eq7.th.jpg (http://img138.imageshack.us/my.php?image=frame1eq7.jpg)
Original image vs mc_spuds(frames=2,strength=4)
http://img138.imageshack.us/img138/1526/frame2ue3.th.jpg (http://img138.imageshack.us/my.php?image=frame2ue3.jpg)
Original image vs mc_spuds(frames=3,strength=4)
http://img138.imageshack.us/img138/421/frames3vw6.th.jpg (http://img138.imageshack.us/my.php?image=frames3vw6.jpg)
Original image vs mc_spuds(frames=4,strength=4)
http://img138.imageshack.us/img138/9053/frames4cu2.th.jpg (http://img138.imageshack.us/my.php?image=frames4cu2.jpg)
Not 'clean' enough, then try aggressive=true with frames= 3 or 4
Original image vs mc_spuds(frames=3,strength=3,aggressive=true)
http://img138.imageshack.us/img138/3827/frames3aso2.th.jpg (http://img138.imageshack.us/my.php?image=frames3aso2.jpg)
insane processing with full frames and strength and aggressive.
Original image vs mc_spuds(frames=4,strength=6,aggressive=true)
http://img138.imageshack.us/img138/1723/frames46aaq7.th.jpg (http://img138.imageshack.us/my.php?image=frames46aaq7.jpg)
Example overrides, normally post process is set to false with strength=3, override like this
original vs mc_spuds(frames=3,strength=3,aggressive=true,postprocess=true)
http://img138.imageshack.us/img138/1019/frames33apptgw4.th.jpg (http://img138.imageshack.us/my.php?image=frames33apptgw4.jpg)
Or like this
original vs mc_spuds(frames=2,strength=3,postprocess=true)
http://img138.imageshack.us/img138/3631/frames23pptnc7.th.jpg (http://img138.imageshack.us/my.php?image=frames23pptnc7.jpg)
Adub
7th November 2007, 22:10
I have to say, I am impressed. That is a really crappy source, not just because of noise, but it looks like aliasing has some affect. Take a look at the white horse ring poles.
foxyshadis
8th November 2007, 01:09
Spuds, this is a cool filter =D But I was wondering, is there a way to work with the filter without the global blankclip? Because that seems to disable setmtmode when mc_spuds is used as an avsi. (Loaded before the script.)
tsp
8th November 2007, 18:07
foxyshadis: try moving it inside FUNCTION MC_Spuds.
As it is global it should work inside the other functions but are only evaluated when MC_spuds is actually used
Spuds
8th November 2007, 18:56
@foxyshadis: I updated the function to rev 0.3b, its in the second post of this thread. I removed the global nullclp and now set nullclp in the first function and pass it as need to the other sub functions. Let me know if this solves the issue you were having using it as an avsi and setmt.
Granted doing it this way there is a tiny overhead of setting the nullclp on each call to mc_spuds vs just once with global, but I don't think that will be noticed given all the calls to mvtools :rolleyes:
@Merlin7777 Thanks. Hard to believe, or maybe not, but that was a commercially produced video. Goes to show what low light, poor optics and wrong film choice can do for you.
salehin
8th November 2007, 19:10
Thanks a lot for your hard work and for sharing it with us :)
Seeing those screens, I'm motivated to try mc_spuds.avsi with some really old films (now on DVD) i got :)
Alain2
8th November 2007, 22:17
Result on your screenshots seems good, I will try your function when I've got the occasion :)
btw to improve the readability of the presets in your code, maybe you could do something like in the hybridFuPP (http://forum.doom9.org/showthread.php?t=92061&highlight=hybridfupp) script ?
# HybridFuPP 0.97a by FuPP
Function HybridFuPP(clip input, int "width", int "height", bool "Fast", bool "Dering", bool "Deblock", int "MP_Mode",
\ int "EM_Mode", int "DB_Q", int "DB_Off_a" , int "DB_Off_b", int "M_Thr", int "M_SCD", int "E_Thr",
\ int "D_Thr", int "B_Thr", int "Resizer", int "S_Str", int "T_Str", int "S_Radius", float "S_Dist",
\ int "C_Str", int "M_Str", int "E_Str_X", int "E_Str_Y", int "E_Str_B", int "LP_Str", int "DR_Str" ,
\ int "DR_Radius", string "show", string "N1", string "N2", string "M", string "E1", string "E2" ,
\ string "LP", string "DR", string "Preset", bool "Skin", int "Sp_Str", bool "ARAdjust", int "Skin_Type")
{
width = Default(width , width(input))
height = Default(height, height(input))
Preset = Default(Preset, "high")
Show = Default(Show , "")
preset_num = -1
preset_num = Preset == "medium" ? 0 : preset_num
preset_num = Preset == "high" ? 1 : preset_num
preset_num = Preset == "very high" ? 2 : preset_num
preset_num = Preset == "low" ? 3 : preset_num
preset_num = Preset == "very low" ? 4 : preset_num
preset_num = Preset == "anime1" ? 5 : preset_num
preset_num = Preset == "anime2" ? 6 : preset_num
preset_num = Preset == "HybridQ" ? 7 : preset_num
Assert(preset_num >=0 ? true : false, chr(10) + "This preset does not exist !" + chr(10))
_Resizer = Select(preset_num, 3 , 4 , 5 , 2 , 0 , 2 , 0 , 3 )
_Fast = Select(preset_num, true , true , true , true , true , true , true , true )
_S_Str = Select(preset_num, 10 , 5 , 7 , 12 , 12 , 7 , 20 , 12 )
_S_Radius = Select(preset_num, 1 , 1 , 1 , 1 , 1 , 1 , 2 , 1 )
_S_Dist = Select(preset_num, 0.1 , 0.1 , 0.1 , 0.1 , 0.1 , 0.1 , 0.1 , 0.1 )
_T_Str = Select(preset_num, 3 , 3 , 2 , 5 , 5 , 6 , 15 , 5 )
_C_Str = Select(preset_num, 14 , 14 , 14 , 14 , 14 , 15 , 15 , 14 )
_MP_Mode = Select(preset_num, 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 )
_M_Thr = Select(preset_num, 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 )
_M_SCD = Select(preset_num, 260 , 260 , 260 , 260 , 260 , 260 , 260 , 260 )
_M_Str = Select(preset_num, 120 , 120 , 80 , 120 , 120 , 0 , 60 , 120 )
_EM_Mode = Select(preset_num, 1 , 1 , 1 , 1 , 1 , 3 , 3 , 3 )
_E_Thr = Select(preset_num, 12 , 10 , 10 , 14 , 14 , 8 , 6 , 14 )
_E_Str_X = Select(preset_num, 0 , 0 , 0 , 0 , 0 , 46 , 46 , 1 )
_E_Str_Y = Select(preset_num, 0 , 0 , 0 , 0 , 0 , 46 , 46 , 0 )
_E_Str_B = Select(preset_num, 0 , 0 , 0 , 0 , 0 , -2 , -2 , 0 )
_Dering = Select(preset_num, false, false, false, false, false, true , false, false)
_DR_Radius = Select(preset_num, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 )
_DR_Str = Select(preset_num, 30 , 30 , 30 , 30 , 30 , 60 , 60 , 30 )
_D_Thr = Select(preset_num, 35 , 32 , 31 , 37 , 39 , 30 , 30 , 30 )
_B_Thr = Select(preset_num, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 )
_LP_Str = Select(preset_num, 30 , 30 , 30 , 30 , 30 , 40 , 40 , 30 )
_Deblock = Select(preset_num, false, false, false, false, false, false, false, false)
_DB_Q = Select(preset_num, 25 , 25 , 25 , 25 , 25 , 25 , 25 , 25 )
_DB_Off_a = Select(preset_num, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 )
_DB_Off_b = Select(preset_num, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 )
_Skin = Select(preset_num, false, false, false, false, false, false, false, true )
_SP_str = Select(preset_num, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 )
_ARAdjust = Select(preset_num, false, false, false, false, false, false, false, true )
_Skin_Type = Select(preset_num, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 )
Resizer = Default(Resizer, _Resizer)
Fast = Default(Fast, _Fast)
S_Str = Default(S_Str, _S_Str)
S_Radius = Default(S_Radius, _S_Radius)
S_Dist = Default(S_Dist, _S_Dist)
T_Str = Default(T_Str, _T_Str)
C_Str = Default(C_Str, _C_Str)
MP_Mode = Default(MP_Mode, _MP_Mode)
M_Thr = Default(M_Thr, _M_Thr)
M_SCD = Default(M_SCD, _M_SCD)
M_Str = Default(M_Str, _M_Str)
D_Thr = Default(D_Thr, _D_Thr)
B_Thr = Default(B_Thr, _B_Thr)
LP_Str = Default(LP_Str, _LP_Str)
[....]
Spuds
9th November 2007, 01:13
@Alain2 .. Thank you for the pointer to that script layout, very cool. I'll see what improvements I can make to the readability of the presets section.
I can't do exactly what he did since I'm allowing you to override a single part of a preset which allows you to take most of preset has and just tweak it vs start from ground zero and specify everything should you just want one change, like thsad for example.
Anyway it gives me some stuff to look into!
Alain2
9th November 2007, 01:36
Actually in fupp layout it is the same, you use
Preset = Default(Preset, "high")
to define a default preset, and this preset then select the value for each of the parameters, for instance the resizer:
_Resizer = Select(preset_num, 3 , 4 , 5 , 2 , 0 , 2 , 0 , 3 )
(note that it starts with _, so it's a different variable than the parameter Resizer from the function header)
And all these parameters are still overridable, as define after with the Default function, for instance for the resizer (_Resizer from preset is overriden by Resizer if it exists/is defined when calling the function)
Resizer = Default(Resizer, _Resizer)
Spuds
9th November 2007, 02:08
Doh! missed the _ on the variable :o Perhaps the occasional use of a comment would have helped me :D
Its certainly one approach to the problem but I think I'm going to leave this in the if-then-else format that I currently have. I'm going to go back and do better alignment of the lines to improve readability though.
I'm also intrigued with the string definitions for the functions in one place, makes for easy function changes, may take a shot at that as well.
Again thanks for the pointer, good stuff!
Spuds
12th November 2007, 03:05
Rev 0.4 posted.
I made some changes mostly aimed at speed. Even for a motion compensated script this was starting to crawl !
I did some benchmarking of functions for speed (function vs function and function vs parameters) to arrive at some new items in the script.
The major changes are:
1) changed resizer for the upsampled clip, used to help search for motion vectors. Was LanczosResize now BicubicResize, small speed increase
2) changed noise filter for pre-filtered clip, used to help search for motion vectors. Was fft3dfilter now removegrain + temporalrepair. Large speed increase. Made add config option to choose in the future if there is interest.
3) removed last call to ttempsmoothf, seemed redundant and that is a very slow function. Good speed increase.
4) Improved code readability
5) Improved debug views
6) Added additional lite edge cleaning via masking
7) Changed some of the block and overlap values in the presets to help with speed
Overall the speed increased 2-3X from where it was, still slow but now comparable to what you expect from a motion compensated noise script.
Let me know if you find any errors in the script or my logic.
Thanks
Zanejin
12th November 2007, 05:24
Be sure to add that Unfilter is a necessary filter and that the latest package of RemoveGrain (http://videoprocessing.11.forumer.com/viewtopic.php?p=593#593) should not be used with this script (except for SSETools, which is not in the pre-release (http://videoprocessing.11.forumer.com/viewtopic.php?t=9) package). Also, line 82 calls the function "inpand"; should it instead be "mt_inpand"?
Spuds
12th November 2007, 16:12
@Zanejin -- good catch on the mt_inpand(), thanks for that! ... I often find myself reading both the V1 anv V2 documentation for masktools since they both have good information. Kind of need to read V1 to understand the V2 sequel but that leads to my mt_ mistakes :)
I'll make the header update to show unfilter as a req, not sure what to do about the new release of removegrain, for now I just was more explicit via date code in the header of what I've tested.
Rev 0.4a posted
2Bdecided
22nd November 2007, 17:53
In addition to the filters you listed, I also had to grab unfilter from here:
http://avisynth.org/warpenterprises/
Is that right, or should it have come from somewhere else?
Cheers,
David.
DeathAngelBR
22nd November 2007, 21:23
Thought I should give an opinion on this filter: it rocks my socks!
Some screens (frame 17790) for comparison purpose.
Original:
http://img152.imageshack.us/img152/6694/17790001originalrj6.th.png (http://img152.imageshack.us/img152/6694/17790001originalrj6.png)
Denoise + sharpening script 1:
degrainmedian(mode=0)
degrainmedian(mode=3)
ttempsmooth()
fastlinedarkenmod(thinning=0, strength=25)
limitedsharpenfaster(ss_x=1.0, ss_y=1.0, smode=4, strength=20)
http://img444.imageshack.us/img444/3884/17790002lsfhs1.th.png (http://img444.imageshack.us/img444/3884/17790002lsfhs1.png)
Denoise + sharpening script 2:
fft3dfilter()
ttempsmooth()
fastlinedarkenmod(thinning=0, strength=25)
limitedsharpenfaster(ss_x=1.0, ss_y=1.0, smode=4, strength=20)
http://img152.imageshack.us/img152/2286/17790002fft3dka9.th.png (http://img152.imageshack.us/img152/2286/17790002fft3dka9.png)
Denoise + sharpening script 3:
mc_spuds(frames=2,strength=4)
ttempsmooth()
fastlinedarkenmod(thinning=0, strength=25)
limitedsharpenfaster(ss_x=1.0, ss_y=1.0, smode=4, strength=20)
http://img218.imageshack.us/img218/2517/17790002mcspudstr4wa6.th.png (http://img218.imageshack.us/img218/2517/17790002mcspudstr4wa6.png)
I don't even need to use LSF on this. Here's one without it.
http://img218.imageshack.us/img218/6307/17790003mcspudstr4nolsfhu7.th.png (http://img218.imageshack.us/img218/6307/17790003mcspudstr4nolsfhu7.png)
Fizick
22nd November 2007, 23:57
spuds,
why bicubic upsampled instead internal interpolation?
2Bdecided
23rd November 2007, 22:24
Is that version of RemoveDirt on-line anywhere? I have a copy (RemoveGrain 1.0.rar) already, but can't find anywhere for anyone else to grab it, which isn't very helpful.
Cheers,
David.
Reuf Toc
23rd November 2007, 23:40
The URL to get this plugin is in the script :)
RemoveDirt 0.9 (http://home.arcor.de/kassandro/RemoveDirt/RemoveDirt.zip)
ankurs
24th November 2007, 20:57
http://i10.tinypic.com/72prl35.jpg
??
also i only called it into my script and just used it as
mc_spuds(frames=3,strength=4)
my avisynth version is 2.5.8 latest update ..
P.S : everything required is there including all the versions of the filters you stated in your first post ..
Leak
24th November 2007, 22:56
P.S : everything required is there including all the versions of the filters you stated in your first post ..
So what dimensions does the video you're feeding into MC_Spuds have? Did you actually check if the error message might not, just for once, be right? If either it's width or height cannot be divided by 8 without a remainder it's not going to work...
np: Bola - AMNiON (Soup)
Spuds
25th November 2007, 00:14
I don't even need to use LSF on this. Here's one without it. The script makes use of LSF on the static parts of the frame after it does its initial denoising, you should not need to call it again. Glad you are enjoying the scripts results !
why bicubic upsampled instead internal interpolation? Thats a great question, wish I had a great answer :) ... I assume since I'm using pel=2 I could just use sharp=1 to get a pretty similar result. My intention was to utilize the b/c parameters of bicubic to explore their impact and see if anything of interest came out. Does mvtools do a straight b=c=1/3 bicubic for sharp=1 ?
mc_spuds(frames=3,strength=4) Just like Leak said the script checks to see if the clip size (Width & Height) is divisible by 8 before it will run. I should update the logic so it only throws that error when asking for a frames=3 or 4 since that invokes a call to deblock which is what needs mod8.
I have some small updates in the works, I'll post a new version in the next couple of weeks. I've got another notably bad videocam clip that I'm working on to help make further improvements, mostly edge enhancements.
DeathAngelBR
25th November 2007, 01:33
The script makes use of LSF on the static parts of the frame after it does its initial denoising, you should not need to call it again. Glad you are enjoying the scripts results !
Unfortunely I just found out it's causing a lot of blocking, and it blurs too much the next frame, even lowering the strength value. Other than that it could have been the perfect denoiser IMO.
The blocking seems to be common among filters using mvanalyse or any mvtools thing.
Spuds
25th November 2007, 05:25
Do you have an example video clip you could post and a still shot of the issue? I'd like to see if it could be avoided.
Blocking to my understanding is an artifact caused by video compression. If you are getting it after you compress the scripts output then we might be able to do a couple of things to the to help avoid that (trick the compression engine to allocate more bandwidth into the sections that are blocking).
DeathAngelBR
25th November 2007, 06:52
All of those appear while seeking in virtualdub.
setmemorymax(768)
movie = DGDecode_mpeg2source("G:\Gundam Wing - Endless Waltz\VTS_01_1.d2v",cpu=4,info=3)
movied2v = "G:\Gundam Wing - Endless Waltz\VTS_01_1.d2v"
movie = tfm(movie,d2v=movied2v,order=1).tdecimate(mode=1)
movie = ColorMatrix(movie,hints=true)
last = movie
crop( 4, 0, -4, 0)
Lanczos4Resize(640,480)
mc_spuds(frames=2, strength=2)
Frame 1412 blured.
http://img267.imageshack.us/img267/9287/1412blurkp5.th.png (http://img267.imageshack.us/img267/9287/1412blurkp5.png)
Frame 1413 NOT blured.
http://img204.imageshack.us/img204/2973/1413normalvx8.th.png (http://img204.imageshack.us/img204/2973/1413normalvx8.png)
Frame 1438 blured.
http://img204.imageshack.us/img204/3708/1438blurhq5.th.png (http://img204.imageshack.us/img204/3708/1438blurhq5.png)
Frame 1439 NOT blured.
http://img211.imageshack.us/img211/4908/1439normalhl1.th.png (http://img211.imageshack.us/img211/4908/1439normalhl1.png)
Blocks on frame 1459.
http://img211.imageshack.us/img211/6397/1459blockshr1.th.png (http://img211.imageshack.us/img211/6397/1459blockshr1.png)
Will post an uncompressed vid as soon as I can.
ankurs
25th November 2007, 10:34
So what dimensions does the video you're feeding into MC_Spuds have? Did you actually check if the error message might not, just for once, be right? If either it's width or height cannot be divided by 8 without a remainder it's not going to work...
np: Bola - AMNiON (Soup)
my source is 720x576 ..
also it isnt woking on a 720x480 source .. also i am tryin to get this one to 640x272 ..
foxyshadis
25th November 2007, 10:42
my source is 720x576 ..
also it isnt woking on a 720x480 source .. also i am tryin to get this one to 640x272 ..
You're absolutely sure you have no cropping or resizing beforehand? Replace mc_spuds with Info() to verify. If it's the case, post your full script.
Terranigma
25th November 2007, 15:45
The blocking seems to be common among filters using mvanalyse or any mvtools thing.
LSF doesn't cause blocking. If your source has blocks, it'd just pronounce it. Your analysis here is correct though, and this script allows you to avoid it by increasing the overlap value. That's one of the reasons why it was added (Although it'd give you better denoising as well.) Try using a blocksize of 8, and overlapping value of 8/2, or 16 16/2, or 4 4/2. Though if you do decide to do this, expect the processing speed to drop tremendously.
DeathAngelBR
25th November 2007, 17:05
Try using a blocksize of 8, and overlapping value of 8/2, or 16 16/2, or 4 4/2. Though if you do decide to do this, expect the processing speed to drop tremendously.
That didn't work. There's still a *lot* of blocking and bluring. :(
Spuds
25th November 2007, 17:08
@DeathAngelBR -- Thanks for the examples, good stuff to work on, look forward to the video clip link so I can do some checking. I'm curious on the blurred frames if they are like that straight from tfm.tdecimate or not.
On the blocking as Terranigma pointed out you can override the default blocksize and overlap to try and deal with them, but be prepared to board the speed pain train :eek: I do have a couple of script ideas I'd like to try out on them to see if they would be effective or not. I'll get to trying those when I get the clip :)
Terranigma
25th November 2007, 17:14
Will post an uncompressed vid as soon as I can.
Well, i'll be waiting for the sample. :)
DeathAngelBR
25th November 2007, 20:06
http://www.sendspace.com/file/06xiuy
(134MB)
I don't know how to split it into smaller VOBs, so if any of you knows a software to do this I'm all ears.
:thanks:
Terranigma
25th November 2007, 21:25
Downloaded and tested on the exact same frame as you did (after forcing film since it's 95% film.)
Original:
http://img405.imageshack.us/img405/683/originalvu9.png
MC_Spuds Default:
http://img233.imageshack.us/img233/6813/mcspudssv7.png
MC_Spuds, my suggestion (mc_spuds(blocksize=8,overlap=8/2)):
http://img233.imageshack.us/img233/694/overlapfv9.png
So it's obvious that you weren't doing what I said correctly. :D
DeathAngelBR
25th November 2007, 21:57
Downloaded and tested on the exact same frame as you did (after forcing film since it's 95% film.)
Original:
http://img405.imageshack.us/img405/683/originalvu9.png
MC_Spuds Default:
http://img233.imageshack.us/img233/6813/mcspudssv7.png
MC_Spuds, my suggestion (mc_spuds(blocksize=8,overlap=8/2)):
http://img233.imageshack.us/img233/694/overlapfv9.png
So it's obvious that you weren't doing what I said correctly. :D
What about the frames 1459 and 1603 that have blocks all over?
Also there's this transition from blury frame to better, sharpened looking frame:
Blury:
http://img441.imageshack.us/img441/350/1313blurmk1.png
NOT blury:
http://img441.imageshack.us/img441/108/1314normalva8.png
Terranigma
25th November 2007, 22:01
What about the frames 1459 and 1603 that have blocks all over?
Well I just tried the one frame.
I deleted your sample, so i'll redownload and try it once more for the other troubled frames.
Vesi
25th November 2007, 23:17
any idea, why i get error. there is no function "unfilter" when i load my script with avsp
Terranigma
25th November 2007, 23:18
What about the frames 1459 and 1603 that have blocks all over?
mc_spuds(blocksize=8,overlap=8/2)
Frame 1459:
http://img223.imageshack.us/img223/7844/frame1459zz2.png
Frame 1603:
http://img223.imageshack.us/img223/6050/frame1603vi2.png
Also there's this transition from blury frame to better, sharpened looking frame:
Blury:
http://img441.imageshack.us/img441/350/1313blurmk1.png
NOT blury:
http://img441.imageshack.us/img441/108/1314normalva8.png
Your concerns about this qualm is a valid one, as I too noticed the transition from sharp to blurry.
mcspuds (Frame 1313):
http://img443.imageshack.us/img443/2184/frame1313spudscl2.png
mcspuds (Frame 1314):
http://img142.imageshack.us/img142/6628/frame1314spudslc6.png
s.w.t. + linedarken (Frame 1313):
http://img118.imageshack.us/img118/231/frame1313urlsdhc5.png
s.w.t. + linedarken (Frame 1314):
http://img510.imageshack.us/img510/60/frame1314urlsdeg2.png
s.w.t. (Frame 1313):
http://img510.imageshack.us/img510/378/frame1313urlsd2sh5.png
s.w.t. (Frame 1314):
http://img111.imageshack.us/img111/3381/frame1314urlsd2ku7.png
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.