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. |
18th May 2010, 22:54 | #1 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
How to use MT in this script?
I need to speed up this script. I tried SetMTMode but it does not change anything in terms of speed. So now I thinking about using MT function however I have no idea how to do it.
Code:
video=DSS2("video.mkv") super = MSuper(video) backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) video=MFlowFps(video, super, backward_vec, forward_vec, num=200, den=1, ml=100) a = selectevery(video,8, 0) b = selectevery(video,8, 1) c = selectevery(video,8, 2) d = selectevery(video,8, 3) e = selectevery(video,8, 4) f = selectevery(video,8, 5) g = selectevery(video,8, 6) h = selectevery(video,8, 7) ab = merge(a,b,0.5) cd = merge(c,d,0.5) ef = merge(e,f,0.5) gh = merge(g,h,0.5) abcd = merge(ab,cd,0.5) efgh = merge(ef,gh,0.5) video = merge(abcd,efgh,0.5) return video
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper Last edited by Atak_Snajpera; 18th May 2010 at 23:11. |
19th May 2010, 00:06 | #2 | Link | |
Actually in reserve
Join Date: Oct 2004
Posts: 1,605
|
Quote:
From scratch: http://avisynth.org/mediawiki/MT_support_page and/or http://avisynth.org/mediawiki/MT No time to test the resulting but you can go this path: 1/ use MT("...") for every line and test 1 line after another ex: MT("super = MSuper(video)") MT("backward_vec = MAnalyse(super, isb = true)") 2/ a/use MT with triple quotes whenever the inside function uses simple quotes; ex: MT("""video=MFlowFps(video, super, backward_vec, forward_vec, num=200, den=1, ml=100)""") b/ MT with single or triple quotes can be used for multiples lines (verify that MT line by line is working before attempting multiple lines); triple quotes is, however, more flexible. ex: MT(""" super = MSuper(video) backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) video=MFlowFps(video, super, backward_vec, forward_vec, num=200, den=1, ml=100) """) 3/ a/Whenever MTing frames results can have 1 or more horizontal jaggied lines; overlap needs to be increased to 4 or more. Ex same as above: MT(""" ... video=MFlowFps(video, super, backward_vec, forward_vec, num=200, den=1, ml=100) """, overlap=4) b/ see also this post and following for preferred version (SET 2.58): http://forum.doom9.org/showthread.ph...82#post1390182 I, for one, would be very happy if you can get a reliable MTing use in Ripbot cause using an outside avs as source with heavy MT inside can be a pain atm. Did
__________________
Having a problem with AutoGK? Read & use the FAQ & MORE FAQ first Want to exchange on AutoGK? try doom10.org In reserve (inactive) for an undefined period of time. Last edited by BigDid; 19th May 2010 at 01:18. Reason: Some corrections, thanks to Gavino |
|
19th May 2010, 00:58 | #3 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
Code:
video=DSS2("video.mkv") video.mt(""" super = MSuper(video) backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) video=MFlowFps(video, super, backward_vec, forward_vec, num=200, den=1, ml=100) return video """,2,0,splitvertical=true) a = selectevery(video,8, 0) b = selectevery(video,8, 1) c = selectevery(video,8, 2) d = selectevery(video,8, 3) e = selectevery(video,8, 4) f = selectevery(video,8, 5) g = selectevery(video,8, 6) h = selectevery(video,8, 7) ab = merge(a,b,0.5) cd = merge(c,d,0.5) ef = merge(e,f,0.5) gh = merge(g,h,0.5) abcd = merge(ab,cd,0.5) efgh = merge(ef,gh,0.5) video = merge(abcd,efgh,0.5) return video If I change to =false then I also get an error (it tells me to change to =true)
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper |
19th May 2010, 01:04 | #4 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Triple quotes are not required for multiple lines, simple quotes work too, although it's a good practice to use triple quotes as then you don't need to worry if you have (simple) quotes inside, or add them later. I will add some further general advice: - don't use MT for filters that don't actually process any pixel data and merely select frames (eg Trim, SelectEvery) as it will be slower with MT than without. |
|
19th May 2010, 01:12 | #5 | Link | |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Quote:
Code:
w = 1./8. Average(a,w, b,w, c,w, d,w, e,w, f,w, g,w, h,w)
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) Last edited by Didée; 19th May 2010 at 01:15. |
|
19th May 2010, 01:25 | #6 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Code:
video=DSS2("video.mkv") video = video.mt(""" super = MSuper() backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) MFlowFps(super, backward_vec, forward_vec, num=200, den=1, ml=100) """,2,0,splitvertical=false) You probably also need to use a non-zero overlap for best results too, as otherwise the motion analysis will stop where mt splits the frame. Last edited by Gavino; 19th May 2010 at 01:28. |
|
19th May 2010, 01:32 | #7 | Link | |
Actually in reserve
Join Date: Oct 2004
Posts: 1,605
|
Quote:
This works (no "video" variable inserted): Code:
mt(""" super = MSuper() backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) MFlowFps(super, backward_vec, forward_vec, num=200, den=1, ml=100) """,2,0) Did
__________________
Having a problem with AutoGK? Read & use the FAQ & MORE FAQ first Want to exchange on AutoGK? try doom10.org In reserve (inactive) for an undefined period of time. Last edited by BigDid; 19th May 2010 at 01:36. |
|
19th May 2010, 07:55 | #8 | Link |
Derek Prestegard IRL
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,989
|
Code:
video=DSS2("video.mkv") MT(""" super = MSuper(video) backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) video=MFlowFps(video, super, backward_vec, forward_vec, num=200, den=1, ml=100) """, 2,0) a = selectevery(video,8, 0) b = selectevery(video,8, 1) c = selectevery(video,8, 2) d = selectevery(video,8, 3) e = selectevery(video,8, 4) f = selectevery(video,8, 5) g = selectevery(video,8, 6) h = selectevery(video,8, 7) ab = merge(a,b,0.5) cd = merge(c,d,0.5) ef = merge(e,f,0.5) gh = merge(g,h,0.5) abcd = merge(ab,cd,0.5) efgh = merge(ef,gh,0.5) video = merge(abcd,efgh,0.5) return video
__________________
These are all my personal statements, not those of my employer :) |
19th May 2010, 08:17 | #9 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
... and when you have it up & running, watch out carefully for oddities in the middle of the frame. Of all MV** functions, MVFlow** should be the most sensitive when it comes to slicing artifacts.
For 'denoising' purposes based on compensation, the drawback mostly is just reduced efficiency around the slice borders. But when interpolating new frames, true visual artifacts are to be expected. (Can't follow motion across slice boundaries -> can not synthesize any motion that crosses slice boundaries.) I'd suggest to look somewhat deeper into getting SetMTmode work like expected. Also, don't forget Josey's "Multi" version of MVTools, which can/will use multithreading internally/natively, instead of brute-force-work-around-ing same from external. Lastly, MVTools actually is offering internal filters for creating motion blur ... any particular reason to build it up all manually?
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) Last edited by Didée; 19th May 2010 at 08:20. |
19th May 2010, 08:20 | #10 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
The key to understanding this aspect is that MT works like this:
1. The input clip is split (by cropping) into the appropriate parts, according to the number of threads, vertical/horizontal flag and overlap. 2. For each part-clip in turn, the clip is assigned to 'last' and the filter or filter-chain (ie the part in quotes) is evaluated. At run-time, each of these parts is run in a separate thread. 3. The results from each part are joined together and returned as the result of MT. The second point is important here. For MT to work properly, the inner filter (or chain) must be written to use 'last' as its input. (Normally this use of 'last' is implicit, ie the filter is called without an explicit input clip.) So mt(""" super = MSuper() ...""", ...) works (as long as 'last' is defined before the call to mt). MSuper will be called on slices of 'last'. video.mt(""" super = MSuper() ...""", ...) also works; 'video' is the input to mt and MSuper is called on slices of 'video'. But Atak_Snajpera's original video.mt(""" super = MSuper(video) ...""", ...) does not work because MSuper is called on 'video' instead of 'last', so the filter for each slice returns the full video, leading to error messages about changing the height or width. Blue_MiSfit's MT(""" super = MSuper(video) ...""", ...) fails for the same reason (or would do, but since 'last', the defaulted input to mt, is not defined before the call, it fails with "invalid arguments to function mt"). Last edited by Gavino; 19th May 2010 at 11:24. |
19th May 2010, 12:02 | #11 | Link | |
--preset WTF!
Join Date: Feb 2009
Posts: 86
|
Quote:
So that should work Code:
video=DSS2("video.mkv") MT(""" super = video.MSuper() backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) video=MFlowFps(video, super, backward_vec, forward_vec, num=200, den=1, ml=100) return video """, 2,0) |
|
19th May 2010, 13:47 | #12 | Link | ||
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Quote:
Further (the 'fourth' reason), the result of mt must also be assigned to 'video', since it is needed later in the script. Doing the assignment inside MT assigns only one 'slice' of the result to 'video'. So it should be done as I showed in post #6. |
||
19th May 2010, 21:12 | #13 | Link |
Actually in reserve
Join Date: Oct 2004
Posts: 1,605
|
Hi,
Thanks to Gavino for taking the time to share some knowledge about avisynth and MTing, I appreciate. Also thanks to Didée for is technical comments (even if usually too brillant for me). I can catch some glimpse from time to time @ Atak: is your script working? Any speed improvement? Did
__________________
Having a problem with AutoGK? Read & use the FAQ & MORE FAQ first Want to exchange on AutoGK? try doom10.org In reserve (inactive) for an undefined period of time. Last edited by BigDid; 19th May 2010 at 21:20. |
19th May 2010, 22:06 | #14 | Link |
Registered User
Join Date: Jan 2009
Posts: 1,210
|
I hope this is close enough to the topic to fit in this thread but is there a way to prevent MT from creating a "spliced noise line" right in the middle of the frame if used like this:
Code:
MT(""" super = MSuper(pel=2, sharp=1) backward_vec2 = super.MAnalyse(isb = true, delta = 2, overlap=4, blksize=16,chroma=false) backward_vec1 = super.MAnalyse(isb = true, delta = 1, overlap=4, blksize=16,chroma=false) forward_vec1 = super.MAnalyse(isb = false, delta = 1, overlap=4, blksize=16,chroma=false) forward_vec2 = super.MAnalyse(isb = false, delta = 2, overlap=4, blksize=16,chroma=false) MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=200) """,2) |
19th May 2010, 23:07 | #15 | Link | ||
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
Quote:
Quote:
To all. Big thanks for explaining me how to use MT with variable! My final script for 1/100 -> 1/25 shutter emulation Code:
SetMTMode(5,0) video=DSS2("C:\temp\AVCHD2Intratemp\001-00000\video.mkv") SetMTMode(2) super = MSuper(video) backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) video=MFlowFps(video, super, backward_vec, forward_vec, num=100, den=1, ml=100) a = selectevery(video,4, 0) b = selectevery(video,4, 1) c = selectevery(video,4, 2) d = selectevery(video,4, 3) w = 1.0/4.0 video = Average(a,w, b,w, c,w, d,w) return video
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper Last edited by Atak_Snajpera; 19th May 2010 at 23:23. |
||
21st May 2010, 18:08 | #16 | Link | |
Actually in reserve
Join Date: Oct 2004
Posts: 1,605
|
Quote:
Already answered: increase overlap from 4 to 8 or more; see 3/ http://forum.doom9.org/showthread.ph...11#post1401011 Did
__________________
Having a problem with AutoGK? Read & use the FAQ & MORE FAQ first Want to exchange on AutoGK? try doom10.org In reserve (inactive) for an undefined period of time. |
|
21st May 2010, 23:19 | #17 | Link | |
Registered User
Join Date: Dec 2007
Posts: 25
|
Quote:
I copied from another thread a script containing: #Denoiser script for interlaced video Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll") loadPlugin("c:\Program Files\AviSynth 2.5\plugins\CNR\Cnr2.dll") loadPlugin("c:\Program Files\AviSynth 2.5\plugins\MT.dll") SetMTMode(5) #Modify this line to point to your video file source=AVISource("E:\Disney Films\Oscars0009.avi").killaudio() SetMTMode(2,0) chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS #chroma=source.Cnr2("oxx",8,14,191,75,255,20,255,false) #Laserdisc output=MDegrain2i2(chroma,0,0) #stackhorizontal(source,output) return output function MDegrain2i2(clip source, int "overlap", int "dct") { overlap=default(overlap,0) # overlap value (0 to 4 for blksize=8) dct=default(dct,0) # use dct=1 for clip with light flicker fields=source.SeparateFields() # separate by fields super = fields.MSuper() backward_vec2 = super.MAnalyse(isb = true, delta = 2, overlap=overlap, dct=dct) forward_vec2 = super.MAnalyse(isb = false, delta = 2, overlap=overlap, dct=dct) backward_vec4 = super.MAnalyse(isb = true, delta = 4, overlap=overlap, dct=dct) forward_vec4 = super.MAnalyse(isb = false, delta = 4, overlap=overlap, dct=dct) fields.MDegrain2(super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=400) Weave() } And last version from avisynth returns: Script error: there is no function caller Super... Any advice for that? Thank you in advance. Best regards. Last edited by the_provider; 23rd May 2010 at 19:59. |
|
|
|