Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th November 2007, 22:17   #21  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
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 script ?
Code:
# 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)

[....]
Alain2 is offline   Reply With Quote
Old 9th November 2007, 01:13   #22  |  Link
Spuds
dumber every day
 
Spuds's Avatar
 
Join Date: Dec 2006
Location: Planet Earth
Posts: 154
@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!
Spuds is offline   Reply With Quote
Old 9th November 2007, 01:36   #23  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
Actually in fupp layout it is the same, you use
Code:
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:
Code:
_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)
Code:
Resizer    = Default(Resizer, _Resizer)
Alain2 is offline   Reply With Quote
Old 9th November 2007, 02:08   #24  |  Link
Spuds
dumber every day
 
Spuds's Avatar
 
Join Date: Dec 2006
Location: Planet Earth
Posts: 154
Doh! missed the _ on the variable Perhaps the occasional use of a comment would have helped me

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 is offline   Reply With Quote
Old 12th November 2007, 03:05   #25  |  Link
Spuds
dumber every day
 
Spuds's Avatar
 
Join Date: Dec 2006
Location: Planet Earth
Posts: 154
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
Spuds is offline   Reply With Quote
Old 12th November 2007, 05:24   #26  |  Link
Zanejin
Registered User
 
Zanejin's Avatar
 
Join Date: Jan 2007
Posts: 24
Be sure to add that Unfilter is a necessary filter and that the latest package of RemoveGrain should not be used with this script (except for SSETools, which is not in the pre-release package). Also, line 82 calls the function "inpand"; should it instead be "mt_inpand"?

Last edited by Zanejin; 12th November 2007 at 06:05.
Zanejin is offline   Reply With Quote
Old 12th November 2007, 16:12   #27  |  Link
Spuds
dumber every day
 
Spuds's Avatar
 
Join Date: Dec 2006
Location: Planet Earth
Posts: 154
@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
Spuds is offline   Reply With Quote
Old 22nd November 2007, 17:53   #28  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: UK
Posts: 1,673
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.
2Bdecided is offline   Reply With Quote
Old 22nd November 2007, 21:23   #29  |  Link
DeathAngelBR
Registered User
 
Join Date: Nov 2006
Location: Brazil
Posts: 83
Thought I should give an opinion on this filter: it rocks my socks!

Some screens (frame 17790) for comparison purpose.

Original:


Denoise + sharpening script 1:
Code:
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)


Denoise + sharpening script 2:
Code:
fft3dfilter()
ttempsmooth()
fastlinedarkenmod(thinning=0, strength=25)
limitedsharpenfaster(ss_x=1.0, ss_y=1.0, smode=4, strength=20)


Denoise + sharpening script 3:
Code:
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)


I don't even need to use LSF on this. Here's one without it.
DeathAngelBR is offline   Reply With Quote
Old 22nd November 2007, 23:57   #30  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,182
spuds,
why bicubic upsampled instead internal interpolation?
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 23rd November 2007, 22:24   #31  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: UK
Posts: 1,673
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.
2Bdecided is offline   Reply With Quote
Old 23rd November 2007, 23:40   #32  |  Link
Reuf Toc
Registered User
 
Join Date: Feb 2007
Posts: 65
The URL to get this plugin is in the script

RemoveDirt 0.9
Reuf Toc is offline   Reply With Quote
Old 24th November 2007, 20:57   #33  |  Link
ankurs
N00B !
 
Join Date: Jun 2006
Posts: 223


??

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 ..
ankurs is offline   Reply With Quote
Old 24th November 2007, 22:56   #34  |  Link
Leak
ffdshow/AviSynth wrangler
 
Leak's Avatar
 
Join Date: Feb 2003
Location: Austria
Posts: 2,441
Quote:
Originally Posted by ankurs View Post
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)
__________________
now playing: [artist] - [track] ([album])
Leak is offline   Reply With Quote
Old 25th November 2007, 00:14   #35  |  Link
Spuds
dumber every day
 
Spuds's Avatar
 
Join Date: Dec 2006
Location: Planet Earth
Posts: 154
Quote:
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 !

Quote:
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 ?

Quote:
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.
Spuds is offline   Reply With Quote
Old 25th November 2007, 01:33   #36  |  Link
DeathAngelBR
Registered User
 
Join Date: Nov 2006
Location: Brazil
Posts: 83
Quote:
Originally Posted by Spuds View Post
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.
DeathAngelBR is offline   Reply With Quote
Old 25th November 2007, 05:25   #37  |  Link
Spuds
dumber every day
 
Spuds's Avatar
 
Join Date: Dec 2006
Location: Planet Earth
Posts: 154
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).
Spuds is offline   Reply With Quote
Old 25th November 2007, 06:52   #38  |  Link
DeathAngelBR
Registered User
 
Join Date: Nov 2006
Location: Brazil
Posts: 83
All of those appear while seeking in virtualdub.

Code:
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.


Frame 1413 NOT blured.


Frame 1438 blured.


Frame 1439 NOT blured.


Blocks on frame 1459.


Will post an uncompressed vid as soon as I can.
DeathAngelBR is offline   Reply With Quote
Old 25th November 2007, 10:34   #39  |  Link
ankurs
N00B !
 
Join Date: Jun 2006
Posts: 223
Quote:
Originally Posted by Leak View 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)
my source is 720x576 ..
also it isnt woking on a 720x480 source .. also i am tryin to get this one to 640x272 ..
ankurs is offline   Reply With Quote
Old 25th November 2007, 10:42   #40  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,567
Quote:
Originally Posted by ankurs View Post
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.
foxyshadis is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 15:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.